Update patch and reply to bug report.

master
http://www.cse.unsw.edu.au/~willu/ 2009-02-13 06:49:22 -05:00 committed by Joey Hess
parent 7599de6e43
commit 8b4f45e1e0
1 changed files with 134 additions and 110 deletions

View File

@ -35,10 +35,32 @@ I hit a wall the following example (the last commit in the above repo).
</div>
>>> That is quite strange. I tested your version of the plugin. I had to revert one your changes to get it to
>>> work: the linenumber argument should not have a space at the end of it. Once I made that change,
>>> everything worked as expected. The output I get for your example is below:
<div id="content">
<ul>
<li><div id="sourcecode"></li>
</ul>
<pre><tt><span class="linenum">00001:</span> <span class="normal">test</span></tt></pre>
<p></div></p>
</div>
>>> I don't know what is going wrong for you... source-highlight, Markdown or something else.
>>> I do find it interesting the way the sourcecode `div` and the list get interleaved. That
>>> just looks like a Markdown thing though.
>>> In any case, I've updated the patch below to include most of your changes. -- [[Will]]
----
#!/usr/bin/perl
# markup source files
# Originally by Will Uther
# With modifications by David Bremner
package IkiWiki::Plugin::sourcecode;
use warnings;
@ -123,7 +145,9 @@ I hit a wall the following example (the last commit in the above repo).
foreach my $lang (split(/[, ]+/, $config{sourcecode_lang})) {
if ($langs{$lang}) {
hook(type => "htmlize", id => $lang, call => \&htmlize, keepextension => 1);
hook(type => "htmlize", id => $lang, no_override=>1,
call => sub { htmlize(lang=>$lang, @_) },
keepextension => 1);
} else {
error("Your installation of source-highlight cannot handle sourcecode language $lang!");
}
@ -145,11 +169,11 @@ I hit a wall the following example (the last commit in the above repo).
my @args;
if ($config{sourcecode_linenumbers}) {
push @args, '--line-number= ';
push @args, '--line-number';
}
my $pid = open2(*SPS_IN, *SPS_OUT, $config{sourcecode_command},
'-s', IkiWiki::pagetype($pagesources{$page}),
'-s', $params{lang},
'-c', $config{sourcecode_css}, '--no-doc',
'-f', 'xhtml',
@args);
@ -171,7 +195,7 @@ I hit a wall the following example (the last commit in the above repo).
' type="text/css" />';
}
return '<div id="sourcecode">'."\r\n".join("\r\n",@html)."\r\n</div>\n";
return '<div id="sourcecode">'."\r\n".join("",@html)."\r\n</div>\r\n";
}
sub pagetemplate (@) {