From bruno at mkdoc.com Thu Jul 21 15:19:04 2005 From: bruno at mkdoc.com (Bruno Postle) Date: Thu Jul 21 15:19:08 2005 Subject: [MKDoc-dev] Re: patch to distinguish between internal and external links In-Reply-To: References: Message-ID: <20050721141904.GD20371@mkdoc.com> On Sun 10-Jul-2005 at 19:52 -0400, Sam Tregar wrote: Sorry, just catching up on all this now (CC'ing to mkdoc-dev since this is relevant there). > - Whether links open in a new window or not is controlled via a > configuration variable in flo/Editor.pm: > > # Set this to true and external links (as determined by > # MKDoc::Util::LinkParser) will open in a new window. > our $EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW = 1; > > If this is the way we want to go then I should move this into a > configuration file. Any pointers on the right way to do that would > be appreciated - I haven't added a new configuration variable in > MKDoc so far. These kinds of global configuration options are handled by MKDoc::Config. Basically you create a method that returns a value from the environment or a sensible default: package MKDoc::Config; ... sub EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW { my $class = shift; return get_env ('MKD__EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW') || 0; } ..and you access it like so: use MKDoc::Config; ... our $EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW = MKDoc::Config->EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW(); In principle, these globals are accessible to the template writer. So you can put this in a template: ...

Warning this page fails the principle of least surprise

... There is another entire configuration system that resembles a hierarchical 'registry' (also implemented in MKDoc::Config). This is used to set the sizes of thumbnail images and the number of items in a search results page and not much else. It seems that the idea was to store configuration options in files, though in reality there is just a single hash ($::MKD_CONFIG), it is implemented here: MKDoc::Config::new() MKDoc::Config::get() MKDoc::Config::keys() MKDoc::Config::hash() This extra system was completely broken under mod_perl, I hacked a fix for it this January to get the search results and thumbnailing working: https://lists.webarch.co.uk/pipermail/mkdoc-commit/2005-January/000643.html -- Bruno From bruno at mkdoc.com Thu Jul 21 15:45:03 2005 From: bruno at mkdoc.com (Bruno Postle) Date: Thu Jul 21 15:45:11 2005 Subject: [MKDoc-dev] Re: patch to distinguish between internal and external links In-Reply-To: <20050721141904.GD20371@mkdoc.com> References: <20050721141904.GD20371@mkdoc.com> Message-ID: <20050721144503.GI2928@webarchitects.co.uk> On Thu 21-Jul-2005 at 15:19 +0100, Bruno Postle wrote: > > These kinds of global configuration options are handled by > MKDoc::Config. Basically you create a method that returns a value > from the environment or a sensible default: > > package MKDoc::Config; > ... > sub EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW > { > my $class = shift; > return get_env ('MKD__EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW') || 0; > } Of course you reset the default value in $SITE_DIR/httpd/httpd-env.conf like so: SetEnv MKD__EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW 1 This file is templated in MKDoc::Site::ConfigWriter::Httpd_Conf. So I would put it in the defaults, but commented out like so: # Uncomment if you want external links in popup windows # SetEnv MKD__EXTERNAL_LINKS_OPEN_IN_NEW_WINDOW 1 -- Bruno