Difference between revisions of "Wiki2html"

From VNUML-WIKI
Jump to: navigation, search
m
 
(45 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
   mkdir vnumlweb
 
   mkdir vnumlweb
 
   cd vnumlweb
 
   cd vnumlweb
   httrack www.dit.upm.es/vnuml
+
   httrack <nowiki>http://www.dit.upm.es/vnumlwiki/</nowiki> 
 +
  # Note: Don't forget the  "/" at the end of the URL!
  
<li>Create a script named vnuml-clean-web with the following content:
+
<li>Create a script named '''vnuml-clean-web''' with the content shown below.
 
 
<pre>
 
#!/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
 
</pre>
 
  
 
<li>Execute that script on the directory where the main files reside, that is:
 
<li>Execute that script on the directory where the main files reside, that is:
 
</li>
 
</li>
  
   cd www.dit.upm.es/vnuml
+
   cd www.dit.upm.es/vnumlwiki
 
   cd index.php
 
   cd index.php
 
   vnuml-clean-web
 
   vnuml-clean-web
  
<li>Delete the auxiliary files httrack generate in upper directory (it seems they are not needed):
+
Script options:
 +
* '''<nowiki>"--doc-only"</nowiki>''' eliminates the "Navigation" menu on the left side of the pages;
 +
* '''<nowiki>"--without-docvnuml"</nowiki>''' eliminates the "VNUML Documentation" menu on the left side of the pages;
 +
* '''<nowiki>"--withouth-ediv"</nowiki>''' eliminates the "EDIV Documentation" menu on the left side of the pages;
 +
* '''<nowiki>"--without-otherdoc"</nowiki>''' eliminates the "Other Documentation" menu on the left side of the pages;
 +
* '''<nowiki>"--without-docintro"</nowiki>''' eliminates the "Introduction" option in "Documentation" menu.
 +
 
 +
<li>Delete the auxiliary files httrack generates in upper directory (it seems they are not needed):
 
</li>
 
</li>
  
Line 49: Line 38:
 
   rm index????*.{html,css,php} opensearch_desc.php  
 
   rm index????*.{html,css,php} opensearch_desc.php  
  
<li>Load the index.html file in www.dit.upm.es/vnuml directory and you will have access to the local copy of the documentation.
+
<li>Load the index.html file in www.dit.upm.es/vnumlwiki directory and you will have access to the local copy of the documentation:
 
</li>
 
</li>
 +
 +
  firefox index.html
 +
 +
<li>If you are generating the documentation for the .tgz, then you can remove all except (put them in a html/ directory, at the same level than skin/ and images/ directories you also have got):</li>
 +
 +
  Tutorial.html
 +
  Installation.html
 +
  Reference.html
 +
  Usermanual.html
 +
  Howto.html
 +
  Ubuntu.html
 +
  Suse10-2.html
 +
  Suse10.html
 +
  Capture.html
 +
  Livedvd-install-vmware.html
 +
  Livedvd-makingoff.html
 +
  Resize-rootfs.html
 +
  Slc-rootfs.html
 +
  Clean-rootfs.html
 +
  Create-rootfs.html
 +
  Tips.html
 +
  FAQ.html
 +
  Wiki2html.html
 +
  Xen-test-debian.html
 +
  Debian-packages.html
 +
  Install-dyna.html
 +
  Vnumlgui_Debian.html
 +
  Fedora7.html
 +
  Root-fs-installer.html
 +
  Resize-rootfs.html
 +
  N3vlr-rootfs.html
 +
  Vnuml2dot.html
 +
  Xterm-screenshot-capture.html
 +
  Gdb-traces.html
 +
 +
The following script (executed in the root of the working directory) can be very useful to extract those files.
 +
 +
  mkdir final_html
 +
  cd www.dit.upm.es/vnumlwiki/index.php/
 +
  mv Tutorial.html \
 +
    Installation.html \
 +
    Reference.html \
 +
    Usermanual.html \
 +
    Howto.html \
 +
    Ubuntu.html \
 +
    Suse10-2.html \
 +
    Suse10.html \
 +
    Capture.html \
 +
    Livedvd-install-vmware.html \
 +
    Livedvd-makingoff.html \
 +
    Resize-rootfs.html \
 +
    Slc-rootfs.html \
 +
    Clean-rootfs.html \
 +
    Create-rootfs.html \
 +
    Tips.html \
 +
    FAQ.html \
 +
    Wiki2html.html \
 +
    Xen-test-debian.html \
 +
    Debian-packages.html \
 +
    Install-dyna.html \
 +
    Vnumlgui_Debian.html \
 +
    Fedora7.html \
 +
    Root-fs-installer.html \
 +
    Resize-rootfs.html \
 +
    N3vlr-rootfs.html \
 +
    Vnuml2dot.html \
 +
    Xterm-screenshot-capture.html \
 +
    Gdb-traces.html \
 +
    ../../../final_html
  
 
</ol>
 
</ol>
 +
 +
== Unsolved issues ==
 +
 +
* <s>The footnote regarding how many time the page has been visited has no sense in static HTML, so it should be removed.</s>
 +
 +
* Images links with pages that has no sense in static HTML. The image should remain in the HTML but the associated link removed.
 +
 +
* <s>In Ubuntu.html, offline references to Download.html get broken (because Download.html is not included in the HTML documentation bunch)</s>
 +
 +
* <s>In FAQ.html, offline references to Example-update-rootfs.html get broken (because Example-update-rootfs.html is not included in the HTML documentation bunch)</s>
 +
 +
* <s>In FAQ.html, offline references to Example-simple.html get broken (because Example-simple.html is not included in the HTML documentation bunch)</s>
 +
 +
* Some files in images/ should be cleaned up.
 +
 +
== vnuml-clean-web script ==
 +
 +
<pre>
 +
#!/bin/bash
 +
 +
# get a list of files, excluding directories
 +
FILES=`ls -F1 | sed -e 's/.*\///'`
 +
 +
# Options?
 +
DOCONLY="no"
 +
NODOCINTRO="no"
 +
NODOCVNUML="no"
 +
NODOCEDIV="no"
 +
NOOTHERDOC="no"
 +
while :
 +
do
 +
    case $# in
 +
        0)      break;;
 +
        *)      case "$1" in
 +
 +
                    "--doc-only")
 +
                        DOCONLY="yes"
 +
                        shift
 +
                        ;;
 +
 +
                    "--without-docintro")
 +
                        NODOCINTRO="yes"
 +
                        shift
 +
                        ;;
 +
 +
                    "--without-docvnuml")
 +
                        NODOCVNUML="yes"
 +
                        shift
 +
                        ;;
 +
 +
                    "--without-docediv")
 +
                        NODOCEDIV="yes"
 +
                        shift
 +
                        ;;
 +
 +
                    "--without-otherdoc")
 +
                        NOOTHERDOC="yes"
 +
                        shift
 +
                        ;;
 +
 +
                    *)
 +
                        echo "Error: unknown command line option (\"$1\")"
 +
                        exit 1
 +
                        ;;
 +
 +
                    "") break;;
 +
 +
                esac
 +
    esac
 +
