X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=in%2Finheritance.md;fp=in%2Finheritance.md;h=89c7502f6e02a6455481f4ffaee6c4de6d204b2e;hb=07e692ef713a7d0d65296cd62b978539ac1ed683;hp=a1651732098487ac7a07d7ca55b246dd5d12d1cf;hpb=648cef7debdd1b5b96dc00db31445206c0de0f48;p=webber.git diff --git a/in/inheritance.md b/in/inheritance.md index a165173..89c7502 100644 --- a/in/inheritance.md +++ b/in/inheritance.md @@ -1,34 +1,58 @@ title: Configuration inheritance linktitle: Inheritance -parent: Webber +parent: Configuration lang: en ctime: 2009-06-24 -mtime: 2009-06-26 +mtime: 2010-07-06 +change: various clarifications, a better example = Overview = -Internally, webber uses a bunch of `Holder` classes to store information -(command-line options, config file options, parameters for a directory, -parameters for a file). +Internally, webber uses a bunch of `Holder` classes to store information. -Each `Holder` "inherits" configuration entries from the layer above: +We have objects of class `Holder` for this entities: -* `options` for command-line options -* `cfg` for entries from the command line -* `direc` for information about a directory -* `file` (either directly or via `get_current_file()` for data about the - currently rendered file +* "`cfg`" stores [[configuration]] and [[commandline]]. +* "`direc`" stores per-directory variables +* "`file`" stores attributes for each file that webber processes -= Example = +This is like the inheritance works: + +* "`direc`" inherits everything from "`cfg`". It can, however, + override anything. In a future version of webber, the "`direc`" + object for directory "`foo/bar/`" will inherit from the + directory object for "`bar/`" and only the last one will inherit from + "`cfg`". But that's not yet coded. +* "`file`" inherits from "`direc`" and again is free to override + anything on a per-file basis. -Due to parsing the [[command line|commandline]] there will exist an entry -`options.style_dir`. -However, you can also access this same value via `cfg.style_dir`, -`direc.style_dir` and `file.style_dir`. Any one of them however could -over-write the settings that originally was in `options`. += Example = -Quite often you'll use this for the page template. In `webber.conf`, you -specify `template: "default"`, which will be used for most pages. Any -page that needs a different template will get `template: history` entry -in it's header. +Due to parsing the [[commandline]] the attribute "`style_dir`" have +some value. If you don't specify one, it will be "default" by default. + +Now the [[configuration]] file "`webber.conf`" get's processed. It may +set "`style`" to "twoframe", if you want a two-frame template for your +web-site. + +Assuming you have a subdirectory with source-code examples. In this +directory you have a file "`directory.conf`" which re-sets it to "default". +This makes the default template work now only for your source-code +examples. + +There's one page where you use the [[hierarchy]] plugin to generate a +sitemap. This one page should have it's own template. Simply make the +[[page|pageformat]] be like this: + + title: Sitemap + template: sitemap + + <% + site = get_linear_sitemap() + %> +