Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions phpdotnet/phd/Package/Generic/XHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
),
'info' => array(
/* DEFAULT */ 'format_div',
'note' => 'span',
),
'informalexample' => 'format_div',
'informaltable' => 'format_table',
Expand Down Expand Up @@ -294,7 +293,6 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
'simplesect' => 'div',
'simpara' => array(
/* DEFAULT */ 'p',
'note' => 'span',
'listitem' => 'span',
'entry' => 'span',
'example' => 'format_example_content',
Expand Down Expand Up @@ -2042,16 +2040,16 @@ public function format_editor($open, $name, $attrs, $props) {
}
public function format_note($open, $name, $attrs, $props) {
if ($open) {
return '<blockquote class="note"><p>'.$this->admonition_title("note", $props["lang"]). ': ';
return '<div class="note">' .$this->admonition_title("note", $props["lang"]);
}
return "</p></blockquote>";
return "</div>";
}
public function format_note_title($open, $name, $attrs)
{
if ($open) {
return '<strong>';
return '<h5 class="title">';
}
return '</strong><br />';
return '</h5>';
}
public function format_example($open, $name, $attrs, $props) {
if ($open) {
Expand Down
14 changes: 14 additions & 0 deletions tests/package/generic/data/note_rendering_001.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<article xml:id="test_note" xmlns='http://docbook.org/ns/docbook'>
<title>Note rendering test</title>

<note>
<simpara>Simple note content</simpara>
</note>

<note>
<title>Custom Title</title>
<simpara>Note with a title</simpara>
</note>

</article>
33 changes: 33 additions & 0 deletions tests/package/generic/note_rendering_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
Note rendering - notes use div instead of blockquote, titles use h5, simpara uses p
--FILE--
<?php
namespace phpdotnet\phd;

require_once __DIR__ . "/../../setup.php";

$xmlFile = __DIR__ . "/data/note_rendering_001.xml";

$config->xmlFile = $xmlFile;

$format = new TestGenericChunkedXHTML($config, $outputHandler);
$render = new TestRender(new Reader($outputHandler), $config, $format);

$render->run();
?>
--EXPECT--
Filename: test_note.html
Content:
<div id="test_note" class="article">
<h1>Note rendering test</h1>

<div class="note"><strong class="note">Note</strong>
<p class="simpara">Simple note content</p>
</div>

<div class="note"><strong class="note">Note</strong>
<h5 class="title">Custom Title</h5>
<p class="simpara">Note with a title</p>
</div>

</div>