Talk:Menus

From Red Eclipse Wiki
Jump to: navigation, search

Just in case this regex-madness is useful. This will extract some gui stuff from usage.cfg. Just copy any other sections of the article to head and tail, run the script and copy/paste the output back to the wiki.

menu.sh:

cat head
gawk '
    /setdesc "newgui"/ {
        print "==creation and display of menus=="
    }
    /setdesc "guitext"/ {
        print "==basic gui elements=="
    }
    /setdesc "guilist"/ {
        print "==gui layout elements=="
    }
    /setdesc "guifield"/ {
        print "==advanced gui elements=="
    }
    /setdesc "guinohitfx"/ {
        print "==hover effects=="
    }
    /setdesc .gui/ {
        cmd = $2
        $1 = ""
        $2 = ""
        gsub("^  ","") 
        gsub("\" \"\"","")
        gsub("\\^n?<","\n\n*'\'\''")
        gsub("\\^n?\\[","\n\n*\[")
        gsub("\\^n","\n\n")
        gsub("\\^\"","\"")
        gsub("\\\"","\"")
        gsub("<","'\'\''")
        gsub(">","'\'\''")
        gsub("\" \"","\n\nusage: " cmd " ")
        gsub("\"","")
        gsub("\"","")
        gsub("\"","", cmd)
        print "\n==="cmd"===\n"
        print $0
    }
' usage.cfg
cat tail


 sh menu.sh usage.cfg > menu.wiki