X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;ds=inline;f=xtaran%2Ftagging;h=0e408a16ff11fafea18606d769fcd9048de904e4;hb=refs%2Fheads%2Fmaster;hp=988f3229df56f33e02650ab308c700a74e4bf05c;hpb=2f4ac8d0f79206acaeae4efb2c6b65f80d5823c3;p=matthijs%2Fupstream%2Fblosxom-plugins.git
diff --git a/xtaran/tagging b/xtaran/tagging
index 988f322..0e408a1 100644
--- a/xtaran/tagging
+++ b/xtaran/tagging
@@ -229,6 +229,8 @@ our $related_story_join = "\n" unless defined $related_story_join;
our $related_story_prefix = '
' unless defined $related_story_prefix;
our $related_story_suffix = '' unless defined $related_story_suffix;
our $related_story_class = 'related_stories' unless defined $related_story_class;
+# Use the title of the post for the link instead of the filename
+our $related_story_title = 0 unless defined $related_story_title;
our $shared_tags_text = 'shared tags' unless defined $shared_tags_text;
@@ -257,6 +259,7 @@ $related_stories = '';
$related_tags = '';
%tags = ();
+%titles = ();
%related_tags = ();
sub start {
@@ -322,15 +325,21 @@ sub story {
$opath =~ s!\Q$blosxom::datadir\E!$blosxom::url!;
$opath =~ s!\Q$blosxom::file_extension\E$!$blosxom::default_flavour!;
- my $title = $other;
- $title =~ s!^.*/([^/]+)\.$blosxom::file_extension$!$1!;
+ my $title;
+ if ($related_story_title) {
+ $title = $titles{$other};
+ } else {
+ $title = $other;
+ $title =~ s!^.*/([^/]+)\.$blosxom::file_extension$!$1!;
+ }
my $shared_tags_list = join(', ', @{$other_stories{$other}});
my $shared_tags_number = scalar(@{$other_stories{$other}});
- my $attr_title = "$shared_tags_number $shared_tags_text: $shared_tags_list";
-
- $related_stories .= qq($related_story_prefix$title);
+ my $attr_title = blosxom::blosxom_html_escape("$shared_tags_number $shared_tags_text: $shared_tags_list");
+ my $attr_href = blosxom::blosxom_html_escape($opath);
+ my $html_title = blosxom::blosxom_html_escape($title);
+ $related_stories .= qq($related_story_prefix$html_title);
$related_stories .= ' ('
if $show_shared_tags || $show_number_of_shared_tags;
@@ -338,7 +347,7 @@ sub story {
if $show_number_of_shared_tags;
$related_stories .= $shared_tags_text
if $show_shared_tags || $show_number_of_shared_tags;
- $related_stories .= ": $shared_tags_list"
+ $related_stories .= blosxom::blosxom_html_escape(": $shared_tags_list")
if $show_shared_tags;
$related_stories .= ')'
if $show_shared_tags || $show_number_of_shared_tags;
@@ -368,6 +377,10 @@ sub filter {
my $tags_found = 0;
my $empty_line_found = 0;
while ($_ = ) {
+ # Take the title from the first line
+ if (not defined $titles{$key}) {
+ $titles{$key} = $_;
+ }
last if /^\s*$/;
if (m!^$tag_re(.+?)$!) {
my @localtags = split($split_re, $1);