pax_global_header00006660000000000000000000000064146317775210014527gustar00rootroot0000000000000052 comment=920345c040160fa16c30846b38dd49a854e938be roffit-0.16/000077500000000000000000000000001463177752100127465ustar00rootroot00000000000000roffit-0.16/.github/000077500000000000000000000000001463177752100143065ustar00rootroot00000000000000roffit-0.16/.github/workflows/000077500000000000000000000000001463177752100163435ustar00rootroot00000000000000roffit-0.16/.github/workflows/reuse.yml000066400000000000000000000011251463177752100202100ustar00rootroot00000000000000# Copyright (C) Daniel Stenberg, , et al. # SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. # # SPDX-License-Identifier: curl name: REUSE compliance on: push: branches: - master - '*/ci' pull_request: branches: - master concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true permissions: {} jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: REUSE Compliance Check uses: fsfe/reuse-action@v1 roffit-0.16/.github/workflows/test.yml000066400000000000000000000006501463177752100200460ustar00rootroot00000000000000# Copyright (C) 2000 - 2022 Daniel Stenberg, , et al. # # SPDX-License-Identifier: curl name: test on: # Trigger the workflow on push or pull requests, but only for the # master branch push: branches: - master - '*/ci' pull_request: branches: - master jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: test run: make test roffit-0.16/.gitignore000066400000000000000000000000161463177752100147330ustar00rootroot00000000000000testpage.dump roffit-0.16/.reuse/000077500000000000000000000000001463177752100141475ustar00rootroot00000000000000roffit-0.16/.reuse/dep5000066400000000000000000000007331463177752100147320ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: roffit Upstream-Contact: Daniel Stenberg Source: https://curl.se # Tests Files: testpage.1 testpage.output Copyright: Daniel Stenberg, , et al. License: curl # Docs Files: README.md CHANGES Copyright: Daniel Stenberg, , et al. License: curl # Meta Files: .gitignore Copyright: Daniel Stenberg, , et al. License: curl roffit-0.16/CHANGES000066400000000000000000000041041463177752100137400ustar00rootroot00000000000000* 2007-08-10 - Imported the project files to the new CVS repository on sourceforge - Added some files - Added 'make install' support for easier/faster deployment * 2007-07-31 - double backslashes should not be cleared entirely - add $id$ * 2006-01-23 - remove carriage returns and show line numbers of unknown keywords to ease debugging of this script * (Jan 2, 2006) - Steve Benson made roffit translate all '\-' sequenes to just '-'. * (April 5, 2005) - Make a bare .BR do a "
" - Make .pp start a new paragraph - Ignore the weird '\" comment latex2man adds - Ignore de, ft and "..". I *believe* they are use to set a "macro". * (March 15, 2005) - Added comments about .nf and .fi based on https://web.archive.org/web/20150905054410/www.rfc-editor.org/nroff.html * (June 21, 2004) - make .fi properly end a .nf section * (April 12, 2004) - convert <> properly within the .BR data as well * (March 5, 2004) - make links for ftp:// as well - strip \& completely instead of making "&zerosp;" (which isn't good html) 0.6 (February 27, 2004) - added --mandir and --hrefdir - made it convert http:// URLs to links - added --version 0.5 (February 3, 2004) - Added support for more &-combos - Better treatment of .nf to make
 sections, and we now do newlines
   better within such a 
 section
 - .IR is now treated equally as .I
 - keywords and their data can be tab-separated
 - .SS is now treated as .SH

0.4 (December 5, 2003)
 - Andrew Dixon filed a bug report with a man page generated with the
   help2man tool. roffit now deals with \fR as well as \fP as an end
   marker for special word formatting.
 - I moved the changelog into this file
 - Wrote a first basic man page for roffit

0.3 (November 14, 2003)
 Daniel Fandrich brought:
 - deals with .lp lines
 - .TH needs no section portion anymore
 - added generator meta tag in the header

0.2 (November 7, 2003)
 - fixed the  name for the SH section
 - added  links from all words within \fIthis\fP or \fBthis\fP
   that has the same text as a .SH or .IP.

0.1 (November 5, 2003)
 - Initial public release
roffit-0.16/LICENSE000066400000000000000000000020241463177752100137510ustar00rootroot00000000000000COPYRIGHT AND PERMISSION NOTICE

Copyright (c) 2004 - 2023, Daniel Stenberg, .

