webgen 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +2565 -14
- data/README +4 -6
- data/Rakefile +207 -89
- data/TODO +175 -17
- data/VERSION +1 -1
- data/bin/webgen +1 -2
- data/data/webgen/gallery-creator/default.png +0 -0
- data/data/webgen/gallery_styles/default/README +6 -0
- data/data/webgen/gallery_styles/default/gallery_gallery.template +38 -0
- data/data/webgen/gallery_styles/default/gallery_image.template +30 -0
- data/data/webgen/gallery_styles/default/gallery_main.template +18 -0
- data/data/webgen/gallery_styles/slides/README +18 -0
- data/data/webgen/gallery_styles/slides/collage.rb +334 -0
- data/data/webgen/gallery_styles/slides/gallery_gallery.template +62 -0
- data/data/webgen/gallery_styles/slides/gallery_image.template +53 -0
- data/data/webgen/gallery_styles/slides/gallery_main.template +32 -0
- data/data/webgen/resources/images/generated_by_webgen.png +0 -0
- data/data/webgen/resources/images/webgen_logo.png +0 -0
- data/data/webgen/website_styles/1024px/README +10 -0
- data/data/webgen/website_styles/1024px/default.css +188 -0
- data/data/webgen/website_styles/1024px/default.template +62 -0
- data/data/webgen/website_styles/1024px/images/background.gif +0 -0
- data/data/webgen/website_styles/andreas00/README +10 -0
- data/data/webgen/website_styles/andreas00/default.css +290 -0
- data/data/webgen/website_styles/andreas00/default.template +62 -0
- data/data/webgen/website_styles/andreas00/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas00/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas00/images/menubg.gif +0 -0
- data/data/webgen/website_styles/andreas00/images/menubg2.gif +0 -0
- data/data/webgen/website_styles/andreas01/README +11 -0
- data/data/webgen/website_styles/andreas01/default.css +310 -0
- data/data/webgen/website_styles/andreas01/default.template +63 -0
- data/data/webgen/website_styles/andreas01/images/bg.gif +0 -0
- data/data/webgen/website_styles/andreas01/images/front.jpg +0 -0
- data/data/webgen/website_styles/andreas01/print.css +35 -0
- data/data/webgen/website_styles/andreas03/README +11 -0
- data/data/webgen/website_styles/andreas03/default.css +223 -0
- data/data/webgen/website_styles/andreas03/default.template +60 -0
- data/data/webgen/website_styles/andreas03/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas03/images/contbg.png +0 -0
- data/data/webgen/website_styles/andreas03/images/footerbg.png +0 -0
- data/data/webgen/website_styles/andreas03/images/gradient1.png +0 -0
- data/data/webgen/website_styles/andreas03/images/gradient2.png +0 -0
- data/data/webgen/website_styles/andreas04/README +12 -0
- data/data/webgen/website_styles/andreas04/default.css +290 -0
- data/data/webgen/website_styles/andreas04/default.template +83 -0
- data/data/webgen/website_styles/andreas04/images/blinkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/bodybg.png +0 -0
- data/data/webgen/website_styles/andreas04/images/contentbg.png +0 -0
- data/data/webgen/website_styles/andreas04/images/entrybg.png +0 -0
- data/data/webgen/website_styles/andreas04/images/flash.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/flash2.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/globe.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/globebottom.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/linkarrow.gif +0 -0
- data/data/webgen/website_styles/andreas04/images/menuhover.png +0 -0
- data/data/webgen/website_styles/andreas05/README +11 -0
- data/data/webgen/website_styles/andreas05/default.css +33 -0
- data/data/webgen/website_styles/andreas05/default.template +42 -0
- data/data/webgen/website_styles/andreas05/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas05/images/front.png +0 -0
- data/data/webgen/website_styles/andreas06/README +11 -0
- data/data/webgen/website_styles/andreas06/default.css +353 -0
- data/data/webgen/website_styles/andreas06/default.template +72 -0
- data/data/webgen/website_styles/andreas06/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas06/images/boxbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/images/greypx.gif +0 -0
- data/data/webgen/website_styles/andreas06/images/header.jpg +0 -0
- data/data/webgen/website_styles/andreas06/images/innerbg.gif +0 -0
- data/data/webgen/website_styles/andreas06/images/leaves.jpg +0 -0
- data/data/webgen/website_styles/andreas06/images/tabs.gif +0 -0
- data/data/webgen/website_styles/andreas07/README +12 -0
- data/data/webgen/website_styles/andreas07/browserfix.css +7 -0
- data/data/webgen/website_styles/andreas07/default.css +92 -0
- data/data/webgen/website_styles/andreas07/default.template +44 -0
- data/data/webgen/website_styles/andreas07/images/bodybg.gif +0 -0
- data/data/webgen/website_styles/andreas07/images/sidebarbg.gif +0 -0
- data/data/webgen/website_styles/andreas08/README +11 -0
- data/data/webgen/website_styles/andreas08/default.css +224 -0
- data/data/webgen/website_styles/andreas08/default.template +53 -0
- data/data/webgen/website_styles/andreas09/README +11 -0
- data/data/webgen/website_styles/andreas09/default.css +308 -0
- data/data/webgen/website_styles/andreas09/default.template +70 -0
- data/data/webgen/website_styles/andreas09/images/bodybg-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/bodybg-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/bodybg-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/bodybg-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/bodybg-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/bodybg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/footerbg.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover-black.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover-green.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover-orange.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover-purple.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover-red.jpg +0 -0
- data/data/webgen/website_styles/andreas09/images/menuhover.jpg +0 -0
- data/data/webgen/website_styles/default/README +6 -0
- data/data/webgen/website_styles/default/default.css +1 -1
- data/data/webgen/website_styles/default/default.template +9 -3
- data/data/webgen/website_styles/plain/README +12 -0
- data/data/webgen/website_styles/plain/default.css +244 -0
- data/data/webgen/website_styles/plain/default.template +63 -0
- data/data/webgen/website_styles/plain/images/a_hover.jpg +0 -0
- data/data/webgen/website_styles/plain/images/desc.jpg +0 -0
- data/data/webgen/website_styles/plain/images/li.gif +0 -0
- data/data/webgen/website_styles/plain/images/mainbar.jpg +0 -0
- data/data/webgen/website_styles/plain/images/menu.jpg +0 -0
- data/data/webgen/website_styles/plain/images/submenua.gif +0 -0
- data/data/webgen/website_styles/plain/images/submenua_hover.jpg +0 -0
- data/data/webgen/website_templates/default/README +7 -5
- data/data/webgen/website_templates/personal_hp/README +7 -5
- data/data/webgen/website_templates/project/README +8 -6
- data/doc/config.yaml +2 -2
- data/doc/examples/website_styles/1024px/README +9 -0
- data/doc/examples/website_styles/1024px/config.yaml +2 -0
- data/doc/examples/website_styles/1024px/src/about.page +12 -0
- data/doc/examples/website_styles/1024px/src/default.css +188 -0
- data/doc/examples/website_styles/1024px/src/default.template +62 -0
- data/doc/examples/website_styles/1024px/src/download.page +15 -0
- data/doc/examples/website_styles/1024px/src/features.page +8 -0
- data/doc/examples/website_styles/1024px/src/images/background.gif +0 -0
- data/doc/examples/website_styles/1024px/src/index.page +9 -0
- data/doc/examples/website_styles/1024px/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas00/README +9 -0
- data/doc/examples/website_styles/andreas00/config.yaml +2 -0
- data/doc/examples/website_styles/andreas00/src/about.page +12 -0
- data/doc/examples/website_styles/andreas00/src/default.css +290 -0
- data/doc/examples/website_styles/andreas00/src/default.template +62 -0
- data/doc/examples/website_styles/andreas00/src/download.page +15 -0
- data/doc/examples/website_styles/andreas00/src/features.page +8 -0
- data/doc/examples/website_styles/andreas00/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/images/menubg2.gif +0 -0
- data/doc/examples/website_styles/andreas00/src/index.page +9 -0
- data/doc/examples/website_styles/andreas00/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas01/README +9 -0
- data/doc/examples/website_styles/andreas01/config.yaml +2 -0
- data/doc/examples/website_styles/andreas01/src/about.page +12 -0
- data/doc/examples/website_styles/andreas01/src/default.css +310 -0
- data/doc/examples/website_styles/andreas01/src/default.template +63 -0
- data/doc/examples/website_styles/andreas01/src/download.page +15 -0
- data/doc/examples/website_styles/andreas01/src/features.page +8 -0
- data/doc/examples/website_styles/andreas01/src/images/bg.gif +0 -0
- data/doc/examples/website_styles/andreas01/src/images/front.jpg +0 -0
- data/doc/examples/website_styles/andreas01/src/index.page +9 -0
- data/doc/examples/website_styles/andreas01/src/print.css +35 -0
- data/doc/examples/website_styles/andreas01/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas03/README +9 -0
- data/doc/examples/website_styles/andreas03/config.yaml +2 -0
- data/doc/examples/website_styles/andreas03/src/about.page +12 -0
- data/doc/examples/website_styles/andreas03/src/default.css +223 -0
- data/doc/examples/website_styles/andreas03/src/default.template +60 -0
- data/doc/examples/website_styles/andreas03/src/download.page +15 -0
- data/doc/examples/website_styles/andreas03/src/features.page +8 -0
- data/doc/examples/website_styles/andreas03/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/contbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/footerbg.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient1.png +0 -0
- data/doc/examples/website_styles/andreas03/src/images/gradient2.png +0 -0
- data/doc/examples/website_styles/andreas03/src/index.page +9 -0
- data/doc/examples/website_styles/andreas03/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas04/README +9 -0
- data/doc/examples/website_styles/andreas04/config.yaml +2 -0
- data/doc/examples/website_styles/andreas04/src/about.page +12 -0
- data/doc/examples/website_styles/andreas04/src/default.css +290 -0
- data/doc/examples/website_styles/andreas04/src/default.template +83 -0
- data/doc/examples/website_styles/andreas04/src/download.page +15 -0
- data/doc/examples/website_styles/andreas04/src/features.page +8 -0
- data/doc/examples/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/bodybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/contentbg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/entrybg.png +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/flash2.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globe.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/globebottom.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/linkarrow.gif +0 -0
- data/doc/examples/website_styles/andreas04/src/images/menuhover.png +0 -0
- data/doc/examples/website_styles/andreas04/src/index.page +9 -0
- data/doc/examples/website_styles/andreas04/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas05/README +9 -0
- data/doc/examples/website_styles/andreas05/config.yaml +2 -0
- data/doc/examples/website_styles/andreas05/src/about.page +12 -0
- data/doc/examples/website_styles/andreas05/src/default.css +33 -0
- data/doc/examples/website_styles/andreas05/src/default.template +42 -0
- data/doc/examples/website_styles/andreas05/src/download.page +15 -0
- data/doc/examples/website_styles/andreas05/src/features.page +8 -0
- data/doc/examples/website_styles/andreas05/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas05/src/images/front.png +0 -0
- data/doc/examples/website_styles/andreas05/src/index.page +9 -0
- data/doc/examples/website_styles/andreas05/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas06/README +9 -0
- data/doc/examples/website_styles/andreas06/config.yaml +2 -0
- data/doc/examples/website_styles/andreas06/src/about.page +12 -0
- data/doc/examples/website_styles/andreas06/src/default.css +353 -0
- data/doc/examples/website_styles/andreas06/src/default.template +72 -0
- data/doc/examples/website_styles/andreas06/src/download.page +15 -0
- data/doc/examples/website_styles/andreas06/src/features.page +8 -0
- data/doc/examples/website_styles/andreas06/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/boxbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/greypx.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/header.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/innerbg.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/images/leaves.jpg +0 -0
- data/doc/examples/website_styles/andreas06/src/images/tabs.gif +0 -0
- data/doc/examples/website_styles/andreas06/src/index.page +9 -0
- data/doc/examples/website_styles/andreas06/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas07/README +9 -0
- data/doc/examples/website_styles/andreas07/config.yaml +2 -0
- data/doc/examples/website_styles/andreas07/src/about.page +12 -0
- data/doc/examples/website_styles/andreas07/src/browserfix.css +7 -0
- data/doc/examples/website_styles/andreas07/src/default.css +92 -0
- data/doc/examples/website_styles/andreas07/src/default.template +44 -0
- data/doc/examples/website_styles/andreas07/src/download.page +15 -0
- data/doc/examples/website_styles/andreas07/src/features.page +8 -0
- data/doc/examples/website_styles/andreas07/src/images/bodybg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
- data/doc/examples/website_styles/andreas07/src/index.page +9 -0
- data/doc/examples/website_styles/andreas07/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas08/README +9 -0
- data/doc/examples/website_styles/andreas08/config.yaml +2 -0
- data/doc/examples/website_styles/andreas08/src/about.page +12 -0
- data/doc/examples/website_styles/andreas08/src/default.css +224 -0
- data/doc/examples/website_styles/andreas08/src/default.template +53 -0
- data/doc/examples/website_styles/andreas08/src/download.page +15 -0
- data/doc/examples/website_styles/andreas08/src/features.page +8 -0
- data/doc/examples/website_styles/andreas08/src/index.page +9 -0
- data/doc/examples/website_styles/andreas08/src/screenshots.page +18 -0
- data/doc/examples/website_styles/andreas09/README +9 -0
- data/doc/examples/website_styles/andreas09/config.yaml +2 -0
- data/doc/examples/website_styles/andreas09/src/about.page +12 -0
- data/doc/examples/website_styles/andreas09/src/default.css +308 -0
- data/doc/examples/website_styles/andreas09/src/default.template +70 -0
- data/doc/examples/website_styles/andreas09/src/download.page +15 -0
- data/doc/examples/website_styles/andreas09/src/features.page +8 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/bodybg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/footerbg.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/images/menuhover.jpg +0 -0
- data/doc/examples/website_styles/andreas09/src/index.page +9 -0
- data/doc/examples/website_styles/andreas09/src/screenshots.page +18 -0
- data/doc/examples/website_styles/default/README +9 -0
- data/doc/examples/website_styles/default/config.yaml +2 -0
- data/doc/examples/website_styles/default/src/about.page +12 -0
- data/doc/examples/website_styles/default/src/default.css +84 -0
- data/doc/examples/website_styles/default/src/default.template +38 -0
- data/doc/examples/website_styles/default/src/download.page +15 -0
- data/doc/examples/website_styles/default/src/features.page +8 -0
- data/doc/examples/website_styles/default/src/index.page +9 -0
- data/doc/examples/website_styles/default/src/screenshots.page +18 -0
- data/doc/examples/website_styles/plain/README +9 -0
- data/doc/examples/website_styles/plain/config.yaml +2 -0
- data/doc/examples/website_styles/plain/src/about.page +12 -0
- data/doc/examples/website_styles/plain/src/default.css +244 -0
- data/doc/examples/website_styles/plain/src/default.template +63 -0
- data/doc/examples/website_styles/plain/src/download.page +15 -0
- data/doc/examples/website_styles/plain/src/features.page +8 -0
- data/doc/examples/website_styles/plain/src/images/a_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/desc.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/li.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/mainbar.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/menu.jpg +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua.gif +0 -0
- data/doc/examples/website_styles/plain/src/images/submenua_hover.jpg +0 -0
- data/doc/examples/website_styles/plain/src/index.page +9 -0
- data/doc/examples/website_styles/plain/src/screenshots.page +18 -0
- data/doc/examples/website_templates/default/README +8 -0
- data/doc/examples/website_templates/default/config.yaml +2 -0
- data/doc/examples/website_templates/default/src/default.css +84 -0
- data/doc/examples/website_templates/default/src/default.template +38 -0
- data/doc/examples/website_templates/default/src/index.page +8 -0
- data/doc/examples/website_templates/personal_hp/README +8 -0
- data/doc/examples/website_templates/personal_hp/config.yaml +2 -0
- data/doc/examples/website_templates/personal_hp/src/about.page +12 -0
- data/doc/examples/website_templates/personal_hp/src/default.css +84 -0
- data/doc/examples/website_templates/personal_hp/src/default.template +38 -0
- data/doc/examples/website_templates/personal_hp/src/index.page +9 -0
- data/doc/examples/website_templates/personal_hp/src/links.page +22 -0
- data/doc/examples/website_templates/personal_hp/src/projects.page +20 -0
- data/doc/examples/website_templates/project/README +9 -0
- data/doc/examples/website_templates/project/config.yaml +2 -0
- data/doc/examples/website_templates/project/src/about.page +12 -0
- data/doc/examples/website_templates/project/src/default.css +84 -0
- data/doc/examples/website_templates/project/src/default.template +38 -0
- data/doc/examples/website_templates/project/src/download.page +15 -0
- data/doc/examples/website_templates/project/src/features.page +8 -0
- data/doc/examples/website_templates/project/src/index.page +9 -0
- data/doc/examples/website_templates/project/src/screenshots.page +18 -0
- data/doc/metainfo.yaml +85 -0
- data/doc/plugin/emoticon.rb +19 -21
- data/doc/plugin/extension.rb +134 -55
- data/doc/plugin/gallery/slides/collage.rb +334 -0
- data/doc/plugin/listpluginparameters.rb +24 -26
- data/doc/plugin/resources.rb +20 -22
- data/doc/src/default.css +333 -154
- data/doc/src/default.template +92 -39
- data/doc/src/documentation/extending_webgen.page +1 -2
- data/doc/src/documentation/gettingstarted.page +161 -44
- data/doc/src/documentation/index.page +15 -28
- data/doc/src/documentation/plugins/contentconverter/default.page +15 -0
- data/doc/src/documentation/plugins/contentconverter/html.page +10 -0
- data/doc/src/documentation/plugins/contentconverter/markdown.page +21 -0
- data/doc/src/documentation/plugins/contentconverter/rdoc.page +11 -0
- data/doc/src/documentation/plugins/contentconverter/textile.page +21 -0
- data/doc/src/documentation/plugins/contentconverter/xmlbuilder.page +61 -0
- data/doc/src/documentation/plugins/core/configuration.page +11 -0
- data/doc/src/documentation/plugins/core/filehandler.page +214 -0
- data/doc/src/documentation/plugins/core/index.page +11 -0
- data/doc/src/documentation/plugins/core/resourcemanager.page +46 -0
- data/doc/src/documentation/plugins/core/tagprocessor.page +17 -0
- data/doc/src/documentation/plugins/file/copyhandler.page +26 -0
- data/doc/src/documentation/plugins/file/defaulthandler.page +15 -0
- data/doc/src/documentation/plugins/file/directoryhandler.page +37 -0
- data/doc/src/documentation/plugins/file/galleryhandler.page +181 -0
- data/doc/src/documentation/plugins/file/pagehandler.page +154 -0
- data/doc/src/documentation/plugins/file/templatehandler.page +34 -0
- data/doc/src/documentation/plugins/file/thumbnailwriter.page +39 -0
- data/doc/src/documentation/plugins/htmlvalidator/default.page +12 -0
- data/doc/src/documentation/plugins/htmlvalidator/xmllint.page +12 -0
- data/doc/src/documentation/plugins/index.page +32 -11
- data/doc/src/documentation/plugins/menustyle/default.page +19 -0
- data/doc/src/documentation/plugins/menustyle/horizontal.page +32 -0
- data/doc/src/documentation/plugins/{menustyles → menustyle}/horizontaldropdown.page +25 -19
- data/doc/src/documentation/plugins/menustyle/section.page +34 -0
- data/doc/src/documentation/plugins/menustyle/vertical.page +48 -0
- data/doc/src/documentation/plugins/menustyle/verticaldropdown.page +29 -0
- data/doc/src/documentation/plugins/misc/index.page +9 -0
- data/doc/src/documentation/plugins/{miscplugins → misc}/smileyreplacer.page +15 -14
- data/doc/src/documentation/plugins/misc/syntaxhighlighter.page +26 -0
- data/doc/src/documentation/plugins/tag/block.page +29 -0
- data/doc/src/documentation/plugins/tag/breadcrumbtrail.page +29 -0
- data/doc/src/documentation/plugins/tag/date.page +34 -0
- data/doc/src/documentation/plugins/tag/default.page +27 -0
- data/doc/src/documentation/plugins/tag/download.page +60 -0
- data/doc/src/documentation/plugins/tag/executecommand.page +29 -0
- data/doc/src/documentation/plugins/tag/includefile.page +30 -0
- data/doc/src/documentation/plugins/{tags → tag}/langbar.de.page +1 -1
- data/doc/src/documentation/plugins/tag/langbar.fr.page +6 -0
- data/doc/src/documentation/plugins/tag/langbar.page +41 -0
- data/doc/src/documentation/plugins/tag/menu.page +78 -0
- data/doc/src/documentation/plugins/{tags → tag}/meta.page +8 -7
- data/doc/src/documentation/plugins/tag/relocatable.page +46 -0
- data/doc/src/documentation/plugins/tag/resource.page +35 -0
- data/doc/src/documentation/plugins/tag/sitemap.page +35 -0
- data/doc/src/documentation/plugins/tag/wikilink.page +33 -0
- data/doc/src/documentation/references/index.page +0 -1
- data/doc/src/documentation/references/meta_info_reference.page +90 -13
- data/doc/src/documentation/references/parameter_reference.page +0 -1
- data/doc/src/documentation/references/webpage_format.page +249 -0
- data/doc/src/download.page +50 -21
- data/doc/src/examples/gallery_styles/default/default.gallery +78 -0
- data/doc/src/examples/gallery_styles/default/gallery_gallery.template +38 -0
- data/doc/src/examples/gallery_styles/default/gallery_image.template +30 -0
- data/doc/src/examples/gallery_styles/default/gallery_main.template +18 -0
- data/doc/src/examples/gallery_styles/index.page +22 -0
- data/doc/src/examples/gallery_styles/slides/gallery_gallery.template +62 -0
- data/doc/src/examples/gallery_styles/slides/gallery_image.template +53 -0
- data/doc/src/examples/gallery_styles/slides/gallery_main.template +32 -0
- data/doc/src/examples/gallery_styles/slides/slides.gallery +79 -0
- data/doc/src/examples/images/image01.jpg +0 -0
- data/doc/src/examples/images/image02.jpg +0 -0
- data/doc/src/examples/images/image03.jpg +0 -0
- data/doc/src/examples/images/image04.jpg +0 -0
- data/doc/src/examples/images/image05.jpg +0 -0
- data/doc/src/examples/images/image06.jpg +0 -0
- data/doc/src/examples/images/image07.jpg +0 -0
- data/doc/src/examples/images/image08.jpg +0 -0
- data/doc/src/examples/images/image09.jpg +0 -0
- data/doc/src/examples/images/image10.jpg +0 -0
- data/doc/src/examples/images/image11.jpg +0 -0
- data/doc/src/examples/images/image12.jpg +0 -0
- data/doc/src/examples/images/image13.jpg +0 -0
- data/doc/src/examples/images/image14.jpg +0 -0
- data/doc/src/examples/images/image15.jpg +0 -0
- data/doc/src/examples/images/image16.jpg +0 -0
- data/doc/src/examples/images/image17.jpg +0 -0
- data/doc/src/examples/images/image18.jpg +0 -0
- data/doc/src/examples/index.page +18 -0
- data/doc/src/examples/website_styles/1024px.page +5 -0
- data/doc/src/examples/website_styles/andreas00.page +5 -0
- data/doc/src/examples/website_styles/andreas01.page +5 -0
- data/doc/src/examples/website_styles/andreas03.page +5 -0
- data/doc/src/examples/website_styles/andreas04.page +5 -0
- data/doc/src/examples/website_styles/andreas05.page +5 -0
- data/doc/src/examples/website_styles/andreas06.page +5 -0
- data/doc/src/examples/website_styles/andreas07.page +5 -0
- data/doc/src/examples/website_styles/andreas08.page +5 -0
- data/doc/src/examples/website_styles/andreas09.page +5 -0
- data/doc/src/examples/website_styles/default.page +5 -0
- data/doc/src/examples/website_styles/index.page +71 -0
- data/doc/src/examples/website_styles/plain.page +5 -0
- data/doc/src/examples/website_templates/default.page +5 -0
- data/doc/src/examples/website_templates/index.page +24 -0
- data/doc/src/examples/website_templates/personal_hp.page +5 -0
- data/doc/src/examples/website_templates/project.page +5 -0
- data/doc/src/features.page +16 -14
- data/doc/src/images/bodybg.jpg +0 -0
- data/doc/src/images/footerbg.jpg +0 -0
- data/doc/src/images/menuhover.jpg +0 -0
- data/doc/src/images/node_diagram.svg +7132 -0
- data/doc/src/images/thumb_example.jpg +0 -0
- data/doc/src/images/thumb_example_cropped.jpg +0 -0
- data/doc/src/images/thumb_example_normal.jpg +0 -0
- data/doc/src/index.page +14 -102
- data/doc/src/news.page +154 -0
- data/doc/src/plugin.template +10 -0
- data/lib/webgen/cli.rb +427 -0
- data/lib/webgen/composite.rb +11 -11
- data/lib/webgen/config.rb +52 -0
- data/lib/webgen/content.rb +172 -0
- data/lib/webgen/extcommand.rb +23 -0
- data/lib/webgen/languages.rb +110 -0
- data/lib/webgen/listener.rb +1 -1
- data/lib/webgen/node.rb +196 -124
- data/lib/webgen/plugin.rb +480 -144
- data/lib/webgen/plugins/{contenthandlers → contentconverters}/default.rb +10 -9
- data/lib/webgen/plugins/{contenthandlers → contentconverters}/html.rb +11 -8
- data/lib/webgen/plugins/contentconverters/markdown.rb +54 -0
- data/lib/webgen/plugins/{contenthandlers → contentconverters}/rdoc.rb +16 -12
- data/lib/webgen/plugins/{contenthandlers → contentconverters}/textile.rb +18 -13
- data/lib/webgen/plugins/contentconverters/xmlbuilder.rb +58 -0
- data/lib/webgen/plugins/coreplugins/configuration.rb +11 -102
- data/lib/webgen/plugins/coreplugins/resourcemanager.rb +95 -74
- data/lib/webgen/plugins/filehandlers/copy.rb +41 -19
- data/lib/webgen/plugins/filehandlers/directory.rb +52 -50
- data/lib/webgen/plugins/filehandlers/filehandler.rb +370 -123
- data/lib/webgen/plugins/filehandlers/gallery.rb +368 -117
- data/lib/webgen/plugins/filehandlers/page.rb +160 -146
- data/lib/webgen/plugins/filehandlers/template.rb +65 -52
- data/lib/webgen/plugins/htmlvalidators/default.rb +9 -7
- data/lib/webgen/plugins/htmlvalidators/xmllint.rb +17 -33
- data/lib/webgen/plugins/menustyles/default.rb +27 -25
- data/lib/webgen/plugins/menustyles/horizontal.rb +22 -41
- data/lib/webgen/plugins/menustyles/horizontal_dropdown.rb +25 -39
- data/lib/webgen/plugins/menustyles/section.rb +68 -0
- data/lib/webgen/plugins/menustyles/vertical.rb +36 -56
- data/lib/webgen/plugins/menustyles/vertical_dropdown.rb +24 -32
- data/lib/webgen/plugins/miscplugins/smileyreplacer.rb +20 -17
- data/lib/webgen/plugins/miscplugins/syntax_highlighter.rb +72 -0
- data/lib/webgen/plugins/miscplugins/treewalker.rb +9 -36
- data/lib/webgen/plugins/tags/block.rb +65 -0
- data/lib/webgen/plugins/tags/breadcrumbtrail.rb +15 -11
- data/lib/webgen/plugins/tags/date.rb +11 -7
- data/lib/webgen/plugins/tags/download.rb +38 -38
- data/lib/webgen/plugins/tags/executecommand.rb +30 -15
- data/lib/webgen/plugins/tags/includefile.rb +26 -13
- data/lib/webgen/plugins/tags/langbar.rb +23 -18
- data/lib/webgen/plugins/tags/menu.rb +49 -70
- data/lib/webgen/plugins/tags/meta.rb +12 -9
- data/lib/webgen/plugins/tags/relocatable.rb +41 -13
- data/lib/webgen/plugins/tags/sitemap.rb +32 -28
- data/lib/webgen/plugins/tags/tag_processor.rb +279 -0
- data/lib/webgen/plugins/tags/wikilink.rb +25 -20
- data/lib/webgen/test.rb +202 -0
- data/lib/webgen/website.rb +310 -0
- data/test/fixtures/sample_site/src/chained.template +3 -0
- data/test/fixtures/sample_site/src/default.template +3 -0
- data/test/fixtures/sample_site/src/dir1/dir11/file111.de.page +3 -0
- data/test/fixtures/sample_site/src/dir1/dir11/file111.page +3 -0
- data/test/fixtures/sample_site/src/dir1/dir11/index.page +3 -0
- data/test/fixtures/sample_site/src/dir1/file11.page +3 -0
- data/test/fixtures/sample_site/src/dir2/file21.page +3 -0
- data/test/fixtures/sample_site/src/embedded.rhtml +1 -0
- data/test/fixtures/sample_site/src/file1.page +8 -0
- data/test/fixtures/sample_site/src/file2.de.page +6 -0
- data/test/fixtures/sample_site/src/index.de.page +4 -0
- data/test/fixtures/sample_site/src/index.en.page +1 -0
- data/test/fixtures/sample_site/src/invalid.template +3 -0
- data/test/fixtures/sample_site/src/test.jpg +1 -0
- data/test/fixtures/sample_site/src/test.template +3 -0
- data/test/fixtures/tc_content/blocks.yaml +40 -0
- data/test/fixtures/tc_content/correct.yaml +65 -0
- data/test/fixtures/tc_content/incorrect.yaml +42 -0
- data/test/fixtures/tc_filehandler_filehandler/backing/metainfo.yaml +9 -0
- data/test/fixtures/tc_filehandler_filehandler/backing_empty/metainfo.yaml +6 -0
- data/test/fixtures/tc_filehandler_filehandler/sample_plugin.rb +49 -0
- data/test/fixtures/tc_filehandler_filehandler/unmodified +0 -0
- data/test/fixtures/tc_filehandler_gallery/test.gallery +2 -0
- data/test/fixtures/tc_filehandler_gallery/test1.gallery +2 -0
- data/test/fixtures/tc_filehandler_gallery/test1.jpg +0 -0
- data/test/fixtures/tc_filehandler_gallery/test2.jpg +0 -0
- data/test/fixtures/tc_filehandler_gallery/test3.jpg +0 -0
- data/test/fixtures/tc_filehandler_gallery/test4.jpg +0 -0
- data/test/fixtures/tc_filehandler_page/testdata.yaml +10 -0
- data/test/fixtures/tc_menustyles_default/menustyle.rb +7 -0
- data/test/fixtures/tc_node/nodes.yaml +64 -0
- data/test/fixtures/tc_plugin/handlerplugin.rb +15 -0
- data/test/fixtures/tc_plugin/plugin1.rb +33 -0
- data/test/fixtures/tc_plugin/plugin2.rb +8 -0
- data/test/fixtures/tc_tags_includefile/testfile +1 -0
- data/test/fixtures/tc_tags_tag_processor/test_file1 +1 -0
- data/test/fixtures/tc_tags_tag_processor/testtag.rb +17 -0
- data/test/fixtures/tc_website/correct.yaml +6 -0
- data/test/fixtures/tc_website/incorrect_structure.yaml +2 -0
- data/test/fixtures/tc_website/incorrect_yaml.yaml +5 -0
- data/test/fixtures/tc_website/meta_info_test.yaml +10 -0
- data/test/fixtures/tc_website/testdir/README +1 -0
- data/test/fixtures/tc_website/testdir/falsedir/README +1 -0
- data/test/runtests.rb +2 -0
- data/test/unittests/tc_composite.rb +82 -0
- data/test/unittests/tc_config.rb +18 -0
- data/test/unittests/tc_content.rb +88 -0
- data/test/unittests/tc_contentconverters_default.rb +13 -0
- data/test/unittests/tc_contentconverters_html.rb +16 -0
- data/test/unittests/tc_contentconverters_markdown.rb +22 -0
- data/test/unittests/tc_contentconverters_rdoc.rb +16 -0
- data/test/unittests/tc_contentconverters_textile.rb +22 -0
- data/test/unittests/tc_contentconverters_xmlbuilder.rb +22 -0
- data/test/unittests/tc_filehandler_copy.rb +65 -0
- data/test/unittests/tc_filehandler_directory.rb +134 -0
- data/test/unittests/tc_filehandler_filehandler.rb +294 -0
- data/test/unittests/tc_filehandler_gallery.rb +165 -0
- data/test/unittests/tc_filehandler_page.rb +183 -0
- data/test/unittests/tc_filehandler_template.rb +60 -0
- data/test/unittests/tc_htmlvalidators_default.rb +12 -0
- data/test/unittests/tc_htmlvalidators_xmllint.rb +19 -0
- data/test/unittests/tc_languages.rb +57 -0
- data/test/unittests/tc_listener.rb +72 -0
- data/test/unittests/tc_menustyles_default.rb +51 -0
- data/test/unittests/tc_menustyles_horizontal.rb +18 -0
- data/test/unittests/tc_menustyles_horizontal_dropdown.rb +18 -0
- data/test/unittests/tc_menustyles_section.rb +59 -0
- data/test/unittests/tc_menustyles_vertical.rb +79 -0
- data/test/unittests/tc_menustyles_vertical_dropdown.rb +18 -0
- data/test/unittests/tc_node.rb +202 -0
- data/test/unittests/tc_plugin.rb +214 -0
- data/test/unittests/tc_resourcemanager.rb +42 -0
- data/test/unittests/tc_smileyreplacer.rb +25 -0
- data/test/unittests/tc_syntax_highlighter.rb +30 -0
- data/test/unittests/tc_tags_block.rb +27 -0
- data/test/unittests/tc_tags_breadcrumbtrail.rb +22 -0
- data/test/unittests/tc_tags_date.rb +15 -0
- data/test/unittests/tc_tags_download.rb +32 -0
- data/test/unittests/tc_tags_executecommand.rb +37 -0
- data/test/unittests/tc_tags_includefile.rb +53 -0
- data/test/unittests/tc_tags_langbar.rb +42 -0
- data/test/unittests/tc_tags_menu.rb +50 -0
- data/test/unittests/tc_tags_meta.rb +19 -0
- data/test/unittests/tc_tags_relocatable.rb +66 -0
- data/test/unittests/tc_tags_sitemap.rb +33 -0
- data/test/unittests/tc_tags_tag_processor.rb +107 -0
- data/test/unittests/tc_tags_wikilink.rb +22 -0
- data/test/unittests/tc_treewalker.rb +44 -0
- data/test/unittests/tc_website.rb +188 -0
- metadata +829 -312
- data/bin/webgen-gallery-editor +0 -654
- data/bin/webgen-gui +0 -10
- data/data/webgen/website_templates/default/config.yaml +0 -2
- data/doc/plugin/clidesc.rb +0 -46
- data/doc/plugin/source.rb +0 -21
- data/doc/src/about.page +0 -22
- data/doc/src/documentation/cli.page +0 -12
- data/doc/src/documentation/plugins/contenthandlers/html.page +0 -11
- data/doc/src/documentation/plugins/contenthandlers/index.page +0 -7
- data/doc/src/documentation/plugins/contenthandlers/markdown.page +0 -11
- data/doc/src/documentation/plugins/contenthandlers/rdoc.page +0 -11
- data/doc/src/documentation/plugins/contenthandlers/textile.page +0 -11
- data/doc/src/documentation/plugins/coreplugins/configuration.page +0 -12
- data/doc/src/documentation/plugins/coreplugins/index.page +0 -7
- data/doc/src/documentation/plugins/coreplugins/logging.page +0 -13
- data/doc/src/documentation/plugins/coreplugins/resourcemanager.page +0 -34
- data/doc/src/documentation/plugins/filehandlers/backing.page +0 -46
- data/doc/src/documentation/plugins/filehandlers/copy.page +0 -12
- data/doc/src/documentation/plugins/filehandlers/directoryhandler.page +0 -35
- data/doc/src/documentation/plugins/filehandlers/gallery.page +0 -86
- data/doc/src/documentation/plugins/filehandlers/index.page +0 -34
- data/doc/src/documentation/plugins/filehandlers/page.page +0 -170
- data/doc/src/documentation/plugins/filehandlers/template.page +0 -21
- data/doc/src/documentation/plugins/gallerylayouters/index.page +0 -18
- data/doc/src/documentation/plugins/htmlvalidators/index.page +0 -6
- data/doc/src/documentation/plugins/htmlvalidators/xmllint.page +0 -14
- data/doc/src/documentation/plugins/menustyles/horizontal.page +0 -21
- data/doc/src/documentation/plugins/menustyles/index.page +0 -12
- data/doc/src/documentation/plugins/menustyles/partial.page +0 -27
- data/doc/src/documentation/plugins/menustyles/vertical.page +0 -32
- data/doc/src/documentation/plugins/menustyles/verticaldropdown.page +0 -23
- data/doc/src/documentation/plugins/miscplugins/index.page +0 -7
- data/doc/src/documentation/plugins/tags/breadcrumbtrail.page +0 -20
- data/doc/src/documentation/plugins/tags/date.page +0 -19
- data/doc/src/documentation/plugins/tags/download.page +0 -23
- data/doc/src/documentation/plugins/tags/executecommand.page +0 -18
- data/doc/src/documentation/plugins/tags/includefile.page +0 -15
- data/doc/src/documentation/plugins/tags/index.page +0 -44
- data/doc/src/documentation/plugins/tags/langbar.page +0 -27
- data/doc/src/documentation/plugins/tags/menu.de.page +0 -12
- data/doc/src/documentation/plugins/tags/menu.page +0 -19
- data/doc/src/documentation/plugins/tags/multilang.de.page +0 -4
- data/doc/src/documentation/plugins/tags/multilang.fr.page +0 -4
- data/doc/src/documentation/plugins/tags/multilang.page +0 -4
- data/doc/src/documentation/plugins/tags/relocatable.page +0 -16
- data/doc/src/documentation/plugins/tags/resource.page +0 -22
- data/doc/src/documentation/plugins/tags/sitemap.page +0 -17
- data/doc/src/documentation/plugins/tags/wikilink.page +0 -18
- data/doc/src/documentation/webgen_gallery_editor.page +0 -82
- data/doc/src/images/screenshots/wge-image.png +0 -0
- data/doc/src/images/screenshots/wge-layout-preview.png +0 -0
- data/doc/src/images/screenshots/wge-main-disabled.png +0 -0
- data/doc/src/images/screenshots/wge-main.png +0 -0
- data/doc/src/meta.info +0 -30
- data/doc/src/screenshots.gallery +0 -33
- data/install.rb +0 -19
- data/lib/webgen.rb +0 -277
- data/lib/webgen/plugins/contenthandlers/markdown.rb +0 -50
- data/lib/webgen/plugins/coreplugins/logging.rb +0 -101
- data/lib/webgen/plugins/filehandlers/backing.rb +0 -159
- data/lib/webgen/plugins/gallerylayouters/default.rb +0 -152
- data/lib/webgen/plugins/menustyles/partial.rb +0 -95
- data/lib/webgen/plugins/tags/tags.rb +0 -254
data/lib/webgen/composite.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: composite.rb
|
|
4
|
+
# $Id: composite.rb 402 2006-04-07 15:21:41Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -45,16 +45,16 @@ module Composite
|
|
|
45
45
|
|
|
46
46
|
# Returns the array of children
|
|
47
47
|
def children
|
|
48
|
-
@children = [] unless defined? @children
|
|
48
|
+
@children = [] unless defined?( @children )
|
|
49
49
|
@children
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
# Adds all objects in the array
|
|
54
54
|
def add_children( array )
|
|
55
|
-
if array.kind_of? Array
|
|
56
|
-
@children = [] unless defined? @children
|
|
57
|
-
@children.concat array
|
|
55
|
+
if array.kind_of?( Array )
|
|
56
|
+
@children = [] unless defined?( @children )
|
|
57
|
+
@children.concat( array.compact )
|
|
58
58
|
else
|
|
59
59
|
raise ArgumentError, "Parameter must be array"
|
|
60
60
|
end
|
|
@@ -69,8 +69,8 @@ module Composite
|
|
|
69
69
|
|
|
70
70
|
# Adds the child
|
|
71
71
|
def add_child( child )
|
|
72
|
-
@children = [] unless defined? @children
|
|
73
|
-
@children.push child unless @children.include? child
|
|
72
|
+
@children = [] unless defined?( @children )
|
|
73
|
+
@children.push( child ) unless child.nil? || @children.include?( child )
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
|
|
@@ -79,17 +79,17 @@ module Composite
|
|
|
79
79
|
# [+Numeric+] the child at the specified position is deleted
|
|
80
80
|
# [+else+] the specified child is deleted
|
|
81
81
|
def del_child( child )
|
|
82
|
-
if child.kind_of? Numeric
|
|
83
|
-
@children.delete_at child if defined? @children
|
|
82
|
+
if child.kind_of?( Numeric )
|
|
83
|
+
@children.delete_at( child ) if defined?( @children )
|
|
84
84
|
else
|
|
85
|
-
@children.delete child if defined? @children
|
|
85
|
+
@children.delete( child ) if defined?( @children )
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
# Iterates over all childrenldren
|
|
91
91
|
def each # :yields: child
|
|
92
|
-
children.each
|
|
92
|
+
@children.each {|child| yield child } if defined?( @children )
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
#
|
|
4
|
+
# $Id: config.rb 531 2006-11-17 17:56:14Z thomas $
|
|
5
|
+
#
|
|
6
|
+
# webgen: template based static website generator
|
|
7
|
+
# Copyright (C) 2004 Thomas Leitner
|
|
8
|
+
#
|
|
9
|
+
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
|
10
|
+
# General Public License as published by the Free Software Foundation; either version 2 of the
|
|
11
|
+
# License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
|
14
|
+
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+
# General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License along with this program; if not,
|
|
18
|
+
# write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
#
|
|
20
|
+
#++
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
require 'rbconfig'
|
|
24
|
+
|
|
25
|
+
module Webgen
|
|
26
|
+
|
|
27
|
+
VERSION = [0, 4, 0]
|
|
28
|
+
AUTHOR = 'Thomas Leitner <t_leitner@gmx.at>'
|
|
29
|
+
SUMMARY = "webgen is a templated based static Web site generator."
|
|
30
|
+
DESCRIPTION = "webgen is a Web site generator implemented in Ruby. " \
|
|
31
|
+
"It is used to generate static Web pages from templates and page " \
|
|
32
|
+
"description files."
|
|
33
|
+
|
|
34
|
+
# The directory below a website directory in which the source files are.
|
|
35
|
+
SRC_DIR = 'src'
|
|
36
|
+
|
|
37
|
+
# The directory below a website directory in which the plugin files are.
|
|
38
|
+
PLUGIN_DIR = 'plugin'
|
|
39
|
+
|
|
40
|
+
# Returns the data directory for webgen.
|
|
41
|
+
def self.data_dir
|
|
42
|
+
unless defined?( @@data_dir )
|
|
43
|
+
@@data_dir = File.join( Config::CONFIG["datadir"], "webgen" )
|
|
44
|
+
|
|
45
|
+
@@data_dir = File.join( File.dirname( __FILE__ ), '..', '..', 'data', 'webgen') if !File.exists?( @@data_dir )
|
|
46
|
+
|
|
47
|
+
raise "Could not find webgen data directory! This is a bug, report it please!" unless File.directory?( @@data_dir )
|
|
48
|
+
end
|
|
49
|
+
@@data_dir
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
#
|
|
4
|
+
# $Id: content.rb 576 2007-01-03 19:41:12Z thomas $
|
|
5
|
+
#
|
|
6
|
+
# webgen: template based static website generator
|
|
7
|
+
# Copyright (C) 2004 Thomas Leitner
|
|
8
|
+
#
|
|
9
|
+
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
|
10
|
+
# General Public License as published by the Free Software Foundation; either version 2 of the
|
|
11
|
+
# License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
|
14
|
+
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+
# General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License along with this program; if not,
|
|
18
|
+
# write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
#
|
|
20
|
+
#++
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
require 'yaml'
|
|
24
|
+
require 'erb'
|
|
25
|
+
|
|
26
|
+
# A single block within a page file. The content of the block gets automatically parsed for HTML
|
|
27
|
+
# headers with the id attribute set and converts them into sections for later use.
|
|
28
|
+
class HtmlBlock
|
|
29
|
+
|
|
30
|
+
# A section with a block. Corresponds to an HTML header with an id.
|
|
31
|
+
class Section
|
|
32
|
+
|
|
33
|
+
# The level of the header, ie. 1 for a h1 tag, 2, for a h2 tag, and so on.
|
|
34
|
+
attr_reader :level
|
|
35
|
+
|
|
36
|
+
# The id of the tag.
|
|
37
|
+
attr_reader :id
|
|
38
|
+
|
|
39
|
+
# The title of the tag, ie. the content between the opening and closing h[123456] tag.
|
|
40
|
+
attr_reader :title
|
|
41
|
+
|
|
42
|
+
# Sub sections of this section.
|
|
43
|
+
attr_accessor :subsections
|
|
44
|
+
|
|
45
|
+
# Creates a new Section object with the given +level+, +id+, and +title+.
|
|
46
|
+
def initialize( level, id, title )
|
|
47
|
+
@level, @id, @title = level, id, title
|
|
48
|
+
@subsections = []
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The name of the block.
|
|
54
|
+
attr_reader :name
|
|
55
|
+
|
|
56
|
+
# The content of the block.
|
|
57
|
+
attr_reader :content
|
|
58
|
+
|
|
59
|
+
# The parsed sections as array of Section objects.
|
|
60
|
+
attr_reader :sections
|
|
61
|
+
|
|
62
|
+
# Creates a new block with the name +name+ and the given +content+. The content gets parsed for
|
|
63
|
+
# sections automatically.
|
|
64
|
+
def initialize( name, content )
|
|
65
|
+
@name, @content = name, content
|
|
66
|
+
@sections = self.class.parse_sections( content )
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Renders the block using ERB and +context+ as binding.
|
|
70
|
+
def render_with_erb( context )
|
|
71
|
+
@compiled_block = ERB.new( @content ) unless defined?( @compiled_block )
|
|
72
|
+
@compiled_block.result( context )
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#######
|
|
76
|
+
private
|
|
77
|
+
#######
|
|
78
|
+
|
|
79
|
+
SECTION_REGEXP = /<h([123456])(?:>|\s([^>]*)>)(.*?)<\/h\1\s*>/i
|
|
80
|
+
ATTR_REGEXP = /\s*(\w+)\s*=\s*('|")([^\2]+)\2\s*/
|
|
81
|
+
|
|
82
|
+
def self.parse_sections( content )
|
|
83
|
+
sections = []
|
|
84
|
+
stack = []
|
|
85
|
+
content.scan( SECTION_REGEXP ).each do |level,attrs,title|
|
|
86
|
+
next if attrs.nil?
|
|
87
|
+
id_attr = attrs.scan( ATTR_REGEXP ).find {|name,sep,value| name == 'id'}
|
|
88
|
+
next if id_attr.nil?
|
|
89
|
+
id = id_attr[2]
|
|
90
|
+
|
|
91
|
+
section = Section.new( level.to_i, id, title )
|
|
92
|
+
success = false
|
|
93
|
+
while !success
|
|
94
|
+
if stack.empty?
|
|
95
|
+
sections << section
|
|
96
|
+
stack << section
|
|
97
|
+
success = true
|
|
98
|
+
elsif stack.last.level < section.level
|
|
99
|
+
stack.last.subsections << section
|
|
100
|
+
stack << section
|
|
101
|
+
success = true
|
|
102
|
+
else
|
|
103
|
+
stack.pop
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
sections
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Raised when during parsing of data in the WebPage Description Format if the data is invalid.
|
|
114
|
+
class WebPageDataInvalid < RuntimeError; end
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# A WebPageData object contains the parsed data of a file/string in the WebPage Description Format.
|
|
118
|
+
class WebPageData
|
|
119
|
+
|
|
120
|
+
# The content blocks. Access via index or name.
|
|
121
|
+
attr_reader :blocks
|
|
122
|
+
|
|
123
|
+
# The contents of the meta information block.
|
|
124
|
+
attr_reader :meta_info
|
|
125
|
+
|
|
126
|
+
# Parses the given String +data+ and initializes a new WebPageData object with the found values.
|
|
127
|
+
# The blocks are converted to HTML by using the provided +formatters+ hash. A key in this hash has
|
|
128
|
+
# to be a format name and the value and object which responds to the +call(content)+ method. You
|
|
129
|
+
# can set +default_meta_info+ to provide default entries for the meta information block.
|
|
130
|
+
def initialize( data, formatters = {'default' => proc {|c| c} }, default_meta_info = {} )
|
|
131
|
+
@meta_info = default_meta_info
|
|
132
|
+
@formatters = formatters
|
|
133
|
+
parse( data )
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
#######
|
|
137
|
+
private
|
|
138
|
+
#######
|
|
139
|
+
|
|
140
|
+
def parse( data )
|
|
141
|
+
@blocks = {}
|
|
142
|
+
blocks = data.scan( /(?:(?:^--- *(?:(\w+) *(?:, *(\w+) *)?)?$)|\A)(.*?)(?:(?=^---.*?$)|\Z)/m )
|
|
143
|
+
if data =~ /\A---\s*$/
|
|
144
|
+
begin
|
|
145
|
+
meta = YAML::load( blocks.shift[2] )
|
|
146
|
+
raise( WebPageDataInvalid, 'Invalid structure of meta information part') unless meta.kind_of?( Hash )
|
|
147
|
+
@meta_info.update( meta )
|
|
148
|
+
rescue ArgumentError => e
|
|
149
|
+
raise WebPageDataInvalid, e.message
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
raise( WebPageDataInvalid, 'No content blocks specified' ) if blocks.length == 0
|
|
154
|
+
|
|
155
|
+
blocks.each_with_index do |block_data, index|
|
|
156
|
+
name, format, content = *block_data
|
|
157
|
+
name = name || (@meta_info['blocks'] && @meta_info['blocks'][index] && @meta_info['blocks'][index][0]) || 'content'
|
|
158
|
+
raise( WebPageDataInvalid, "Same name used for more than one block: #{name}" ) if @blocks.has_key?( name )
|
|
159
|
+
content ||= ''
|
|
160
|
+
content.gsub!( /^(\\+)(---.*?)$/ ) {|m| "\\" * ($1.length / 2) + $2 }
|
|
161
|
+
content.strip!
|
|
162
|
+
format = format || (@meta_info['blocks'] && @meta_info['blocks'][index] && @meta_info['blocks'][index][1]) || 'default'
|
|
163
|
+
@blocks[name] = @blocks[index] = HtmlBlock.new( name, convert( content, format ) )
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def convert( content, format )
|
|
168
|
+
raise( WebPageDataInvalid, "Invalid content format specified: #{format}" ) unless @formatters.has_key?( format )
|
|
169
|
+
@formatters[format].call( content )
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "tempfile"
|
|
2
|
+
|
|
3
|
+
# Allows one to get stdout and stderr from an executed command. Original version
|
|
4
|
+
# by Karl von Laudermann in ruby-talk #113035
|
|
5
|
+
class ExtendedCommand
|
|
6
|
+
|
|
7
|
+
attr_reader :ret_code, :out_text, :err_text
|
|
8
|
+
|
|
9
|
+
def initialize( command )
|
|
10
|
+
tempfile = Tempfile.new( 'webgen' )
|
|
11
|
+
tempfile.close # So that child process can write to it
|
|
12
|
+
|
|
13
|
+
# Execute command, redirecting stderr to temp file
|
|
14
|
+
@out_text = `#{command} 2> #{tempfile.path}`
|
|
15
|
+
@ret_code = $? >> 8
|
|
16
|
+
|
|
17
|
+
# Read temp file
|
|
18
|
+
tempfile.open
|
|
19
|
+
@err_text = tempfile.readlines.join
|
|
20
|
+
tempfile.close
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
#
|
|
4
|
+
# $Id: languages.rb 484 2006-09-02 07:55:59Z thomas $
|
|
5
|
+
#
|
|
6
|
+
# webgen: template based static website generator
|
|
7
|
+
# Copyright (C) 2004 Thomas Leitner
|
|
8
|
+
#
|
|
9
|
+
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
|
10
|
+
# General Public License as published by the Free Software Foundation; either version 2 of the
|
|
11
|
+
# License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
|
14
|
+
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+
# General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU General Public License along with this program; if not,
|
|
18
|
+
# write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19
|
+
#
|
|
20
|
+
#++
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
require 'webgen/config'
|
|
24
|
+
|
|
25
|
+
module Webgen
|
|
26
|
+
|
|
27
|
+
# Describes a human language which is uniquely identfied by a three letter code and, optionally,
|
|
28
|
+
# by an alternative three letter or a two letter code.
|
|
29
|
+
class Language
|
|
30
|
+
|
|
31
|
+
include Comparable
|
|
32
|
+
|
|
33
|
+
attr_reader :codes
|
|
34
|
+
attr_reader :description
|
|
35
|
+
|
|
36
|
+
# Creates a new language. +codes+ has to be an array containing three strings: the three letter
|
|
37
|
+
# code, the alternative three letter code and the two letter code. If one is not available for
|
|
38
|
+
# the language, it has to be +nil+.
|
|
39
|
+
def initialize( codes, description )
|
|
40
|
+
@codes = codes
|
|
41
|
+
@description = description
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# The two letter code.
|
|
45
|
+
def code2chars
|
|
46
|
+
@codes[2]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# The three letter code.
|
|
50
|
+
def code3chars
|
|
51
|
+
@codes[0]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# The alternative three letter code.
|
|
55
|
+
def code3chars_alternative
|
|
56
|
+
@codes[1]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The textual representation of the language.
|
|
60
|
+
def to_s
|
|
61
|
+
code2chars || code3chars
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
alias_method :to_str, :to_s
|
|
65
|
+
|
|
66
|
+
def inspect
|
|
67
|
+
"#<Language codes=#{codes.inspect} description=#{description.inspect}"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def <=>( other )
|
|
71
|
+
self.to_s <=> other.to_s
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# Used for managinging human languages.
|
|
78
|
+
module LanguageManager
|
|
79
|
+
|
|
80
|
+
# Returns a +Language+ object for the given language code.
|
|
81
|
+
def self.language_for_code( code )
|
|
82
|
+
languages[code]
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns an array of +Language+ objects whose description match the given +text+.
|
|
86
|
+
def self.find_language( text )
|
|
87
|
+
languages.values.find_all {|lang| /.*#{Regexp.escape(text)}.*/i =~ lang.description}.uniq.sort
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Returns all available languages as a Hash. The keys are the language codes and the values are
|
|
91
|
+
# the +Language+ objects for them.
|
|
92
|
+
def self.languages
|
|
93
|
+
unless defined?( @@languages )
|
|
94
|
+
@@languages = {}
|
|
95
|
+
code_file = File.join( Webgen.data_dir, 'data', 'ISO-639-2_values_8bits.txt' )
|
|
96
|
+
File.readlines( code_file ).each do |l|
|
|
97
|
+
data = l.chomp.split( '|' ).collect {|f| f.empty? ? nil : f }
|
|
98
|
+
lang = Language.new( data[0..2], data[3] )
|
|
99
|
+
@@languages[lang.code2chars] ||= lang unless lang.code2chars.nil?
|
|
100
|
+
@@languages[lang.code3chars] ||= lang unless lang.code3chars.nil?
|
|
101
|
+
@@languages[lang.code3chars_alternative] ||= lang unless lang.code3chars_alternative.nil?
|
|
102
|
+
end
|
|
103
|
+
@@languages.freeze
|
|
104
|
+
end
|
|
105
|
+
@@languages
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
end
|
data/lib/webgen/listener.rb
CHANGED
data/lib/webgen/node.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: node.rb
|
|
4
|
+
# $Id: node.rb 576 2007-01-03 19:41:12Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -21,179 +21,251 @@
|
|
|
21
21
|
#
|
|
22
22
|
|
|
23
23
|
require 'uri'
|
|
24
|
+
require 'pathname'
|
|
24
25
|
require 'webgen/composite'
|
|
25
26
|
|
|
27
|
+
# The Node class is used for building the internal data structure which represents the output tree.
|
|
26
28
|
class Node
|
|
27
29
|
|
|
28
30
|
include Composite
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
# The parent node.
|
|
33
|
+
attr_reader :parent
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
# The path of this node.
|
|
36
|
+
attr_reader :path
|
|
37
|
+
|
|
38
|
+
# Information used for processing the node.
|
|
39
|
+
attr_accessor :node_info
|
|
40
|
+
|
|
41
|
+
# Meta information associated with the node.
|
|
42
|
+
attr_accessor :meta_info
|
|
43
|
+
|
|
44
|
+
# Initializes a new Node instance.
|
|
45
|
+
#
|
|
46
|
+
# +parent+::
|
|
47
|
+
# if this parameter is +nil+, then the new node acts as root. Otherwise, +parent+ has to
|
|
48
|
+
# be a valid node instance.
|
|
49
|
+
# +path+::
|
|
50
|
+
# The path for this node. If this node is a directory, the path must have a trailing
|
|
51
|
+
# slash ('dir/'). If it is a fragment, the hash sign must be the first character of the
|
|
52
|
+
# path ('#fragment'). A compound path like 'dir/file#fragment' is also allowed as are
|
|
53
|
+
# absolute paths like 'http://myhost.com/'.
|
|
54
|
+
#
|
|
55
|
+
# Note: a compound path like 'dir/file' is invalid if the parent node already has a child
|
|
56
|
+
# with path 'dir/'!!! (solution: just create a node with path 'file' and node 'dir/' as parent!)
|
|
57
|
+
def initialize( parent, path )
|
|
58
|
+
@parent = nil
|
|
59
|
+
@path = path
|
|
60
|
+
self.parent = parent
|
|
61
|
+
@node_info = Hash.new
|
|
62
|
+
@meta_info = Hash.new
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Returns the root node for +node+.
|
|
66
|
+
def self.root( node )
|
|
67
|
+
node = node.parent until node.parent.nil?
|
|
68
|
+
node
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Sets a new parent for the node.
|
|
72
|
+
def parent=( var )
|
|
73
|
+
@parent.del_child( self ) unless @parent.nil?
|
|
74
|
+
@parent = var
|
|
75
|
+
@parent.add_child( self ) unless @parent.nil?
|
|
76
|
+
precalc_with_children!
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Sets the path for the node.
|
|
80
|
+
def path=( path )
|
|
81
|
+
@path = path
|
|
82
|
+
precalc!
|
|
36
83
|
end
|
|
37
84
|
|
|
38
|
-
#
|
|
85
|
+
# Gets object +name+ from +meta_info+.
|
|
39
86
|
def []( name )
|
|
40
|
-
@
|
|
87
|
+
@meta_info[name]
|
|
41
88
|
end
|
|
42
89
|
|
|
43
|
-
#
|
|
90
|
+
# Assigns +value+ to +meta_info+ called +name.
|
|
44
91
|
def []=( name, value )
|
|
45
|
-
@
|
|
92
|
+
@meta_info[name] = value
|
|
46
93
|
end
|
|
47
94
|
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
def recursive_value( name, ignoreVirtual = true )
|
|
51
|
-
value = ignoreVirtual && @metainfo['virtual'] ? '' : @metainfo[name]
|
|
52
|
-
if value.nil?
|
|
53
|
-
value = ''
|
|
54
|
-
self.logger.warn { "No meta information called '#{name}' for <#{metainfo['src']}>" }
|
|
55
|
-
end
|
|
56
|
-
@parent.nil? ? value : @parent.recursive_value( name, ignoreVirtual ) + value
|
|
57
|
-
end
|
|
95
|
+
# Regexp for matching absolute URLs, ie. URLs with a scheme part (also see RFC1738)
|
|
96
|
+
ABSOLUTE_URL = /^\w[a-zA-Z0-9+.-]*:/
|
|
58
97
|
|
|
98
|
+
# Returns the full path for this node. See also Node#absolute_path !
|
|
99
|
+
def full_path
|
|
100
|
+
return @precalc[:full_path] if @precalc
|
|
59
101
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if dest[0] == ?/
|
|
63
|
-
from = recursive_value( 'dest' ).sub( /#{self['dest']}$/, '' ).split( '/' )[1..-1] || []
|
|
64
|
-
from.fill( '..' )
|
|
65
|
-
from.concat( dest.split( '/' )[1..-1] ).join( '/' )
|
|
102
|
+
if @path =~ ABSOLUTE_URL
|
|
103
|
+
@path
|
|
66
104
|
else
|
|
67
|
-
|
|
68
|
-
from.concat( dest.split( '/' ) ).join( '/' )
|
|
105
|
+
(@parent.nil? ? @path : @parent.full_path + @path)
|
|
69
106
|
end
|
|
70
107
|
end
|
|
71
108
|
|
|
72
|
-
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
109
|
+
# Returns the absolute path, ie. starting with a slash for the root directory, for this node.
|
|
110
|
+
#
|
|
111
|
+
# Here is an example that shows the difference between +full_path+ and +absolute_path+:
|
|
112
|
+
#
|
|
113
|
+
# root = Node.new( nil, '../output/' )
|
|
114
|
+
# dir = Node.new( root, 'testdir/' )
|
|
115
|
+
# node = Node.new( dir, 'testfile' )
|
|
116
|
+
# node.full_path # => '../output/testdir/testfile'
|
|
117
|
+
# node.absolute_path # => '/testdir/testfile'
|
|
118
|
+
def absolute_path
|
|
119
|
+
return @precalc[:absolute_path] if @precalc
|
|
120
|
+
|
|
121
|
+
if @path =~ ABSOLUTE_URL
|
|
122
|
+
@path
|
|
79
123
|
else
|
|
80
|
-
|
|
81
|
-
to = destNode.recursive_value( 'dest' ).sub( /#{destNode['dest']}$/, '' ).split( '/' )[1..-1] || []
|
|
82
|
-
|
|
83
|
-
while from.size > 0 and to.size > 0 and from[0] == to[0]
|
|
84
|
-
from.shift
|
|
85
|
-
to.shift
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
from.fill( '..' )
|
|
89
|
-
from.concat( to )
|
|
90
|
-
path = ( from.length == 0 ? '.' : from.join( '/' ) )
|
|
91
|
-
path += '/' + destNode['dest'] if includeDestNode && !destNode.parent.nil?
|
|
124
|
+
full_path.sub( /^#{Node.root( self ).path}/, '/' )
|
|
92
125
|
end
|
|
93
|
-
path
|
|
94
126
|
end
|
|
95
127
|
|
|
128
|
+
# Returns the level of the node. The level specifies how deep the node is in the hierarchy.
|
|
129
|
+
def level
|
|
130
|
+
(@parent.nil? ? 0 : @parent.level + 1)
|
|
131
|
+
end
|
|
96
132
|
|
|
97
|
-
#
|
|
98
|
-
def
|
|
99
|
-
|
|
100
|
-
if node.nil?
|
|
101
|
-
self.logger.warn { "Could not get destination node '#{destString}' for <#{recursive_value( 'src' )}>" }
|
|
102
|
-
end
|
|
103
|
-
node
|
|
133
|
+
# Checks if the node is a directory.
|
|
134
|
+
def is_directory?
|
|
135
|
+
@path[-1] == ?/
|
|
104
136
|
end
|
|
105
137
|
|
|
106
|
-
#
|
|
107
|
-
def
|
|
108
|
-
|
|
138
|
+
# Checks if the node is a file.
|
|
139
|
+
def is_file?
|
|
140
|
+
!is_directory? && !is_fragment?
|
|
109
141
|
end
|
|
110
142
|
|
|
111
|
-
#
|
|
112
|
-
def
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
143
|
+
# Checks if the node is a fragment.
|
|
144
|
+
def is_fragment?
|
|
145
|
+
@path[0] == ?#
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Matches the path of the node against the given path at the beginning. Returns the
|
|
149
|
+
# matched portion or +nil+. Used by #resolve_node.
|
|
150
|
+
def =~( path )
|
|
151
|
+
md = if is_directory?
|
|
152
|
+
/^#{@path.chomp('/')}(\/|$)/ =~ path #' #emacs hack
|
|
153
|
+
elsif is_fragment?
|
|
154
|
+
/^#{@path}$/ =~ path
|
|
155
|
+
else
|
|
156
|
+
/^#{@path}(?=#|$)/ =~ path
|
|
157
|
+
end
|
|
158
|
+
if md then $& end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Returns the value of the meta info +orderInfo+ or +0+ if it is not set.
|
|
162
|
+
def order_info
|
|
163
|
+
self['orderInfo'].to_s.to_i # nil.to_s.to_i => 0
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Sorts nodes by using the meta info +orderInfo+ of both involved nodes or, if these values are
|
|
167
|
+
# equal, by the meta info +title+.
|
|
168
|
+
def <=>( other )
|
|
169
|
+
self_oi = self.order_info
|
|
170
|
+
other_oi = other.order_info
|
|
171
|
+
(self_oi == other_oi ? (self['title'] || '') <=> (other['title'] || '') : self_oi <=> other_oi)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the route to the given path. The parameter +path+ can be a String or a Node.
|
|
175
|
+
def route_to( other )
|
|
176
|
+
my_url = self.to_url
|
|
177
|
+
other_url = case other
|
|
178
|
+
when String then my_url + other
|
|
179
|
+
when Node then other.to_url
|
|
180
|
+
else raise ArgumentError
|
|
181
|
+
end
|
|
182
|
+
# resolve any '.' and '..' paths in the target url
|
|
183
|
+
if other_url.path =~ /\/\.\.?\// && other_url.scheme == 'webgen'
|
|
184
|
+
other_url.path = Pathname.new( other_url.path ).cleanpath.to_s
|
|
118
185
|
end
|
|
186
|
+
route = my_url.route_to( other_url ).to_s
|
|
187
|
+
(route == '' ? ( self.is_fragment? ? self.parent.path : self.path ) : route )
|
|
119
188
|
end
|
|
120
189
|
|
|
121
|
-
# Checks if the current node is in the subtree
|
|
122
|
-
#
|
|
123
|
-
def
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
190
|
+
# Checks if the current node is in the subtree which is spanned by the supplied node. The check is
|
|
191
|
+
# performed using only the +parent+ information of the involved nodes, NOT the actual path values!
|
|
192
|
+
def in_subtree_of?( node )
|
|
193
|
+
temp = self
|
|
194
|
+
temp = temp.parent while !temp.nil? && temp != node
|
|
195
|
+
!temp.nil?
|
|
127
196
|
end
|
|
128
197
|
|
|
129
|
-
# Returns the
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
198
|
+
# Returns the node representing the given +path+. The path can be absolute (i.e. starting with a
|
|
199
|
+
# slash) or relative to the current node. If no node exists for the given path or it would lie
|
|
200
|
+
# outside the node tree, +nil+ is returned.
|
|
201
|
+
def resolve_node( path )
|
|
202
|
+
url = self.to_url + path
|
|
203
|
+
|
|
204
|
+
path = url.path[1..-1].to_s + (url.fragment.nil? ? '' : '#' + url.fragment)
|
|
205
|
+
return nil if path =~ /^\.\./ || url.scheme != 'webgen' # path outside dest dir or not an internal URL (webgen://...)
|
|
206
|
+
|
|
207
|
+
node = Node.root( self )
|
|
208
|
+
|
|
209
|
+
match = nil
|
|
210
|
+
while !node.nil? && !path.empty?
|
|
211
|
+
node = node.find {|c| match = (c =~ path) }
|
|
212
|
+
path.sub!( match, '' ) unless node.nil?
|
|
213
|
+
break if path.empty?
|
|
214
|
+
end
|
|
215
|
+
|
|
133
216
|
node
|
|
134
217
|
end
|
|
135
218
|
|
|
136
|
-
# Returns the
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
219
|
+
# Returns the full URL (including dummy scheme and host) for use with URI classes. The returned
|
|
220
|
+
# URL does not include the real path of the root node but a slash instead. So if the full path of
|
|
221
|
+
# the node is 'a/b/c/d/file1' and the root node path is 'a/b/c', the URL path would be '/d/file1'.
|
|
222
|
+
def to_url
|
|
223
|
+
return @precalc[:to_url] if @precalc
|
|
224
|
+
|
|
225
|
+
url = URI::parse( absolute_path )
|
|
226
|
+
url = URI::parse( 'webgen://webgen.localhost/' ) + url unless url.absolute?
|
|
227
|
+
url
|
|
140
228
|
end
|
|
141
229
|
|
|
142
230
|
# Returns an informative representation of the node.
|
|
143
|
-
def
|
|
144
|
-
"<##{self.class.name}:
|
|
231
|
+
def inspect
|
|
232
|
+
"<##{self.class.name}: path=#{full_path}>"
|
|
145
233
|
end
|
|
146
234
|
|
|
235
|
+
alias_method :to_s, :full_path
|
|
236
|
+
|
|
147
237
|
#######
|
|
148
238
|
private
|
|
149
239
|
#######
|
|
150
240
|
|
|
151
|
-
def
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
end
|
|
241
|
+
def precalc!
|
|
242
|
+
@precalc = nil
|
|
243
|
+
@precalc = {
|
|
244
|
+
:full_path => full_path,
|
|
245
|
+
:absolute_path => absolute_path,
|
|
246
|
+
:to_url => to_url
|
|
247
|
+
}
|
|
248
|
+
end
|
|
160
249
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
break if node.nil?
|
|
167
|
-
case element
|
|
168
|
-
when '..' then node = node.parent
|
|
169
|
-
else
|
|
170
|
-
node = node.find do |child|
|
|
171
|
-
/^#{element}\/?$/ =~ child[metainfo] || \
|
|
172
|
-
(metainfo == 'dest' && (child['int:pagename'] == element || child['int:local-pagename'] == element) && \
|
|
173
|
-
child['lang'] == pagelang)
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
end
|
|
250
|
+
def precalc_with_children!
|
|
251
|
+
precalc!
|
|
252
|
+
each {|child| child.precalc_with_children!}
|
|
253
|
+
end
|
|
254
|
+
protected :precalc_with_children!
|
|
177
255
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
case element
|
|
186
|
-
when '..' then node = node.parent
|
|
187
|
-
else node = node.find {|child| /^#{element}\/?$/ =~ child[metainfo] }
|
|
188
|
-
end
|
|
189
|
-
else
|
|
190
|
-
node = temp
|
|
191
|
-
break
|
|
192
|
-
end
|
|
193
|
-
end
|
|
256
|
+
# Delegates missing methods to a processor. The current node is placed into the argument array as
|
|
257
|
+
# the first argument before the method +name+ is invoked on the processor.
|
|
258
|
+
def method_missing( name, *args, &block )
|
|
259
|
+
if @node_info[:processor]
|
|
260
|
+
@node_info[:processor].send( name, *([self] + args), &block )
|
|
261
|
+
else
|
|
262
|
+
super
|
|
194
263
|
end
|
|
195
|
-
|
|
196
|
-
node
|
|
197
264
|
end
|
|
198
265
|
|
|
266
|
+
=begin
|
|
267
|
+
TODO:
|
|
268
|
+
- stable sort which does not switch items that have the same order_info
|
|
269
|
+
=end
|
|
270
|
+
|
|
199
271
|
end
|