// Remove menu from a html file generated by Textinfo
// The @content command must be inserted just before the menu, inside the node
// How it works?
// The table of content is generated by @content, and marked up by
// The menu is marked up also by
// This second bloc is just removed
// www.scriptol.org - Public Domain
int main(int argc, array argv)
int start, finish, group, ulstack
array html
print "MenuRem - Remove menu from html texinfo - www.scriptol.org"
if argc < 2
print "syntax: menurem filename.html"
exit(0)
/if
text fname = argv[1]
print "Processing", fname
html.load(fname) `loading file into array
ulstack = 0 `count occurences of
group = 0 `this is the first or second group
for int num in 0 .. html.size() - 1
text line = html[num]
if line[ .. 3] = ''
if ulstack = 0 let group + 1
start = num
ulstack + 1
continue
/if
if line[ .. 4] = '
'
finish = num
ulstack - 1
if (group = 2) and (ulstack = 0 ) break `second group, skip next line
continue
/if
/for
html[start .. finish] = nil `removing menu
html.store(fname) `writting file again
print finish - start + 1 , "lines removed"
print fname, "rewritten"
return 0
main($argc, $argv)