All rights reserved.

Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.
roffit-0.16/LICENSES/000077500000000000000000000000001463177752100141535ustar00rootroot00000000000000roffit-0.16/LICENSES/curl.txt000066400000000000000000000020631463177752100156620ustar00rootroot00000000000000COPYRIGHT AND PERMISSION NOTICE

Copyright (C) Daniel Stenberg, , and many
contributors, see the THANKS file.

All rights reserved.

Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.
roffit-0.16/Makefile000066400000000000000000000017651463177752100144170ustar00rootroot00000000000000##########################################################################
#
# Copyright (C) Daniel Stenberg, , et al.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
##########################################################################
# default installation directory
INSTALLDIR=/usr/local/bin

all:

install:
	cp roffit $(DESTDIR)$(INSTALLDIR)

test:
	@perl roffit --bare < testpage.1 > testpage.dump
	@if cmp testpage.dump testpage.output; then \
	  echo "SUCCESS"; \
	else \
	  echo "FAIL"; \
	  diff -u testpage.output testpage.dump; \
	  exit 1; \
	fi
roffit-0.16/README.md000066400000000000000000000005431463177752100142270ustar00rootroot00000000000000# roffit

A command line tool that reads nroff and outputs HTML

## Home

 Project home: https://daniel.haxx.se/projects/roffit

 Source code: https://github.com/bagder/roffit

## Code

 git clone git://github.com/bagder/roffit.git

## Contributors

 Daniel Stenberg, Jay Satiro, Jari Aalto, Daniel Miller, René Nyffenegger,
 Sumit Roy

## License

 MIT
roffit-0.16/release.pl000077500000000000000000000017711463177752100147340ustar00rootroot00000000000000#!/usr/bin/perl
##########################################################################
#
# Copyright (C) Daniel Stenberg, , et al.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
##########################################################################

my @files=('CHANGES', 'roffit', 'roffit.1', 'LICENSE', 'Makefile', 'README');

my $version=$ARGV[0];

if(!$version) {
    print "Usage: release.pl \n";
    exit;
}

my $dir = "roffit-$version";

mkdir $dir;

for(@files) {
    `cp $_ $dir`;
}

`tar czf roffit-${version}.tar.gz $dir`;

`rm -rf $dir`;
roffit-0.16/roffit000077500000000000000000000505221463177752100141710ustar00rootroot00000000000000#!/usr/bin/env perl
##########################################################################
#
# Copyright (C) Daniel Stenberg, , et al.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
# SPDX-License-Identifier: curl
#
##########################################################################
#
# Read an nroff file. Output a HTML file.
#
# Web:     https://daniel.haxx.se/projects/roffit

my $version = "0.16";

