From 9446c25f45057b9feb2233d9f7774dbdbda5c39b Mon Sep 17 00:00:00 2001 From: Gavin Carr Date: Mon, 17 Dec 2007 15:44:21 +0000 Subject: [PATCH] Convert tagcloud and uf plugins to multi-line %config initialisation, for better scriptability. --- gavinc/hcard | 8 +++---- gavinc/tagcloud | 30 +++++++++++++------------- gavinc/uf_adr_meta | 40 +++++++++++++++++----------------- gavinc/uf_geo_meta | 40 +++++++++++++++++----------------- gavinc/uf_hcalendar_meta | 40 +++++++++++++++++----------------- gavinc/uf_hcard_meta | 40 +++++++++++++++++----------------- gavinc/uf_xfolk_meta | 46 +++++++++++++++++++--------------------- 7 files changed, 116 insertions(+), 128 deletions(-) diff --git a/gavinc/hcard b/gavinc/hcard index 9fa0f5b..0428473 100644 --- a/gavinc/hcard +++ b/gavinc/hcard @@ -14,12 +14,10 @@ use IO::File; # --- Configuration defaults ----- -my %config = ( +my %config = (); - # Where is the hcard metadata? - hcard_meta_file => "$blosxom::datadir/hcard.yml", - -); +# Where is the hcard metadata? +$config{hcard_meta_file} = "$blosxom::datadir/hcard.yml"; # -------------------------------- # __END_CONFIG__ diff --git a/gavinc/tagcloud b/gavinc/tagcloud index e0c3baa..d89fc92 100644 --- a/gavinc/tagcloud +++ b/gavinc/tagcloud @@ -13,28 +13,28 @@ use vars qw(%config $cloud); # --- Configuration defaults ----- -%config = ( +%config = (); - # tagcloud requires a hashref containing 'tag => count' pairs - tag_hashref => $tags::tag_counts, +# tagcloud requires a hashref containing 'tag => count' pairs +$config{tag_hashref} = $tags::tag_counts; - # Formatting options - tagcloud_prefix => qq(

\n), - tagcloud_suffix => qq(

\n), - show_tag_no => 0, - min_tag_no => 2, - min_size => 75, - max_size => 200, - entry_type => 'posting', +# Formatting options +$config{tagcloud_prefix} = qq(

