aUCBLogo Demos and Tests / create_hhc_and_hhk_from_index
setCaseIgnored false
be create_hhc_and_hhk_from_index
closeall
clearText
changeDir "D:\Users\AndreasM\fftw-3.1.2\doc\html
idx="..\shortindex.html
openRead idx
setReader idx
data=readListFlatTags
(type
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD>
<BODY>
<OBJECT type="text/site properties">
<param name="Window Styles" value="0x800025">
<param name="comment" value="title:Online Help">
<param name="comment" value="base:index.htm">
</OBJECT>)
hrefs=[]
titles=[]
ignore traverseTree data 0
(type "
</BODY>
</HTML>)
setReader []
close idx
(type
"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD>
<BODY>
<OBJECT type="text/site properties">
</OBJECT>
<UL>)
while [not empty? hrefs]
[ (type
" <LI> <OBJECT type="text/sitemap">
<param name="Name" value="
stripNumbers first titles "">
<param name="Local" value=" first hrefs "">
</OBJECT>
) hrefs=butFirst hrefs
titles=butFirst titles
]
(type "
</UL>
</BODY>
</HTML>)
be ignoreWhite d
while [(and
not empty? d
[(or
(first first d)=="
(first first d)=="
(first first d)=="
)])]
[ d=butFirst d
]
output d
end
be ignoreToken d token
if substring? token (first d)
[ d=butFirst d
]
output d
end
be extract_href w
while [and
not empty? w
((items 1 6 w) != "href=")]
[ w=butFirst w
]
if not empty? w
[ output items 7 (count w)-2 w
]
output "
end
be traverseTree d tabs
d=ignoreWhite d
while [substring? "<ul> (first d)]
[ d=butFirst d
(type "
) repeat tabs [(type " )]
(type "<UL>)
d=ignoreWhite d
while [substring? "<li> (first d)]
[ d=butFirst d
(type "
) repeat tabs [(type " )]
(type "<LI><OBJECT type="text/sitemap">
<param name="Name" value=")
href=extract_href first d
d=butFirst d
title="
do_until
[ title=word title first d
d=butFirst d
d=ignoreToken d "</a>
][(first d)=="
] (type title
"">
<param name="Local" value=" href)
(type "">
</OBJECT>)
hrefs=lput href hrefs
titles=lput title titles
d=ignoreWhite d
d=traverseTree d tabs+1
d=ignoreToken d "</li>
]
d=ignoreToken d "</ul>
(type "
</UL>)
]
d=ignoreWhite d
output d
end
be stripNumbers w
while [and not empty? w [not alpha? first w]]
[ w=butFirst w
]
output w
end
end