use strict;
#use warnings;
use HTML::Entities qw(encode_entities);
use File::Basename;
sub do_encode($) {
    return encode_entities(shift, q{<>&"'#});
}

my $InFH = \*STDIN;
my $OutFH = \*STDOUT;
my $debugFH = \*STDERR;

my %manpage;
my @out;

my $indentlevel=0; # logical levels, not columns
my @p;
my $within_tp;
my $standalone=1; # by default we make stand-alone HTML pages
my $pre;
my %anchor; # hash with all anchors

my @mandirs;
my $mandir;
my $hrefdir=".";
my $filename;
my $leavecase;

while($ARGV[0]) {
    if($ARGV[0] eq "--bare") {
        # don't include headers and stuff
        $standalone=0;
        shift @ARGV;
    }
    elsif($ARGV[0] eq "--version") {
        print "roffit $version (https://daniel.haxx.se/projects/roffit/)\n";
        exit;
    }
    elsif($ARGV[0] eq "--preserve-case") {
        $leavecase = 1;
        exit;
    }
    elsif($ARGV[0] =~ /^--mandir=(.*)/) {
        # check for other HTMLized man pages in these given dirs
        # can be specified multiple times
        push @mandirs, $1;
        $mandir = 1; # option used
        shift @ARGV;
    }
    elsif($ARGV[0] =~ /^--hrefdir=(.*)/) {
        # if another manpage is found in the --mandir, this is the dir we
        # prefix the HTML file name with in the output HTML
        $hrefdir=$1;
        shift @ARGV;
    }
    elsif($ARGV[0] =~ /^(--help|-h)/) {
        print $debugFH "Usage: roffit [options] [infile] < infile > outfile\n",
            "Options:\n",
            " --bare          do not put in HTML, HEAD, BODY tags\n",
            " --hrefdir= if a manpage is found in the --mandir, this is the\n",
            "                 dir we prefix the HTML file name with in the output\n",
            " --mandir=  check for other HTMLized man pages in these dirs\n",
            " --preserve-case leave case of section headers untouched\n",
            " --version       display roffit version and exit\n";
            
        exit;
    }
    else {
        $filename=$ARGV[0];
        last;
    }
}

sub strlen($) { defined($_[0]) ? length($_[0]) : 0; }

sub showp {
    my @p = @_;
    if(@p && join("", @p)) {
        push @out, "\n

" if(!$pre); push @out, @p; push @out, "

" if(!$pre); } } sub defaultcss { print $OutFH < pre { overflow: auto; margin: 0; } P.level0, pre.level0 { padding-left: 2em; } P.level1, pre.level1 { padding-left: 4em; } P.level2, pre.level2 { padding-left: 6em; } span.emphasis { font-style: italic; } span.bold { font-weight: bold; } span.manpage { font-weight: bold; } h2.nroffsh { background-color: #e0e0e0; } span.nroffip { font-weight: bold; font-size: 120%; font-family: monospace; } p.roffit { text-align: center; font-size: 80%; } ENDOFCSS ; } sub text2name { my ($text) = @_; $text =~ s/^ *([^ ]*).*/$1/g; $text =~ s/[^a-zA-Z0-9-]//g; return $text; } # scan through the file and check for sections we should convert # to proper links. ignore preformatted text. sub linkfile { my $preformatted; my @new; for(@out) { my $remaining = $_; my $processed = ""; while(strlen($remaining)) { my $field; my $tail; $remaining =~ /(?:(.*?)(<\/?pre.*?>))?(.*)/s; # $1 is anything before the first encountered pre tag # $2 is that pre tag (starts with
bar)
                    $processed .= (strlen($1) ? $1 : "") . $2;
                    next;
                }
                # $1 is not empty and not preformatted
                $field = $1;
                $tail = $2;
            }
            else {
                # $2 is empty which means $1 is empty and $3 contains no pre
                # we can process the remaining part of the line all at once
                $remaining = "";
                if(!strlen($3) || $preformatted) {
                    # $3 is empty or preformatted from previous tag
                    $processed .= (strlen($3) ? $3 : "");
                    last;
                }
                # $3 is not empty and not preformatted
                $field = $3;
                $tail = "";
            }

            while($field =~ s/([^<]*)<\/span>/[]/) {
                my ($style, $name)=($1, $2);

                my $l = text2name($name);

                my $link;
                if($anchor{$l}) {
                    $link="$name";
                }
                else {
                    if($mandir) {
                        my ($symbol, $section);
                        if ($name =~ /^ *([A-Za-z_0-9-]*) *\( *(\d+[A-Za-z]*) *\) *$/) {

                            # this looks like a reference to another man page, and
                            # we have asked for this feature! We check for the
                            # specified nroff file and not the HTML version, to
                            # avoid depending on which order the set of files are
                            # converted to HTML!
                            ($symbol, $section)=($1, lc $2);
                        }
                        elsif ($field =~ /\[\] *\( *(\d+[A-Za-z]*) *\)/) {
                            # Also look for references where the man page
                            # section is outside the span.
                            $section = lc $1;
                            ($symbol) = ($name =~ /^ *([A-Za-z_0-9-]+)/);
                        }
                        if ($symbol && $section) {
                            for my $d (@mandirs) {
                                my $file = "$d/$symbol.$section";

                                if(-r $file) {
                                    my $html = "$hrefdir/$symbol.html";
                                    # there is such a HTML file present, produce a
                                    # link to it!
                                    $link = "$symbol";
                                    last; # skip out of loop
                                }
                            }
                        }
                    }
                    if(!$link) {
                        $link = "$name";
                    }
                }
                $field =~ s/\[\]/$link/;
            }

            # convert https://, http:// and ftp:// URLs to  links
            $field =~ s/(^|\W)((https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)/$1$2<\/a>/gi;

            # convert (uppercase only) "RFC [number]" to a link
            $field =~ s/(^|\W)RFC ?(\d+)/$1RFC $2<\/a>/g;

            $processed .= $field . $tail;
        }
        push @new, $processed;
    }
    return @new;
}

