Difference between revisions of "Wiki2html"
Line 53: | Line 53: | ||
</ol> | </ol> | ||
+ | |||
+ | == Improved version of script == | ||
+ | |||
+ | <pre> | ||
+ | #!/bin/bash | ||
+ | |||
+ | for X in * | ||
+ | do | ||
+ | echo "Filtering file $X" | ||
+ | cp $X $X.tmp | ||
+ | cat $X.tmp | \ | ||
+ | awk 'BEGIN {RS="" } { | ||
+ | gsub("<!-- BEGINMENU -->.*<!-- ENDMENU -->", "", $0); | ||
+ | gsub("<!-- BEGINSEARCH -->.*<!-- ENDSEARCH -->", "", $0); | ||
+ | gsub("<!-- BEGINPERSONALTOOLS -->.*<!-- ENDPERSONALTOOLS -->", "", $0); | ||
+ | gsub("<!-- BEGINTOOLBOX -->.*<!-- ENDTOOLBOX -->", "", $0); | ||
+ | gsub("<span class="editsection">.*]</span>", "", $0); | ||
+ | print $0 | ||
+ | }' > $X | ||
+ | |||
+ | if [ "$1" == "--doc-only" ]; then | ||
+ | # Remove navigation menu | ||
+ | cp $X $X.tmp | ||
+ | cat $X.tmp | \ | ||
+ | awk 'BEGIN {RS="" } { | ||
+ | gsub("<div class=\047portlet\047 id=\047p-navigation\047>.*<!-- ENDSIDEBAR p-navigation -->", "", $0); | ||
+ | print $0 | ||
+ | }' > $X | ||
+ | fi | ||
+ | rm $X.tmp | ||
+ | |||
+ | done | ||
+ | |||
+ | </pre> |
Revision as of 01:44, 16 March 2007
How to generate a local copy of the documentation in html starting from the VNUML wiki
Tested on Suse linux, although it should work on any distribution.
- Download and install htttrack from http://www.httrack.com/
- Get a copy of VNUML wiki:
- Create a script named vnuml-clean-web with the following content:
#!/bin/bash for X in * do echo "Filtering file $X" cp $X $X.tmp cat $X.tmp | \ sed -e '/BEGINMENU/,/ENDMENU/d' | \ sed -e '/BEGINSEARCH/,/ENDSEARCH/d' | \ sed -e '/BEGINPERSONALTOOLS/,/ENDPERSONALTOOLS/d' | \ sed -e '/BEGINTOOLBOX2/,/ENDTOOLBOX2/d' | \ sed -e 's/<span class="editsection">.*]<\/span>//g' \ > $X rm $X.tmp done
- Execute that script on the directory where the main files reside, that is:
- Delete the auxiliary files httrack generate in upper directory (it seems they are not needed):
- Load the index.html file in www.dit.upm.es/vnuml directory and you will have access to the local copy of the documentation.
mkdir vnumlweb cd vnumlweb httrack www.dit.upm.es/vnuml
cd www.dit.upm.es/vnuml cd index.php vnuml-clean-web
cd .. rm index????*.{html,css,php} opensearch_desc.php
Improved version of script
#!/bin/bash for X in * do echo "Filtering file $X" cp $X $X.tmp cat $X.tmp | \ awk 'BEGIN {RS="" } { gsub("<!-- BEGINMENU -->.*<!-- ENDMENU -->", "", $0); gsub("<!-- BEGINSEARCH -->.*<!-- ENDSEARCH -->", "", $0); gsub("<!-- BEGINPERSONALTOOLS -->.*<!-- ENDPERSONALTOOLS -->", "", $0); gsub("<!-- BEGINTOOLBOX -->.*<!-- ENDTOOLBOX -->", "", $0); gsub("<span class="editsection">.*]</span>", "", $0); print $0 }' > $X if [ "$1" == "--doc-only" ]; then # Remove navigation menu cp $X $X.tmp cat $X.tmp | \ awk 'BEGIN {RS="" } { gsub("<div class=\047portlet\047 id=\047p-navigation\047>.*<!-- ENDSIDEBAR p-navigation -->", "", $0); print $0 }' > $X fi rm $X.tmp done