Skip to content

Commit 84d4e50

Browse files
committed
fix references & directives
1 parent 51df7d9 commit 84d4e50

File tree

16 files changed

+43
-31
lines changed

16 files changed

+43
-31
lines changed

_build/notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Changes needed in symfony.com
88
- `<p>` added to `.. seealso::` directive
99
- `versionadded` dom changed
1010
- toc level `.toctree-lX` class has disappeared (was it needed ?)
11+
- toc item: link: `.internal-reference` has gone
1112

1213
Notes
1314
=====

_build/src/JsonGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace SymfonyDocs;
44

5-
use Doctrine\RST\HTML\Document;
6-
use Doctrine\RST\HTML\Environment;
7-
use Doctrine\RST\MetaEntry;
5+
use Doctrine\RST\Environment;
6+
use Doctrine\RST\Meta\MetaEntry;
7+
use Doctrine\RST\Nodes\DocumentNode;
88
use Symfony\Component\Console\Helper\ProgressBar;
99
use Symfony\Component\DomCrawler\Crawler;
1010
use Symfony\Component\Filesystem\Filesystem;
@@ -21,7 +21,7 @@ class JsonGenerator
2121
public function __construct(array $documents)
2222
{
2323
$this->environments = array_map(
24-
function (Document $document) {
24+
function (DocumentNode $document) {
2525
return $document->getEnvironment();
2626
},
2727
$documents

_build/src/Nodes/SpanNode.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public function literal(string $text): string
1313

1414
public function link(?string $url, string $title, array $attributes = []): string
1515
{
16-
if (isset($attributes['is-ref'])) {
16+
if (isset($attributes['isRef'])) {
1717
$title = '<span>'.$title.'</span>';
18-
unset($attributes['is-ref']);
18+
unset($attributes['isRef']);
1919
}
20-
if (isset($attributes['is-doc'])) {
20+
if (isset($attributes['isDoc'])) {
2121
$title = '<em>'.$title.'</em>';
22-
unset($attributes['is-doc']);
22+
unset($attributes['isDoc']);
2323
}
2424

2525
if (!$attributes) {

_build/src/Reference/DocReference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getName() : string
2828

2929
public function resolve(Environment $environment, string $data) : ResolvedReference
3030
{
31-
return $this->resolver->resolve($environment, $data, ['class' => 'reference internal', 'is-doc' => true]);
31+
return $this->resolver->resolve($environment, $data, ['class' => 'reference internal', 'domElement' => 'em']);
3232
}
3333

3434
public function found(Environment $environment, string $data) : void

_build/src/Reference/RefReference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function getName(): string
1717
public function resolve(Environment $environment, string $data): ResolvedReference
1818
{
1919
$resolver = new Resolver();
20-
$resolvedReference = $resolver->resolve($environment, $data, ['class' => 'reference internal', 'is-ref' => true]);
20+
$resolvedReference = $resolver->resolve($environment, $data, ['class' => 'reference internal', 'domElement' => 'span']);
2121
if (!$resolvedReference) {
2222
throw new \RuntimeException(sprintf('Reference "%s" could not be resolved', $data));
2323
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
<a href="{{ url|raw }}"{% for key, value in attributes %} {{ key }}="{{ value }}"{% endfor %}>{{ title|raw }}</a>
1+
{% set domElement = attributes.domElement|default %}
2+
<a href="{{ url|raw }}"{% for key, value in attributes if key != 'domElement' %} {{ key }}="{{ value }}"{% endfor %}>
3+
{% if domElement %}<{{ domElement }}>{% endif %}{{ title|raw }}{% if domElement %}</{{ domElement }}>{% endif %}
4+
</a>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<li>{{ text|raw }}</li>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<{{ keyword }}>
1+
<{{ keyword }} class="simple">
22
</{{ keyword }}>

_build/src/Templates/default/html/table.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
<tbody valign="top">
1313
{% for tableRow in tableRows %}
14-
<tr class="row-{{ loop.index0 is odd ? 'odd' : 'even' }}">
14+
{% set index = tableHeader ? loop.index0 : loop.index %}
15+
<tr class="row-{{ index is odd ? 'odd' : 'even' }}">
1516
{% for value in tableRow %}
1617
<td>{{ value|raw }}</td>
1718
{% endfor %}

_build/tests/fixtures/expected/blocks/references/class.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.html" class="reference external" title="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel">ContainerAwareHttpKernel</a></p>
7+
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.html" class="reference external" title="Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel">
8+
ContainerAwareHttpKernel</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/blocks/references/method.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation/RequestStack.html#method_getCurrentRequest" class="reference external" title="Symfony\Component\HttpFoundation\RequestStack::getCurrentRequest()">getCurrentRequest()</a></p>
7+
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation/RequestStack.html#method_getCurrentRequest" class="reference external" title="Symfony\Component\HttpFoundation\RequestStack::getCurrentRequest()">
8+
getCurrentRequest()</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/blocks/references/namespace.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation.html" class="reference external" title="Symfony\Component\HttpFoundation">HttpFoundation</a></p>
7+
<p><a href="https://api.symfony.com/4.0/Symfony/Component/HttpFoundation.html" class="reference external" title="Symfony\Component\HttpFoundation">
8+
HttpFoundation</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/blocks/references/php-class.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://secure.php.net/manual/en/class.arrayaccess.php" class="reference external" title="ArrayAccess">ArrayAccess</a></p>
7+
<p><a href="https://secure.php.net/manual/en/class.arrayaccess.php" class="reference external" title="ArrayAccess">
8+
ArrayAccess</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/blocks/references/php-function.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://secure.php.net/manual/en/function.trigger-error.php" class="reference external" title="trigger_error">trigger_error</a></p>
7+
<p><a href="https://secure.php.net/manual/en/function.trigger-error.php" class="reference external" title="trigger_error">
8+
trigger_error</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/blocks/references/php-method.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="utf-8" />
55
</head>
66
<body>
7-
<p><a href="https://secure.php.net/manual/en/locale.getdefault.php" class="reference external" title="Locale">Locale::getDefault()</a></p>
7+
<p><a href="https://secure.php.net/manual/en/locale.getdefault.php" class="reference external" title="Locale">
8+
Locale::getDefault()</a></p>
89
</body>
910
</html>

_build/tests/fixtures/expected/toctree/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@
77
<h1 id="toctree">Toctree<a class="headerlink" href="#toctree" title="Permalink to this headline"></a></h1>
88
<div class="toctree-wrapper compound">
99
<ul>
10-
<li><a class="reference internal" href="file.html">Title</a>
10+
<li><a href="file.html#title">Title</a>
1111
<ul>
12-
<li><a class="reference internal" href="file.html#sub-title">Sub title</a></li>
12+
<li><a href="file.html#sub-title">Sub title</a></li>
1313
</ul>
1414
</li>
1515
</ul>
1616
</div>
1717
<div class="toctree-wrapper compound">
1818
<ul>
19-
<li><a class="reference internal" href="file.html">Title</a></li>
19+
<li><a href="file.html#title">Title</a></li>
2020
</ul>
2121
</div>
2222
<div class="toctree-wrapper compound">
2323
<ul>
24-
<li><a class="reference internal" href="directory/another_file.html">Another file</a></li>
24+
<li><a href="directory/another_file.html#another-file">Another file</a></li>
2525
</ul>
2626
</div>
2727
<div class="toctree-wrapper compound">
2828
<ul>
29-
<li><a class="reference internal" href="index.html">Toctree</a></li>
30-
<li><a class="reference internal" href="directory/another_file.html">Another file</a></li>
31-
<li><a class="reference internal" href="file.html">Title</a>
29+
<li><a href="index.html#toctree">Toctree</a></li>
30+
<li><a href="directory/another_file.html#another-file">Another file</a></li>
31+
<li><a href="file.html#title">Title</a>
3232
<ul>
33-
<li><a class="reference internal" href="file.html#sub-title">Sub title</a></li>
33+
<li><a href="file.html#sub-title">Sub title</a></li>
3434
</ul>
3535
</li>
3636
</ul>
3737
</div>
3838
<div class="toctree-wrapper compound">
3939
<ul>
40-
<li><a class="reference internal" href="file.html">Title</a>
40+
<li><a href="file.html#title">Title</a>
4141
<ul>
42-
<li><a class="reference internal" href="file.html#sub-title">Sub title</a></li>
42+
<li><a href="file.html#sub-title">Sub title</a></li>
4343
</ul>
4444
</li>
45-
<li><a class="reference internal" href="index.html">Toctree</a></li>
46-
<li><a class="reference internal" href="directory/another_file.html">Another file</a></li>
45+
<li><a href="index.html#toctree">Toctree</a></li>
46+
<li><a href="directory/another_file.html#another-file">Another file</a></li>
4747
</ul>
4848
</div>
4949
</body>

0 commit comments

Comments
 (0)