#! /bin/sh

(
cat << /END
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
code {font-weight: bold;}
</style>
<script language="JavaScript">top.select ("mnemodoc");</script>
<h3>Mined mnemonic character input support</h3>
Mined mnemonic character input support recognizes character mnemonics 
as taken from various resources:

<ul>
<li>Mnemos from <a href=http://rfc.sunsite.dk/rfc/rfc1345.html>
	RFC 1345</a>; in ambiguous cases, the RFC 1345 mnemos must be 
	prepended a digit "1".
<li><a href=http://selfhtml.teamone.de/html/referenz/zeichen.htm#benannte_iso8859_1>
	HTML mnemos</a>; in ambiguous cases, the HTML mnemos must be 
	prepended a "&".
<li>TeX mnemos (macros) and substitutes, leaving out any "\".
<li><a href=#mnemotable>Additional mnemonics</a>: a collection of useful 
	specific mnemonics maintained by mined (in addition to the 
	mnemonic repository of the sources mentioned above) 
	is listed in the second table below.
	<br><font style="background-color: yellow">&nbsp;</font> means: 
	enter a blank character (only works in two-character 
	combination shortcut ^Vxy).
</ul>

For accented characters, there are a number of <i>mnemonic patterns</i> 
(generic accent composing mnemonics).
They are listed in the following overview table; replace the "x" with 
the base letter to be combined.
<br><i>Note:</i> For frequently used accented characters, also a 
selection of 
<a href=mined.html#accentprefix>Accent prefix function keys</a> is 
available, see the section in the manual.

<h4>Generic mnemonics</h4>

/END

sed -e "/<table .*name=genericmnemonics.*>/,/<\/table>/ b" -e d ../doc/mined.html |
iconv -f 8859_1 -t UTF8

cat << /END

<a name=mnemotable>
<h4>Additional mnemonics</h4>
</a>
<table border=1>
<tr><th>hex value<th>mnemo<th>character<th>description
/END

#	{"|T", 0x00DE /* Þ */},

sed	-e 's,^[ 	]*/\*\(.*\)\*/,<tr><td colspan=4><br><h4>\1</h4>,' \
	-e t \
	-e 's,{"",{"  ",' \
	-e 's/},.*/},/' \
	-e '/^[	 ]*{/ b entry' -e d \
	-e ': entry' \
	-e 's,\\",",g' \
	-e 's+{"\(.*\)", *0x\([0-9A-Fa-f]*\) */\* *\(.*\) *\*/},*+<tr><td><code>\2</code><td><code>\1</code><td><code>\&#x\2;</code><td>\3+' \
	-e 's,  </code>,<font style="background-color: yellow">\&nbsp;</font> <font style="background-color: yellow">\&nbsp;</font></code>,' \
	-e 's, </code>,<font style="background-color: yellow">\&nbsp;</font></code>,' \
	mnemos.add

echo '</table>'
) > ../doc/mnemodoc.html
