Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/help/restconv
blob: fe5a55f4b0aa6e316d598ea310ce4cacfddb55db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
processline()
{
	echo "- $1 -"
	echo "=============================================================================================="
	name="$1"
	anchors=""
	echo "$1.txt $*" >> anchors
	while [ "$1" != "" ] ; do
		echo "s!\[help:$1\]!$name.html!g" >> htmllinks.sed
		echo "s!\[help:$1\]!help:anchor=$name bookID=XaoS Help!g" >> applehelplinks.sed
		shift
	done
	# I changed "0" to "$" because my sed
	# doesn't want to understand "0".
	# -- Zoltan
	echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
  <TITLE>XaoS online help</TITLE>
</HEAD>
<BODY>' > $name.html
	cat $mypath/xaos.hlp | sed '1,/%'"$name"'/d;/^%/,$ d' | sed \
'1,2s_<head>\([^<]*\)</head>_<H1>\1</H1>_g
s_<head>_<center><H2>_g
s_</head>_</H2></center>_g
s_<emph>_<strong>_g
s_<submenu>__g
s_<menuhead>__g
s_</menuhead>__g
s_<mainmenu>__g
s_<menuitems>__g
s_</menuitems>__g
s_<main>__g
s_</main>__g
s_<math>__g
s_</math>__g
s_<notex>__g
s_</notex>__g
s_<node.*>__g
s_</emph>_</strong>_g
s_<tt>_<code>_g
s_</tt>_</code>_g
s_<tutor \([^>]*\)>_<A HREF="[tutor:\1]">_g
s_</tutor>_</A>_g
s_<a \([^>]*\)>_<A HREF="\1">_g
s/'\'\''/"/g
s/``/"/g' >> $name.html
        if [ $2 ]; then
           echo $* >> aliases.conf
	fi
	echo "</BODY></HTML>" >> $name.html
	cat -n $name.html
	tidy -utf8 -asxml -qm $name.html
	$mypath/xhtml2rest.py $name.html > $name.txt
	rm $name.html
}
process()
{
	while read line ; do
		eval "processline $line"
	done
}
mypath=`dirname $0`
rm htmllinks.sed
rm applehelplinks.sed
rm anchors
grep "^%" $mypath/xaos.hlp | sed '/%%/d;s/%//g' | process