]> git.saurik.com Git - wxWidgets.git/blame - utils/HelpHTML/html2wxhelp
added cmdline.h/.cpp to the makefiles
[wxWidgets.git] / utils / HelpHTML / html2wxhelp
CommitLineData
cb813dee
KB
1#!/bin/sh
2#
3# $Id$
4#
5# html2wxhelp Creates a wxhelp.map file from a directory full of html files.
6# It takes header lines, extracts the NAME=xxx section for the URL and the help
7# id which must be added to the header using _ID_.
8#
9# It also removes all _ID_ tags from the html sources.
10
11
12make_map()
13{
14 cat $1 | tr -d '\n' | \
15 sed "1,$ s/^.*<[hH][0-9]\([^<].*\)<\/[hH][0-9]>.*$/
16#__#\1
17/g" | \
18 fgrep \#__\# | tr '
19' '\n' | egrep -v '^$' | \
20 sed "1,$ s/^.*NAME=\"\([^\"]*\)\".*>\([^>]*\)<.*$/$1#\1;\2/g" | \
21 sed "1,$ s/^\#__\#[^>]*>\([^<>][^<>]*\)<.*$/;\1/g" | \
22 sed "1,$ s/^\(.*\);\(.*\)_\(.*\)_.*$/\3 \1 ;\2/g" | \
23 sed "1,$ s/^\([^+-0123456789]\)\(.*\);\(.*\)$/-1 \1\2 ;\3/g" | \
24 fgrep -v \#__\#
25}
26
27remove_ids()
28{
29 cat $1 | \
30 sed "1,$ s/_[0-9][0-9]*_//g" > tmp$$ && mv tmp$$ $1
31# cat $1 | tr -d '\n' | \
32# sed "1,$ s/^\(.*<[hH][0-9]\)\([^<_][^_]*\)_.*_*\(<\/[hH][0-9]>.*\)$/\1\2\3
33/g" | \
34# tr '
35' '\n' > tmp$$ \
36# && mv tmp$$ $1
37}
38
39for i in *.html
40do
41 make_map $i
42 remove_ids $i
43done
44