[libsyntax-highlight-engine-kate-perl] 01/07: Import patch from upstream to support case-insensitive names
Daniel Lintott
dlintott-guest at moszumanska.debian.org
Wed Mar 26 12:22:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
dlintott-guest pushed a commit to branch master
in repository libsyntax-highlight-engine-kate-perl.
commit 3ce5f28f43f4d797b9c851dafd162f51c59bbcdb
Author: Daniel Lintott <daniel at serverb.co.uk>
Date: Wed Mar 26 11:59:23 2014 +0000
Import patch from upstream to support case-insensitive names
Closes: #742667
---
.../patches/Support-case-insensitive-names.patch | 76 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 77 insertions(+)
diff --git a/debian/patches/Support-case-insensitive-names.patch b/debian/patches/Support-case-insensitive-names.patch
new file mode 100644
index 0000000..1e405e3
--- /dev/null
+++ b/debian/patches/Support-case-insensitive-names.patch
@@ -0,0 +1,76 @@
+Description: Support case-insensitive names
+ Patch taken from upstream commit
+Author: Jeff Fearn <jfearn at redhat.com>
+Origin: upstream
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=84982
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742667
+Applied-Upstream: https://github.com/szabgab/Syntax-Highlight-Engine-Kate/commit/9fa9156674aa04156940a7139e525f06e3245a88
+Last-Update: 2014-03-26
+--- a/lib/Syntax/Highlight/Engine/Kate.pm
++++ b/lib/Syntax/Highlight/Engine/Kate.pm
+@@ -616,11 +616,30 @@
+ }
+
+ sub languagePlug {
+- my ($self, $req) = @_;
++ my ($self, $req, $insensitive) = @_;
++
+ unless (exists($self->{'syntaxes'}->{$req})) {
+- warn "undefined language: $req";
+- return undef;
++ if (defined($insensitive) && $insensitive) {
++ my $matched = 0;
++ foreach my $key (keys(%{$self->{'syntaxes'}})) {
++ if (lc($key) eq lc($req)) {
++ warn "substituting language $key for $req";
++ $req = $key;
++ $matched = 1;
++ last;
++ }
++ }
++
++ unless ($matched) {
++ warn "undefined language: $req";
++ return undef;
++ }
++ } else {
++ warn "undefined language: $req";
++ return undef;
++ }
+ }
++
+ return $self->{'syntaxes'}->{$req};
+ }
+
+@@ -804,9 +823,13 @@
+
+ returns a list of languages for which plugins have been defined.
+
+-=item B<languagePlug>(I<$language>);
++=item B<languagePlug>(I<$language>, I<?$insensitive?>);
++
++Returns the module name of the plugin for B<$language>.
++
++If B<$insensitive> is set it will also try to match names ignoring case and return the correct module name of the plugin.
+
+-returns the module name of the plugin for B<$language>
++e.g. $highlighter->languagePlug('HtMl', 1); will return 'HTML'.
+
+ =item B<languagePropose>(I<$filename>);
+
+--- /dev/null
++++ b/t/10-case.t
+@@ -0,0 +1,13 @@
++use strict;
++use warnings;
++
++use Test::More tests => 4;
++use Syntax::Highlight::Engine::Kate;
++
++my $hl = new Syntax::Highlight::Engine::Kate();
++
++is($hl->languagePlug( 'HTML'), 'HTML', 'Standard "HTML" should work');
++is($hl->languagePlug( 'html'), undef, 'Standard "html" should not work');
++is($hl->languagePlug( 'HTML', 1), 'HTML', 'Insesitive "HTML" should work');
++is($hl->languagePlug( 'html', 1), 'HTML', 'Insesitive "html" should work');
++
diff --git a/debian/patches/series b/debian/patches/series
index 5299247..bc52179 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+Support-case-insensitive-names.patch
spelling.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libsyntax-highlight-engine-kate-perl.git
More information about the Pkg-perl-cvs-commits
mailing list