diff --git a/ChangeLog.txt b/ChangeLog.txt
index eb88a02b..2a6a5198 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,9 @@
+2015-05-14 LarsDW223
+
+ * Added support for language and country settings. These are both taken from the property
+ 'lang', e.g. 'de-de' sets the language to german and country to germany. If there is no '-'
+ it is assumed that only the language shall be set.
+
2015-05-12 LarsDW223
* Added support for text indentation for the first line of a paragraph.
diff --git a/helper/stylefactory.php b/helper/stylefactory.php
index f3558d46..0b1c998d 100644
--- a/helper/stylefactory.php
+++ b/helper/stylefactory.php
@@ -157,6 +157,14 @@ public static function createTextStyle(&$style, $properties, $disabled_props = N
$display = $properties ['display'];
$attrs++;
}
+ if ( empty ($disabled_props ['display']) === true ) {
+ $display = $properties ['display'];
+ $attrs++;
+ }
+ if ( empty ($disabled_props ['lang']) === true ) {
+ $lang = $properties ['lang'];
+ $attrs++;
+ }
if ( empty ($parent) === false ) {
$attrs++;
}
@@ -178,6 +186,13 @@ public static function createTextStyle(&$style, $properties, $disabled_props = N
unset($odt_valign);
}
+ // Separate country from language
+ if ( empty($lang) === false ) {
+ $parts = preg_split ('/-/', $lang);
+ $lang = $parts [0];
+ $country = $parts [1];
+ }
+
// Create style name.
$style_name = self::getNewStylename ('Text');
@@ -229,6 +244,16 @@ public static function createTextStyle(&$style, $properties, $disabled_props = N
if ( empty($display) === false ) {
$style .= 'text:display="'.$display.'" ';
}
+ if ( empty($lang) === false ) {
+ $style .= 'fo:language="'.$lang.'" ';
+ $style .= 'style:language-asian="'.$lang.'" ';
+ $style .= 'style:language-complex="'.$lang.'" ';
+ }
+ if ( empty($country) === false ) {
+ $style .= 'fo:country="'.$country.'" ';
+ $style .= 'style:country-asian="'.$country.'" ';
+ $style .= 'style:country-complex="'.$country.'" ';
+ }
$style .= '/>';
$style .= '';
@@ -308,6 +333,10 @@ public static function createParagraphStyle(&$style, $properties, $disabled_prop
$display = $properties ['display'];
$attrs++;
}
+ if ( empty ($disabled_props ['lang']) === true ) {
+ $lang = $properties ['lang'];
+ $attrs++;
+ }
if ( empty ($disabled_props ['text-indent']) === true ) {
$text_indent = $properties ['text-indent'];
$attrs++;
@@ -333,6 +362,13 @@ public static function createParagraphStyle(&$style, $properties, $disabled_prop
unset($odt_valign);
}
+ // Separate country from language
+ if ( empty($lang) === false ) {
+ $parts = preg_split ('/-/', $lang);
+ $lang = $parts [0];
+ $country = $parts [1];
+ }
+
// Create style name.
$style_name = self::getNewStylename ('Paragraph');
@@ -396,6 +432,16 @@ public static function createParagraphStyle(&$style, $properties, $disabled_prop
if ( empty($display) === false ) {
$style .= 'text:display="'.$display.'" ';
}
+ if ( empty($lang) === false ) {
+ $style .= 'fo:language="'.$lang.'" ';
+ $style .= 'style:language-asian="'.$lang.'" ';
+ $style .= 'style:language-complex="'.$lang.'" ';
+ }
+ if ( empty($country) === false ) {
+ $style .= 'fo:country="'.$country.'" ';
+ $style .= 'style:country-asian="'.$country.'" ';
+ $style .= 'style:country-complex="'.$country.'" ';
+ }
$style .= '/>';
$style .= '';
diff --git a/plugin.info.txt b/plugin.info.txt
index c97dfa17..a44f3e99 100644
--- a/plugin.info.txt
+++ b/plugin.info.txt
@@ -1,7 +1,7 @@
base odt
author Andreas Gohr, Aurelien Bompard, Florian Lamml, LarsDW223
email andi@splitbrain.org, aurelien@bompard.org, infor@florian-lamml.de
-date 2015-05-12
+date 2015-05-14
name Open Document Plugin
desc Export the current Wiki page to a OpenOffice ODT file
url http://www.dokuwiki.org/plugin:odt
diff --git a/renderer.php b/renderer.php
index 5714bc39..f4e107cf 100644
--- a/renderer.php
+++ b/renderer.php
@@ -739,6 +739,7 @@ function header($text, $level, $pos){
}
function hr() {
+ $this->p_close();
$this->doc .= '';
}
@@ -913,6 +914,7 @@ function footnote_close() {
$this->doc .= '';
$this->doc .= ''.($i+1).'';
$this->doc .= '';
+ //FIXME: Can break document if paragraphs have been opened inside of $footnote!!!
$this->doc .= '';
$this->doc .= $footnote;
$this->doc .= '';