From 63fa0ef5ba9a2e367791dd19b9aeb7c98d70ac85 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Tue, 8 Mar 2016 14:31:15 -0500 Subject: [PATCH] Process .md like .mdwn, but disallow web creation. --- IkiWiki/Plugin/comments.pm | 3 ++- IkiWiki/Plugin/editpage.pm | 3 ++- IkiWiki/Plugin/mdwn.pm | 1 + IkiWiki/Plugin/rename.pm | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index e93db94eb..b47f965e7 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -356,7 +356,8 @@ sub editcomment ($$) { my @page_types; if (exists $IkiWiki::hooks{htmlize}) { foreach my $key (grep { !/^_/ && isallowed($_) } keys %{$IkiWiki::hooks{htmlize}}) { - push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key]; + push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key] + unless $IkiWiki::hooks{htmlize}{$key}{nocreate}; } } @page_types=sort @page_types; diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 78d0704c7..6ca4b589f 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -305,7 +305,8 @@ sub cgi_editpage ($$) { my @page_types; if (exists $hooks{htmlize}) { foreach my $key (grep { !/^_/ } keys %{$hooks{htmlize}}) { - push @page_types, [$key, $hooks{htmlize}{$key}{longname} || $key]; + push @page_types, [$key, $hooks{htmlize}{$key}{longname} || $key] + unless $hooks{htmlize}{$key}{nocreate}; } } @page_types=sort @page_types; diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 014e78eea..daf9d592e 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -9,6 +9,7 @@ use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "mdwn", call => \&getsetup); hook(type => "htmlize", id => "mdwn", call => \&htmlize, longname => "Markdown"); + hook(type => "htmlize", id => "md", call => \&htmlize, longname => "Markdown (popular file extension)", nocreate => 1); } sub getsetup () { diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 6d56340b8..4a86d5a09 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -141,7 +141,8 @@ sub rename_form ($$$) { my @page_types; if (exists $IkiWiki::hooks{htmlize}) { foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) { - push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key]; + push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key] + unless $IkiWiki::hooks{htmlize}{$key}{nocreate}; } } @page_types=sort @page_types; -- 2.39.5