From 0636360f7bad4c440274c9ab73cc3d72add7d381 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 12 Mar 2010 15:08:53 +0100 Subject: [PATCH] tagging: Allow tagging configuration to be overridden externally. This removes the need to edit the tagging plugin itself. --- xtaran/tagging | 92 +++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/xtaran/tagging b/xtaran/tagging index 6b13426..f6167e0 100644 --- a/xtaran/tagging +++ b/xtaran/tagging @@ -145,15 +145,15 @@ use CGI; ### # Where to link story tags (URLs defined below) -my $link_tag = 'blosxom'; +our $link_tag = 'blosxom' unless defined $link_tag; # Where to link tags in the tag cloud (URLs defined below) -my $link_cloud = 'blosxom'; +our $link_cloud = 'blosxom' unless defined $link_cloud; # Where to link related tags (URLs defined below) -my $link_rtag = 'blosxom'; +our $link_rtag = 'blosxom' unless defined $link_rtag; -my %base_url = ( +our %base_url = ( blosxom => "$blosxom::url?-tags=", blosxom_tags => "$blosxom::url/tags/", technorati => "http://www.technorati.com/tags/", @@ -180,70 +180,70 @@ my %base_url = ( wikipedia_nn => "http://nn.wikipedia.org/wiki/", wikipedia_lb => "http://lb.wikipedia.org/wiki/", wikipedia_simple => "http://simple.wikipedia.org/wiki/", - ); + ) unless defined %base_url; # Regular expressions -my $tag_re = qr/Tags:\s*/i; -my $split_re = qr/\s*,\s*/; +our $tag_re = qr/Tags:\s*/i unless defined $tag_re; +our $split_re = qr/\s*,\s*/ unless defined $split_re; # Texts for tags -my $tag_prefix = 'Tagged as: '; -my $tag_suffix = ''; #' » '; -my $global_tag_prefix = '

'; # '

Available tags: '; -my $global_tag_suffix = '

'; -my $current_filter_prefix = '

Current filter: »'; -my $current_filter_suffix = '« (Click tag to exclude it or click a conjunction to switch them.)

'; +our $tag_prefix = 'Tagged as: ' unless defined $tag_prefix; +our $tag_suffix = '' unless defined $tag_suffix; #' » ' +our $global_tag_prefix = '

' unless defined $global_tag_prefix; # '

Available tags: ' +our $global_tag_suffix = '

' unless defined $global_tag_suffix; +our $current_filter_prefix = '

Current filter: »' unless defined $current_filter_prefix; +our $current_filter_suffix = '« (Click tag to exclude it or click a conjunction to switch them.)

' unless defined $current_filter_suffix; # Displaying the tag cloud -my $min_tag_no = 2; -my $show_tag_no = 0; -my $show_tag_no_by_size = 1; -my $show_tag_no_by_color = 1; -my $max_size = 250; -my $min_size = 75; +our $min_tag_no = 2 unless defined $min_tag_no; +our $show_tag_no = 0 unless defined $show_tag_no; +our $show_tag_no_by_size = 1 unless defined $show_tag_no_by_size; +our $show_tag_no_by_color = 1 unless defined $show_tag_no_by_color; +our $max_size = 250 unless defined $max_size; +our $min_size = 75 unless defined $min_size; -my @tag_cloud_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot'); +our @tag_cloud_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot') unless defined @tag_cloud_blacklist; -my $start_color = 'ff9900'; -my $end_color = '991100'; -#my $start_color = '0000ff'; -#my $end_color = 'ff0000'; -#my $start_color = 'ff9900'; -#my $end_color = '0000ff'; +our $start_color = 'ff9900' unless defined $start_color; +our $end_color = '991100' unless defined $end_color; +#our $start_color = '0000ff' unless defined $start_color; +#our $end_color = 'ff0000' unless defined $end_color; +#our $start_color = 'ff9900' unless defined $start_color; +#our $end_color = '0000ff' unless defined $end_color; # Texts for related stories -my @related_stories_tag_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot'); +our @related_stories_tag_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot') unless defined @related_stories_tag_blacklist; -my $min_story_relations = 2; -my $max_related_stories = 5; -my $show_shared_tags = 0; -my $show_number_of_shared_tags = 1; +our $min_story_relations = 2 unless defined $min_story_relations; +our $max_related_stories = 5 unless defined $max_related_stories; +our $show_shared_tags = 0 unless defined $show_shared_tags; +our $show_number_of_shared_tags = 1 unless defined $show_number_of_shared_tags; -my $related_stories_prefix = '
\n"; -my $related_story_join = "\n"; -my $related_story_prefix = ''; -my $related_story_class = 'related_stories'; +our $related_stories_prefix = '
\n" unless defined $related_stories_suffix; +our $related_story_join = "\n" unless defined $related_story_join; +our $related_story_prefix = '' unless defined $related_story_suffix; +our $related_story_class = 'related_stories' unless defined $related_story_class; -my $shared_tags_text = 'shared tags'; +our $shared_tags_text = 'shared tags' unless defined $shared_tags_text; # Related Tags -my $min_tag_relations = 2; -my $max_related_tags = 5; # 0 to disable; -my $show_tag_shares = 0; +our $min_tag_relations = 2 unless defined $min_tag_relations; +our $max_related_tags = 5 unless defined $max_related_tags; # 0 to disable +our $show_tag_shares = 0 unless defined $show_tag_shares; -my @related_tags_tag_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot'); +our @related_tags_tag_blacklist = ('Now Playing', 'Other Blogs', 'Screenshot') unless defined @related_tags_tag_blacklist; -my $related_tags_prefix = '\n"; -my $related_tag_join = ", "; -my $related_tag_class = 'related_tags'; +our $related_tags_prefix = '\n" unless defined $related_tags_suffix; +our $related_tag_join = ", " unless defined $related_tag_join; +our $related_tag_class = 'related_tags' unless defined $related_tag_class; ### ### Init (You can use these variables in templates prefixed with "$tagging::".) -- 2.30.2