User Tools

Site Tools


packet:xrouter:manpages:parsing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
packet:xrouter:manpages:parsing [2025/04/20 07:21] m0mzfpacket:xrouter:manpages:parsing [2025/04/20 07:28] (current) m0mzf
Line 58: Line 58:
 } }
 checkRoot () { checkRoot () {
- if [[ $UID -eq 0 ]]; then;+ if [[ $UID -eq 0 ]]; then
  echoRed "Don't run this as root please"  echoRed "Don't run this as root please"
  exit 1  exit 1
Line 132: Line 132:
  do  do
  # Get the penultimate field in file path, i.e. the section (folder) name  # Get the penultimate field in file path, i.e. the section (folder) name
- section=$(echo $folder | awk  -F/ '{print $(NF-1)}')+ local section=$(echo $folder | awk  -F/ '{print $(NF-1)}')
  # Format the section name as a docuWiki header  # Format the section name as a docuWiki header
  echo "$folder" | awk "$awkSectionHeader" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki  echo "$folder" | awk "$awkSectionHeader" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki
Line 141: Line 141:
  do  do
  # Get the last field in file path, i.e. file name  # Get the last field in file path, i.e. file name
- title=$(echo $file | awk -F/ '{print $NF}')+ local title=$(echo $file | awk -F/ '{print $NF}') 
 + local outputpath="${OUTPUTDIR}"/"$1"/"${section}".docuwiki
  # Format the file name as a docuwiki header  # Format the file name as a docuwiki header
- echo "$title" | awk "$awkFileHeader" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki+ echo "$title" | awk "$awkFileHeader" >> "$outputpath"
  case "$1" in  case "$1" in
  # For MAN files, after awk has done it's job we need to remove the last line; this last line breaks  # For MAN files, after awk has done it's job we need to remove the last line; this last line breaks
  # the following <code> statement and is just an EOF message, so we don't lose anything.  # the following <code> statement and is just an EOF message, so we don't lose anything.
- MANFILES) awk "$awkParseMan" "$file" | head -n -1 >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki + MANFILES) awk "$awkParseMan" "$file" | head -n -1 >> "$outputpath
- echo -e "</code>\n----" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki+ echo -e "</code>\n----" >> "$outputpath"
  ;;  ;;
  # For HLP files we don't want to remove the last line because that truly is real content  # For HLP files we don't want to remove the last line because that truly is real content
- HLPFILES) awk "$awkParseHlp" "$file" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki + HLPFILES) awk "$awkParseHlp" "$file" >> "$outputpath
- echo -e "</code>" >> "${OUTPUTDIR}"/"$1"/"${section}".docuwiki+ echo -e "</code>" >> "$outputpath"
  ;;  ;;
  esac  esac
packet/xrouter/manpages/parsing.1745133698.txt.gz · Last modified: 2025/04/20 07:21 by m0mzf