From 274219ecc865f9bdcb65ad26e4750fa90dfaa670 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 11 Oct 2010 11:12:41 -0400 Subject: websetup: Fix saving of advanced mode changes. The showadvanced field was not known to formbuilder when hitting the save changes button. --- IkiWiki/Plugin/websetup.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 11b4428e3..2674b91e8 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -295,6 +295,7 @@ sub showform ($$) { $form->field(name => "do", type => "hidden", value => "setup", force => 1); $form->field(name => "rebuild_asked", type => "hidden"); + $form->field(name => "showadvanced", type => "hidden"); if ($form->submitted eq 'Basic Mode') { $form->field(name => "showadvanced", type => "hidden", -- cgit v1.2.3 From cfbd272c8bdbb96b6e92449f4d940fb2b72aa651 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 11 Oct 2010 11:27:06 -0400 Subject: websetup: Fix defaults of checkboxes in advanced mode. So formbuilder has an annoying glitch, that setting the value of a checkbox, even without force, will override the value currently on the form. Thus the guards against changing checkbox values when a form has been submitted. But those guards also prevented the checkboxes for advanced items getting the right value when going into advanced mode. Note that if the user makes changes to advanced mode stuff and leaves advanced mode, those changes are lost. That seems reasonable so I didn't change it -- and it made this fix simple. --- IkiWiki/Plugin/websetup.pm | 3 ++- debian/changelog | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 2674b91e8..0ab18997c 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -219,7 +219,8 @@ sub showfields ($$$@) { options => [ [ 1 => $description ] ], fieldset => $section, ); - if (! $form->submitted) { + if (! $form->submitted || + ($info{advanced} && $form->submitted eq 'Advanced Mode')) { $form->field(name => $name, value => $value); } } diff --git a/debian/changelog b/debian/changelog index fb012abd2..6d333a843 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ ikiwiki (3.20100927) UNRELEASED; urgency=low feature. * actiontabs: More consistent styling of Hn tags. * websetup: Fix saving of advanced mode changes. + * websetup: Fix defaults of checkboxes in advanced mode. -- Joey Hess Wed, 29 Sep 2010 11:58:23 -0400 -- cgit v1.2.3 From 7ba0f7d297e7d3e833756016b635ffa0cc78200e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 11 Oct 2010 20:30:14 -0400 Subject: monotone: Fix recentchanges page when the srcdir is not at the top of the monotone workspace. Thanks, tommyd. --- IkiWiki/Plugin/monotone.pm | 13 ++++++++++++- debian/changelog | 2 ++ .../monotone_backend_does_not_support_srcdir_in_subdir.mdwn | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index 95fbcee76..75bf2f458 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -252,9 +252,20 @@ sub get_changed_files ($$) { my @ret; my %seen = (); - + + # we need to strip off the relative path to the source dir + # because monotone outputs all file paths absolute according + # to the workspace root + my $rel_src_dir = $config{'srcdir'}; + $rel_src_dir =~ s/^\Q$config{'mtnrootdir'}\E\/?//; + $rel_src_dir .= "/" if length $rel_src_dir; + while ($changes =~ m/\s*(add_file|patch|delete|rename)\s"(.*?)(? Wed, 29 Sep 2010 11:58:23 -0400 diff --git a/doc/bugs/monotone_backend_does_not_support_srcdir_in_subdir.mdwn b/doc/bugs/monotone_backend_does_not_support_srcdir_in_subdir.mdwn index 9e1924472..35f624f78 100644 --- a/doc/bugs/monotone_backend_does_not_support_srcdir_in_subdir.mdwn +++ b/doc/bugs/monotone_backend_does_not_support_srcdir_in_subdir.mdwn @@ -1,3 +1,5 @@ The [[rcs/monotone]] backend does not currently support putting the ikiwiki srcdir in a subdirectory of the repository. It must be at the top. Git has special code to handle this case. --[[Joey]] + +[[done]] -- cgit v1.2.3 From 8555d10f6369d78c44cf4677010b7e1260d9f5c0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 13 Oct 2010 12:57:16 -0400 Subject: img: If a class is specified, don't also put the img in the img class. --- IkiWiki/Plugin/img.pm | 5 +---- debian/changelog | 2 ++ .../class_parameter_of_img_directive_behave_not_as_documented.mdwn | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 2375ead89..bd527c8c8 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -156,10 +156,7 @@ sub preprocess (@) { $imgurl="$config{url}/$imglink"; } - if (exists $params{class}) { - $params{class}.=" img"; - } - else { + if (! exists $params{class}) { $params{class}="img"; } diff --git a/debian/changelog b/debian/changelog index 12cc90b11..5433ba05f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,8 @@ ikiwiki (3.20100927) UNRELEASED; urgency=low * websetup: Fix defaults of checkboxes in advanced mode. * monotone: Fix recentchanges page when the srcdir is not at the top of the monotone workspace. Thanks, tommyd. + * img: If a class is specified, don't also put the img in the img + class. -- Joey Hess Wed, 29 Sep 2010 11:58:23 -0400 diff --git a/doc/bugs/class_parameter_of_img_directive_behave_not_as_documented.mdwn b/doc/bugs/class_parameter_of_img_directive_behave_not_as_documented.mdwn index 10ba15066..e7797765f 100644 --- a/doc/bugs/class_parameter_of_img_directive_behave_not_as_documented.mdwn +++ b/doc/bugs/class_parameter_of_img_directive_behave_not_as_documented.mdwn @@ -27,3 +27,5 @@ I would prefer if the `img` class were only added if no class attribute is passed. If you keep the current behaviour, please document it. + +> [[done]] --[[Joey]] -- cgit v1.2.3 From 9b832df0d257e3d358ead63fd865d2a6b1914e19 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Oct 2010 21:37:31 -0400 Subject: add a missing chomp --- IkiWiki/Plugin/filecheck.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm index a78058ffe..3b0a7b314 100644 --- a/IkiWiki/Plugin/filecheck.pm +++ b/IkiWiki/Plugin/filecheck.pm @@ -148,6 +148,7 @@ sub match_mimetype ($$;@) { if (! defined $mimetype) { open(my $file_h, "-|", "file", "-bi", $file); $mimetype=<$file_h>; + chomp $mimetype; close $file_h; } if (! defined $mimetype || $mimetype !~s /;.*//) { -- cgit v1.2.3 From 9ca9959eda17ca85ca1550353d09ee33f6bb0469 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Oct 2010 16:19:16 -0400 Subject: fix web reversion when the srcdir is in a subdir of the git repo. --- IkiWiki/Plugin/git.pm | 35 +++++++++++++++++++++++------------ debian/changelog | 1 + 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index e89813253..892b711d8 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -9,7 +9,7 @@ use open qw{:utf8 :std}; my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes -my $no_chdir=0; +my $git_dir=undef; sub import { hook(type => "checkconfig", id => "git", call => \&checkconfig); @@ -164,9 +164,13 @@ sub safe_git (&@) { if (!$pid) { # In child. # Git commands want to be in wc. - if (! $no_chdir) { + if (! defined $git_dir) { chdir $config{srcdir} - or error("Cannot chdir to $config{srcdir}: $!"); + or error("cannot chdir to $config{srcdir}: $!"); + } + else { + chdir $git_dir + or error("cannot chdir to $git_dir: $!"); } exec @cmdline or error("Cannot exec '@cmdline': $!"); } @@ -721,14 +725,13 @@ sub rcs_getmtime ($) { } { -my $git_root; - +my $ret; sub git_find_root { # The wiki may not be the only thing in the git repo. # Determine if it is in a subdirectory by examining the srcdir, # and its parents, looking for the .git directory. - return $git_root if defined $git_root; + return @$ret if defined $ret; my $subdir=""; my $dir=$config{srcdir}; @@ -740,7 +743,8 @@ sub git_find_root { } } - return $git_root=$subdir; + $ret=[$subdir, $dir]; + return @$ret; } } @@ -748,7 +752,7 @@ sub git_find_root { sub git_parse_changes { my @changes = @_; - my $subdir = git_find_root(); + my ($subdir, $rootdir) = git_find_root(); my @rets; foreach my $ci (@changes) { foreach my $detail (@{ $ci->{'details'} }) { @@ -794,8 +798,8 @@ sub git_parse_changes { die $@ if $@; my $fh; ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); - my $cmd = ($no_chdir ? '' : "cd $config{srcdir} && ") - . "git show $detail->{sha1_to} > '$path'"; + my $cmd = "cd $git_dir && ". + "git show $detail->{sha1_to} > '$path'"; if (system($cmd) != 0) { error("failed writing temp file '$path'."); } @@ -825,10 +829,12 @@ sub rcs_receive () { # Avoid chdir when running git here, because the changes # are in the master git repo, not the srcdir repo. + # (Also, if a subdir is involved, we don't want to chdir to + # it and only see changes in it.) # The pre-receive hook already puts us in the right place. - $no_chdir=1; + $git_dir="."; push @rets, git_parse_changes(git_commit_info($oldrev."..".$newrev)); - $no_chdir=0; + $git_dir=undef; } return reverse @rets; @@ -838,7 +844,12 @@ sub rcs_preprevert ($) { my $rev=shift; my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint + # Examine changes from root of git repo, not from any subdir, + # in order to see all changes. + my ($subdir, $rootdir) = git_find_root(); + $git_dir=$rootdir; return git_parse_changes(git_commit_info($sha1, 1)); + $git_dir=undef; } sub rcs_revert ($) { diff --git a/debian/changelog b/debian/changelog index 3f649a2ce..cee42dc85 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ ikiwiki (3.20101020) UNRELEASED; urgency=low * Fix typo that broke anonymous git push. + * fix web reversion when the srcdir is in a subdir of the git repo. -- Joey Hess Sat, 23 Oct 2010 15:25:19 -0400 -- cgit v1.2.3 From 62a0f2f3d65aa86996f11a01cadb88380ba3d4e4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Oct 2010 16:31:58 -0400 Subject: bugfix --- IkiWiki/Plugin/git.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 892b711d8..f8e16859b 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -848,8 +848,9 @@ sub rcs_preprevert ($) { # in order to see all changes. my ($subdir, $rootdir) = git_find_root(); $git_dir=$rootdir; - return git_parse_changes(git_commit_info($sha1, 1)); + my @ret=git_parse_changes(git_commit_info($sha1, 1)); $git_dir=undef; + return @ret; } sub rcs_revert ($) { -- cgit v1.2.3 From 5db2d6f6b224872b119535d57e675d12a2c7dfe1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 23 Oct 2010 17:13:04 -0400 Subject: nice message if someone tries to revert a merge commit --- IkiWiki/Plugin/git.pm | 15 +++++++++++++-- debian/changelog | 6 +++--- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index f8e16859b..f5101d904 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -848,9 +848,20 @@ sub rcs_preprevert ($) { # in order to see all changes. my ($subdir, $rootdir) = git_find_root(); $git_dir=$rootdir; - my @ret=git_parse_changes(git_commit_info($sha1, 1)); + my @commits=git_commit_info($sha1, 1); $git_dir=undef; - return @ret; + + if (! @commits) { + error "unknown commit"; # just in case + } + + # git revert will fail on merge commits. Add a nice message. + if (exists $commits[0]->{parents} && + @{$commits[0]->{parents}} > 1) { + error gettext("you are not allowed to revert a merge"); + } + + return git_parse_changes(@commits); } sub rcs_revert ($) { diff --git a/debian/changelog b/debian/changelog index cee42dc85..b304e4b86 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -ikiwiki (3.20101020) UNRELEASED; urgency=low +ikiwiki (3.20101023) unstable; urgency=low * Fix typo that broke anonymous git push. - * fix web reversion when the srcdir is in a subdir of the git repo. + * Fix web reversion when the srcdir is in a subdir of the git repo. - -- Joey Hess Sat, 23 Oct 2010 15:25:19 -0400 + -- Joey Hess Sat, 23 Oct 2010 16:36:50 -0400 ikiwiki (3.20101019) unstable; urgency=low -- cgit v1.2.3 From 2076ed597c02bfede9063c3d40f4b855d4e8f8b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Oct 2010 22:37:34 -0400 Subject: txt: Fix display when used inside a format directive. txt's use of a format hook can't work in that case, so it needs to use a htmlizeformat hook in this case to handle wrapping the text in pre tags. --- IkiWiki/Plugin/format.pm | 24 +++++++++++++----------- IkiWiki/Plugin/highlight.pm | 6 +++--- IkiWiki/Plugin/txt.pm | 38 ++++++++++++++++++++++++++++---------- debian/changelog | 6 ++++++ 4 files changed, 50 insertions(+), 24 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm index d54e71131..b596bc0a1 100644 --- a/IkiWiki/Plugin/format.pm +++ b/IkiWiki/Plugin/format.pm @@ -29,22 +29,24 @@ sub preprocess (@) { if (! defined $format || ! defined $text) { error(gettext("must specify format and text")); } + + # Other plugins can register htmlizeformat hooks to add support + # for page types not suitable for htmlize, or that need special + # processing when included via format. Try them until one succeeds. + my $ret; + IkiWiki::run_hooks(htmlizeformat => sub { + $ret=shift->($format, $text) + unless defined $ret; + }); + + if (defined $ret) { + return $ret; + } elsif (exists $IkiWiki::hooks{htmlize}{$format}) { return IkiWiki::htmlize($params{page}, $params{destpage}, $format, $text); } else { - # Other plugins can register htmlizefallback - # hooks to add support for page types - # not suitable for htmlize. Try them until - # one succeeds. - my $ret; - IkiWiki::run_hooks(htmlizefallback => sub { - $ret=shift->($format, $text) - unless defined $ret; - }); - return $ret if defined $ret; - error(sprintf(gettext("unsupported page format %s"), $format)); } } diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm index d4ade0a7b..5674f0b4a 100644 --- a/IkiWiki/Plugin/highlight.pm +++ b/IkiWiki/Plugin/highlight.pm @@ -10,8 +10,8 @@ sub import { hook(type => "getsetup", id => "highlight", call => \&getsetup); hook(type => "checkconfig", id => "highlight", call => \&checkconfig); # this hook is used by the format plugin - hook(type => "htmlizefallback", id => "highlight", call => - \&htmlizefallback); + hook(type => "htmlizeformat", id => "highlight", call => + \&htmlizeformat); } sub getsetup () { @@ -79,7 +79,7 @@ sub checkconfig () { } } -sub htmlizefallback { +sub htmlizeformat { my $format=lc shift; my $langfile=ext2langfile($format); diff --git a/IkiWiki/Plugin/txt.pm b/IkiWiki/Plugin/txt.pm index 0d9a0b35b..fcfb68be9 100644 --- a/IkiWiki/Plugin/txt.pm +++ b/IkiWiki/Plugin/txt.pm @@ -17,6 +17,7 @@ sub import { hook(type => "getsetup", id => "txt", call => \&getsetup); hook(type => "filter", id => "txt", call => \&filter); hook(type => "htmlize", id => "txt", call => \&htmlize); + hook(type => "htmlizeformat", id => "txt", call => \&htmlizeformat); eval q{use URI::Find}; if (! $@) { @@ -46,25 +47,42 @@ sub filter (@) { will_render($params{page}, 'robots.txt'); writefile('robots.txt', $config{destdir}, $content); } - - encode_entities($content, "<>&"); - if ($findurl) { - my $finder = URI::Find->new(sub { - my ($uri, $orig_uri) = @_; - return qq|$orig_uri|; - }); - $finder->find(\$content); - } - $content = "
" . $content . "
"; + return txt2html($content); } return $content; } +sub txt2html ($) { + my $content=shift; + + encode_entities($content, "<>&"); + if ($findurl) { + my $finder = URI::Find->new(sub { + my ($uri, $orig_uri) = @_; + return qq|$orig_uri|; + }); + $finder->find(\$content); + } + return "
" . $content . "
"; +} + # We need this to register the .txt file extension sub htmlize (@) { my %params=@_; return $params{content}; } +sub htmlizeformat ($$) { + my $format=shift; + my $content=shift; + + if ($format eq 'txt') { + return txt2html($content); + } + else { + return; + } +} + 1 diff --git a/debian/changelog b/debian/changelog index b304e4b86..2857ec482 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ikiwiki (3.20101024) UNRELEASED; urgency=low + + * txt: Fix display when used inside a format directive. + + -- Joey Hess Mon, 25 Oct 2010 22:30:29 -0400 + ikiwiki (3.20101023) unstable; urgency=low * Fix typo that broke anonymous git push. -- cgit v1.2.3 From 5c6eb167b8e69e0607330f06c893a73dfe1c675a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Oct 2010 23:00:32 -0400 Subject: highlight: Ensure that other, more-specific format plugins, like txt are used in preference to this one in case of ties. --- IkiWiki/Plugin/highlight.pm | 5 +++-- debian/changelog | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin') diff --git a/IkiWiki/Plugin/highlight.pm b/IkiWiki/Plugin/highlight.pm index 5674f0b4a..872537c72 100644 --- a/IkiWiki/Plugin/highlight.pm +++ b/IkiWiki/Plugin/highlight.pm @@ -10,8 +10,8 @@ sub import { hook(type => "getsetup", id => "highlight", call => \&getsetup); hook(type => "checkconfig", id => "highlight", call => \&checkconfig); # this hook is used by the format plugin - hook(type => "htmlizeformat", id => "highlight", call => - \&htmlizeformat); + hook(type => "htmlizeformat", id => "highlight", + call => \&htmlizeformat, last => 1); } sub getsetup () { @@ -74,6 +74,7 @@ sub checkconfig () { }, longname => sprintf(gettext("Source code: %s"), $file), @opts, + last => 1, ); } } diff --git a/debian/changelog b/debian/changelog index 2857ec482..f6ca122a0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ ikiwiki (3.20101024) UNRELEASED; urgency=low * txt: Fix display when used inside a format directive. + * highlight: Ensure that other, more-specific format plugins, + like txt are used in preference to this one in case of ties. -- Joey Hess Mon, 25 Oct 2010 22:30:29 -0400 -- cgit v1.2.3