-
-
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] Convert basic mark-down into restructured Text
* headlines * paragpraphs * links * lists
- Loading branch information
Showing
26 changed files
with
266 additions
and
60 deletions.
There are no files selected for viewing
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
1 change: 0 additions & 1 deletion
1
packages/guides-theme-rst/resources/template/rst/body/anchor.rst.twig
This file was deleted.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
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,4 +1,3 @@ | ||
\lstset{language={{ node.language }}{{ '}'}} | ||
\begin{lstlisting} | ||
``` | ||
{{ node.value|raw }} | ||
\end{lstlisting} | ||
``` |
1 change: 0 additions & 1 deletion
1
packages/guides-theme-rst/resources/template/rst/body/image.rst.twig
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/guides-theme-rst/resources/template/rst/body/list/list-item.rst.twig
This file was deleted.
Oops, something went wrong.
21 changes: 9 additions & 12 deletions
21
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,12 +1,9 @@ | ||
{% set keyword = 'itemize' %} | ||
|
||
{% if node.isOrdered %} | ||
{% set enumerate = 'ol' %} | ||
{% endif %} | ||
|
||
|
||
\begin{{ '{' }}{{ keyword }}{{ '}' }} | ||
{% for item in node.items %} | ||
{{ renderNode(item) }} | ||
{% endfor %} | ||
\end{{ '{' }}{{ keyword }}{{ '}' }} | ||
{% if node.isOrdered -%} | ||
{%- for item in node.value -%} | ||
#. {{ renderNode(item.value)|raw }}{{ "\n\n" }} | ||
{% endfor -%} | ||
{%- else -%} | ||
{%- for item in node.value -%} | ||
* {{ renderNode(item.value)|raw }}{{ "\n" }} | ||
{%- endfor -%} | ||
{%- endif -%} |
3 changes: 1 addition & 2 deletions
3
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,5 +1,4 @@ | ||
{%- set text = renderNode(node.value) -%} | ||
|
||
{%- set text = renderNode(node.value)|raw -%} | ||
{%- if text|trim %} | ||
{{- text|raw -}} | ||
{% endif -%} |
4 changes: 1 addition & 3 deletions
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,3 +1 @@ | ||
\begin{quotation} | ||
{{ renderNode(node.value) }} | ||
\end{quotation} | ||
{{ renderNode(node.value) }} |
2 changes: 1 addition & 1 deletion
2
packages/guides-theme-rst/resources/template/rst/body/separator.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 @@ | ||
\ \ | ||
==== |
4 changes: 0 additions & 4 deletions
4
packages/guides-theme-rst/resources/template/rst/body/toc/toc.rst.twig
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. figure:: {{ node.url }} | ||
:alt: {{ node.altText }} |
7 changes: 7 additions & 0 deletions
7
packages/guides-theme-rst/resources/template/rst/inline/link.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{%- if node.url -%} | ||
`{{ node.value|raw }} <{{- node.url -}}>`__ | ||
{%- elseif node.targetReference -%} | ||
:doc:`{{ node.value|raw }} <{{- node.targetReference -}}>` | ||
{%- else -%} | ||
{{- node.value -}} | ||
{%- endif -%} |
2 changes: 1 addition & 1 deletion
2
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 +1 @@ | ||
\texttt{{ '{' }}{{- node.value -}}{{ '}' }} | ||
`{{- node.value -}}` |
2 changes: 1 addition & 1 deletion
2
packages/guides-theme-rst/resources/template/rst/inline/plain-text.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 @@ | ||
{{- node.value -}} | ||
{{- node.value|raw -}} |
4 changes: 0 additions & 4 deletions
4
packages/guides-theme-rst/resources/template/rst/inline/textroles/generic.rst.twig
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/guides-theme-rst/resources/template/rst/inline/textroles/unknown.rst.twig
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
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,3 @@ | ||
{% for child in node.children %} | ||
{{ renderNode(child) }} | ||
{% endfor %} | ||
{% for child in node.children -%} | ||
{{- renderNode(child) -}} | ||
{%- endfor %} |
14 changes: 1 addition & 13 deletions
14
packages/guides-theme-rst/resources/template/rst/structure/header-title.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,13 +1 @@ | ||
{%- set headingLevel = node.level -%} | ||
{% if headingLevel == 1 %} | ||
=== | ||
{{ renderNode(node.value)) }} | ||
=== | ||
{% elseif headingLevel == 2 %} | ||
{% elseif headingLevel == 3 %} | ||
{% elseif headingLevel == 4 %} | ||
{% elseif headingLevel == 5 %} | ||
{% elseif headingLevel == 6 %} | ||
{{- renderNode(node.value) -}} | ||
{% endif %} | ||
|
||
{{ renderRstTitle(node, renderNode(node.value)) }} |
5 changes: 2 additions & 3 deletions
5
packages/guides-theme-rst/resources/template/rst/structure/project.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,3 @@ | ||
|
||
{%- for document in documents -%} | ||
{{ renderNode(document) }} | ||
{%- for document in documents %} | ||
{{- renderNode(document) }} | ||
{%- endfor -%} |
7 changes: 4 additions & 3 deletions
7
packages/guides-theme-rst/resources/template/rst/structure/section.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,4 @@ | ||
{% for childNode in node.children %} | ||
{{ renderNode(childNode) }} | ||
{% endfor %} | ||
{% for childNode in node.children -%} | ||
{{- renderNode(childNode) }} | ||
|
||
{% endfor -%} |
32 changes: 32 additions & 0 deletions
32
packages/guides-theme-rst/src/RstTheme/Configuration/HeaderSyntax.php
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 @@ | ||
<?php | ||
|
||
namespace phpDocumentor\Guides\RstTheme\Configuration; | ||
|
||
enum HeaderSyntax: int | ||
{ | ||
case H1 = 1; | ||
case H2 = 2; | ||
case H3 = 3; | ||
case H4 = 4; | ||
case H5 = 5; | ||
case H6 = 6; | ||
public function delimiter(): string | ||
{ | ||
return match($this) | ||
Check failure on line 15 in packages/guides-theme-rst/src/RstTheme/Configuration/HeaderSyntax.php GitHub Actions / Coding Standards
|
||
{ | ||
HeaderSyntax::H1, HeaderSyntax::H2 => '=', | ||
HeaderSyntax::H3 => '-', | ||
HeaderSyntax::H4 => '~', | ||
HeaderSyntax::H5 => '#', | ||
HeaderSyntax::H6 => '*', | ||
}; | ||
} | ||
public function hasTopDelimiter(): bool | ||
{ | ||
return match($this) | ||
{ | ||
HeaderSyntax::H1 => true, | ||
default => false, | ||
}; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
packages/guides-theme-rst/src/RstTheme/Twig/RstExtension.php
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,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link https://phpdoc.org | ||
*/ | ||
|
||
namespace phpDocumentor\Guides\RstTheme\Twig; | ||
|
||
use League\Flysystem\Exception; | ||
use League\Uri\Uri; | ||
use League\Uri\UriInfo; | ||
use LogicException; | ||
use phpDocumentor\Guides\Meta\InternalTarget; | ||
use phpDocumentor\Guides\Meta\Target; | ||
use phpDocumentor\Guides\NodeRenderers\NodeRenderer; | ||
use phpDocumentor\Guides\Nodes\BreadCrumbNode; | ||
use phpDocumentor\Guides\Nodes\Node; | ||
use phpDocumentor\Guides\Nodes\TitleNode; | ||
use phpDocumentor\Guides\ReferenceResolvers\DocumentNameResolverInterface; | ||
use phpDocumentor\Guides\RenderContext; | ||
use phpDocumentor\Guides\Renderer\UrlGenerator\UrlGeneratorInterface; | ||
use phpDocumentor\Guides\RstTheme\Configuration\HeaderSyntax; | ||
use phpDocumentor\Guides\Twig\GlobalMenuExtension; | ||
use Psr\Log\LoggerInterface; | ||
use RuntimeException; | ||
use Stringable; | ||
use Twig\Extension\AbstractExtension; | ||
use Twig\TwigFunction; | ||
use Twig\TwigTest; | ||
|
||
use function sprintf; | ||
use function trim; | ||
|
||
final class RstExtension extends AbstractExtension | ||
{ | ||
|
||
/** @param NodeRenderer<Node> $nodeRenderer */ | ||
public function __construct( | ||
private readonly NodeRenderer $nodeRenderer, | ||
) { | ||
$this->menuExtension = new GlobalMenuExtension($this->nodeRenderer); | ||
Check failure on line 48 in packages/guides-theme-rst/src/RstTheme/Twig/RstExtension.php GitHub Actions / Static analysis / Static Code Analysis (8.2)UndefinedThisPropertyAssignment
|
||
} | ||
|
||
/** @return TwigFunction[] */ | ||
public function getFunctions(): array | ||
{ | ||
return [ | ||
new TwigFunction('renderRstTitle', $this->renderRstTitle(...), ['is_safe' => ['rst'], 'needs_context' => false]), | ||
]; | ||
} | ||
|
||
public function renderRstTitle(TitleNode $node, string $content): string | ||
{ | ||
$headerSyntax = HeaderSyntax::from(min($node->getLevel(), 6)); | ||
$ret = ''; | ||
if ($headerSyntax->hasTopDelimiter()) { | ||
$ret .= str_repeat($headerSyntax->delimiter(), strlen($content))."\n"; | ||
} | ||
$ret .= $content ."\n" . str_repeat($headerSyntax->delimiter(), strlen($content)); | ||
return $ret; | ||
} | ||
} |
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
65 changes: 65 additions & 0 deletions
65
tests/Integration/tests-full/md-to-rst/md-to-rst-list-link/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,65 @@ | ||
========================================= | ||
TYPO3 Extension powermail - Documentation | ||
========================================= | ||
|
||
This documentation helps | ||
|
||
* Administrators to install and configure powermail | ||
* Editors to use powermail | ||
* Developers to extend powermail | ||
|
||
|
||
Example Screenshots | ||
=================== | ||
|
||
Frontend: Show a form with different field types | ||
------------------------------------------------ | ||
|
||
.. figure:: Images/frontend1.png | ||
:alt: Example form | ||
|
||
Example Form with Input, Textarea, Select, Multiselect, Checkboxes, Radiobuttons, and Submit | ||
|
||
|
||
|
||
Frontend: Multistep Form | ||
------------------------ | ||
|
||
.. figure:: Images/frontend2.png | ||
:alt: Example form2 | ||
|
||
Example Multistep Form with clientside validation | ||
|
||
|
||
|
||
Backend: Mail Listing | ||
--------------------- | ||
|
||
.. figure:: Images/backend1.png | ||
:alt: backend1 | ||
|
||
Manage the delivered mails with a fulltext search and some export possibilities | ||
|
||
|
||
|
||
Backend: Reporting | ||
------------------ | ||
|
||
.. figure:: Images/backend2.png | ||
:alt: backend2 | ||
|
||
See the reporting about the delivered mails (Form or Marketing Data Analyses are possible) | ||
|
||
|
||
|
||
|
||
|
||
Documentation overview | ||
====================== | ||
|
||
* `Introduction <https://github.com/in2code-de/powermail/blob/develop/Documentation/Readme.md>`__ | ||
* `Documentation for editors <https://github.com/in2code-de/powermail/blob/develop/Documentation/ForEditors/Readme.md>`__ | ||
|
||
|
||
|
||
|
11 changes: 11 additions & 0 deletions
11
tests/Integration/tests-full/md-to-rst/md-to-rst-list-link/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> |
41 changes: 41 additions & 0 deletions
41
tests/Integration/tests-full/md-to-rst/md-to-rst-list-link/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,41 @@ | ||
# TYPO3 Extension powermail - Documentation | ||
|
||
This documentation helps | ||
* Administrators to install and configure powermail | ||
* Editors to use powermail | ||
* Developers to extend powermail | ||
|
||
## Example Screenshots | ||
|
||
|
||
### Frontend: Show a form with different field types | ||
|
||
![Example form](Images/frontend1.png "Example Form") | ||
|
||
Example Form with Input, Textarea, Select, Multiselect, Checkboxes, Radiobuttons, and Submit | ||
|
||
|
||
### Frontend: Multistep Form | ||
|
||
![Example form2](Images/frontend2.png "Example Form with validation") | ||
|
||
Example Multistep Form with clientside validation | ||
|
||
### Backend: Mail Listing | ||
|
||
![backend1](Images/backend1.png) | ||
|
||
Manage the delivered mails with a fulltext search and some export possibilities | ||
|
||
|
||
### Backend: Reporting | ||
|
||
![backend2](Images/backend2.png) | ||
|
||
See the reporting about the delivered mails (Form or Marketing Data Analyses are possible) | ||
|
||
|
||
## Documentation overview | ||
|
||
* [Introduction](https://github.com/in2code-de/powermail/blob/develop/Documentation/Readme.md) | ||
* [Documentation for editors](https://github.com/in2code-de/powermail/blob/develop/Documentation/ForEditors/Readme.md) |