Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Mar 6, 2015
2 parents cb6d714 + d848cef commit 56c13de
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/Process/Headings/HeadingsProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use DomDocument;
use DomNode;
use DomNodeList;
use DomText;
use DomXpath;

class HeadingsProcess implements ProcessInterface
Expand Down Expand Up @@ -130,7 +131,11 @@ protected function addHeading(DomNode $node)
{
$heading = $this->newHeading($node);
$this->headings[] = $heading;
$node->nodeValue = $heading->getNumber() . " {$node->nodeValue}";

$number = new DOMText();
$number->nodeValue = $heading->getNumber() . ' ';
$node->insertBefore($number, $node->firstChild);

$node->setAttribute('id', $heading->getId());
}

Expand Down
2 changes: 1 addition & 1 deletion tests/BookFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class BookFixture
Text under title.
## Subtitle A
## Subtitle `code` A
Text under subtitle A.
Expand Down
2 changes: 1 addition & 1 deletion tests/Process/ConversionProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testConversion()
$this->process->__invoke($this->fixture->page);
$expect = '<h1>Title</h1>
<p>Text under title.</p>
<h2>Subtitle A</h2>
<h2>Subtitle <code>code</code> A</h2>
<p>Text under subtitle A.</p>
<h3>Sub-subtitle</h3>
<p>Text under sub-subtitle.</p>
Expand Down
2 changes: 1 addition & 1 deletion tests/Process/HeadingsProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testHeadings()
),
array(
'number' => '1.1.1.',
'title' => 'Subtitle A',
'title' => 'Subtitle <code>code</code> A',
'id' => '1.1.1',
'href' => '/chapter/section.html',
'level' => 3,
Expand Down
2 changes: 1 addition & 1 deletion tests/Process/RenderingProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testRendering()
<dl>
<dt>1.1. <a href="/chapter/section.html#1.1">Title</a></dt>
<dd><dl>
<dt>1.1.1. <a href="/chapter/section.html#1.1.1">Subtitle A</a></dt>
<dt>1.1.1. <a href="/chapter/section.html#1.1.1">Subtitle <code>code</code> A</a></dt>
<dd><dl>
<dt>1.1.1.1. <a href="/chapter/section.html#1.1.1.1">Sub-subtitle</a></dt>
</dl></dd>
Expand Down
4 changes: 2 additions & 2 deletions tests/Process/TocProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testTocIndex()
),
array(
'number' => '1.1.1.',
'title' => 'Subtitle A',
'title' => 'Subtitle <code>code</code> A',
'id' => '1.1.1',
'href' => '/chapter/section.html',
'level' => 3,
Expand Down Expand Up @@ -125,7 +125,7 @@ public function testTocRoot()
),
array(
'number' => '1.1.1.',
'title' => 'Subtitle A',
'title' => 'Subtitle <code>code</code> A',
'id' => '1.1.1',
'href' => '/chapter/section.html',
'level' => 3,
Expand Down

0 comments on commit 56c13de

Please sign in to comment.