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: menu.rb
|
|
4
|
+
# $Id: menu.rb 563 2006-12-29 08:59:41Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -21,93 +21,69 @@
|
|
|
21
21
|
#
|
|
22
22
|
|
|
23
23
|
require 'webgen/node'
|
|
24
|
-
|
|
24
|
+
load_plugin 'webgen/plugins/tags/tag_processor'
|
|
25
25
|
|
|
26
26
|
module Tags
|
|
27
27
|
|
|
28
|
-
# Generates a menu. All page files for which the meta information +inMenu+ is set are
|
|
29
|
-
# If you have one page in several languages, it is sufficient to add this meta information to only
|
|
30
|
-
# one page file.
|
|
28
|
+
# Generates a menu. All page files for which the meta information +inMenu+ is set are used.
|
|
31
29
|
#
|
|
32
30
|
# The order in which the menu items are listed can be controlled via the meta information
|
|
33
|
-
# +orderInfo+. By default the menu items are sorted by
|
|
31
|
+
# +orderInfo+. By default the menu items are sorted by their titles.
|
|
34
32
|
class MenuTag < DefaultTag
|
|
35
33
|
|
|
36
|
-
class ::Node
|
|
37
|
-
|
|
38
|
-
# Retrieves the meta information +orderInfo+.
|
|
39
|
-
def order_info
|
|
40
|
-
# be optimistic and try metainfo field first
|
|
41
|
-
node = self
|
|
42
|
-
value = node['orderInfo'].to_s.to_i unless node['orderInfo'].nil?
|
|
43
|
-
|
|
44
|
-
# get index file for directory
|
|
45
|
-
if node['int:directory?']
|
|
46
|
-
node = node['indexFile']
|
|
47
|
-
value ||= node['orderInfo'].to_s.to_i unless node.nil? || node['orderInfo'].nil?
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# find the first orderInfo entry in the page files if node is a page file
|
|
51
|
-
if !node.nil? && node['int:pagename']
|
|
52
|
-
node = node.parent.find {|child| child['int:pagename'] == node['int:pagename'] && child['orderInfo'].to_s.to_i != 0}
|
|
53
|
-
value ||= node['orderInfo'].to_s.to_i unless node.nil?
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# fallback value
|
|
57
|
-
value ||= 0
|
|
58
|
-
|
|
59
|
-
value
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
SORT_PROC = Proc.new do |a,b|
|
|
63
|
-
aoi = a.order_info
|
|
64
|
-
boi = b.order_info
|
|
65
|
-
(aoi == boi ? a['title'] <=> b['title'] : aoi <=> boi)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
|
|
70
34
|
# Specialised node class for the menu.
|
|
71
35
|
class MenuNode < Node
|
|
72
36
|
|
|
73
37
|
def initialize( parent, node )
|
|
74
|
-
super( parent )
|
|
75
|
-
self
|
|
76
|
-
self[
|
|
77
|
-
self['isMenuNode'] = true
|
|
78
|
-
self['virtual'] = true
|
|
79
|
-
self['node'] = node
|
|
38
|
+
super( parent, '' )
|
|
39
|
+
self['title'] = 'Menu: ' + node['title']
|
|
40
|
+
self.node_info[:node] = node
|
|
80
41
|
end
|
|
81
42
|
|
|
82
43
|
|
|
83
44
|
# Sorts recursively all children of the node depending on their order value. If two order
|
|
84
45
|
# values are equal, sort the items using their title.
|
|
85
46
|
def sort!
|
|
86
|
-
self.children.sort! {|a,b|
|
|
87
|
-
self.children.each {|child| child.sort!
|
|
47
|
+
self.children.sort! {|a,b| a.node_info[:node] <=> b.node_info[:node] }
|
|
48
|
+
self.children.each {|child| child.sort! }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def inspect
|
|
52
|
+
@node_info[:node]
|
|
88
53
|
end
|
|
54
|
+
alias_method :to_s, :inspect
|
|
89
55
|
|
|
90
56
|
end
|
|
91
57
|
|
|
92
58
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
59
|
+
infos( :name => 'Tag/Menu',
|
|
60
|
+
:author => Webgen::AUTHOR,
|
|
61
|
+
:summary => 'Builds a menu'
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
param 'menuStyle', nil, 'Specifies the style of the menu.'
|
|
65
|
+
param 'options', {}, 'Options that are passed on to the plugin which layouts the menu.'
|
|
66
|
+
set_mandatory 'menuStyle', true
|
|
96
67
|
|
|
97
|
-
|
|
68
|
+
register_tag 'menu'
|
|
98
69
|
|
|
99
|
-
tag
|
|
70
|
+
def process_tag( tag, chain )
|
|
71
|
+
lang = chain.last['lang']
|
|
72
|
+
@menus ||= {}
|
|
73
|
+
unless @menus[lang]
|
|
74
|
+
@menus[lang] = create_menu_tree( Node.root( chain.last ), nil, lang )
|
|
75
|
+
@menus[lang].sort! if @menus[lang]
|
|
76
|
+
end
|
|
100
77
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
78
|
+
style = @plugin_manager['MenuStyle/Default'].registered_handlers[param( 'menuStyle' )]
|
|
79
|
+
if style.nil?
|
|
80
|
+
log(:error) { "Invalid style specified in <#{chain.first.node_info[:src]}>" }
|
|
81
|
+
''
|
|
82
|
+
elsif @menus[lang]
|
|
83
|
+
style.build_menu( chain.last, @menus[lang], param( 'options' ) )
|
|
84
|
+
else
|
|
85
|
+
''
|
|
109
86
|
end
|
|
110
|
-
Webgen::Plugin['DefaultMenuStyle'].get_menu_style( get_param( 'menuStyle' ) ).build_menu( node, @menuTree, get_param( 'options' ) )
|
|
111
87
|
end
|
|
112
88
|
|
|
113
89
|
|
|
@@ -115,16 +91,19 @@ module Tags
|
|
|
115
91
|
private
|
|
116
92
|
#######
|
|
117
93
|
|
|
118
|
-
|
|
119
|
-
|
|
94
|
+
# Returns a menu tree if at least one node is in the menu or +nil+ otherwise.
|
|
95
|
+
def create_menu_tree( node, parent, lang )
|
|
96
|
+
menu_node = MenuNode.new( parent, node )
|
|
97
|
+
parent.del_child( menu_node ) if parent
|
|
120
98
|
|
|
121
|
-
node.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
99
|
+
node.select do |child|
|
|
100
|
+
child['lang'] == lang || child['lang'].nil? || child.is_directory?
|
|
101
|
+
end.each do |child|
|
|
102
|
+
sub_node = create_menu_tree( child, menu_node, lang )
|
|
103
|
+
menu_node.add_child( sub_node ) unless sub_node.nil?
|
|
104
|
+
end if node.is_directory?
|
|
126
105
|
|
|
127
|
-
return
|
|
106
|
+
return menu_node.has_children? ? menu_node : ( node['inMenu'] ? menu_node : nil )
|
|
128
107
|
end
|
|
129
108
|
|
|
130
109
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: meta.rb
|
|
4
|
+
# $Id: meta.rb 563 2006-12-29 08:59:41Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
#++
|
|
21
21
|
#
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
load_plugin 'webgen/plugins/tags/tag_processor'
|
|
24
24
|
|
|
25
25
|
module Tags
|
|
26
26
|
|
|
@@ -31,18 +31,21 @@ module Tags
|
|
|
31
31
|
# simple copy the values to the output file.
|
|
32
32
|
class MetaTag < DefaultTag
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
infos( :name => 'Tag/Meta',
|
|
35
|
+
:author => Webgen::AUTHOR,
|
|
36
|
+
:summary => "Replaces all tags without tag plugin with their respective values from the node meta info"
|
|
37
|
+
)
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
register_tag :default
|
|
37
40
|
|
|
38
|
-
def process_tag( tag,
|
|
41
|
+
def process_tag( tag, chain )
|
|
39
42
|
output = ''
|
|
40
|
-
if
|
|
41
|
-
output =
|
|
43
|
+
if chain.last[tag]
|
|
44
|
+
output = chain.last[tag].to_s
|
|
42
45
|
else
|
|
43
|
-
|
|
46
|
+
log(:warn) { "No value for tag '#{tag}' in <#{chain.first.node_info[:src]}> found in <#{chain.last.node_info[:src]}>" }
|
|
44
47
|
end
|
|
45
|
-
|
|
48
|
+
output
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: relocatable.rb
|
|
4
|
+
# $Id: relocatable.rb 563 2006-12-29 08:59:41Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
#++
|
|
21
21
|
#
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
load_plugin 'webgen/plugins/tags/tag_processor'
|
|
24
24
|
require 'uri'
|
|
25
25
|
|
|
26
26
|
module Tags
|
|
@@ -35,14 +35,20 @@ module Tags
|
|
|
35
35
|
# Tag parameter: the name of the file which should be relocated
|
|
36
36
|
class RelocatableTag < DefaultTag
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
infos( :name => 'Tag/Relocatable',
|
|
39
|
+
:author => Webgen::AUTHOR,
|
|
40
|
+
:summary => 'Adds a relative path to the specified name if necessary'
|
|
41
|
+
)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
param 'path', nil, 'The path which should be relocatable'
|
|
44
|
+
param 'resolveFragment', true, 'Specifies if the fragment part (#something) in the path should also be resolved'
|
|
45
|
+
set_mandatory 'path', true
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
register_tag 'relocatable'
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def process_tag( tag, chain )
|
|
51
|
+
uri_string = param( 'path' )
|
|
46
52
|
result = ''
|
|
47
53
|
unless uri_string.nil?
|
|
48
54
|
begin
|
|
@@ -50,15 +56,37 @@ module Tags
|
|
|
50
56
|
if uri.absolute?
|
|
51
57
|
result = uri_string
|
|
52
58
|
else
|
|
53
|
-
|
|
54
|
-
qf = (uri.query.nil? ? '' : '?'+ uri.query ) + (uri.fragment.nil? ? '' : '#' + uri.fragment)
|
|
55
|
-
result = ( destNode.nil? ? '' : node.relpath_to_node( destNode['processor'].get_node_for_lang( destNode, node['lang'] ) ) + qf )
|
|
59
|
+
result = resolve_path( uri, chain )
|
|
56
60
|
end
|
|
61
|
+
log(:error) { "Could not resolve path '#{uri_string}' in <#{chain.first.node_info[:src]}>" } if result.empty?
|
|
57
62
|
rescue URI::InvalidURIError => e
|
|
58
|
-
|
|
63
|
+
log(:error) { "Error while parsing path for tag relocatable in <#{chain.first.node_info[:src]}>: #{e.message}" }
|
|
59
64
|
end
|
|
60
65
|
end
|
|
61
|
-
|
|
66
|
+
result
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
#######
|
|
70
|
+
private
|
|
71
|
+
#######
|
|
72
|
+
|
|
73
|
+
def query_fragment( uri )
|
|
74
|
+
(uri.query.nil? ? '' : '?'+ uri.query ) + (uri.fragment.nil? ? '' : '#' + uri.fragment)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def resolve_path( uri, chain )
|
|
78
|
+
dest_node = chain.first.resolve_node( uri.path )
|
|
79
|
+
if !dest_node.nil? && (File.basename( uri.path ) == dest_node.node_info[:pagename] || dest_node.is_directory?)
|
|
80
|
+
dest_node = dest_node.node_for_lang( chain.last['lang'] )
|
|
81
|
+
end
|
|
82
|
+
if !dest_node.nil? && !uri.fragment.nil? && param( 'resolveFragment' )
|
|
83
|
+
dest_node = dest_node.resolve_node( '#' + uri.fragment )
|
|
84
|
+
end
|
|
85
|
+
if dest_node.nil?
|
|
86
|
+
''
|
|
87
|
+
else
|
|
88
|
+
chain.last.route_to( dest_node.is_fragment? ? dest_node.parent : dest_node ) + query_fragment( uri )
|
|
89
|
+
end
|
|
62
90
|
end
|
|
63
91
|
|
|
64
92
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
3
|
#
|
|
4
|
-
# $Id: sitemap.rb
|
|
4
|
+
# $Id: sitemap.rb 563 2006-12-29 08:59:41Z thomas $
|
|
5
5
|
#
|
|
6
6
|
# webgen: template based static website generator
|
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
|
@@ -20,55 +20,59 @@
|
|
|
20
20
|
#++
|
|
21
21
|
#
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
load_plugin 'webgen/plugins/tags/tag_processor'
|
|
24
|
+
load_plugin 'webgen/plugins/filehandlers/page'
|
|
24
25
|
|
|
25
26
|
module Tags
|
|
26
27
|
|
|
27
28
|
# Generates a sitemap. The sitemap contains the hierarchy of all pages on the web site.
|
|
28
29
|
class SitemapTag < DefaultTag
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'the sitemap if true'
|
|
31
|
+
infos( :name => 'Tag/Sitemap',
|
|
32
|
+
:author => Webgen::AUTHOR,
|
|
33
|
+
:summary => 'Shows all page files of the website'
|
|
34
|
+
)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
param 'levelTag', 'ul', 'The tag used for creating a new hierarchy level.'
|
|
37
|
+
param 'itemTag', 'li', 'The tag used for hierarchy items.'
|
|
38
|
+
param 'honorInMenu', true, 'Only pages for which the \'inMenu\' meta information is set are shown in ' +
|
|
39
|
+
'the sitemap if true'
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
register_tag 'sitemap'
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
|
|
44
|
+
def process_tag( tag, chain )
|
|
45
|
+
root = Node.root( chain.last )
|
|
46
|
+
output_node( root, chain.last )
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
#######
|
|
46
50
|
private
|
|
47
51
|
#######
|
|
48
52
|
|
|
49
|
-
def output_node( node,
|
|
50
|
-
|
|
53
|
+
def output_node( node, src_node )
|
|
54
|
+
nodes = node.select do |child|
|
|
55
|
+
child.is_directory? || (child.kind_of?( FileHandlers::PageHandler::PageNode ) && child['lang'] == src_node['lang'])
|
|
56
|
+
end
|
|
57
|
+
return '' if nodes.empty?
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
out = "<#{get_param( 'levelTag' )}>"
|
|
59
|
+
out = "<#{param( 'levelTag' )}>"
|
|
54
60
|
temp = ''
|
|
55
|
-
|
|
56
|
-
next
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
next if !node['indexFile'].nil? && node['indexFile']['int:pagename'] == child['int:pagename']
|
|
61
|
+
nodes.sort.each do |child|
|
|
62
|
+
next if !child.is_directory? &&
|
|
63
|
+
((param( 'honorInMenu' ) && !child['inMenu']) ||
|
|
64
|
+
(!node['indexFile'].nil? && node['indexFile'].node_info[:pagename] == child.node_info[:pagename] && !node.parent.nil?))
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
link = child['processor'].get_html_link( child, srcNode ) if subout != '' || !isDir
|
|
66
|
+
subout = output_node( child, src_node )
|
|
67
|
+
link = child.link_from( src_node ) if !child.is_directory? || subout != ''
|
|
64
68
|
|
|
65
|
-
temp += "<#{
|
|
66
|
-
temp += subout if
|
|
67
|
-
temp += "</#{
|
|
69
|
+
temp += "<#{param( 'itemTag' )}>#{link}" if !child.is_directory? || subout != ''
|
|
70
|
+
temp += subout if child.is_directory?
|
|
71
|
+
temp += "</#{param( 'itemTag' )}>" if !child.is_directory? || subout != ''
|
|
68
72
|
end
|
|
69
73
|
|
|
70
74
|
out += temp
|
|
71
|
-
out += "</#{
|
|
75
|
+
out += "</#{param( 'levelTag' )}>"
|
|
72
76
|
|
|
73
77
|
(temp == '' ? temp : out)
|
|
74
78
|
end
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
#
|
|
4
|
+
# $Id: tag_processor.rb 572 2006-12-31 08:19:56Z 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
|
+
|
|
25
|
+
module Tags
|
|
26
|
+
|
|
27
|
+
# This class is used for processing tags. When a content string is parsed and a tag is
|
|
28
|
+
# encountered, the registered plugin for the tag is called. If no plugin for a tag is registered
|
|
29
|
+
# but a default plugin is, the default plugin is called. Otherwise an error is raised.
|
|
30
|
+
#
|
|
31
|
+
# The default plugin can be defined by using the special key <tt>:default</tt>.
|
|
32
|
+
class TagProcessor < Webgen::Plugin
|
|
33
|
+
|
|
34
|
+
infos( :name => 'Core/TagProcessor',
|
|
35
|
+
:author => Webgen::AUTHOR,
|
|
36
|
+
:summary => "Plugin for processing tags"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Processes the given +content+ using the nodes in +chain+ which should be an array of nodes.
|
|
40
|
+
# The first node is the main template (from which the +content+ was retrieved, the +ref_node+),
|
|
41
|
+
# then comes the sub template, the sub sub template and so on until the last node which is the
|
|
42
|
+
# current node (the +node+) that is the reason for the whole processing.
|
|
43
|
+
#
|
|
44
|
+
# After having processed all nodes, the method returns the result as string, ie. the rendered
|
|
45
|
+
# content.
|
|
46
|
+
def process( content, chain )
|
|
47
|
+
if !content.kind_of?( String )
|
|
48
|
+
log(:warn) { "The content in <#{chain.first.node_info[:src]}> is not a string, but a #{content.class.name}" }
|
|
49
|
+
content = content.to_s
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
return replace_tags( content, chain.first ) do |tag, tag_data|
|
|
53
|
+
log(:debug) { "Replacing tag #{tag} with data '#{tag_data}' in <#{chain.first.full_path}>" }
|
|
54
|
+
|
|
55
|
+
result = ''
|
|
56
|
+
processor = processor_for_tag( tag )
|
|
57
|
+
if !processor.nil?
|
|
58
|
+
begin
|
|
59
|
+
processor.set_tag_config( YAML::load( "--- #{tag_data}" ), chain.first )
|
|
60
|
+
rescue ArgumentError => e
|
|
61
|
+
log(:error) { "Could not parse the data '#{tag_data}' for tag #{tag} in <#{node.nod_info[:src]}>: #{e.message}" }
|
|
62
|
+
end
|
|
63
|
+
result, tag_chain = processor.process_tag( tag, chain )
|
|
64
|
+
processor.reset_tag_config
|
|
65
|
+
|
|
66
|
+
result = process( result, tag_chain || chain ) if processor.process_output?
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
result
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
#######
|
|
74
|
+
private
|
|
75
|
+
#######
|
|
76
|
+
|
|
77
|
+
# Scans the +content+ for tags. If a tag is found, the block is called which needs to return the
|
|
78
|
+
# value for the given tag. The changed content is returned.
|
|
79
|
+
def replace_tags( content, node ) # :yields: tag, data
|
|
80
|
+
offset = 0;
|
|
81
|
+
content = content.dup
|
|
82
|
+
while index = content.index( /(\\*)\{(\w+):/, offset )
|
|
83
|
+
bracketCount = 1;
|
|
84
|
+
length = $1.length + 1;
|
|
85
|
+
tag = $2
|
|
86
|
+
content[(index + length)..-1].each_byte do |char|
|
|
87
|
+
length += 1
|
|
88
|
+
bracketCount += 1 if char == ?{
|
|
89
|
+
bracketCount -= 1 if char == ?}
|
|
90
|
+
break if bracketCount == 0
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if bracketCount > 0
|
|
94
|
+
log(:error) { "Unbalanced curly brackets in <#{node.node_info[:src]}>!!!" }
|
|
95
|
+
newContent = content[index, length]
|
|
96
|
+
else
|
|
97
|
+
newContent = "\\"* ( $1.length / 2 )
|
|
98
|
+
if $1.length % 2 == 1
|
|
99
|
+
newContent += content[index + $1.length, length - $1.length]
|
|
100
|
+
else
|
|
101
|
+
tagHeaderLength = $1.length + tag.length + 2
|
|
102
|
+
realContent = content[index + tagHeaderLength, length - tagHeaderLength - 1].lstrip
|
|
103
|
+
newContent += yield( tag, realContent ).to_s
|
|
104
|
+
end
|
|
105
|
+
content[index, length] = newContent
|
|
106
|
+
end
|
|
107
|
+
offset = index + newContent.length
|
|
108
|
+
end
|
|
109
|
+
content
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Returns the tag processor for +tag+ or +nil+ if +tag+ is unknown.
|
|
114
|
+
def processor_for_tag( tag )
|
|
115
|
+
tags = registered_tags
|
|
116
|
+
if tags.has_key?( tag )
|
|
117
|
+
tags[tag]
|
|
118
|
+
elsif tags.has_key?( :default )
|
|
119
|
+
tags[:default]
|
|
120
|
+
else
|
|
121
|
+
log(:error) { "No tag processor for tag '#{tag}' found" }
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Returns a hash of the registered tag plugins with the tag name as key.
|
|
126
|
+
def registered_tags
|
|
127
|
+
if !defined?( @registered_tags_cache ) || @cached_plugins_hash != @plugin_manager.plugins.keys.hash
|
|
128
|
+
@registered_tags_cache = {}
|
|
129
|
+
@plugin_manager.plugins.each do |name, plugin|
|
|
130
|
+
if plugin.kind_of?( DefaultTag )
|
|
131
|
+
#TOOD write log message if duplicate tag name
|
|
132
|
+
plugin.tags.each {|tag| @registered_tags_cache[tag] = plugin }
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
@cached_plugins_hash = @plugin_manager.plugins.keys.hash
|
|
136
|
+
end
|
|
137
|
+
@registered_tags_cache
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# Base class for all tag plugins. The base class provides a default mechanism for retrieving
|
|
144
|
+
# configuration data from either the configuration file or the tag itself.
|
|
145
|
+
class DefaultTag < Webgen::Plugin
|
|
146
|
+
|
|
147
|
+
infos( :name => 'Tag/Default',
|
|
148
|
+
:summary => "Base plugin for all tag plugins",
|
|
149
|
+
:author => Webgen::AUTHOR,
|
|
150
|
+
:instantiate => false
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def initialize( plugin_manager )
|
|
154
|
+
super
|
|
155
|
+
@process_output = true
|
|
156
|
+
@cur_config = {}
|
|
157
|
+
@tags = []
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Returns +true+ if the output should be processed again
|
|
161
|
+
def process_output?
|
|
162
|
+
@process_output
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Set the parameter +param+ as mandatory. The parameter +default+ specifies, if this parameter
|
|
166
|
+
# should be the default mandatory parameter. If only a String is supplied in a tag, its value
|
|
167
|
+
# will be assigned to the default mandatory parameter. There *should* be only one default
|
|
168
|
+
# mandatory parameter.
|
|
169
|
+
def self.set_mandatory( param, default = false )
|
|
170
|
+
if self.config.params.nil? || !self.config.params.has_key?( param )
|
|
171
|
+
$stderr.puts( "Cannot set parameter #{param} as mandatory as this parameter does not exist for #{self.name}" ) if $VERBOSE
|
|
172
|
+
else
|
|
173
|
+
self.config.params[param].mandatory = true
|
|
174
|
+
self.config.params[param].mandatory_default = default
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Register +tag+ so that it gets processed by the current class.
|
|
179
|
+
def self.register_tag( tag )
|
|
180
|
+
(self.config.infos[:tags] ||= [] ) << tag
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# See DefaultTag.register_tag
|
|
184
|
+
def register_tag( tag )
|
|
185
|
+
@tags << tag
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Returns all registered tags for the plugin.
|
|
189
|
+
def tags
|
|
190
|
+
(self.class.config.infos[:tags] || []) + @tags
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Set the configuration parameters for the next #process_tag call. The configuration, if
|
|
194
|
+
# specified, is taken from the tag itself.
|
|
195
|
+
def set_tag_config( config, node )
|
|
196
|
+
@cur_config = {}
|
|
197
|
+
case config
|
|
198
|
+
when Hash
|
|
199
|
+
set_cur_config( config, node )
|
|
200
|
+
|
|
201
|
+
when String
|
|
202
|
+
set_default_mandatory_param( config, node )
|
|
203
|
+
|
|
204
|
+
when NilClass
|
|
205
|
+
|
|
206
|
+
else
|
|
207
|
+
log(:error) { "Invalid parameter type (#{config.class}) for tag '#{self.class.plugin_name}' in <#{node.node_info[:src]}>" }
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
unless all_mandatory_params_set?
|
|
211
|
+
log(:error) { "Not all mandatory parameters for tag '#{self.class.plugin_name}' in <#{node.node_info[:src]}> set" }
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Resets the tag configuration data.
|
|
216
|
+
def reset_tag_config
|
|
217
|
+
@cur_config = {}
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Retrieves the parameter value for +name+. The value is taken from the current tag if the
|
|
221
|
+
# parameter is specified there or the default value set in #register_config_value is used.
|
|
222
|
+
def param( name, plugin = nil )
|
|
223
|
+
if @cur_config.has_key?( name ) && plugin.nil?
|
|
224
|
+
return @cur_config[name]
|
|
225
|
+
else
|
|
226
|
+
super( name, plugin )
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Default implementation for processing a tag. The parameter +tag+ specifies the name of the tag
|
|
231
|
+
# which should be processed (useful for tag plugins which process different tags).
|
|
232
|
+
#
|
|
233
|
+
# The +node_chain+ parameter holds all relevant nodes. The first node in the chain is always the
|
|
234
|
+
# node in which the tag was found (a template )and the last node is the current node, i.e. the
|
|
235
|
+
# page node which triggered all this. The nodes between are other template nodes.
|
|
236
|
+
#
|
|
237
|
+
# The method has to return the result of the tag processing and, optionally, a modified chain
|
|
238
|
+
# (as second result). The second value is currently only returned by the block tag.
|
|
239
|
+
#
|
|
240
|
+
# Has to be overridden by subclasses!!!
|
|
241
|
+
def process_tag( tag, node_chain )
|
|
242
|
+
raise NotImplementedError
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
#######
|
|
246
|
+
private
|
|
247
|
+
#######
|
|
248
|
+
|
|
249
|
+
# Set the current configuration taking values from +config+ which has to be a Hash.
|
|
250
|
+
def set_cur_config( config, node )
|
|
251
|
+
config.each do |key, value|
|
|
252
|
+
if self.class.config.params.has_key?( key )
|
|
253
|
+
@cur_config[key] = value
|
|
254
|
+
log(:debug) { "Setting parameter '#{key}' to '#{value}' for tag '#{self.class.plugin_name}' in <#{node.node_info[:src]}>" }
|
|
255
|
+
else
|
|
256
|
+
log(:warn) { "Invalid parameter '#{key}' for tag '#{self.class.plugin_name}' in <#{node.node_info[:src]}>" }
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Set the default mandatory parameter.
|
|
262
|
+
def set_default_mandatory_param( value, node )
|
|
263
|
+
param_name, param_value = self.class.config.params.find {|k,v| v.mandatory_default} unless self.class.config.params.nil?
|
|
264
|
+
if param_name.nil?
|
|
265
|
+
log(:error) { "No default mandatory parameter specified for tag '#{self.class.plugin_name}' but set in <#{node.node_info[:src]}>"}
|
|
266
|
+
else
|
|
267
|
+
@cur_config[param_name] = value
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# Check if all mandatory parameters have been set
|
|
272
|
+
def all_mandatory_params_set?
|
|
273
|
+
params = self.class.config.params
|
|
274
|
+
( params.nil? ? true : params.all? { |k,v| !v.mandatory || @cur_config.has_key?( k ) || !v.default.nil? } )
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
end
|