done
 +
 +
echo "DOCONLY=$DOCONLY"
 +
echo "NODOCVNUML=$NODOCVNUML"
 +
echo "NODOCEDIV=$NODOCEDIV"
 +
echo "NOOTHERDOC=$NOOTHERDOC"
 +
echo "NODOCINTRO=$NODOCINTRO"
 +
 +
# Process each file
 +
for X in $FILES
 +
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("This page has been accessed.*times. -", "", $0);
 +
    print $0
 +
  }' | \
 +
  sed -e '/Redirected from/ d' \
 +
  > $X
 +
 +
  if [ "$DOCONLY" == "yes" ]; then
 +
    # Remove navigation menu
 +
    cp $X $X.tmp
 +
    cat $X.tmp | \
 +
    awk 'BEGIN {RS="" } {
 +
      # delete navigation sidebar
 +
      gsub("<!-- BEGINSIDEBAR p-navigation -->.*<!-- ENDSIDEBAR p-navigation -->", "", $0);
 +
      #gsub("<div class=\047portlet\047 id=\047p-navigation\047>.*<!-- ENDSIDEBAR p-navigation -->", "", $0);
 +
      # change image link from Main_Page to Docintro.html
 +
      #gsub("<a href=\"Main_Page.html\" id=\"home\"><i>Home</i></a>", "<a href=\"Docintro.html\" id=\"home\"><i>Home</i></a>", $0);
 +
      print $0
 +
    }' > $X
 +
  fi
 +
 +
  if [ "$NODOCVNUML" == "yes" ]; then
 +
    # Remove navigation menu
 +
    cp $X $X.tmp
 +
    cat $X.tmp | \
 +
    awk 'BEGIN {RS="" } {
 +
      # delete navigation sidebar
 +
      gsub("<!-- BEGINSIDEBAR p-VNUML Documentation -->.*<!-- ENDSIDEBAR p-EDIV Documentation -->", "", $0);
 +
      print $0
 +
    }' > $X
 +
  fi
 +
 +
  if [ "$NODOCEDIV" == "yes" ]; then
 +
    # Remove navigation menu
 +
    cp $X $X.tmp
 +
    cat $X.tmp | \
 +
    awk 'BEGIN {RS="" } {
 +
      # delete navigation sidebar
 +
      gsub("<!-- BEGINSIDEBAR p-EDIV Documentation -->.*<!-- ENDSIDEBAR p-EDIV Documentation -->", "", $0);
 +
      print $0
 +
    }' > $X
 +
  fi
 +
 +
  if [ "$NOOTHERDOC" == "yes" ]; then
 +
    # Remove navigation menu
 +
    cp $X $X.tmp
 +
    cat $X.tmp | \
 +
    awk 'BEGIN {RS="" } {
 +
      # delete navigation sidebar
 +
      gsub("<!-- BEGINSIDEBAR p-Other Documentation -->.*<!-- ENDSIDEBAR p-Other Documentation -->", "", $0);
 +
      print $0
 +
    }' > $X
 +
  fi
 +
 +
  if [ "$NODOCINTRO" == "yes" ]; then
 +
      # Removes Introduction entry in Documentation menu
 +
      cp $X $X.tmp
 +
 +
      cat $X.tmp | \
 +
      sed -e '/n-Introduction/ d' | sed -e '/n-Documentation/ d'  \
 +
      > $X
 +
 +
  fi
 +
 +
  rm $X.tmp
 +
 +
