summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-08-04 02:19:28 +0200
committerJonas Smedegaard <dr@jones.dk>2008-08-04 02:19:28 +0200
commit52d3706fd4d7ba3425dac767d75db549fb499dc7 (patch)
tree7e71b8bcb0ae7cbcfb5e959e3813932150d3d59b
parentb68f746ade49fff4ff4ba3c0adec95d26237a966 (diff)
Extend make and po4a to support templates.
-rw-r--r--make/rules.mk9
-rw-r--r--perl/Locale/Po4a/Text.pm7
2 files changed, 13 insertions, 3 deletions
diff --git a/make/rules.mk b/make/rules.mk
index 973af61..9961061 100644
--- a/make/rules.mk
+++ b/make/rules.mk
@@ -1,3 +1,6 @@
+# use markdown template for po4a, or some custom one?
+HTMLTEMPLATE = text
+
# 1:source 2:locales
define SOURCE_template
$(1): $$($(1)_MODULES) $(dummy_MODULES)
@@ -48,7 +51,7 @@ export PERL5LIB = $(CURDIR)/perl
# 1:moduledir 2:locale 3:mastermodule 4:source
define POT_template
-fileformat = $(if $(filter templates,$(3)),htmltemplate,text)
+fileformat = $(if $(filter templates,$(3)),$(HTMLTEMPLATE),text)
filetype = $(if $(filter templates,$(3)),tmpl,mdwn)
ALL_POTFILES += $(podir)/$(3).pot
$(3)_L10NFILES = $$(patsubst $(1)/%,%,$$(shell find $(1) -type f -name '*.$$(filetype)' | LANG=C sort))
@@ -65,7 +68,7 @@ $(foreach source,$(SOURCES),$(foreach module,$($(source)_POMODULES),$(eval $(cal
# 1:moduledir 2:locale 3:mastermodule 4:source 5:originmodule
define INITPO_template
-fileformat = $(if $(filter templates,$(3)),htmltemplate,text)
+fileformat = $(if $(filter templates,$(3)),$(HTMLTEMPLATE),text)
filetype = $(if $(filter templates,$(3)),tmpl,mdwn)
ALL_POFILES += $(podir)/$(3).$(2).po
LOCALE_L10NFILES += $$(patsubst %,$(1)/%,$$($(3)_L10NFILES))
@@ -89,7 +92,7 @@ $(foreach source,$(SOURCES),$(foreach module,$(po-init-modules),$(foreach locale
# 1:moduledir 2:locale 3:mastermodule 4:source
define PO_template
-fileformat = $(if $(filter templates,$(3)),htmltemplate,text)
+fileformat = $(if $(filter templates,$(3)),$(HTMLTEMPLATE),text)
filetype = $(if $(filter templates,$(3)),tmpl,mdwn)
ALL_POFILES += $(podir)/$(3).$(2).po
LOCALE_L10NFILES += $$(patsubst %,$(1)/%,$$($(3)_L10NFILES))
diff --git a/perl/Locale/Po4a/Text.pm b/perl/Locale/Po4a/Text.pm
index 5236095..0cc2cc8 100644
--- a/perl/Locale/Po4a/Text.pm
+++ b/perl/Locale/Po4a/Text.pm
@@ -179,6 +179,12 @@ sub parse {
$paragraph="";
$wrapped_mode = 1;
$self->pushline($line."\n");
+ } elsif ($line =~ /^-- $/) {
+ # Break paragraphs on email signature hint
+ do_paragraph($self,$paragraph,$wrapped_mode);
+ $paragraph="";
+ $wrapped_mode = 1;
+ $self->pushline($line."\n");
} elsif ( $line =~ /^=+$/
or $line =~ /^_+$/
or $line =~ /^-+$/) {
@@ -237,6 +243,7 @@ sub parse {
$wrapped_mode = 0 if (
$paragraph =~ /^>/ms # blockquote
or $paragraph =~ /^( {8}|\t)/ms # monospaced
+ or $paragraph =~ /^\$(\S+[{}]\S*\s*)+/ms # Xapian macro
or $paragraph =~ /[<>]/ms # maybe html
or $paragraph =~ /^\s*\[\[\!\S[^\]]+$/ms # macro begin
);