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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: copy.rb
|
|
4
|
+
# $Id: copy.rb 538 2006-12-18 08:52:02Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -21,37 +21,59 @@
|
|
|
21
21
|
#
|
|
22
22
|
|
|
23
23
|
require 'fileutils'
|
|
24
|
-
require '
|
|
24
|
+
require 'erb'
|
|
25
|
+
load_plugin 'webgen/plugins/filehandlers/filehandler'
|
|
25
26
|
|
|
26
27
|
module FileHandlers
|
|
27
28
|
|
|
28
|
-
# A simple file handler which copies files
|
|
29
|
-
# directory.
|
|
30
|
-
class
|
|
29
|
+
# A simple file handler which copies files specified by a pattern from the source to the output
|
|
30
|
+
# directory.
|
|
31
|
+
class CopyHandler < DefaultHandler
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
infos( :name => 'File/CopyHandler',
|
|
34
|
+
:author => Webgen::AUTHOR,
|
|
35
|
+
:summary => "Copies files from source to destination"
|
|
36
|
+
)
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
param 'paths', ['**/*.css', '**/*.js', '**/*.jpg', '**/*.png', '**/*.gif'], 'The path patterns ' +
|
|
39
|
+
'which match the files that should get copied by this handler.'
|
|
40
|
+
|
|
41
|
+
param 'erbPaths', ['**/*.rhtml', '**/*.rcss'], 'The path patterns which match the files ' +
|
|
42
|
+
'that should get preprocessed by ERB. The leading letter r is removed from the extension.'
|
|
43
|
+
|
|
44
|
+
def initialize( plugin_manager )
|
|
38
45
|
super
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
end
|
|
46
|
+
param( 'paths' ).each {|path| register_path_pattern( path ) }
|
|
47
|
+
param( 'erbPaths' ).each {|path| register_path_pattern( path ) }
|
|
42
48
|
end
|
|
43
49
|
|
|
44
|
-
def create_node(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
def create_node( path, parent, meta_info )
|
|
51
|
+
processWithErb = param( 'erbPaths' ).any? {|pattern| File.fnmatch( pattern, path, File::FNM_DOTMATCH )}
|
|
52
|
+
name = File.basename( path )
|
|
53
|
+
name = name.sub( /\.r([^.]+)$/, '.\1' ) if processWithErb
|
|
54
|
+
|
|
55
|
+
node = parent.find {|c| c =~ name }
|
|
56
|
+
if node.nil?
|
|
57
|
+
node = Node.new( parent, name )
|
|
58
|
+
node['title'] = name
|
|
59
|
+
node.meta_info.update( meta_info )
|
|
60
|
+
node.node_info[:src] = path
|
|
61
|
+
node.node_info[:processor] = self
|
|
62
|
+
node.node_info[:preprocess] = processWithErb
|
|
63
|
+
else
|
|
64
|
+
log(:warn) { "Can't create node <#{node.full_path}> as it already exists (node handled by #{node.node_info[:processor].class.plugin_name})!" }
|
|
65
|
+
end
|
|
48
66
|
node
|
|
49
67
|
end
|
|
50
68
|
|
|
51
69
|
# Copy the file to the destination directory if it has been modified.
|
|
52
70
|
def write_node( node )
|
|
53
|
-
if
|
|
54
|
-
|
|
71
|
+
if @plugin_manager['Core/FileHandler'].file_modified?( node.node_info[:src], node.full_path )
|
|
72
|
+
if node.node_info[:preprocess]
|
|
73
|
+
File.open( node.full_path, 'w+' ) {|f| f.write( ERB.new( File.read( node.node_info[:src] ) ).result( binding ) ) }
|
|
74
|
+
else
|
|
75
|
+
FileUtils.cp( node.node_info[:src], node.full_path )
|
|
76
|
+
end
|
|
55
77
|
end
|
|
56
78
|
end
|
|
57
79
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: directory.rb
|
|
4
|
+
# $Id: directory.rb 548 2006-12-23 14:45:53Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -20,40 +20,45 @@
|
|
|
20
20
|
#++
|
|
21
21
|
#
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
load_plugin 'webgen/plugins/filehandlers/filehandler.rb'
|
|
24
|
+
require 'webgen/node'
|
|
24
25
|
|
|
25
26
|
module FileHandlers
|
|
26
27
|
|
|
27
28
|
# Handles directories.
|
|
28
|
-
class DirectoryHandler <
|
|
29
|
+
class DirectoryHandler < DefaultHandler
|
|
29
30
|
|
|
30
|
-
# Specialized node
|
|
31
|
+
# Specialized node for a directory.
|
|
31
32
|
class DirNode < Node
|
|
32
33
|
|
|
33
|
-
def initialize( parent,
|
|
34
|
-
super( parent )
|
|
35
|
-
self
|
|
36
|
-
self['
|
|
37
|
-
self['processor'] = Webgen::Plugin['DirectoryHandler']
|
|
38
|
-
self['int:directory?'] = true
|
|
34
|
+
def initialize( parent, path, meta_info = {} )
|
|
35
|
+
super( parent, path )
|
|
36
|
+
self.meta_info = meta_info
|
|
37
|
+
self['title'] = File.basename( path ).capitalize
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
def []( name )
|
|
42
|
-
process_dir_index if
|
|
41
|
+
process_dir_index if name == 'indexFile' &&
|
|
42
|
+
(!self.meta_info.has_key?( 'indexFile' ) ||
|
|
43
|
+
(!self.meta_info['indexFile'].nil? && !self.meta_info['indexFile'].kind_of?( Node ) ) )
|
|
43
44
|
super
|
|
44
45
|
end
|
|
45
46
|
|
|
47
|
+
#######
|
|
48
|
+
private
|
|
49
|
+
#######
|
|
50
|
+
|
|
46
51
|
def process_dir_index
|
|
47
|
-
indexFile =
|
|
52
|
+
indexFile = self.meta_info['indexFile']
|
|
48
53
|
if indexFile.nil?
|
|
49
54
|
self['indexFile'] = nil
|
|
50
55
|
else
|
|
51
|
-
node =
|
|
56
|
+
node = resolve_node( indexFile )
|
|
52
57
|
if node
|
|
53
|
-
|
|
58
|
+
node_info[:processor].log(:info) { "Directory index file for <#{self.full_path}> => <#{node.full_path}>" }
|
|
54
59
|
self['indexFile'] = node
|
|
55
60
|
else
|
|
56
|
-
|
|
61
|
+
node_info[:processor].log(:warn) { "No directory index file found for directory <#{self.full_path}>" }
|
|
57
62
|
self['indexFile'] = nil
|
|
58
63
|
end
|
|
59
64
|
end
|
|
@@ -62,61 +67,58 @@ module FileHandlers
|
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
infos( :name => 'File/DirectoryHandler',
|
|
71
|
+
:author => Webgen::AUTHOR,
|
|
72
|
+
:summary => "Handles directories"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
default_meta_info( { 'indexFile' => 'index.page' } )
|
|
76
|
+
|
|
77
|
+
register_path_pattern '**/', 0
|
|
78
|
+
|
|
70
79
|
|
|
71
|
-
#
|
|
72
|
-
def create_node( path, parent )
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
# Returns a new DirNode.
|
|
81
|
+
def create_node( path, parent, meta_info )
|
|
82
|
+
filename = File.basename( path ) + '/'
|
|
83
|
+
if parent.nil? || (node = parent.find {|child| child =~ filename }).nil?
|
|
84
|
+
node = DirNode.new( parent, filename, meta_info )
|
|
85
|
+
node.node_info[:processor] = self
|
|
86
|
+
node.node_info[:src] = path
|
|
75
87
|
end
|
|
76
88
|
node
|
|
77
89
|
end
|
|
78
90
|
|
|
79
|
-
#
|
|
91
|
+
# Creates the directory (and all its parent directories if necessary).
|
|
80
92
|
def write_node( node )
|
|
81
|
-
|
|
82
|
-
FileUtils.makedirs( name ) unless File.exists?( name )
|
|
93
|
+
FileUtils.makedirs( node.full_path ) unless File.exists?( node.full_path )
|
|
83
94
|
end
|
|
84
95
|
|
|
85
96
|
# Return the page node for the directory +node+ using the specified language +lang+. If an
|
|
86
97
|
# index file is specified, then the its correct language node is returned, else +node+ is
|
|
87
98
|
# returned.
|
|
88
|
-
def
|
|
89
|
-
if node['indexFile']
|
|
90
|
-
|
|
91
|
-
else
|
|
92
|
-
node
|
|
93
|
-
end
|
|
99
|
+
def node_for_lang( node, lang )
|
|
100
|
+
langnode = node['indexFile'].node_for_lang( lang ) if node['indexFile']
|
|
101
|
+
langnode || node
|
|
94
102
|
end
|
|
95
103
|
|
|
96
|
-
#
|
|
97
|
-
def
|
|
98
|
-
lang_node =
|
|
99
|
-
|
|
100
|
-
super( lang_node,
|
|
104
|
+
# See DefaultFileHandler#link_from and PageHandler#link_from.
|
|
105
|
+
def link_from( node, ref_node, attr = {} )
|
|
106
|
+
lang_node = (attr[:resolve_lang_node] == false ? node : node.node_for_lang( ref_node['lang'] ) )
|
|
107
|
+
attr[:link_text] ||= lang_node['directoryName'] || node['title']
|
|
108
|
+
super( lang_node, ref_node, attr )
|
|
101
109
|
end
|
|
102
110
|
|
|
103
|
-
# Recursively
|
|
111
|
+
# Recursively creates a given directory path starting from the path of +parent+ and returns the
|
|
112
|
+
# bottom most directory node.
|
|
104
113
|
def recursive_create_path( path, parent )
|
|
105
|
-
p = parent
|
|
106
|
-
node = nil
|
|
107
114
|
path.split( File::SEPARATOR ).each do |pathname|
|
|
108
115
|
case pathname
|
|
109
|
-
when '.' then
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
p = p.parent
|
|
113
|
-
else
|
|
114
|
-
node = create_node( pathname, p )
|
|
115
|
-
p.add_child( node ) unless p.nil? || node.nil?
|
|
116
|
-
p = node
|
|
116
|
+
when '.' then #do nothing
|
|
117
|
+
when '..' then parent = parent.parent
|
|
118
|
+
else parent = @plugin_manager['Core/FileHandler'].create_node( pathname, parent, self )
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
|
-
|
|
121
|
+
parent
|
|
120
122
|
end
|
|
121
123
|
|
|
122
124
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: filehandler.rb
|
|
4
|
+
# $Id: filehandler.rb 577 2007-01-04 20:09:28Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -21,182 +21,366 @@
|
|
|
21
21
|
#
|
|
22
22
|
|
|
23
23
|
require 'set'
|
|
24
|
+
require 'yaml'
|
|
25
|
+
require 'webgen/node'
|
|
24
26
|
require 'webgen/listener'
|
|
27
|
+
require 'webgen/languages'
|
|
25
28
|
|
|
26
29
|
module FileHandlers
|
|
27
30
|
|
|
31
|
+
# The main plugin for handling files.
|
|
32
|
+
#
|
|
33
|
+
# The following message listening hooks (defined via symbols) are available for this plugin
|
|
34
|
+
# (see Listener):
|
|
35
|
+
#
|
|
36
|
+
# +before_node_created+:: called before a node is created
|
|
37
|
+
# +after_node_created+:: called after a node has been created
|
|
38
|
+
# +after_all_nodes_created+:: called after the plugin has finfished reading in all files and the
|
|
39
|
+
# output backing section of the meta information file has been processed
|
|
40
|
+
# +before_node_written+:: called before a node is written out
|
|
41
|
+
# +after_node_written+:: called after a node has been written out
|
|
42
|
+
# +before_all_nodes_written+:: called before the plugin starts writing out the files
|
|
43
|
+
# +after_all_nodes_written+:: called after the plugin has finfished writing out the files
|
|
28
44
|
class FileHandler < Webgen::Plugin
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
infos( :name => 'Core/FileHandler',
|
|
47
|
+
:author => Webgen::AUTHOR,
|
|
48
|
+
:summary => "Main plugin for handling the files in the source directory"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
param 'ignorePaths', ['**/CVS{/**/**,/}'], 'An array of path patterns which match files ' +
|
|
52
|
+
'that should be excluded from the list of \'to be processed\' files.'
|
|
53
|
+
|
|
54
|
+
param 'defaultMetaInfo', {}, 'The keys for this hash are the names of file handlers, the ' +
|
|
55
|
+
'values hashes with meta data.'
|
|
56
|
+
|
|
57
|
+
depends_on 'Core/Configuration'
|
|
38
58
|
|
|
39
59
|
include Listener
|
|
40
60
|
|
|
41
|
-
def initialize
|
|
42
|
-
|
|
43
|
-
add_msg_name( :
|
|
61
|
+
def initialize( manager )
|
|
62
|
+
super
|
|
63
|
+
add_msg_name( :before_node_created )
|
|
64
|
+
add_msg_name( :after_node_created )
|
|
65
|
+
add_msg_name( :after_all_nodes_created )
|
|
66
|
+
add_msg_name( :before_node_written )
|
|
67
|
+
add_msg_name( :after_node_written )
|
|
68
|
+
add_msg_name( :before_all_nodes_written )
|
|
69
|
+
add_msg_name( :after_all_nodes_written )
|
|
70
|
+
load_meta_info_backing_file
|
|
44
71
|
end
|
|
45
72
|
|
|
46
|
-
#
|
|
47
|
-
def
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
73
|
+
# Renders the whole website.
|
|
74
|
+
def render_site
|
|
75
|
+
tree = build_tree
|
|
76
|
+
#TODO
|
|
77
|
+
#transform tree???
|
|
78
|
+
write_tree( tree ) unless tree.nil?
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Renders only the given +files+.
|
|
82
|
+
def render_files( files )
|
|
83
|
+
tree = build_tree
|
|
84
|
+
return unless tree.nil?
|
|
85
|
+
files.each do |file|
|
|
86
|
+
node = tree.resolve_node( file )
|
|
87
|
+
if !node.nil?
|
|
88
|
+
write_node( node.parent ) if !node.parent.nil? && node.parent.is_directory?
|
|
89
|
+
write_node( node )
|
|
90
|
+
end
|
|
51
91
|
end
|
|
92
|
+
end
|
|
52
93
|
|
|
53
|
-
|
|
54
|
-
|
|
94
|
+
# Returns true if the file +src+ is newer than +dest+ and therefore has been modified since the
|
|
95
|
+
# last execution of webgen. The +mtime+ values for the source and destination files are used to
|
|
96
|
+
# find this out.
|
|
97
|
+
def file_modified?( src, dest )
|
|
98
|
+
if File.exists?( dest ) && ( File.mtime( src ) <= File.mtime( dest ) )
|
|
99
|
+
log(:info) { "File is up to date: <#{dest}>" }
|
|
100
|
+
return false
|
|
101
|
+
else
|
|
102
|
+
return true
|
|
55
103
|
end
|
|
104
|
+
end
|
|
56
105
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
106
|
+
# Returns the meta info for nodes for the given +handler+. If +file+ is specified, meta
|
|
107
|
+
# information from the backing file is also used if available (using files specified in the
|
|
108
|
+
# source block of the backing file). The parameter +file+ has to be an absolute path, ie.
|
|
109
|
+
# starting with a slash.
|
|
110
|
+
def meta_info_for( handler, file = nil )
|
|
111
|
+
info = (handler.class.config.infos[:default_meta_info] || {}).dup
|
|
112
|
+
info.update( param('defaultMetaInfo')[handler.class.plugin_name] || {} )
|
|
113
|
+
if file
|
|
114
|
+
file = normalize_path( file )
|
|
115
|
+
if @source_backing.has_key?( file )
|
|
116
|
+
info.update( @source_backing[file] )
|
|
117
|
+
end
|
|
63
118
|
end
|
|
119
|
+
info
|
|
120
|
+
end
|
|
64
121
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
122
|
+
# Creates a node for +file+ (creating parent directories apropriately) under +parent_node+ using
|
|
123
|
+
# the given +handler+. If a block is given, then the block is used to create the node which is
|
|
124
|
+
# useful if you want a custom node creation method.
|
|
125
|
+
def create_node( file, parent_node, handler ) # :yields: file, parent_node, handler, meta_info
|
|
126
|
+
pathname, filename = File.split( file )
|
|
127
|
+
parent_node = @plugin_manager['File/DirectoryHandler'].recursive_create_path( pathname, parent_node )
|
|
128
|
+
|
|
129
|
+
meta_info = meta_info_for( handler, File.join( parent_node.absolute_path, filename ) )
|
|
130
|
+
|
|
131
|
+
src_path = File.join( Node.root( parent_node ).node_info[:src], parent_node.absolute_path, filename )
|
|
132
|
+
dispatch_msg( :before_node_created, src_path, parent_node, handler, meta_info )
|
|
133
|
+
if block_given?
|
|
134
|
+
node = yield( src_path, parent_node, handler, meta_info )
|
|
135
|
+
else
|
|
136
|
+
node = handler.create_node( src_path, parent_node, meta_info )
|
|
76
137
|
end
|
|
138
|
+
check_node( node ) unless node.nil?
|
|
77
139
|
|
|
78
|
-
dispatch_msg( :
|
|
79
|
-
logger.info { "No handlers found for files: #{allFiles.inspect}" } if allFiles.length > 0
|
|
140
|
+
dispatch_msg( :after_node_created, node ) unless node.nil?
|
|
80
141
|
|
|
81
|
-
|
|
142
|
+
|
|
143
|
+
node
|
|
82
144
|
end
|
|
83
145
|
|
|
146
|
+
#######
|
|
147
|
+
private
|
|
148
|
+
#######
|
|
149
|
+
|
|
150
|
+
# Used to check that certain meta/node information is available and correct.
|
|
151
|
+
def check_node( node )
|
|
152
|
+
node['lang'] = Webgen::LanguageManager.language_for_code( node['lang'] ) unless node['lang'].kind_of?( Webgen::Language )
|
|
153
|
+
node['title'] ||= node.path
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Returns a normalized path, ie. a path starting with a slash and any trailing slashes removed.
|
|
157
|
+
def normalize_path( path )
|
|
158
|
+
path = (path =~ /^\// ? '' : '/') + path.sub( /\/+$/, '' )
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Loads the meta information backing file from the website directory.
|
|
162
|
+
def load_meta_info_backing_file
|
|
163
|
+
file = File.join( param( 'websiteDir', 'Core/Configuration' ), 'metainfo.yaml' )
|
|
164
|
+
if File.exists?( file )
|
|
165
|
+
begin
|
|
166
|
+
index = 1
|
|
167
|
+
YAML::load_documents( File.read( file ) ) do |data|
|
|
168
|
+
if data.nil? || (data.kind_of?( Hash ) && data.all? {|k,v| v.kind_of?( Hash ) })
|
|
169
|
+
if index == 1
|
|
170
|
+
@source_backing = {}
|
|
171
|
+
data.each_pair {|path, metainfo| @source_backing[normalize_path(path)] = metainfo} unless data.nil?
|
|
172
|
+
elsif index == 2
|
|
173
|
+
@output_backing = data
|
|
174
|
+
else
|
|
175
|
+
log(:error) { "A backing file can only have two blocks: one for source and one for output backing!" }
|
|
176
|
+
end
|
|
177
|
+
else
|
|
178
|
+
log(:error) { "Content of backing file (#{index == 1 ? 'source' : 'output'} block) not correctcly structured" }
|
|
179
|
+
end
|
|
180
|
+
index += 1
|
|
181
|
+
end
|
|
182
|
+
rescue
|
|
183
|
+
log(:error) { "Backing file is not a valid YAML document: #{$!.message}" }
|
|
184
|
+
end
|
|
185
|
+
else
|
|
186
|
+
log(:info) { 'No meta information backing file found!' }
|
|
187
|
+
end
|
|
188
|
+
@source_backing ||= {}
|
|
189
|
+
@output_backing ||= {}
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Uses the output backing section of the meta information file to assign meta information or, if
|
|
193
|
+
# no node for a path can be found, to create virtual nodes.
|
|
194
|
+
def handle_output_backing( root )
|
|
195
|
+
@output_backing.each do |path, data|
|
|
196
|
+
path = path[1..-1] if path =~ /^\//
|
|
197
|
+
if node = root.resolve_node( path )
|
|
198
|
+
node.meta_info.update( data )
|
|
199
|
+
else
|
|
200
|
+
node = create_node( path, root, @plugin_manager['File/VirtualFileHandler'] ) do |src, parent, handler, meta_info|
|
|
201
|
+
meta_info = meta_info.merge( data )
|
|
202
|
+
handler.create_node( src, parent, meta_info )
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
check_node( node )
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Reads all files from the source directory and constructs the node tree which is returned.
|
|
210
|
+
def build_tree
|
|
211
|
+
all_files = find_all_files()
|
|
212
|
+
return if all_files.empty?
|
|
213
|
+
|
|
214
|
+
files_for_handlers = find_files_for_handlers()
|
|
215
|
+
|
|
216
|
+
root_node = create_root_node()
|
|
217
|
+
|
|
218
|
+
used_files = Set.new
|
|
219
|
+
files_for_handlers.sort {|a,b| a[0] <=> b[0]}.each do |rank, handler, files|
|
|
220
|
+
log(:debug) { "Creating nodes for #{handler.class.plugin_name} with rank #{rank}" }
|
|
221
|
+
common = all_files & files
|
|
222
|
+
used_files += common
|
|
223
|
+
diff = files - common
|
|
224
|
+
log(:info) { "Not using these files for #{handler.class.plugin_name} as they do not exist or are excluded: #{diff.inspect}" } if diff.length > 0
|
|
225
|
+
common.each do |file|
|
|
226
|
+
log(:info) { "Creating node(s) for file <#{file}>..." }
|
|
227
|
+
create_node( file.sub( /^#{root_node.node_info[:src]}/, '' ), root_node, handler )
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
unused_files = all_files - used_files
|
|
232
|
+
log(:info) { "No handlers found for: #{unused_files.inspect}" } if unused_files.length > 0
|
|
233
|
+
|
|
234
|
+
handle_output_backing( root_node )
|
|
235
|
+
dispatch_msg( :after_all_nodes_created, root_node )
|
|
236
|
+
|
|
237
|
+
root_node
|
|
238
|
+
end
|
|
84
239
|
|
|
85
240
|
# Recursively writes out the tree specified by +node+.
|
|
86
241
|
def write_tree( node )
|
|
87
|
-
|
|
242
|
+
dispatch_msg( :before_all_nodes_written, node ) if node.parent.nil?
|
|
88
243
|
|
|
89
|
-
|
|
244
|
+
write_node( node )
|
|
245
|
+
node.each {|child| write_tree( child ) }
|
|
90
246
|
|
|
91
|
-
node
|
|
92
|
-
|
|
93
|
-
end
|
|
247
|
+
dispatch_msg( :after_all_nodes_written, node ) if node.parent.nil?
|
|
248
|
+
end
|
|
94
249
|
|
|
95
|
-
|
|
250
|
+
# Writes out the given +node+.
|
|
251
|
+
def write_node( node )
|
|
252
|
+
log(:info) { "Writing <#{node.full_path}>" }
|
|
253
|
+
dispatch_msg( :before_node_written, node )
|
|
254
|
+
node.write_node
|
|
255
|
+
dispatch_msg( :after_node_written, node )
|
|
96
256
|
end
|
|
97
257
|
|
|
258
|
+
# Creates a set of all files in the source directory, removing all files which should be ignored.
|
|
259
|
+
def find_all_files
|
|
260
|
+
all_files = files_for_pattern( '**/{**,**/}' ).to_set
|
|
261
|
+
param( 'ignorePaths' ).each {|pattern| all_files.subtract( files_for_pattern( pattern ) ) }
|
|
262
|
+
log(:error) { "No files found in the source directory <#{param('srcDir', 'Core/Configuration')}>" } if all_files.empty?
|
|
263
|
+
all_files
|
|
264
|
+
end
|
|
98
265
|
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
def
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
266
|
+
# Finds the files for each registered handler plugin and stores them in a Hash with the plugin
|
|
267
|
+
# as key.
|
|
268
|
+
def find_files_for_handlers
|
|
269
|
+
files_for_handlers = []
|
|
270
|
+
@plugin_manager.plugins.each do |name, plugin|
|
|
271
|
+
files_for_plugin = Set.new
|
|
272
|
+
if plugin.kind_of?( DefaultHandler )
|
|
273
|
+
plugin.path_patterns.each do |rank, pattern|
|
|
274
|
+
files = files_for_pattern( pattern ) - files_for_plugin
|
|
275
|
+
files_for_handlers << [rank, plugin, files ] unless files.empty?
|
|
276
|
+
files_for_plugin += files
|
|
277
|
+
end
|
|
278
|
+
end
|
|
107
279
|
end
|
|
280
|
+
files_for_handlers
|
|
108
281
|
end
|
|
109
282
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def get_files_for_pattern( pattern )
|
|
115
|
-
files = Dir[File.join( Webgen::Plugin['Configuration']['srcDirectory'], pattern )].to_set
|
|
283
|
+
# Returns an array of files of the source directory matching +pattern+
|
|
284
|
+
def files_for_pattern( pattern )
|
|
285
|
+
files = Dir[File.join( param( 'srcDir', 'Core/Configuration' ), pattern )].to_set
|
|
286
|
+
files.delete( File.join( param( 'srcDir', 'Core/Configuration' ), '/' ) )
|
|
116
287
|
files.collect! do |f|
|
|
117
288
|
f = f.sub( /([^.])\.{1,2}$/, '\1' ) # remove '.' and '..' from end of paths
|
|
118
|
-
f +=
|
|
289
|
+
f += '/' if File.directory?( f ) && ( f[-1] != ?/ )
|
|
119
290
|
f
|
|
120
291
|
end
|
|
121
292
|
files
|
|
122
293
|
end
|
|
123
294
|
|
|
124
|
-
|
|
125
|
-
|
|
295
|
+
# Creates the root node.
|
|
296
|
+
def create_root_node
|
|
297
|
+
root_path = File.join( param( 'srcDir', 'Core/Configuration' ), '/' )
|
|
298
|
+
root_handler = @plugin_manager['File/DirectoryHandler']
|
|
299
|
+
if root_handler.nil?
|
|
300
|
+
log(:error) { "No handler for root directory <#{root_path}> found" }
|
|
301
|
+
return nil
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
root = root_handler.create_node( root_path, nil, meta_info_for( root_handler, '/' ) )
|
|
126
305
|
root['title'] = ''
|
|
127
|
-
root
|
|
128
|
-
root[
|
|
306
|
+
root.path = File.join( param( 'outDir', 'Core/Configuration' ), '/' )
|
|
307
|
+
root.node_info[:src] = root_path
|
|
308
|
+
|
|
129
309
|
root
|
|
130
310
|
end
|
|
131
311
|
|
|
132
|
-
|
|
133
|
-
pathname, filename = File.split( file )
|
|
134
|
-
pathname = pathname + '/'
|
|
135
|
-
treeFile = file.sub( /^#{root['src']}/, '' )
|
|
136
|
-
treePath = pathname.sub( /^#{root['src']}/, '' )
|
|
137
|
-
|
|
138
|
-
node = root.node_for_string?( treeFile, 'src' )
|
|
139
|
-
return node unless node.nil?
|
|
140
|
-
logger.info { "Processing <#{file}> with #{handler.class.name} ..." }
|
|
141
|
-
|
|
142
|
-
parentNode = root.node_for_string?( treePath )
|
|
143
|
-
if parentNode.nil?
|
|
144
|
-
if pathname == root['src']
|
|
145
|
-
parentNode = root
|
|
146
|
-
else
|
|
147
|
-
logger.debug { "Parent node for <#{file}> does not exist, create node for path <#{pathname}>" }
|
|
148
|
-
parentNode = build_entry( pathname, root, handler_for_path( pathname, handlerFiles ), handlerFiles )
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
raise "Parent node is nil" if parentNode.nil?
|
|
152
|
-
logger.info { "Creating node for <#{file}>..." }
|
|
153
|
-
n = handler.create_node( file, parentNode )
|
|
154
|
-
parentNode.add_child( n ) unless n.nil?
|
|
155
|
-
n
|
|
156
|
-
end
|
|
312
|
+
end
|
|
157
313
|
|
|
158
|
-
def handler_for_path( path, handlerFiles )
|
|
159
|
-
temp, handler = handlerFiles.find {|p, handler| p.include?( path )}
|
|
160
|
-
handler
|
|
161
|
-
end
|
|
162
314
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
315
|
+
# The default handler which is the super class of all file handlers. It defines methods thata
|
|
316
|
+
# should be used by the subclasses to specify which files should be handled. There are two types
|
|
317
|
+
# of path patterns: constant ones defined using the class methods and dynamic ones defined using
|
|
318
|
+
# the instance methods. The dynamic path patterns should be defined during the initialization!
|
|
319
|
+
#
|
|
320
|
+
# During a webgen run the FileHandler retrieves all plugins which derive from the DefaultHandler
|
|
321
|
+
# and uses the constant and dynamic path patterns defined for each file handler plugin for finding
|
|
322
|
+
# the handled files.
|
|
323
|
+
class DefaultHandler < Webgen::Plugin
|
|
166
324
|
|
|
167
|
-
|
|
325
|
+
EXTENSION_PATH_PATTERN = "**/*.%s"
|
|
326
|
+
DEFAULT_RANK = 100
|
|
327
|
+
|
|
328
|
+
infos( :name => 'File/DefaultHandler',
|
|
329
|
+
:author => Webgen::AUTHOR,
|
|
330
|
+
:summary => "Base class of all file handler plugins",
|
|
331
|
+
:instantiate => false
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
param 'linkToCurrentPage', false, 'Specifies whether in menus, breadcrumb trails, etc. a real link to ' +
|
|
335
|
+
'the current page should be used or only the link text.'
|
|
168
336
|
|
|
169
|
-
# The default handler which is the super class of all file handlers.
|
|
170
|
-
class DefaultFileHandler < Webgen::Plugin
|
|
171
337
|
|
|
172
|
-
|
|
338
|
+
# Specify the path pattern which should be handled by the class. The +rank+ is used for sorting
|
|
339
|
+
# the patterns so that the creation order of nodes can be influenced. If a file is matched by
|
|
340
|
+
# more than one path pattern defined by a single file handler plugin, it is only used once for
|
|
341
|
+
# the first pattern.
|
|
342
|
+
def self.register_path_pattern( path, rank = DEFAULT_RANK )
|
|
343
|
+
(self.config.infos[:path_patterns] ||= []) << [rank, path]
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Specify the files handled by the class via the extension. The parameter +ext+ should be the
|
|
347
|
+
# pure extension without the dot. Also see DefaultHandler.register_path_pattern !
|
|
348
|
+
def self.register_extension( ext, rank = DEFAULT_RANK )
|
|
349
|
+
register_path_pattern( EXTENSION_PATH_PATTERN % [ext], rank )
|
|
350
|
+
end
|
|
173
351
|
|
|
174
|
-
|
|
352
|
+
# See DefaultHandler.register_path_pattern
|
|
353
|
+
def register_path_pattern( path, rank = DEFAULT_RANK )
|
|
354
|
+
(@path_patterns ||= []) << [rank, path]
|
|
355
|
+
end
|
|
356
|
+
protected :register_path_pattern
|
|
175
357
|
|
|
176
|
-
#
|
|
177
|
-
def
|
|
178
|
-
|
|
179
|
-
(self.config[self].path ||= []) << path
|
|
180
|
-
handlers = (self.config[DefaultFileHandler].file_handler ||= {})
|
|
181
|
-
logger.warn { "Path pattern #{path} already associated with class #{handlers[path].name}, not using class #{self.name} for it!" } if handlers[path]
|
|
182
|
-
handlers[path] ||= self
|
|
358
|
+
# See DefaultHandler.register_extension
|
|
359
|
+
def register_extension( ext, rank = DEFAULT_RANK )
|
|
360
|
+
register_path_pattern( EXTENSION_PATH_PATTERN % [ext], rank )
|
|
183
361
|
end
|
|
362
|
+
protected :register_extension
|
|
184
363
|
|
|
185
|
-
#
|
|
186
|
-
def
|
|
187
|
-
|
|
364
|
+
# Returns all (i.e. static and dynamic) path patterns defined for the file handler.
|
|
365
|
+
def path_patterns
|
|
366
|
+
(self.class.config.infos[:path_patterns] || []) + (@path_patterns ||= [])
|
|
188
367
|
end
|
|
189
368
|
|
|
190
|
-
#
|
|
191
|
-
|
|
192
|
-
|
|
369
|
+
# Sets the default meta information for the file handler. This meta information can later be
|
|
370
|
+
# overridden by the +Core/FileHandler:defaultMetaInfo+ parameter and values set in the meta
|
|
371
|
+
# information backing file. The so updated meta information is then passed to the #create_node
|
|
372
|
+
# method.
|
|
373
|
+
def self.default_meta_info( hash )
|
|
374
|
+
self.config.infos[:default_meta_info] = hash
|
|
193
375
|
end
|
|
194
376
|
|
|
195
|
-
#
|
|
196
|
-
#
|
|
377
|
+
# Asks the plugin to create a node for the given +path+ and the +parent+, using +meta_info+ as
|
|
378
|
+
# default meta data for the node. Should return the node for the path (the newly created node
|
|
379
|
+
# or, if a node with the path already exists, the existing one) or +nil+ if the node could not
|
|
380
|
+
# be created.
|
|
197
381
|
#
|
|
198
382
|
# Has to be overridden by the subclass!!!
|
|
199
|
-
def create_node( path, parent )
|
|
383
|
+
def create_node( path, parent, meta_info )
|
|
200
384
|
raise NotImplementedError
|
|
201
385
|
end
|
|
202
386
|
|
|
@@ -207,15 +391,78 @@ module FileHandlers
|
|
|
207
391
|
raise NotImplementedError
|
|
208
392
|
end
|
|
209
393
|
|
|
210
|
-
# Returns the node
|
|
211
|
-
|
|
394
|
+
# Returns the node which has the same data as +node+ but in language +lang+; or +nil+ if such a
|
|
395
|
+
# node does not exist. The default behaviour assumes that +node+ has the data for all languages.
|
|
396
|
+
def node_for_lang( node, lang )
|
|
212
397
|
node
|
|
213
398
|
end
|
|
214
399
|
|
|
215
|
-
# Returns a HTML link
|
|
216
|
-
#
|
|
217
|
-
|
|
218
|
-
|
|
400
|
+
# Returns a HTML link to the +node+ from +ref_node+ or, if +node+ and +ref_node+ are the same
|
|
401
|
+
# and the parameter +linkToCurrentPage+ is +false+, a +span+ element with the link text.
|
|
402
|
+
#
|
|
403
|
+
# You can optionally specify additional attributes for the html element in the +attr+ Hash.
|
|
404
|
+
# Also, the meta information +linkAttrs+ of the given +node+ is used, if available, to set
|
|
405
|
+
# attributes. However, the +attr+ parameter takes precedence over the +linkAttrs+ meta
|
|
406
|
+
# information. If the special value +:link_text+ is present in the attributes, it will be used
|
|
407
|
+
# as the link text; otherwise the title of the +node+ will be used. Be aware that all key-value
|
|
408
|
+
# pairs with Symbol keys are removed before the attributes are written. Therefore you always
|
|
409
|
+
# need to specify general attributes with Strings!
|
|
410
|
+
def link_from( node, ref_node, attr = {} )
|
|
411
|
+
attr = node['linkAttrs'].merge( attr ) if node['linkAttrs'].kind_of?( Hash )
|
|
412
|
+
link_text = attr[:link_text] || node['title']
|
|
413
|
+
attr.delete_if {|k,v| k.kind_of?( Symbol )}
|
|
414
|
+
|
|
415
|
+
use_link = ( node != ref_node || param( 'linkToCurrentPage' ) )
|
|
416
|
+
attr['href'] = ref_node.route_to( node ) if use_link
|
|
417
|
+
attrs = attr.collect {|name,value| "#{name.to_s}=\"#{value}\"" }.sort.unshift( '' ).join( ' ' )
|
|
418
|
+
( use_link ? "<a#{attrs}>#{link_text}</a>" : "<span#{attrs}>#{link_text}</span>" )
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
# Handles virtual nodes created via the output backing section of the meta information backing
|
|
425
|
+
# file.
|
|
426
|
+
class VirtualFileHandler < DefaultHandler
|
|
427
|
+
|
|
428
|
+
# A virtual node.
|
|
429
|
+
class VirtualNode < ::Node
|
|
430
|
+
|
|
431
|
+
# Overridden to also match the +reference+ path of the virtual node.
|
|
432
|
+
def =~( path )
|
|
433
|
+
md = /^(#{@path}|#{@node_info[:reference]})(?=#|$)/ =~ path
|
|
434
|
+
( md ? $& : nil )
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
infos( :name => 'File/VirtualFileHandler',
|
|
440
|
+
:author => Webgen::AUTHOR,
|
|
441
|
+
:summary => 'Handles virtual files specified in the backing file'
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
def create_node( path, parent, meta_info )
|
|
445
|
+
filename = File.basename( path )
|
|
446
|
+
filename, reference = (meta_info['url'] ? [meta_info['url'], filename] : [filename, filename])
|
|
447
|
+
|
|
448
|
+
# no need to check for an existing nodes, that is already done in FileHandler#handle_output_backing
|
|
449
|
+
temp_node = VirtualNode.new( parent, reference )
|
|
450
|
+
resolved_node = temp_node.resolve_node( filename )
|
|
451
|
+
if resolved_node
|
|
452
|
+
node = VirtualNode.new( parent, temp_node.route_to( resolved_node ) )
|
|
453
|
+
else
|
|
454
|
+
node = VirtualNode.new( parent, filename )
|
|
455
|
+
end
|
|
456
|
+
parent.del_child( temp_node )
|
|
457
|
+
|
|
458
|
+
node.meta_info.update( meta_info )
|
|
459
|
+
node.node_info[:reference] = reference
|
|
460
|
+
node.node_info[:processor] = self
|
|
461
|
+
node
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
def write_node( node )
|
|
465
|
+
# nothing to write
|
|
219
466
|
end
|
|
220
467
|
|
|
221
468
|
end
|