Skip to content

Commit 7326397

Browse files
committed
[TASK] Move directives topic and wrap to GeneralDirectiveNode
Add Integration tests for them and move the themes to guides-restructured text, these are rst-specific constructs
1 parent 07f584a commit 7326397

File tree

8 files changed

+80
-69
lines changed

8 files changed

+80
-69
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{#
2+
A topic is like a block quote with a title, or a self-contained section with no subsections. Use the "topic" directive to indicate a self-contained idea that is separate from the flow of the document. Topics may occur anywhere a section or transition may occur. Body elements and topics may not contain nested topics.
3+
4+
The directive's sole argument is interpreted as the topic title; the next line
5+
must be blank. All subsequent lines make up the topic body, interpreted as body
6+
elements. For example:
7+
8+
.. topic:: Topic Title
9+
10+
Subsequent indented lines comprise
11+
the body of the topic, and are
12+
interpreted as body elements.
13+
14+
https://docutils.sourceforge.io/docs/ref/rst/directives.html#topic
15+
#}
16+
17+
<div class="topic{% if node.classes %} {{ node.classesString }}{% endif %}">
18+
<p class="topic-title">{{ renderNode(node.content) }}</p>
19+
{{ renderNode(node.value) }}
20+
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{%- if node.classes %}
2+
<div class="{{ node.classesString }}">{{ renderNode(node.value) }}</div>
3+
{% else %}
4+
{{ renderNode(node.value) }}
5+
{% endif -%}

packages/guides-restructured-text/src/RestructuredText/Directives/TopicDirective.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/guides-restructured-text/src/RestructuredText/Directives/WrapDirective.php

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Directive tests</title>
5+
6+
</head>
7+
<body>
8+
<div class="section" id="directive-tests">
9+
<h1>Directive tests</h1>
10+
11+
12+
<div class="topic someclass">
13+
<p class="topic-title">This is the <strong>topic</strong></p>
14+
<p>Lorem Ipsum Dolor</p><div class="rubric">Some Rubric</div>
15+
<p>Dolor sit!</p>
16+
</div>
17+
18+
</div>
19+
20+
</body>
21+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Directive tests
2+
===============
3+
4+
.. topic:: This is the **topic**
5+
:class: someClass
6+
7+
Lorem Ipsum Dolor
8+
9+
.. rubric:: Some Rubric
10+
11+
Dolor sit!
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Directive tests</title>
5+
6+
</head>
7+
<body>
8+
<div class="section" id="directive-tests">
9+
<h1>Directive tests</h1>
10+
11+
<div class="someclass"><p>Lorem Ipsum Dolor</p></div>
12+
13+
</div>
14+
15+
</body>
16+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Directive tests
2+
===============
3+
4+
.. wrap::
5+
:class: someClass
6+
7+
Lorem Ipsum Dolor

0 commit comments

Comments
 (0)