diff --git a/modules/markup.pl b/modules/markup.pl
index 2f9839e5..8e711e99 100644
--- a/modules/markup.pl
+++ b/modules/markup.pl
@@ -13,19 +13,34 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
$Id: markup.pl,v 1.33 2009/02/13 10:26:51 as Exp $
'; +$ModulesDescription .= '$Id: markup.pl,v 1.34 2009/03/13 22:28:29 as Exp $
'; use vars qw(%MarkupPairs %MarkupForcedPairs %MarkupSingles %MarkupLines $MarkupQuotes $MarkupQuoteTable); $MarkupQuotes = 1; -$MarkupQuoteTable = [["'", "'", '"', '"'], # 0 + +# $MarkupQuotes 'hi' "hi" I'm Favored in +# 0 'hi' "hi" I'm Typewriters +# 1 ‘hi’ “hi” I’m Britain and North America +# 2 ‹hi› «hi» I’m France and Italy +# 3 ›hi‹ »hi« I’m Germany +# 4 ‚hi’ „hi” I’m Germany + +# 0 1 2 3 4 +$MarkupQuoteTable = [[ "'", "'", '"', '"' , "'" ], # 0 ['‘', '’', '”', '“', '’'], # 1 ['‹', '›', '»', '«', '’'], # 2 ['›', '‹', '«', '»', '’'], # 3 ['‚', '‘', '“', '„', '’'], # 4 ]; +# $MarkupQuoteTable->[2]->[0] ‹ +# $MarkupQuoteTable->[2]->[1] › +# $MarkupQuoteTable->[2]->[2] » +# $MarkupQuoteTable->[2]->[3] « +# $MarkupQuoteTable->[2]->[4] ’ + push(@MyRules, \&MarkupRule); # The ---- rule in usemod.pl conflicts with the --- rule $RuleOrder{\&MarkupRule} = 150; @@ -154,23 +169,38 @@ sub MarkupRule { return '~/'; # fix ~/elisp/ example } elsif ($MarkupPairs{'/'} and m|\G(/[-A-Za-z0-9\x80-\xff/]+/$words/)|gc) { return $1; # fix /usr/share/lib/! example - } elsif ($MarkupQuotes and (m/\G(?<=[[:space:]])"/cg - or pos == 0 and m/\G"/cg)) { + } + # "foo + elsif ($MarkupQuotes and (m/\G(?<=[[:space:]])"/cg + or pos == 0 and m/\G"/cg)) { return $MarkupQuoteTable->[$MarkupQuotes]->[3]; - } elsif ($MarkupQuotes and (m/\G"(?=[[:space:][:punct:]])/cg + } + # foo" + elsif ($MarkupQuotes and (m/\G"(?=[[:space:][:punct:]])/cg or m/\G"\z/cg)) { return $MarkupQuoteTable->[$MarkupQuotes]->[2]; - } elsif ($MarkupQuotes and (m/\G(?<=[[:punct:]])"/cg)) { + } + # foo." + elsif ($MarkupQuotes and (m/\G(?<=[[:punct:]])"/cg)) { return $MarkupQuoteTable->[$MarkupQuotes]->[3]; - } elsif ($MarkupQuotes and pos == 0 and m/\G'/cg) { + } + # single quotes at the beginning of the buffer + elsif ($MarkupQuotes and pos == 0 and m/\G'/cg) { return $MarkupQuoteTable->[$MarkupQuotes]->[0]; - } elsif ($MarkupQuotes and (m/\G'(?=[[:space:][:punct:]])/cg - or m/\G'\z/cg)) { + } + # 'foo + elsif ($MarkupQuotes and (m/\G(?<=[[:space:]])'/cg + or pos == 0 and m/\G'/cg)) { + return $MarkupQuoteTable->[$MarkupQuotes]->[0]; + } + # foo' + elsif ($MarkupQuotes and (m/\G'(?=[[:space:][:punct:]])/cg + or m/\G'\z/cg)) { return $MarkupQuoteTable->[$MarkupQuotes]->[1]; - } elsif ($MarkupQuotes and m/\G(?[$MarkupQuotes]->[4]; - } elsif ($MarkupQuotes and m/\G(?<=[[:space:][:punct:]])'/cg) { - return $MarkupQuoteTable->[$MarkupQuotes]->[0]; } return undef; }