Switch to YAML::XS to work around insanity in YAML::Mo. Closes: #657533

https://rt.cpan.org/Ticket/Display.html?id=74487

Gave up trying to support multiple YAML backends. The XS one requires ugly
manual encoding to get unicode right, and doesn't allow dumping yaml
fragments w/o the yaml header, but at least it doesn't randomly crash
on import like YAML::Mo has started to.
master
Joey Hess 2012-01-28 22:01:49 -04:00
parent e9c38d16fc
commit 6c3cdb04ac
5 changed files with 11 additions and 14 deletions

View File

@ -28,7 +28,7 @@ CGI::Session
Mail::Sendmail
CGI
Data::Dumper
YAML
YAML::XS
JSON
RPC::XML

View File

@ -11,10 +11,8 @@ sub loaddump ($$) {
my $class=shift;
my $content=shift;
eval q{use YAML::Any};
eval q{use YAML} if $@;
eval q{use YAML::XS};
die $@ if $@;
$YAML::Syck::ImplicitUnicode=1;
IkiWiki::Setup::merge(Load(encode_utf8($content)));
}
@ -35,12 +33,12 @@ sub dumpline ($$$$) {
my $type=shift;
my $prefix=shift;
eval q{use YAML::Old};
eval q{use YAML} if $@;
eval q{use YAML::XS};
die $@ if $@;
$YAML::UseHeader=0;
$YAML::XS::QuoteNumericStrings=0;
my $dump=Dump({$key => $value});
my $dump=decode_utf8(Dump({$key => $value}));
$dump=~s/^---\n//; # yaml header, we don't want
chomp $dump;
if (length $prefix) {
$dump=join("\n", map { $prefix.$_ } split(/\n/, $dump));

1
debian/changelog vendored
View File

@ -2,6 +2,7 @@ ikiwiki (3.20120116) UNRELEASED; urgency=low
* mdwn: Added nodiscount setting, which can be used to avoid using the
markdown discount engine, when maximum compatability is needed.
* Switch to YAML::XS to work around insanity in YAML::Mo. Closes: #657533
-- Joey Hess <joeyh@debian.org> Mon, 16 Jan 2012 13:41:14 -0400

4
debian/control vendored
View File

@ -7,7 +7,7 @@ Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl,
libtimedate-perl, libhtml-template-perl,
libhtml-scrubber-perl, wdg-html-validator,
libhtml-parser-perl, liburi-perl (>= 1.36), perlmagick, po4a (>= 0.34),
libfile-chdir-perl, libyaml-perl, python-support
libfile-chdir-perl, libyaml-libyaml-perl, python-support
Maintainer: Joey Hess <joeyh@debian.org>
Uploaders: Josh Triplett <josh@freedesktop.org>
Standards-Version: 3.9.2
@ -19,7 +19,7 @@ Architecture: all
Depends: ${misc:Depends}, ${perl:Depends}, ${python:Depends},
libtext-markdown-discount-perl,
libhtml-scrubber-perl, libhtml-template-perl,
libhtml-parser-perl, liburi-perl (>= 1.36), libyaml-perl, libjson-perl
libhtml-parser-perl, liburi-perl (>= 1.36), libyaml-libyaml-perl, libjson-perl
Recommends: gcc | c-compiler,
libc6-dev | libc-dev,
git (>= 1:1.7) | git-core (>= 1:1.5.0) | subversion | tla | bzr (>= 0.91) | mercurial | monotone (>= 0.38) | darcs,

View File

@ -108,11 +108,9 @@ sub getconfig () {
if (! defined $var || ! defined $val) {
die gettext("usage: --set-yaml var=value"), "\n";
}
eval q{use YAML::Any};
eval q{use YAML} if $@;
eval q{use YAML::XS; use Encode};
die $@ if $@;
eval q{$YAML::Syck::ImplicitUnicode=1};
$config{$var}=Load($val."\n");
$config{$var}=Load(encode_utf8($val)."\n");
},
"version" => sub {
print "ikiwiki version $IkiWiki::version\n";