Permalink
Browse files

Fixed not pre-formatted source code sections

Highlighted source code sections used the default paragraph style.
Therefore code sections looked ugly after export to ODT because the
font was not a monospace font. This has been fixed by using the
'preformatted' paragraph style for code sections.
  • Loading branch information...
LarsGit223 committed Mar 31, 2018
1 parent ae12fb6 commit fcdbf74451ac12f8d844a2b68df4980aa0b2e27f
Showing with 11 additions and 1 deletion.
  1. +9 −1 ODT/ODTUtility.php
  2. +2 −0 renderer/page.php
View
@@ -698,6 +698,13 @@ public static function generateODTfromHTMLCode(ODTInternalParams $params, $HTMLC
$HTMLCode = preg_replace('/\n $/', '', $HTMLCode);
$HTMLCode = str_replace(' ', ' ', $HTMLCode);
// Get default paragraph style
if (!empty($options ['p_style'])) {
$p_style = $options ['p_style'];
} else {
$p_style = $params->document->getStyleName('body');
}
// Get default list style names
if (!empty($options ['list_p_style'])) {
$p_list_style = $options ['list_p_style'];
@@ -882,7 +889,8 @@ public static function generateODTfromHTMLCode(ODTInternalParams $params, $HTMLC
$params->document->paragraphClose();
break;
default:
$params->document->paragraphOpen();
$params->document->paragraphClose();
$params->document->paragraphOpen($p_style);
break;
}
View
@@ -1104,6 +1104,7 @@ protected function createGeshiListStyle () {
* @param string $language
*/
function _highlight($type, $text, $language=null) {
if (is_null($language)) {
$this->_preformatted($text, $style_name);
return;
@@ -1130,6 +1131,7 @@ function _highlight($type, $text, $language=null) {
}
$options ['list_ol_style'] = 'highlight_list_ol_style';
$options ['list_p_style'] = 'highlight_list_paragraph_style';
$options ['p_style'] = $this->document->getStyleName('preformatted');
// Open table with just one cell
$this->document->tableOpen();

0 comments on commit fcdbf74

Please sign in to comment.