Skip to content
Snippets Groups Projects
Verified Commit 2d6f4bb8 authored by mirabilos's avatar mirabilos Committed by mirabilos
Browse files

introduce definition list mode for HTML (to match TeX)…

parent e88dd4cf
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ GENERATED+= linklist.htm linklist.tex ...@@ -4,7 +4,7 @@ GENERATED+= linklist.htm linklist.tex
all: linklist.htm linklist.tex all: linklist.htm linklist.tex
linklist.htm linklist.tex: cvtdat.sh linklist.dat linklist.htm linklist.tex: cvtdat.sh linklist.dat
${MKSH} cvtdat.sh linklist ${MKSH} cvtdat.sh -d linklist
clean: clean:
rm -f ${CLEANFILES} ${GENERATED} rm -f ${CLEANFILES} ${GENERATED}
......
...@@ -24,8 +24,40 @@ ...@@ -24,8 +24,40 @@
#- #-
# Take input in nroff-like syntax and create Teχ and XHTML from it. # Take input in nroff-like syntax and create Teχ and XHTML from it.
nline=0
die() {
print -ru2 -- "E: $0: $*"
print -ru2 -- "N: line #$nline '$oline'"
exit 1
}
dl=0
while getopts "d" ch; do
case $ch {
(d) dl=1 ;;
(*) die syntax error ;;
}
done
shift $((OPTIND - 1))
bn=$1 bn=$1
if (( dl )); then
ul=dl
function htm_li {
local itemkey=${|tohtm "$1";}
print -nru4 -- "<dt>${itemkey:-}</dt><dd$xmllang${1:+ id=\"$itemkey\"}>"
xnl=
}
li=dd
else
ul=ul
function htm_li {
print -nru4 -- "<li$xmllang${1:+ id=\"${|tohtm "$1";}\"}>"
xnl=
}
li=li
fi
function tohtm { function tohtm {
REPLY=${1//'&'/'&amp;'} REPLY=${1//'&'/'&amp;'}
REPLY=${REPLY//'<'/'&lt;'} REPLY=${REPLY//'<'/'&lt;'}
...@@ -56,12 +88,6 @@ function css_escape { ...@@ -56,12 +88,6 @@ function css_escape {
print -r -- "/*]]>*/--></style>" print -r -- "/*]]>*/--></style>"
} }
die() {
print -ru2 -- "E: $0: $*"
print -ru2 -- "N: line #$nline '$oline'"
exit 1
}
function doheader { function doheader {
css_escape <<\EOF css_escape <<\EOF
.marker { .marker {
...@@ -116,7 +142,7 @@ print -ru5 -- '\newcommand{\myLink}[2]{\href{#1}{#2}\Hair\footnote{\texttt{[\url ...@@ -116,7 +142,7 @@ print -ru5 -- '\newcommand{\myLink}[2]{\href{#1}{#2}\Hair\footnote{\texttt{[\url
# end item # end item
function endit { function endit {
(( init )) || return 0 (( init )) || return 0
print -ru4 -- '</li>' print -ru4 -- "</$li>"
xnl= xnl=
print -ru5 -- '%' print -ru5 -- '%'
print -ru5 -- '}' print -ru5 -- '}'
...@@ -175,7 +201,6 @@ function getpc { ...@@ -175,7 +201,6 @@ function getpc {
init=0 init=0
inpq=0 inpq=0
inao=0 inao=0
nline=0
xnl= xnl=
tnl= tnl=
while IFS= read -r line; do while IFS= read -r line; do
...@@ -225,7 +250,7 @@ while IFS= read -r line; do ...@@ -225,7 +250,7 @@ while IFS= read -r line; do
xnl= xnl=
;; ;;
(Bl) (Bl)
print -ru4 -- "<h4>${|tohtm "$line";}</h4><ul>" print -ru4 -- "<h4>${|tohtm "$line";}</h4><$ul>"
xnl= xnl=
print -ru5 -- '\defcaptionname{german,british}{\refname}{'"${|totex "$line";}"'}%' print -ru5 -- '\defcaptionname{german,british}{\refname}{'"${|totex "$line";}"'}%'
print -ru5 -- '\begin{autosizedbibliography}' print -ru5 -- '\begin{autosizedbibliography}'
...@@ -237,7 +262,7 @@ while IFS= read -r line; do ...@@ -237,7 +262,7 @@ while IFS= read -r line; do
[[ -z $line ]] || die .El takes no arguments [[ -z $line ]] || die .El takes no arguments
(( init )) || die empty list (( init )) || die empty list
endit endit
print -ru4 -- "</ul>" print -ru4 -- "</$ul>"
print -ru4 print -ru4
xnl= xnl=
print -ru5 -- '\end{autosizedbibliography}' print -ru5 -- '\end{autosizedbibliography}'
...@@ -247,15 +272,13 @@ while IFS= read -r line; do ...@@ -247,15 +272,13 @@ while IFS= read -r line; do
(It) (It)
endit endit
getlang getlang
htm_li "$line"
if [[ -z $line ]]; then if [[ -z $line ]]; then
print -nru4 -- "<li$xmllang>"
print -ru5 -- '\item[\TwelweStar\hfill]'"$ltxlang{%" print -ru5 -- '\item[\TwelweStar\hfill]'"$ltxlang{%"
else else
print -nru4 -- "<li$xmllang id=\"${|tohtm "$line";}\">"
print -ru5 -- '\bibitem{'"${|totex "$line";}}$ltxlang{%" print -ru5 -- '\bibitem{'"${|totex "$line";}}$ltxlang{%"
fi fi
init=1 init=1
xnl=
tnl=' ' tnl=' '
;; ;;
(a) (a)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment