#! /bin/sh

cat << /END
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
<style>
code, td span {background-color: #CCC0C0;}
</style>
<script language="JavaScript">top.select ("quotesdoc");</script>
</head>

<h3>MinEd Quotation Marks Styles (smart quotes)</h3>
Mined smart quotes mode turns ASCII double and single quotation marks 
(" and ') into typographic quotation marks according to the selected style.
The style to be applied can be selected from the Quotes menu, 
or a locale-specific style can be preset.
<p>Use command line option <code>-q=<i>locale</i></code> to set a specific 
style, <code>+q=<i>locale</i></code> to set a standby style (for quick 
toggling on the Quotes flag), or use just <code>-q</code> or <code>+q</code> 
to derive a style from the current locale environment.

<h4>Style issues</h4>
Information about international usage of typographic quotation marks has 
been collected from Wikipedia (mainly English/German pages) and some 
other web resources; note however that available information is sparse 
and not consistent. Comments are welcome.
<br>Note that the “double” quotation marks are normally used for 
single (or outer) quotations while the ‘single’ quotation marks are 
used for nested (or inner) quotations. In some styles, however, e.g. 
British usage, these are reversed. To achieve that, simply use the 
corresponding keys (e.g. apostrophe for British single quotation or 
for Chinese/Japanese corner brackets).
<br>Note also that many languages have more than one typical style; the 
style from the “alternate” column below is used as standby style.
<p>Language-specific notes:
<ul>
<li>	The alternate/standby style is sometimes used to provide 
	a traditional style (e.g. Dutch, Greek).
<li>	For Arabic, the assumption is that in countries with French 
	influence the French «guillemets» are the preferred style.
<li>	For Greek, a traditional style is provided as standby style;
	to use an alternate modern style (« Οὗτος ἔφη· “ Ἁδρόν ἐστι. ” »), 
	select Spanish style.
<li>	For Hebrew, the language tag <code>he</code> (or <code>hebrew</code>) 
	triggers a more traditional style (lower opening), while the 
	language tag <code>he_IL</code> triggers a supposedly more 
	modern style (upper opening); in both cases, the reverse closing 
	quotation mark is available as alternate style.
<li>	For Polish, three major styles are described; different styles 
	are triggered by locales <code>pl</code> (with inner single quotes) 
	and <code>polish</code> (with inner guillemets), respectively, 
	and can be selected from the menu.
<li>	For right-to-left scripts, quotation marks are applied in the 
	configured order but appear in right-to-left order, so e.g. 
	Arabic ”…“ will appear like “cibarA”. Note, however, that 
	«angle» quotation marks have the Unicode bidi_mirrored property 
	so each of them will appear mirrored on the terminal; this makes 
	their configuration look like their later appearance, by 
	conincidence of double reversal.
</ul>

<h4>Mapping</h4>

<table>
<tr>
<th>Language
<th>Locale
<th colspan=2>main style
<th colspan=2>alternate style
<tr>
<th colspan=2>
<th>outer
<th>inner
<th>outer
<th>inner
<tr>
<td>(default)
<td>(others)
<td><span>“…”<td><span>‘…’
<td><span>“…”<td><span>‘…’
/END

LC_ALL=C
export LC_ALL

sed -e '/^#/ d' -e '/^$/ d' \
    -e 's,$,				,' \
    -e 's%^\([^	 ]*\)[	 ][	 ]*\([A-Za-z,\. ]*\)	*\([^	]*\)	\([^	]*\)		\([^	]*\)	\([^	]*\).*$%<tr><td>\2<td><code>\1</code><td><span>\3<td><span>\4<td><span>\5<td><span>\6%' $* |
sort

cat << /END
</table>
/END
