Skip to content

Commit

Permalink
sytling fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasvielmetter committed Nov 3, 2017
1 parent b0f2484 commit c91b0f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/WrkLst/DocxMustache/HtmlConversion.php
Expand Up @@ -41,15 +41,15 @@ public static function convertHtmlToOpenXMLTag($value, $tag = 'b')
$value_array[] = $tag_open_values[0];
$value_array[] = '</w:t></w:r>';

if($tag=="u") {
if ($tag=="u") {
$tag_ooxml = 'u w:val="single" ';
$loose_formatting = "";
} elseif($tag=="b"||$tag=="strong") {
$loose_formatting = '';
} elseif ($tag=="b" || $tag=="strong") {
$tag_ooxml = 'b ';
$loose_formatting = "";
} elseif($tag=="i"||$tag=="em") {
$loose_formatting = '';
} elseif ($tag=="i" || $tag=="em") {
$tag_ooxml = 'i ';
$loose_formatting = "<w:i w:val=\"0\"/>";
$loose_formatting = '<w:i w:val="0"/>';
}

//define styling parameters
Expand All @@ -58,7 +58,6 @@ public static function convertHtmlToOpenXMLTag($value, $tag = 'b')
$neutral_style = '<w:r><w:rPr>'.substr($tag_open_values[0], ($wrPr_open + 7), ($wrPr_close - ($wrPr_open + 7))).'</w:rPr><w:t xml:space="preserve">';
$tagged_style = '<w:r><w:rPr><w:'.$tag_ooxml.'/>'.str_replace($loose_formatting, '', substr($tag_open_values[0], ($wrPr_open + 7), ($wrPr_close - ($wrPr_open + 7)))).'</w:rPr><w:t xml:space="preserve">';


//open new text run and make it bold, include previous styling
$value_array[] = $tagged_style;
//get everything before bold close and after
Expand Down
1 change: 1 addition & 0 deletions src/WrkLst/DocxMustache/MustacheRender.php
Expand Up @@ -13,6 +13,7 @@ public static function Render($items, $mustache_template, $clean_tags = true)
$m = new \Mustache_Engine(['escape' => function ($value) {
if (str_replace('*[[DONOTESCAPE]]*', '', $value) != $value) {
$value = str_replace('&', '&amp;', $value);

return str_replace('*[[DONOTESCAPE]]*', '', $value);
}

Expand Down

0 comments on commit c91b0f1

Please sign in to comment.