sub handle_italic_bold ($) {
    $_ = shift;
    $_ =~ s/\\fI//g;
    $_ =~ s/\\fB//g;
    $_ =~ s/\\f[PR]/<\/span>/g;
    return $_;
}

sub split_quoted ($) {
    my $t = shift;
    my @tokens;
    my $quoted=0;
    for my $chunk (split /(? sub {
        return sprintf('%s', shift);
    },
    B => sub {
        return sprintf('%s', shift);
    },
    R => sub {
        return shift;
    }
);

sub parsefile {
    my ($filename)=@_;
    my $lineno;
    my $br_lastp;
    while(<$InFH>) {
        $lineno++;
        my $in = $_;
        my $out;

  #     print $debugFH "DEBUG IN: $_";

        $in =~ s/[\r\n]//g if(!$pre); # tear off newlines

        $in =~ s/\r//g; # remove carriage return always

        # substitue all '\-' sequences with '-'.
        # '\-' might be in the source file to specify a literal
        # '-' rather than a hyphen.
        $in =~ s/\\-/-/g;

        if($in =~ /^\'\\\"/) {
            # ignore this kind of weird comment
            $out ="";
        }
        elsif($in =~ /^\.([^ \t\n]*)(.*)/) {
            # this is a line starting with a dot, that means it is special
            my ($keyword, $rest) = ($1, $2);
            $out = "";
            
            # cut off initial spaces
            $rest =~ s/^\s+//;
            
            if ( $keyword eq q(\\") ) {
                # this is a comment, skip this line
            }
            elsif ( $keyword eq "TH" ) {
                # man page header:
                # curl 1 "22 Oct 2003" "Curl 7.10.8" "Curl Manual"

                # Treat pages that have "*(Dt":
                # .TH IDENT 1 \*(Dt GNU

                $rest =~ s,\Q\\*(Dt,,g;

                # Delete backslashes

                $rest =~ s,\\,,g;

                # Delete old RCS tags
                # .TH saidar 1 $Date:\ 2006/11/30\ 23:42:42\ $ i\-scream

                $rest =~ s,\$Date:\s+(.*?)\s+\$,$1,g;

                # NAME SECTION DATE VERSION MANUAL
                # section can be: 1 or 3C

                if ( $rest =~ /(\S+)\s+\"?(\d+\S?)\"?\s+\"([^\"]*)\" \"([^\"]*)\"(\"([^\"]*)\")?/ ) {
                    # strict matching only so far
                    $manpage{'name'}    = $1;
                    $manpage{'section'} = $2;
                    $manpage{'date'}    = $3;
                    $manpage{'version'} = $4;
                    $manpage{'manual'}  = $6;
                }
                # .TH html2text 1 2008-09-20 HH:MM:SS
                elsif ( $rest =~  m, (\S+) \s+ \"?(\d+\S?)\"? \s+ \"?([ \d:/-]+)\"? \s* (.*) ,x )
                {
                    $manpage{'name'}    = $1;
                    $manpage{'section'} = $2;
                    $manpage{'date'}    = $3;
                    $manpage{'manual'}  = $4;
                }
                # .TH program 1 description
                elsif ( $rest =~ /(\S+) \s+ \"?(\d+\S?)\"? \s+ (.+)/x )
                {
                    $manpage{'name'}    = $1;
                    $manpage{'section'} = $2;
                    $manpage{'manual'}  = $3;
                }
                # .TH program 1
                elsif ( $rest =~ /(\S+) \s+ \"?(\d+\S?)\"? /x )
                {
                    $manpage{'name'}    = $1;
                    $manpage{'section'} = $2;
                }
            }
            elsif($keyword =~ /^S[HS]$/i) {
                # SS is treated the same as SH
                # Section Header
                showp(@p);
                @p="";
                if($pre) {
                    push @out, "
\n"; $pre = 0; } my $name = text2name($rest); $anchor{$name}=1; $rest =~ s/\"//g; # cut off quotes $rest = do_encode($rest); $rest = ucfirst(lc($rest)) if(!$leavecase); $out = "

$rest

"; $indentlevel=0; $within_tp=0; } elsif($keyword =~ /^B$/i) { $rest =~ s/\"//g; # cut off quotes $rest = do_encode($rest); # This is pretty lame, but since a .B section and itself # contain a \fI[blabla]\fP section, we cut off all the \f # occurances within the .B text to make it easier for ourself. $rest =~ s/\\f[IPR]//g; push @p, "$rest "; if($pre) { push @p, "\n"; } } elsif($keyword =~ /^I$/i) { $rest =~ s/\"//g; # cut off quotes $rest = do_encode($rest); push @p, "$rest "; } elsif($keyword =~ /^RS$/i) { # the start of another indent-level. for inlined tables # within an "IP" showp(@p); @p=""; $indentlevel++; } elsif($keyword =~ /^RE$/i) { # end of the RS section showp(@p); @p=""; $indentlevel--; } elsif($keyword =~ /^NF$/i) { # We let nf start a
 section .nf = no-fill, you use for
                # graphs or text that you don't want spaces to be ignored

                showp(@p);
                @p="";
                if (!$pre) {
                    # avoid nesting pre sections
                    push @out, "
\n";
                    $pre=1
                }
            }
            elsif($keyword =~ /^TP$/i) {
                # Used within an "RS" section to make a new line. The first
                # TP as a column indicator, but we decide to do that
                # controlling in the CSS instead.
                $within_tp=1;
                showp(@p);
                @p="";                
            }
            elsif($keyword =~ /^IP$/i) {
                # start of a new paragraph coming up
                showp(@p);
                @p="";

                my $name= text2name($rest);
                $anchor{$name}=1;

                $rest =~ s/\"//g; # cut off quotes
		$rest =~ s/\\f[IBPR]//g; # Un-format it (Use CSS on nroffip class instead)
                $rest = do_encode($rest);
                
                $indentlevel-- if ($indentlevel);
                push @p, "$rest ";
                # make this a single-line title
                showp(@p);
                @p="";
                $indentlevel++;
                $within_tp=0;
            }
            elsif($keyword =~ /^ad$/i) {
                showp(@p);
                @p="";
            }
            elsif($keyword =~ /^sp$/i) {
                showp(@p);
                @p="";
            }
            elsif($keyword =~ /^lp$/i) {
                # marks end of a paragraph
                showp(@p);
                @p="";
            }
            elsif($keyword =~ /^pp$/i) {
                # PP ends a TP section, but some TP sections don't use it
                # Often used to separate paragraphs
                $within_tp=0;
                showp(@p);
                @p="";
                $indentlevel-- if ($indentlevel);
            }
            elsif($keyword =~ /^fi$/i) {
                # .fi = fill-in, extra space will be ignored and text that is
                # entered like this, the fill-in command will continue until
                # you enter a .nf command and vice-versa

                showp(@p);
                @p="";
                if($pre) {
                    # if this is the end of a .nf (
) section
                    push @out, "
\n"; $pre=0; # disable pre again } } elsif($keyword =~ /^(de|ft|\.)$/i) { # no idea what these do! } elsif($keyword =~ /^so$/i) { # This keyword refers to a different man page, named in the # $rest. # Recurse and read that instead if possible, otherwise output # generic message saying where to find the information. if ($mandir) { for my $d (@mandirs) { my $sofilename = $d . "/" . basename($rest); if (-r $sofilename) { # Recurse! close($InFH); open($InFH, "<".$sofilename); parsefile($sofilename); return; } } } # If we're here, we didn't recurse. push @out, "See the $rest man page.\n"; } elsif($keyword eq "br") { push @p, "
"; } elsif($keyword =~ /^([RIB])([RIB])$/) { # Alternating font faces my @ff = ($1, $2); if($rest) { my @all = split_quoted($rest); my $fi = 0; my @applied; for(@all) { my $encoded = do_encode($_); push @applied, $apply_face{$ff[$fi]}->($encoded); $fi = $fi ? 0 : 1; } push @applied, " "; push @p, join("", @applied); } } elsif ($keyword =~ /^ti/i) { push @p, "    "; } else { showp(@p); @p=""; printf $debugFH "Error: unknown keyword \"$keyword\" on %s:$lineno\n", $filename?$filename:""; } } else { # text line, decode \-stuff my $txt = $in; $txt =~ s/\\&//g; # Must come after previous substitution or it could munge some entities. $txt = do_encode($txt); $txt =~ s/\\-/-/g; $txt =~ s/\\ / \;/g; $txt =~ s/\\(?:'|')/´\;/g; $txt =~ s/\\\(co/©\;/g; $txt =~ s/\\\(aq/&apos\;/g; $txt =~ s/\\\(cq/&apos\;/g; $txt =~ s/\\\(dq/"\;/g; # \e is the "escape character", defaults to backslash $txt =~ s/\\e/\/g; # \/ and \, are "italic corrections" that we can just remove $txt =~ s/\\[,\/]//g; $txt = handle_italic_bold $txt; # replace backslash [something] with just [something] $txt =~ s/\\(.)/$1/g; # convert remaining backslashes to \ $txt =~ s/\\/&bsol\;/g; if(($txt =~ /^[ \t\r\n]*$/) && (!$pre)) { # no contents, marks end of a paragraph showp(@p); @p=""; } else { $txt =~ s/^ /\ \;/g; $txt =~ s/^\n/\ \;\n/ if($pre); push @p, "$txt"; push @p, " " if(!$pre); } $out =""; } if($out) { push @out, $out; # print $debugFH "DEBUG OUT: $out\n"; } else { # print $debugFH "DEBUG OUT: [withheld]\n"; } } showp(@p); } if($filename) { # if specified, otherwise stick with stdin open($InFH, "<".$filename); } parsefile($filename); my @conv = linkfile(); my $title=sprintf("%s man page", $manpage{'name'}?$manpage{'name'}:"secret"); if($standalone) { print $OutFH < $title MOO ; defaultcss(); print "\n"; } else { print "\n"; } print $OutFH @conv; print $OutFH < This HTML page was made with roffit. ROFFIT ; if($standalone) { print "\n"; } roffit-0.16/roffit.1000066400000000000000000000060021463177752100143170ustar00rootroot00000000000000.\" ************************************************************************** .\" .\" Copyright (C) Daniel Stenberg, , et al. .\" .\" This software is licensed as described in the file LICENSE, which .\" you should have received as part of this distribution. .\" .\" You may opt to use, copy, modify, merge, publish, distribute and/or sell .\" copies of the Software, and permit persons to whom the Software is .\" furnished to do so, under the terms of the COPYING file. .\" .\" This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY .\" KIND, either express or implied. .\" .\" SPDX-License-Identifier: curl .\" .\" ************************************************************************** .\" You can view this file with: .\" nroff -man roffit.1 .\" .TH roffit 1 "October 5 2021" "roffit 0.13" "roffit Manual" .SH NAME roffit \- convert nroff to HTML .SH SYNOPSIS .B roffit [options] < inputfile > outputfile .SH DESCRIPTION .B roffit converts the \fIinputfile\fP to \fIoutputfile\fP. The \fIinputfile\fP must be an nroff formatted man page, and the \fIoutputfile\fP will be an HTML document. .SH OPTIONS .IP \-\-bare The output HTML will not include any HTML, HEAD or BODY tags. Also not that when this is selected, there will be no inlined CSS but you will have to define the necessary classes yourself. .IP \-\-version Display version number and exit .IP \-\-mandir= Set a directory in which \fIroffit\fP will check for other man pages (in nroff [name].[num] format) that this one refers to. If found, a link will be made to that page with a html extension instead of the number. The file name in the generated link will be prefixed by the dir given with \fI\-\-hrefdir\fP. This works for references specified as \fImanpage(3)\fP (within the emhpasis foformatting) and in a plain \.BR section (often used in the SEE ALSO section). .IP \-\-hrefdir= Specify a directory to prefix generated href links created with the \-\-mandir option. This defaults to ".". .IP \-\-preserve-case When used, this makes roffit preserve the case in SH (section header) in the output instead of uppercasing the first letter and doing the rest lowercase. The case changing was introduced in roffit 0.13. .SH "CSS CLASSES" .IP h2.nroffsh The nroff ".SH" section. These are normally the "headlines" before each sub section within the man page. .IP p.nroffip The nroff ".IP" section. These are normally the bullet kind used to list each option out of several in a list. Usually followed by a \fIp.level0\fP containining the descriptive text. .IP p.level0 Normal text at the first level. Normally not indented. .IP p.level1 Text at next logical indent level. Normally indented one level right. .IP p.level2 Text at the second logical indent level. Normally indented two levels right. .IP span.bold Text marked to be bold. .IP span.manpage Text marked as a reference to another man page. .IP span.emphasis Text marked to be emphasized. .IP p.roffit Used for the advertising final paragraph. .SH WWW https://daniel.haxx.se/projects/roffit roffit-0.16/testpage.1000066400000000000000000000047031463177752100146500ustar00rootroot00000000000000.\" This man page is here for testing purposes only. Run 'make test' to .\" verify that the correct output is generated from this input. .\" .TH testpage 1 "2 May 2011" "roffit" "roffit test" .SH NAME testpage \- test input nroff man page for roffit testing .SH SYNOPSIS .B roffit [\fI\,options\/\fR] < inputfile > outputfile .SH DESCRIPTION .B roffit converts the \fIinputfile\fP to \fIoutputfile\fP. The \fIinputfile\fP must be an nroff formatted man page, and the \fIoutputfile\fP will be an HTML document. (RFC 959) is FTP but ARFC 959 is a fake RFC3986 is URI syntax Also, we must support \fIstyle staring on one line and ending on another that may\fP be multiple lines off. .SH OPTIONS .IP "--bare" The output HTML will not include any HTML, HEAD or BODY tags. Also not that when this is selected, there will be no inlined CSS but you will have to define the necessary classes yourself. .IP "--mumbo" Display version number and exit. Also see \fB--jumbo\fP. Word in bold. .IP "--jumbo" Cool option. See \fI--mumbo\fP. Word in italic. .IP \-\-mandir= Set a directory in which \fIroffit\fP will check for other man pages (in nroff [name].[num] format) that this one refers to. If found, a link will be made to that page with a html extension instead of the number. The file name in the generated link will be prefixed by the dir given with \fI\-\-hrefdir\fP. This works for references specified as \fImanpage(3)\fP (within the emhpasis foformatting) and in a plain \.BR section (often used in the SEE ALSO section). .IP \-\-hrefdir= Specify a directory to prefix generated href links created with the \-\-mandir option. This defaults to ".". .SH "CSS CLASSES" .IP h2.nroffsh The nroff ".SH" section. These are normally the "headlines" before each sub section within the man page. .IP p.nroffip The nroff ".IP" section. These are normally the bullet kind used to list each option out of several in a list. Usually followed by a \fIp.level0\fP containining the descriptive text. .IP p.level0 Normal text at the first level. Normally not indented. .IP p.level1 Text at next logical indent level. Normally indented one level right. .IP p.level2 Text at the second logical indent level. Normally indented two levels right. .IP span.bold Text marked to be bold. .IP span.manpage Text marked as a reference to another man page. .IP span.emphasis Text marked to be emphasized. .IP p.roffit Used for the advertising final paragraph. .SH WWW https://daniel.haxx.se/projects/roffit roffit-0.16/testpage.output000066400000000000000000000112511463177752100160440ustar00rootroot00000000000000

Name

testpage - test input nroff man page for roffit testing

Synopsis

roffit [options] < inputfile > outputfile

Description

roffit converts the inputfile to outputfile. The inputfile must be an nroff formatted man page, and the outputfile will be an HTML document.

(RFC 959) is FTP

but ARFC 959 is a fake

RFC 3986 is URI syntax

Also, we must support style staring on one line and ending on another that may be multiple lines off.

Options

--bare

The output HTML will not include any HTML, HEAD or BODY tags. Also not that when this is selected, there will be no inlined CSS but you will have to define the necessary classes yourself.

--mumbo

Display version number and exit. Also see --jumbo. Word in bold.

--jumbo

Cool option. See --mumbo. Word in italic.

--mandir=<dir>

Set a directory in which roffit will check for other man pages (in nroff [name].[num] format) that this one refers to. If found, a <a href> link will be made to that page with a html extension instead of the number. The file name in the generated link will be prefixed by the dir given with --hrefdir.

This works for references specified as manpage(3) (within the emhpasis foformatting) and in a plain .BR section (often used in the SEE ALSO section).

--hrefdir=<dir>

Specify a directory to prefix generated href links created with the --mandir option. This defaults to ".".

Css classes

h2.nroffsh

The nroff ".SH" section. These are normally the "headlines" before each sub section within the man page.

p.nroffip

The nroff ".IP" section. These are normally the bullet kind used to list each option out of several in a list. Usually followed by a p.level0 containining the descriptive text.

p.level0

Normal text at the first level. Normally not indented.

p.level1

Text at next logical indent level. Normally indented one level right.

p.level2

Text at the second logical indent level. Normally indented two levels right.

span.bold

Text marked to be bold.

span.manpage

Text marked as a reference to another man page.

span.emphasis

Text marked to be emphasized.

p.roffit

Used for the advertising final paragraph.

Www

https://daniel.haxx.se/projects/roffit

This HTML page was made with roffit.