aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/smiley.pm6
-rw-r--r--IkiWiki/Plugin/template.pm6
-rw-r--r--IkiWiki/Plugin/wmd.pm18
3 files changed, 21 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm
index 1697a37c1..0d77916d0 100644
--- a/IkiWiki/Plugin/smiley.pm
+++ b/IkiWiki/Plugin/smiley.pm
@@ -87,10 +87,10 @@ MATCH: while (m{(?:^|(?<=\s|>))(\\?)$smiley_regexp(?:(?=\s|<)|$)}g) {
}
else {
# Replace the smiley with its expanded value.
- substr($_, $spos, length($smiley))=
- htmllink($params{page}, $params{destpage},
+ my $link=htmllink($params{page}, $params{destpage},
$smileys{$smiley}, linktext => $smiley);
- pos=$epos+1;
+ substr($_, $spos, length($smiley))=$link;
+ pos=$epos+length($link);
}
}
diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
index b872f0962..b6097bb49 100644
--- a/IkiWiki/Plugin/template.pm
+++ b/IkiWiki/Plugin/template.pm
@@ -69,9 +69,13 @@ sub preprocess (@) {
}
}
+ # This needs to run even in scan mode, in order to process
+ # links and other metadata includes via the template.
+ my $scan=! defined wantarray;
+
return IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage},
- $template->output));
+ $template->output), $scan);
}
1
diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm
index 3372ffe38..9ddd237ab 100644
--- a/IkiWiki/Plugin/wmd.pm
+++ b/IkiWiki/Plugin/wmd.pm
@@ -26,8 +26,9 @@ sub formbuilder_setup (@) {
return if ! defined $form->field("do");
- return unless (($form->field("do") eq "edit") ||
- ($form->field("do") eq "create"));
+ return unless $form->field("do") eq "edit" ||
+ $form->field("do") eq "create" ||
+ $form->field("do") eq "comment";
$form->tmpl_param("wmd_preview", "<div class=\"wmd-preview\"></div>\n".
include_javascript(undef, 1));
@@ -36,9 +37,16 @@ sub formbuilder_setup (@) {
sub include_javascript ($;$) {
my $page=shift;
my $absolute=shift;
-
- return '<script src="'.urlto("wmd.js", $page, $absolute).
- '" type="text/javascript"></script>'."\n";
+
+ my $wmdjs=urlto("wmd/wmd.js", $page, $absolute);
+ return <<"EOF"
+<script type="text/javascript">
+wmd_options = {
+ output: "Markdown"
+};
+</script>
+<script src="$wmdjs" type="text/javascript"></script>
+EOF
}
1