-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Create a rst theme to convert markdown
Convert basic mark-down into restructured Text * blockquote
- Loading branch information
Showing
20 changed files
with
144 additions
and
60 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/guides-theme-rst/resources/template/rst/body/code.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.. code-block:: plaintext | ||
|
||
{{ renderRstIndent(node.value|raw, 1)|raw }} | ||
{{ "\n" }} | ||
{{ "\n" }} | ||
|
6 changes: 4 additions & 2 deletions
6
packages/guides-theme-rst/resources/template/rst/body/list/list.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
{{ "\n" }} | ||
{% if node.isOrdered -%} | ||
{%- for item in node.value -%} | ||
#. {{ renderNode(item.value)|raw }}{{ "\n\n" }} | ||
#. {{ renderNode(item.value)|raw }}{{ "\n" }} | ||
{% endfor -%} | ||
{%- else -%} | ||
{%- for item in node.value -%} | ||
* {{ renderNode(item.value)|raw }}{{ "\n" }} | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{%- endif %} | ||
{{ "\n" }} |
4 changes: 3 additions & 1 deletion
4
packages/guides-theme-rst/resources/template/rst/body/paragraph.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
{%- set text = renderNode(node.value)|raw -%} | ||
{% set text = renderNode(node.value)|raw -%} | ||
{%- if text|trim %} | ||
{{- text|raw -}} | ||
{% endif -%} | ||
{{ "\n" }} | ||
{{ "\n" }} |
4 changes: 3 additions & 1 deletion
4
packages/guides-theme-rst/resources/template/rst/body/quote.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{{ renderNode(node.value) }} | ||
{{ renderRstIndent(renderNode(node.value)|raw, 1)|raw }} | ||
{{ "\n" }} | ||
{{ "\n" }} |
6 changes: 4 additions & 2 deletions
6
packages/guides-theme-rst/resources/template/rst/inline/image.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.. figure:: {{ node.url }} | ||
:alt: {{ node.altText }} | ||
{{ "\n" }} | ||
.. figure:: {{ node.url|raw }} | ||
:alt: {{ node.altText|raw }} | ||
{{ "\n" }} |
2 changes: 1 addition & 1 deletion
2
packages/guides-theme-rst/resources/template/rst/inline/inline-node.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{%- for child in node.children -%} | ||
{{- renderNode(child) -}} | ||
{{- renderNode(child)|raw -}} | ||
{%- endfor -%} |
4 changes: 2 additions & 2 deletions
4
packages/guides-theme-rst/resources/template/rst/inline/literal.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{%- if node.value matches '/`/' -%} | ||
``{{- node.value -}}`` | ||
``{{- node.value|raw -}}`` | ||
{%- else -%} | ||
`{{- node.value -}}` | ||
`{{- node.value|raw -}}` | ||
{%- endif -%} |
10 changes: 7 additions & 3 deletions
10
packages/guides-theme-rst/resources/template/rst/structure/document.rst.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{% for child in node.children -%} | ||
{{- renderNode(child) -}} | ||
{%- endfor %} | ||
{%- set renderedContent -%} | ||
{%- for child in node.children -%} | ||
{{- renderNode(child) -}} | ||
{%- endfor -%} | ||
{%- endset -%} | ||
|
||
{{- renderedContent | clean_content | raw -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/Integration/tests-full/md-to-rst/blockquote-md-to-rst/expected/index.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
==================== | ||
Markdown Blockquotes | ||
==================== | ||
|
||
This is a blockquote. It can span multiple lines. | ||
|
||
Blockquotes with Multiple Paragraphs | ||
==================================== | ||
|
||
Dorothy followed her through many of the beautiful rooms in her castle. | ||
|
||
The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood. | ||
|
||
Blockquotes with Other Elements | ||
=============================== | ||
|
||
The quarterly results look great! | ||
|
||
* Revenue was off the chart. | ||
|
||
* Profits were higher than ever. | ||
|
||
*Everything* is going according to **plan**. | ||
|
||
Blockquotes Best Practices | ||
========================== | ||
|
||
Try to put a blank line before... | ||
|
||
This is a blockquote | ||
|
||
...and after a blockquote. |
11 changes: 11 additions & 0 deletions
11
tests/Integration/tests-full/md-to-rst/blockquote-md-to-rst/input/guides.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<guides xmlns="https://www.phpdoc.org/guides" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://www.phpdoc.org/guides packages/guides-cli/resources/schema/guides.xsd" | ||
input-format="md" | ||
theme="rst" | ||
> | ||
<project title="Project Title" version="6.4"/> | ||
<extension class="phpDocumentor\Guides\RstTheme"/> | ||
<output-format>rst</output-format> | ||
</guides> |
27 changes: 27 additions & 0 deletions
27
tests/Integration/tests-full/md-to-rst/blockquote-md-to-rst/input/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Markdown Blockquotes | ||
|
||
> This is a blockquote. | ||
> It can span multiple lines. | ||
## Blockquotes with Multiple Paragraphs | ||
|
||
> Dorothy followed her through many of the beautiful rooms in her castle. | ||
> | ||
> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood. | ||
## Blockquotes with Other Elements | ||
|
||
> The quarterly results look great! | ||
> | ||
> - Revenue was off the chart. | ||
> - Profits were higher than ever. | ||
> | ||
> *Everything* is going according to **plan**. | ||
## Blockquotes Best Practices | ||
|
||
Try to put a blank line before... | ||
|
||
> This is a blockquote | ||
...and after a blockquote. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ Markdown with emphasis | |
====================== | ||
|
||
*Italic* or *Italic* **Bold** or **Bold** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ Markdown with inline Code | |
Lorem Ipsum Dolor: `$dolor`... | ||
|
||
``Use `code` in your Markdown file.`` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
tests/Integration/tests/directives/directive-raw-custom-sanitizer/expected/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<!-- content start --> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
<p>Lorem Ipsum Dolor</p> | ||
<p>Dolor sit!</p> | ||
</div> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
|
||
|
||
<p>Lorem Ipsum Dolor</p> | ||
|
||
<p>Dolor sit!</p> | ||
|
||
</div> | ||
<!-- content end --> |
15 changes: 8 additions & 7 deletions
15
tests/Integration/tests/directives/directive-raw-default-sanitizer/expected/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<!-- content start --> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
<div> | ||
<p>Lorem Ipsum Dolor</p> | ||
<h2>Some Rubric</h2> | ||
<p>Dolor sit!</p> | ||
</div> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
<div> | ||
|
||
<p>Lorem Ipsum Dolor</p> | ||
<h2>Some Rubric</h2> | ||
<p>Dolor sit!</p> | ||
</div> | ||
</div> | ||
<!-- content end --> |
16 changes: 8 additions & 8 deletions
16
tests/Integration/tests/directives/directive-raw-no-sanitizer/expected/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<!-- content start --> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
<div class="someClass"> | ||
<script>alert('XSS');</script> | ||
<p>Lorem Ipsum Dolor</p> | ||
<h2>Some Rubric</h2> | ||
<p>Dolor sit!</p> | ||
</div> | ||
<div class="section" id="directive-tests"> | ||
<h1>Directive tests</h1> | ||
<div class="someClass"> | ||
<script>alert('XSS');</script> | ||
<p>Lorem Ipsum Dolor</p> | ||
<h2>Some Rubric</h2> | ||
<p>Dolor sit!</p> | ||
</div> | ||
</div> | ||
<!-- content end --> |