done
 +
 +
cd ../skins/fratman_enhanced
 +
# get css file name
 +
CSSFILE=`ls main????.css`
 +
echo "Changing style sheet: $CSSFILE"
 +
echo ".editsection { visibility: hidden }" >> $CSSFILE
 +
cd ../../index.php
 +
</pre>

Latest revision as of 19:08, 14 October 2008

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.

  1. Download and install htttrack from http://www.httrack.com/
  2. Get a copy of VNUML wiki:
  3.  mkdir vnumlweb
     cd vnumlweb
     httrack http://www.dit.upm.es/vnumlwiki/   
     # Note: Don't forget the  "/" at the end of the URL!
    
  4. Create a script named vnuml-clean-web with the content shown below.
  5. Execute that script on the directory where the main files reside, that is:
  6.  cd www.dit.upm.es/vnumlwiki
     cd index.php
     vnuml-clean-web
    

    Script options:

    • "--doc-only" eliminates the "Navigation" menu on the left side of the pages;
    • "--without-docvnuml" eliminates the "VNUML Documentation" menu on the left side of the pages;
    • "--withouth-ediv" eliminates the "EDIV Documentation" menu on the left side of the pages;
    • "--without-otherdoc" eliminates the "Other Documentation" menu on the left side of the pages;
    • "--without-docintro" eliminates the "Introduction" option in "Documentation" menu.
  7. Delete the auxiliary files httrack generates in upper directory (it seems they are not needed):
  8.  cd ..
     rm index????*.{html,css,php} opensearch_desc.php 
    
  9. Load the index.html file in www.dit.upm.es/vnumlwiki directory and you will have access to the local copy of the documentation:
  10.  firefox index.html 
    
  11. If you are generating the documentation for the .tgz, then you can remove all except (put them in a html/ directory, at the same level than skin/ and images/ directories you also have got):
  12.   Tutorial.html
      Installation.html
      Reference.html
      Usermanual.html
      Howto.html
      Ubuntu.html
      Suse10-2.html
      Suse10.html
      Capture.html
      Livedvd-install-vmware.html
      Livedvd-makingoff.html
      Resize-rootfs.html
      Slc-rootfs.html
      Clean-rootfs.html
      Create-rootfs.html
      Tips.html
      FAQ.html
      Wiki2html.html
      Xen-test-debian.html
      Debian-packages.html
      Install-dyna.html
      Vnumlgui_Debian.html
      Fedora7.html
      Root-fs-installer.html
      Resize-rootfs.html
      N3vlr-rootfs.html
      Vnuml2dot.html
      Xterm-screenshot-capture.html
      Gdb-traces.html
    

    The following script (executed in the root of the working directory) can be very useful to extract those files.

     mkdir final_html
     cd www.dit.upm.es/vnumlwiki/index.php/
     mv Tutorial.html \
        Installation.html \
        Reference.html \
        Usermanual.html \
        Howto.html \
        Ubuntu.html \
        Suse10-2.html \
        Suse10.html \
        Capture.html \
        Livedvd-install-vmware.html \
        Livedvd-makingoff.html \
        Resize-rootfs.html \
        Slc-rootfs.html \
        Clean-rootfs.html \
        Create-rootfs.html \
        Tips.html \
        FAQ.html \
        Wiki2html.html \
        Xen-test-debian.html \
        Debian-packages.html \
        Install-dyna.html \
        Vnumlgui_Debian.html \
        Fedora7.html \
        Root-fs-installer.html \
        Resize-rootfs.html \
        N3vlr-rootfs.html \
        Vnuml2dot.html \
        Xterm-screenshot-capture.html \
        Gdb-traces.html \
        ../../../final_html
    