\n); +$config{tagcloud_suffix} = qq(

\n); +$config{show_tag_no} = 0; +$config{min_tag_no} = 2; +$config{min_size} = 75; +$config{max_size} = 200; +$config{entry_type} = 'posting'; - # Tags to omit from tagcloud - tagcloud_blacklist => [ 'Now Playing' ], - -); +# Tags to omit from tagcloud +$config{tagcloud_blacklist} = [ 'Now Playing' ]; # --------------------------------- # __END_CONFIG__ +#blosxom::load_config( \%config, 'tagcloud' ); + my %tagcloud_blacklist = map { $_ => 1 } @{$config{tagcloud_blacklist}}; $cloud = ''; diff --git a/gavinc/uf_adr_meta b/gavinc/uf_adr_meta index a3d2f8b..dc5e385 100644 --- a/gavinc/uf_adr_meta +++ b/gavinc/uf_adr_meta @@ -12,27 +12,25 @@ use strict; # --- Configuration defaults ----- -my %config = ( - - # Extra CSS classes to add to the microformat container e.g. to turn display off - class => '', - #class => 'nodisplay', - - # Whether to automatically add microformat to story bodies. If not set, - # you must explicitly add $uf_adr_meta::adr to a template somewhere. - auto_append_to_body => 1, - - # What markup style to use for your adr, if auto-appending. - # 3 styles are currently defined: - # 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields - # 'ul' uses a 'ul' list for the container, and 'li' elements for the fields - # 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and - # 'dd' elements for the fields themselves - #style => 'div-span', - #style => 'ul', - style => 'dl', - -); +my %config = (); + +# Extra CSS classes to add to the microformat container e.g. to turn display off +$config{class} = ''; +#$config{class} = 'nodisplay'; + +# Whether to automatically add microformat to story bodies. If not set, +# you must explicitly add $uf_adr_meta::adr to a template somewhere. +$config{auto_append_to_body} = 1; + +# What markup style to use for your adr, if auto-appending. +# 3 styles are currently defined: +# 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields +# 'ul' uses a 'ul' list for the container, and 'li' elements for the fields +# 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and +# 'dd' elements for the fields themselves +#$config{style} = 'div-span'; +#$config{style} = 'ul'; +$config{style} = 'dl'; # -------------------------------- # __END_CONFIG__ diff --git a/gavinc/uf_geo_meta b/gavinc/uf_geo_meta index 94c2ee9..e2ac567 100644 --- a/gavinc/uf_geo_meta +++ b/gavinc/uf_geo_meta @@ -12,27 +12,25 @@ use strict; # --- Configurable variables ----- -my %config = ( - - # Extra CSS classes to add to the microformat container e.g. to turn display off - class => '', - #class => 'nodisplay', - - # Whether to automatically add microformat to story bodies. If not set, - # you must explicitly add $uf_adr_meta::adr to a template somewhere. - auto_append_to_body => 1, - - # What markup style to use for your adr, if auto-appending. - # 3 styles are currently defined: - # 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields - # 'ul' uses a 'ul' list for the container, and 'li' elements for the fields - # 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and - # 'dd' elements for the fields themselves - #style => 'div-span', - #style => 'ul', - style => 'dl', - -); +my %config = (); + +# Extra CSS classes to add to the microformat container e.g. to turn display off +$config{class} = ''; +#$config{class} = 'nodisplay'; + +# Whether to automatically add microformat to story bodies. If not set, +# you must explicitly add $uf_adr_meta::adr to a template somewhere. +$config{auto_append_to_body} = 1; + +# What markup style to use for your adr, if auto-appending. +# 3 styles are currently defined: +# 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields +# 'ul' uses a 'ul' list for the container, and 'li' elements for the fields +# 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and +# 'dd' elements for the fields themselves +#$config{style} = 'div-span'; +#$config{style} = 'ul'; +$config{style} = 'dl'; # -------------------------------- # __END_CONFIG__ diff --git a/gavinc/uf_hcalendar_meta b/gavinc/uf_hcalendar_meta index 52b850a..7afab15 100644 --- a/gavinc/uf_hcalendar_meta +++ b/gavinc/uf_hcalendar_meta @@ -12,27 +12,25 @@ use strict; # --- Configurable variables ----- -my %config = ( - - # Extra CSS classes to add to the microformat container e.g. to turn display off - class => '', - #class => 'nodisplay', - - # Whether to automatically add microformat to story bodies. If not set, - # you must explicitly add $uf_adr_meta::adr to a template somewhere. - auto_append_to_body => 1, - - # What markup style to use for your adr, if auto-appending. - # 3 styles are currently defined: - # 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields - # 'ul' uses a 'ul' list for the container, and 'li' elements for the fields - # 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and - # 'dd' elements for the fields themselves - #style => 'div-span', - #style => 'ul', - style => 'dl', - -); +my %config = (); + +# Extra CSS classes to add to the microformat container e.g. to turn display off +$config{class} = ''; +#$config{class} = 'nodisplay'; + +# Whether to automatically add microformat to story bodies. If not set, +# you must explicitly add $uf_adr_meta::adr to a template somewhere. +$config{auto_append_to_body} = 1; + +# What markup style to use for your adr, if auto-appending. +# 3 styles are currently defined: +# 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields +# 'ul' uses a 'ul' list for the container, and 'li' elements for the fields +# 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and +# 'dd' elements for the fields themselves +#$config{style} = 'div-span'; +#$config{style} = 'ul'; +$config{style} = 'dl'; # -------------------------------- # __END_CONFIG__ diff --git a/gavinc/uf_hcard_meta b/gavinc/uf_hcard_meta index 7b6ba06..90b2333 100644 --- a/gavinc/uf_hcard_meta +++ b/gavinc/uf_hcard_meta @@ -12,27 +12,25 @@ use strict; # --- Configuration defaults ----- -my %config = ( - - # Extra CSS classes to add to the microformat container e.g. to turn display off - class => '', - #class => 'nodisplay', - - # Whether to automatically add microformat to story bodies. If not set, - # you must explicitly add $uf_adr_meta::adr to a template somewhere. - auto_append_to_body => 1, - - # What markup style to use for your adr, if auto-appending. - # 3 styles are currently defined: - # 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields - # 'ul' uses a 'ul' list for the container, and 'li' elements for the fields - # 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and - # 'dd' elements for the fields themselves - #style => 'div-span', - #style => 'ul', - style => 'dl', - -); +my %config = (); + +# Extra CSS classes to add to the microformat container e.g. to turn display off +$config{class} = ''; +#$config{class} = 'nodisplay'; + +# Whether to automatically add microformat to story bodies. If not set, +# you must explicitly add $uf_adr_meta::adr to a template somewhere. +$config{auto_append_to_body} = 1; + +# What markup style to use for your adr, if auto-appending. +# 3 styles are currently defined: +# 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields +# 'ul' uses a 'ul' list for the container, and 'li' elements for the fields +# 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and +# 'dd' elements for the fields themselves +#$config{style} = 'div-span'; +#$config{style} = 'ul'; +$config{style} = 'dl'; # -------------------------------- # __END_CONFIG__ diff --git a/gavinc/uf_xfolk_meta b/gavinc/uf_xfolk_meta index e99988c..9d5963d 100644 --- a/gavinc/uf_xfolk_meta +++ b/gavinc/uf_xfolk_meta @@ -12,30 +12,28 @@ use strict; # --- Configurable variables ----- -my %config = ( - - # URL to use as base URL for tag links - tagbase => "$blosxom::url/tags", - - # Extra CSS classes to add to the microformat container e.g. to turn display off - class => '', - #class => 'nodisplay', - - # Whether to automatically add microformat to story bodies. If not set, - # you must explicitly add $uf_adr_meta::adr to a template somewhere. - auto_append_to_body => 1, - - # What markup style to use for your adr, if auto-appending. - # 3 styles are currently defined: - # 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields - # 'ul' uses a 'ul' list for the container, and 'li' elements for the fields - # 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and - # 'dd' elements for the fields themselves - #style => 'div-span', - #style => 'ul', - style => 'dl', - -); +my %config = (); + +# URL to use as base URL for tag links +$config{tagbase} = "$blosxom::url/tags"; + +# Extra CSS classes to add to the microformat container e.g. to turn display off +$config{class} = ''; +#$config{class} = 'nodisplay'; + +# Whether to automatically add microformat to story bodies. If not set, +# you must explicitly add $uf_adr_meta::adr to a template somewhere. +$config{auto_append_to_body} = 1; + +# What markup style to use for your adr, if auto-appending. +# 3 styles are currently defined: +# 'div-span' uses a 'div' elt for the container, and 'span' elements for the fields +# 'ul' uses a 'ul' list for the container, and 'li' elements for the fields +# 'dl' uses a 'dl' list for the container, 'dt' elements for field names, and +# 'dd' elements for the fields themselves +#$config{style} = 'div-span'; +#$config{style} = 'ul'; +$config{style} = 'dl'; # -------------------------------- # __END_CONFIG__ -- 2.30.2