:htmlhelp

dumps html help to console

Description: call:htmlhelp
Dependencies: :ExtractFunction
Script:
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.
69.
70.
71.
:htmlhelp -- dumps html help to console
:$created 20060101 :$changed 20080219
:$source https://www.dostips.com
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
rem echo.^<html^>^<body^>
echo.^<center^>
echo.^<table border=0^>
for /f "tokens=1,* delims=-" %%b in ('"findstr "^^:[^^:].*--" "%~f0" "') do (
    for /f "tokens=1,* delims= " %%m in ("%%b") do (
        set func=%%m
        set args=%%n
    )
    set sign=%%b
    set desc=%%c
    echo.^<tr^>^<td^>^<a href='#_!func:~1!'^>!func!^</a^>^</td^>^<td^> !desc!^</td^>^</tr^>
)
echo.^</table^>
echo.^</center^>

for /f "tokens=*" %%a in ('"findstr "^^:.*-- ^^:\$" "%~f0" "') do (
    set line=%%a
    if "!line:~1,1!"==":" (             rem process function arguments section
        for /f "tokens=1,2,* delims=-[] " %%b in ("!line:*--=!") do (
            set pname=%%b
            set ptype=%%c
            set pdesc=%%d
        )
        echo.^<tr^>
        echo.^<td^>!pname!^</td^>
        echo.^<td^>!ptype!^</td^>
        echo.^<td^>!pdesc!^</td^>
        echo.^</tr^>
    ) ELSE if "!line:~1,1!"=="$" (      rem process the end section
        if "!func!" NEQ "" (
            set depe=
            for /f "tokens=*" %%F in ('%~f0 :ExtractFunction !func!^|findstr /i "call\:[a-z]"') do (
                set line="%%F"
                set line="!line:*call:=!
                for /f "delims=&|>< " %%G in (!line!) do set depe=!depe!%%G &set line=%%G
                rem echo.!func! - !line!>&2
            )
            rem echo.!func! >&2
            rem echo.^<pre^>&call:ExtractFunction !func!&echo.^</pre^>
            echo.^</table^>
            echo.^<p^>Dependencies:
            for %%F in (!depe!) do (echo.^<a href='#_%%F'^>:%%F^</a^> )
            if not defined depe echo.none
            echo.^</p^>
            set func=&rem this makes sure we process the END only once
        )
    ) ELSE (                            rem process function title section
        for /f "tokens=1,* delims=-" %%b in ("!line!") do (
            for /f "tokens=1,* delims= " %%m in ("%%b") do (
                set func=%%m
                set args=%%n
            )
            TITLE processing !func!
            set sign=%%b
            set desc=%%c
        )
        echo.^<br/^>
        echo.^<H2^>^<a name='_!func:~1!'^>!func! -- !desc!^</a^>^</H2^>
        echo.^<span style='float:right;'^> ^<a href='#!func:~1!'^>View Script^</a^>^&nbsp;^&nbsp;^</span^>
        echo.^<p^>Call ^<b^>^<a href='#!func:~1!'^>!func!^</a^>^</b^> ^<i^>!args!^</i^>^</p^>
        echo.^<table border=1^>^<tr^>^<td^>Parameter^</td^>^<td^>Type^</td^>^<td^>Desc^</td^>^</tr^>
    )
)
TITLE processing done
rem echo.^</body^>^</html^>
EXIT /b