packet:xrouter:docs:parsing
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| packet:xrouter:docs:parsing [2025/04/26 18:56] – m0mzf | packet:xrouter:docs:parsing [2025/04/26 21:44] (current) – m0mzf | ||
|---|---|---|---|
| Line 70: | Line 70: | ||
| OUTPUTDIR=" | OUTPUTDIR=" | ||
| INDEXFILE=" | INDEXFILE=" | ||
| - | |||
| - | # Wiki MANPAGE namespace structure. We pass this into awk later but define it here | ||
| - | |||
| # Handy functions | # Handy functions | ||
| Line 88: | Line 85: | ||
| } | } | ||
| + | # awk functions | ||
| awkFormatIndexMANTitle=' | awkFormatIndexMANTitle=' | ||
| { | { | ||
| Line 104: | Line 102: | ||
| awkParseMan=' | awkParseMan=' | ||
| { | { | ||
| - | if (NR> | + | if (NR> |
| - | if (NR> | + | if (NR> |
| if (NR==1 || NR==2) # For the first two lines | if (NR==1 || NR==2) # For the first two lines | ||
| Line 114: | Line 112: | ||
| } | } | ||
| - | if (NR>=3 && NR< | + | if (NR>=3 && NR< |
| { | { | ||
| FS=" | FS=" | ||
| Line 123: | Line 121: | ||
| print "</ | print "</ | ||
| } | } | ||
| - | else if (NR>lno && NR<(recs -1) && NF>0) # If we' | + | else if (NR>lno && NR<(recs -1) && NF>0) # If we are in SEE ALSO and are not EOF and have non-empty lines |
| { | { | ||
| line=$0 # | line=$0 # | ||
| Line 130: | Line 128: | ||
| lno++ | lno++ | ||
| } | } | ||
| - | else if (/ | + | else if (/ |
| { | { | ||
| starthead="</ | starthead="</ | ||
| Line 157: | Line 155: | ||
| ' | ' | ||
| + | # File enumerator / reader / writer | ||
| parseFiles () { | parseFiles () { | ||
| mkdir " | mkdir " | ||
| Line 179: | Line 178: | ||
| do | do | ||
| case " | case " | ||
| - | # For MAN files, after awk has done it's job we need to remove the last two lines; this last line breaks | ||
| - | # the following < | ||
| MAN) | MAN) | ||
| # Section 8 has links to actual real filenames which we want to keep | # Section 8 has links to actual real filenames which we want to keep | ||
| Line 193: | Line 190: | ||
| # Begin by writing a docuwiki header containing file name | # Begin by writing a docuwiki header containing file name | ||
| echo "===== $title =====" >> " | echo "===== $title =====" >> " | ||
| + | # Get line count for the file | ||
| recs=$(wc -l " | recs=$(wc -l " | ||
| + | # Parse the file! | ||
| awk -v flag=0 -v recs=" | awk -v flag=0 -v recs=" | ||
| + | # Add a link back to index page | ||
| + | echo " | ||
| # Add a line break after each MAN entry | # Add a line break after each MAN entry | ||
| - | echo -e "\n\n----\n\n" >> " | + | echo -e " |
| # and add an entry to the index | # and add an entry to the index | ||
| echo " | echo " | ||
| ;; | ;; | ||
| - | # For HLP files we don't want to remove the last line because that truly is real content | ||
| HLP) | HLP) | ||
| local title=$(echo $file | awk -F/ ' | local title=$(echo $file | awk -F/ ' | ||
| Line 206: | Line 206: | ||
| awk " | awk " | ||
| echo "</ | echo "</ | ||
| + | # Add a link back to index page | ||
| + | echo " | ||
| echo " | echo " | ||
| ;; | ;; | ||
| Line 219: | Line 221: | ||
| mkdir " | mkdir " | ||
| echo " | echo " | ||
| - | echo "The content | + | echo "This content is auto-generated from the XRouter documentation using [[$NAMESPACE: |
| - | echoGreen " | + | echoGreen " |
| parseFiles MAN | parseFiles MAN | ||
| - | echoGreen " | + | echoGreen " |
| parseFiles HLP | parseFiles HLP | ||
| - | #echoGreen " | + | #echoGreen " |
| #parseFiles DOC | #parseFiles DOC | ||
| </ | </ | ||
packet/xrouter/docs/parsing.1745693804.txt.gz · Last modified: by m0mzf