Unsolved issues

  • The footnote regarding how many time the page has been visited has no sense in static HTML, so it should be removed.
  • Images links with pages that has no sense in static HTML. The image should remain in the HTML but the associated link removed.
  • In Ubuntu.html, offline references to Download.html get broken (because Download.html is not included in the HTML documentation bunch)
  • In FAQ.html, offline references to Example-update-rootfs.html get broken (because Example-update-rootfs.html is not included in the HTML documentation bunch)
  • In FAQ.html, offline references to Example-simple.html get broken (because Example-simple.html is not included in the HTML documentation bunch)
  • Some files in images/ should be cleaned up.

vnuml-clean-web script

#!/bin/bash

# get a list of files, excluding directories
FILES=`ls -F1 | sed -e 's/.*\///'`

# Options?
DOCONLY="no"
NODOCINTRO="no"
NODOCVNUML="no"
NODOCEDIV="no"
NOOTHERDOC="no"
while :
do
    case $# in
        0)      break;;
        *)      case "$1" in

                    "--doc-only")
                        DOCONLY="yes"
                        shift
                        ;;

                    "--without-docintro")
                        NODOCINTRO="yes"
                        shift
                        ;;

                    "--without-docvnuml")
                        NODOCVNUML="yes"
                        shift
                        ;;

                    "--without-docediv")
                        NODOCEDIV="yes"
                        shift
                        ;;

                    "--without-otherdoc")
                        NOOTHERDOC="yes"
                        shift
                        ;;

                    *)
                        echo "Error: unknown command line option (\"$1\")"
                        exit 1
                        ;;

                    "") break;;

                 esac
    esac
done

echo "DOCONLY=$DOCONLY"
echo "NODOCVNUML=$NODOCVNUML"
echo "NODOCEDIV=$NODOCEDIV"
echo "NOOTHERDOC=$NOOTHERDOC"
echo "NODOCINTRO=$NODOCINTRO"

# Process each file
for X in $FILES
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("This page has been accessed.*times. -", "", $0);
    print $0
  }' | \
  sed -e '/Redirected from/ d' \
  > $X

  if [ "$DOCONLY" == "yes" ]; then
    # Remove navigation menu
    cp $X $X.tmp
    cat $X.tmp | \
    awk 'BEGIN {RS="" } {
      # delete navigation sidebar
      gsub("<!-- BEGINSIDEBAR p-navigation -->.*<!-- ENDSIDEBAR p-navigation -->", "", $0);
      #gsub("<div class=\047portlet\047 id=\047p-navigation\047>.*<!-- ENDSIDEBAR p-navigation -->", "", $0);
      # change image link from Main_Page to Docintro.html
      #gsub("<a href=\"Main_Page.html\" id=\"home\"><i>Home</i></a>", "<a href=\"Docintro.html\" id=\"home\"><i>Home</i></a>", $0);
      print $0
    }' > $X
  fi

  if [ "$NODOCVNUML" == "yes" ]; then
    # Remove navigation menu
    cp $X $X.tmp
    cat $X.tmp | \
    awk 'BEGIN {RS="" } {
      # delete navigation sidebar
      gsub("<!-- BEGINSIDEBAR p-VNUML Documentation -->.*<!-- ENDSIDEBAR p-EDIV Documentation -->", "", $0);
      print $0
    }' > $X
  fi

  if [ "$NODOCEDIV" == "yes" ]; then
    # Remove navigation menu
    cp $X $X.tmp
    cat $X.tmp | \
    awk 'BEGIN {RS="" } {
      # delete navigation sidebar
      gsub("<!-- BEGINSIDEBAR p-EDIV Documentation -->.*<!-- ENDSIDEBAR p-EDIV Documentation -->", "", $0);
      print $0
    }' > $X
  fi

  if [ "$NOOTHERDOC" == "yes" ]; then
    # Remove navigation menu
    cp $X $X.tmp
    cat $X.tmp | \
    awk 'BEGIN {RS="" } {
      # delete navigation sidebar
      gsub("<!-- BEGINSIDEBAR p-Other Documentation -->.*<!-- ENDSIDEBAR p-Other Documentation -->", "", $0);
      print $0
    }' > $X
  fi

  if [ "$NODOCINTRO" == "yes" ]; then
      # Removes Introduction entry in Documentation menu
      cp $X $X.tmp

      cat $X.tmp | \
      sed -e '/n-Introduction/ d' | sed -e '/n-Documentation/ d'  \
      > $X

  fi

  rm $X.tmp

done

cd ../skins/fratman_enhanced
# get css file name
CSSFILE=`ls main????.css`
echo "Changing style sheet: $CSSFILE"
echo ".editsection { visibility: hidden }" >> $CSSFILE
cd ../../index.php