aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--index.html36
-rwxr-xr-xmh119
3 files changed, 19 insertions, 138 deletions
diff --git a/Makefile b/Makefile
index 6709bbf..c5ad251 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,2 @@
index.html: ../master/mht.1
- mandoc -T html -O fragment $< > $@
+ man -T html -O fragment $< | sed 's/<a class="permalink"/& style="color: black; text-decoration: none;"/;s/<td class="head-vol"/& style="text-align: center;"/;s/<td class="head-rtitle"/& style="text-align: right;"/;s/<table class="head"/& style="width: 100%;"/;s/<td class="foot-os"/& style="text-align: right;"/;s/<table class="foot"/& style="width: 100%;"/;s/<h2/<h3/;s/<h1/<h2/;s </h2 </h3 ;s </h1 </h2 ' > $@
diff --git a/index.html b/index.html
index 4b8c6f8..148050e 100644
--- a/index.html
+++ b/index.html
@@ -1,18 +1,18 @@
-<table class="head">
+<table class="head" style="width: 100%;">
<tr>
<td class="head-ltitle">mht(1)</td>
- <td class="head-vol">General Commands Manual</td>
- <td class="head-rtitle">mht(1)</td>
+ <td class="head-vol" style="text-align: center;">General Commands Manual</td>
+ <td class="head-rtitle" style="text-align: right;">mht(1)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
-<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
+<h2 class="Sh" id="NAME"><a class="permalink" style="color: black; text-decoration: none;" href="#NAME">NAME</a></h2>
<code class="Nm">mht</code> &#x2014;
<div class="Nd">troff for HTML</div>
</section>
<section class="Sh">
-<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
+<h2 class="Sh" id="SYNOPSIS"><a class="permalink" style="color: black; text-decoration: none;" href="#SYNOPSIS">SYNOPSIS</a></h2>
<table class="Nm">
<tr>
<td><code class="Nm">mht</code></td>
@@ -21,7 +21,7 @@
</table>
</section>
<section class="Sh">
-<h1 class="Sh" id="DESCIPTION"><a class="permalink" href="#DESCIPTION">DESCIPTION</a></h1>
+<h2 class="Sh" id="DESCIPTION"><a class="permalink" style="color: black; text-decoration: none;" href="#DESCIPTION">DESCIPTION</a></h2>
<code class="Nm">mht</code> is a utility that generates HTML from
<a class="Xr">troff(1)</a> source code.
<p class="Pp">While <code class="Nm">mht</code> is named like a troff macro
@@ -30,7 +30,7 @@
requests.</p>
</section>
<section class="Sh">
-<h1 class="Sh" id="USAGE"><a class="permalink" href="#USAGE">USAGE</a></h1>
+<h2 class="Sh" id="USAGE"><a class="permalink" style="color: black; text-decoration: none;" href="#USAGE">USAGE</a></h2>
This section describes the various types of requests supported by
<code class="Nm">mht</code>. On the left side are the name and arity of each
request, separated by a slash. On the right side is the HTML expansion of each
@@ -44,24 +44,24 @@ This section describes the various types of requests supported by
outside of the area delimited by braces ({...}) is removed when two of the
same contiguous element requests are placed next to one another.</p>
<section class="Ss">
-<h2 class="Ss" id="Standard_troff_requests"><a class="permalink" href="#Standard_troff_requests">Standard
- troff requests</a></h2>
+<h3 class="Ss" id="Standard_troff_requests"><a class="permalink" style="color: black; text-decoration: none;" href="#Standard_troff_requests">Standard
+ troff requests</a></h3>
<dl class="Bl-tag">
<dt><b class="Sy">br/0</b></dt>
<dd>&lt;br/&gt;</dd>
</dl>
</section>
<section class="Ss">
-<h2 class="Ss" id="Contiguous_element_requests"><a class="permalink" href="#Contiguous_element_requests">Contiguous
- element requests</a></h2>
+<h3 class="Ss" id="Contiguous_element_requests"><a class="permalink" style="color: black; text-decoration: none;" href="#Contiguous_element_requests">Contiguous
+ element requests</a></h3>
<dl class="Bl-tag">
<dt><b class="Sy">Qp/0</b></dt>
<dd>&lt;blockquote&gt;{&lt;p&gt;%&lt;/p&gt;}&lt;/blockquote&gt;</dd>
</dl>
</section>
<section class="Ss">
-<h2 class="Ss" id="Block_element_requests"><a class="permalink" href="#Block_element_requests">Block
- element requests</a></h2>
+<h3 class="Ss" id="Block_element_requests"><a class="permalink" style="color: black; text-decoration: none;" href="#Block_element_requests">Block
+ element requests</a></h3>
<dl class="Bl-tag">
<dt><b class="Sy">Pp/0</b></dt>
<dd>&lt;p&gt;%&lt;/p&gt;</dd>
@@ -76,8 +76,8 @@ This section describes the various types of requests supported by
</dl>
</section>
<section class="Ss">
-<h2 class="Ss" id="Inline_element_requests"><a class="permalink" href="#Inline_element_requests">Inline
- element requests</a></h2>
+<h3 class="Ss" id="Inline_element_requests"><a class="permalink" style="color: black; text-decoration: none;" href="#Inline_element_requests">Inline
+ element requests</a></h3>
<dl class="Bl-tag">
<dt><b class="Sy">Au/1</b></dt>
<dd>&lt;meta name=&quot;author&quot; content=&quot;\$1&quot;/&gt;</dd>
@@ -136,16 +136,16 @@ This section describes the various types of requests supported by
</section>
</section>
<section class="Sh">
-<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
+<h2 class="Sh" id="AUTHORS"><a class="permalink" style="color: black; text-decoration: none;" href="#AUTHORS">AUTHORS</a></h2>
<code class="Nm">mht</code> is written by John Ankarstr&#x00F6;m
&lt;<a class="Mt" href="mailto:john">john</a>
<a class="Mt" href="mailto:(at)">(at)</a>
<a class="Mt" href="mailto:ankarstrom.se">ankarstrom.se</a>&gt;.
</section>
</div>
-<table class="foot">
+<table class="foot" style="width: 100%;">
<tr>
<td class="foot-date">December 2, 2020</td>
- <td class="foot-os">Linux 5.4.72-0-lts</td>
+ <td class="foot-os" style="text-align: right;">Linux 5.4.72-0-lts</td>
</tr>
</table>
diff --git a/mh b/mh
deleted file mode 100755
index cae73bf..0000000
--- a/mh
+++ /dev/null
@@ -1,119 +0,0 @@
-#!/usr/bin/perl
-
-use v5.12;
-use warnings;
-
-use Text::ParseWords qw/quotewords/;
-
-
-# 1 Definitions
-
-
-# 1.1 Global program state
-
-my $empty = ''; # currently buffered empty lines
-my $opel = ''; # currently opened element
-
-
-# 1.2 Elements
-
-# 1.2.1 Block elements
-my %blels = (
- Pp_0 => '<p>%</p>',
- Qp_0 => '<blockquote><p>%</p></blockquote>',
- Pr_0 => '<pre>%</pre>',
- Sh_0 => '<h3>%</h3>',
- Sh_1 => '<h\\$1>%</h\\$1>',
- Ti_0 => '<title>%</title>',
-);
-
-# 1.2.2 Inline elements
-my %inels = (
- Au_1 => '<meta name="author" content="\\$1"/>',
- Bd_0 => '\\$3<b>\\$1</b>\\$2',
- br_0 => '<br/>',
- Cd_0 => '\\$3<code>\\$1</code>\\$2',
- Cs_1 => '<meta http-equiv="Content-Type" content="text/html; charset=\\$1"/>',
- Em_0 => '\\$3<em>\\$1</em>\\$2',
- Hy_0 => '<a href="\\$2">\\$1</a>',
- Im_0 => '<img src="\\$1" alt="\\$2"/>',
- It_0 => '\\$3<i>\\$1</i>\\$2',
- St_0 => '\\$3<strong>\\$1</strong>\\$2',
- Tt_0 => '\\$3<tt>\\$1</tt>\\$2',
- Ul_0 => '\\$3<u>\\$1</u>\\$2',
-);
-
-
-# 1.3 Subroutines
-
-# 1.3.1 Handle element request
-sub request {
- my ($el, $args) = @_;
- my @argv = quotewords('\s+', 0, $args);
- my $n = @argv;
- my $elkey = "${el}_$n";
-
- if (exists $blels{$elkey}) {
- # Clear empty line buffer
- $empty = '';
-
- # Close currently open block element, open new
- if (exists $blels{$opel}) {
- print end($blels{$opel}) . "\n";
- $opel = '';
- }
- $opel = $elkey;
-
- print interpol(start($blels{$elkey}), @argv) . "\n";
- } elsif (exists $inels{$elkey}) {
- print interpol($inels{$elkey}, @argv) . "\n";
- } else {
- print STDERR "Error: $el/$n not implemented\n";
- exit 1;
- }
-}
-
-# 1.3.2 Interpolate \$n parameters
-sub interpol {
- my $s = shift;
- my $i = 1;
- my $arg;
- while ($arg = shift) {
- $s =~ s/\\\$$i/$arg/g;
- $i++;
- }
- return $s;
-}
-
-# 1.3.3 Retrieve first portion of block element string
-sub start {
- return (split '%', shift)[0];
-}
-
-# 1.3.4 Retrieve second portion of block element string
-sub end {
- return (split '%', shift)[1];
-}
-
-
-# 2 Program
-
-
-# 2.1 Translate mh source text to HTML
-while (<>) {
- chomp;
- if (/^\.([A-Za-z][a-z])\s*(.*)/) {
- request($1, $2);
- } elsif ($_ eq '') {
- $empty .= "\n";
- } else {
- print $empty; $empty = '';
- print "$_\n";
- }
-}
-
-# 2.2 Close currently open block element
-if (exists $blels{$opel}) {
- print end($blels{$opel}) . "\n";
- $opel = '';
-}