├── .doctrine-project.json ├── .github └── workflows │ ├── coding-standards.yml │ ├── composer-lint.yml │ ├── continuous-integration.yml │ ├── release-on-milestone-closed.yml │ ├── static-analysis.yml │ └── website-schema.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── UPGRADE.md ├── composer.json ├── docs └── en │ ├── attribution.rst │ ├── builder.rst │ ├── configuration.rst │ ├── custom-directives.rst │ ├── customizing-rendering.rst │ ├── events.rst │ ├── formats.rst │ ├── index.rst │ ├── sidebar.rst │ └── themes.rst ├── lib ├── Builder.php ├── Builder │ ├── Copier.php │ ├── Documents.php │ ├── ParseQueue.php │ ├── ParseQueueProcessor.php │ └── Scanner.php ├── Configuration.php ├── Directives │ ├── Admonition.php │ ├── CodeBlock.php │ ├── Directive.php │ ├── Dummy.php │ ├── Raw.php │ ├── Replace.php │ ├── SubDirective.php │ ├── Tip.php │ └── Toctree.php ├── Environment.php ├── Error.php ├── ErrorManager.php ├── Event │ ├── BuildEvent.php │ ├── OnLinkParsedEvent.php │ ├── PostBuildRenderEvent.php │ ├── PostNodeCreateEvent.php │ ├── PostNodeRenderEvent.php │ ├── PostParseDocumentEvent.php │ ├── PreBuildParseEvent.php │ ├── PreBuildRenderEvent.php │ ├── PreBuildScanEvent.php │ ├── PreNodeRenderEvent.php │ └── PreParseDocumentEvent.php ├── Exception │ └── InvalidTableStructure.php ├── FileIncluder.php ├── Formats │ ├── Format.php │ └── InternalFormat.php ├── HTML │ ├── Directives │ │ ├── ClassDirective.php │ │ ├── Div.php │ │ ├── Figure.php │ │ ├── Image.php │ │ ├── Meta.php │ │ ├── Stylesheet.php │ │ ├── Title.php │ │ ├── Url.php │ │ └── Wrap.php │ ├── HTMLFormat.php │ └── Renderers │ │ ├── AnchorNodeRenderer.php │ │ ├── CodeNodeRenderer.php │ │ ├── DefinitionListNodeRenderer.php │ │ ├── DocumentNodeRenderer.php │ │ ├── FigureNodeRenderer.php │ │ ├── ImageNodeRenderer.php │ │ ├── ListNodeRenderer.php │ │ ├── MetaNodeRenderer.php │ │ ├── ParagraphNodeRenderer.php │ │ ├── QuoteNodeRenderer.php │ │ ├── SectionBeginNodeRenderer.php │ │ ├── SectionEndNodeRenderer.php │ │ ├── SeparatorNodeRenderer.php │ │ ├── SpanNodeRenderer.php │ │ ├── TableNodeRenderer.php │ │ ├── TitleNodeRenderer.php │ │ └── TocNodeRenderer.php ├── InvalidLink.php ├── Kernel.php ├── LaTeX │ ├── Directives │ │ ├── Image.php │ │ ├── LaTeXMain.php │ │ ├── Meta.php │ │ ├── Stylesheet.php │ │ ├── Title.php │ │ ├── Url.php │ │ └── Wrap.php │ ├── LaTeXFormat.php │ └── Renderers │ │ ├── AnchorNodeRenderer.php │ │ ├── CodeNodeRenderer.php │ │ ├── DocumentNodeRenderer.php │ │ ├── ImageNodeRenderer.php │ │ ├── LaTexMainNodeRenderer.php │ │ ├── ListNodeRenderer.php │ │ ├── MetaNodeRenderer.php │ │ ├── ParagraphNodeRenderer.php │ │ ├── QuoteNodeRenderer.php │ │ ├── SeparatorNodeRenderer.php │ │ ├── SpanNodeRenderer.php │ │ ├── TableNodeRenderer.php │ │ ├── TitleNodeRenderer.php │ │ └── TocNodeRenderer.php ├── Meta │ ├── CachedMetasLoader.php │ ├── MetaEntry.php │ └── Metas.php ├── NodeFactory │ ├── DefaultNodeFactory.php │ ├── NodeFactory.php │ └── NodeInstantiator.php ├── Nodes │ ├── AnchorNode.php │ ├── BlockNode.php │ ├── CallableNode.php │ ├── CodeNode.php │ ├── DefinitionListNode.php │ ├── DocumentNode.php │ ├── DummyNode.php │ ├── FigureNode.php │ ├── ImageNode.php │ ├── ListNode.php │ ├── MainNode.php │ ├── MetaNode.php │ ├── Node.php │ ├── NodeTypes.php │ ├── ParagraphNode.php │ ├── QuoteNode.php │ ├── RawNode.php │ ├── SectionBeginNode.php │ ├── SectionEndNode.php │ ├── SeparatorNode.php │ ├── SpanNode.php │ ├── Table │ │ ├── TableColumn.php │ │ └── TableRow.php │ ├── TableNode.php │ ├── TitleNode.php │ ├── TocNode.php │ └── WrapperNode.php ├── Parser.php ├── Parser │ ├── Buffer.php │ ├── DefinitionList.php │ ├── DefinitionListTerm.php │ ├── Directive.php │ ├── DirectiveOption.php │ ├── DocumentParser.php │ ├── LineChecker.php │ ├── LineDataParser.php │ ├── Lines.php │ ├── Link.php │ ├── ListItem.php │ ├── State.php │ ├── TableParser.php │ └── TableSeparatorLineConfig.php ├── References │ ├── Doc.php │ ├── Reference.php │ ├── ResolvedReference.php │ └── Resolver.php ├── Renderers │ ├── CallableNodeRenderer.php │ ├── CallableNodeRendererFactory.php │ ├── DefaultNodeRenderer.php │ ├── DocumentNodeRenderer.php │ ├── FormatListRenderer.php │ ├── FullDocumentNodeRenderer.php │ ├── NodeRenderer.php │ ├── NodeRendererFactory.php │ ├── RenderedNode.php │ ├── SpanNodeRenderer.php │ └── SpanRenderer.php ├── Span │ ├── SpanProcessor.php │ └── SpanToken.php ├── Templates │ ├── TemplateEngineAdapter.php │ ├── TemplateRenderer.php │ ├── TwigAdapter.php │ ├── TwigEnvironmentFactory.php │ ├── TwigTemplateRenderer.php │ └── default │ │ ├── html │ │ ├── anchor.html.twig │ │ ├── br.html.twig │ │ ├── bullet-list.html.twig │ │ ├── code.html.twig │ │ ├── definition-list.html.twig │ │ ├── div-open.html.twig │ │ ├── document.html.twig │ │ ├── emphasis.html.twig │ │ ├── enumerated-list.html.twig │ │ ├── favicon.html.twig │ │ ├── figure.html.twig │ │ ├── header-title.html.twig │ │ ├── image.html.twig │ │ ├── javascript.html.twig │ │ ├── layout.html.twig │ │ ├── link.html.twig │ │ ├── list-item.html.twig │ │ ├── literal.html.twig │ │ ├── meta.html.twig │ │ ├── nbsp.html.twig │ │ ├── paragraph.html.twig │ │ ├── quote.html.twig │ │ ├── section-begin.html.twig │ │ ├── section-end.html.twig │ │ ├── separator.html.twig │ │ ├── strong-emphasis.html.twig │ │ ├── stylesheet-link.html.twig │ │ ├── table.html.twig │ │ ├── title.html.twig │ │ ├── toc-item.html.twig │ │ ├── toc-level.html.twig │ │ └── toc.html.twig │ │ └── tex │ │ ├── anchor.tex.twig │ │ ├── br.tex.twig │ │ ├── bullet-list.tex.twig │ │ ├── code.tex.twig │ │ ├── document.tex.twig │ │ ├── emphasis.tex.twig │ │ ├── enumerated-list.tex.twig │ │ ├── image.tex.twig │ │ ├── link.tex.twig │ │ ├── list-item.tex.twig │ │ ├── literal.tex.twig │ │ ├── meta.tex.twig │ │ ├── nbsp.tex.twig │ │ ├── paragraph.tex.twig │ │ ├── quote.tex.twig │ │ ├── separator.tex.twig │ │ ├── strong-emphasis.tex.twig │ │ ├── title.tex.twig │ │ └── toc.tex.twig ├── Toc │ ├── GlobSearcher.php │ └── ToctreeBuilder.php └── UrlGenerator.php ├── phpcs.xml.dist ├── phpstan.neon.dist ├── phpunit.xml.dist └── tests ├── BaseBuilderTest.php ├── Builder ├── BuilderTest.php ├── CopierTest.php ├── DocumentsTest.php ├── ParseQueueProcessorTest.php ├── ParseQueueTest.php ├── ScannerTest.php └── input │ ├── another.rst │ ├── file.txt │ ├── index.rst │ ├── introduction.rst │ ├── link-to-index.rst │ ├── subdir │ ├── file.rst │ ├── include.rst.inc │ ├── index.rst │ └── toc.rst │ ├── subdirective.rst │ ├── toc-glob-reversed.rst │ └── toc-glob.rst ├── BuilderCustomScannerFinder ├── BuilderCustomScannerFinderTest.php └── input │ ├── index.rst │ ├── path1 │ └── file1.rst │ └── path2 │ └── file2.rst ├── BuilderInclude ├── BuilderIncludeTest.php └── input │ ├── file.rst │ ├── include.rst.inc │ └── index.rst ├── BuilderInvalidReferences ├── BuilderInvalidReferencesTest.php └── input │ ├── index.rst │ └── reference.rst ├── BuilderMalformedReference ├── BuilderMalformedReferenceTest.php └── input │ ├── index.rst │ └── subdir │ ├── another.rst │ └── index.rst ├── BuilderReferenceDoesNotExist ├── BuilderReferenceDoesNotExistTest.php └── input │ ├── index.rst │ └── subdir │ └── index.rst ├── BuilderReferences ├── BuilderReferencesTest.php ├── expected │ ├── index.html │ └── reference │ │ └── page.html └── input │ ├── index.rst │ ├── reference.rst │ └── reference │ ├── page.rst │ └── page1.rst ├── BuilderToctree ├── BuilderTocTreeTest.php └── input │ ├── index.rst │ ├── orphaned │ └── file.rst │ ├── subdir │ └── toctree.rst │ └── wildcards │ ├── bugfix1.rst │ ├── feature1.rst │ ├── feature2.rst │ └── index.rst ├── BuilderUrl ├── BuilderUrlTest.php └── input │ ├── index.rst │ └── subdir │ ├── file.rst │ └── index.rst ├── BuilderWithErrors ├── BuilderWithErrorsTest.php └── input │ ├── index.rst │ └── no_content_directive.rst ├── ConfigurationTest.php ├── DefaultNodeFactoryTest.php ├── EnvironmentTest.php ├── ErrorManagerTest.php ├── FileIncluderTest.php ├── Functional ├── FunctionalTest.php └── tests │ ├── build │ ├── toctree-titlesonly │ │ ├── index.html │ │ ├── index.rst │ │ ├── page1.rst │ │ └── page2.rst │ └── toctree │ │ ├── index.html │ │ ├── index.rst │ │ ├── page1.rst │ │ └── page2.rst │ └── render │ ├── anchor-failure │ ├── anchor-failure.html │ └── anchor-failure.rst │ ├── anchor │ ├── anchor.html │ ├── anchor.rst │ └── anchor.tex │ ├── anonymous │ ├── anonymous.html │ ├── anonymous.rst │ └── anonymous.tex │ ├── bom │ ├── bom.html │ └── bom.rst │ ├── class-directive │ ├── class-directive.html │ └── class-directive.rst │ ├── code-block-diff │ ├── code-block-diff.html │ └── code-block-diff.rst │ ├── code-block-lastline │ ├── code-block-lastline.html │ └── code-block-lastline.rst │ ├── code-block │ ├── code-block.html │ └── code-block.rst │ ├── code-java │ ├── code-java.html │ └── code-java.rst │ ├── code-list │ ├── code-list.html │ └── code-list.rst │ ├── code-with-whitespace │ ├── code-with-whitespace.html │ └── code-with-whitespace.rst │ ├── code │ ├── code.html │ ├── code.rst │ └── code.tex │ ├── comment-3 │ ├── comment-3.html │ └── comment-3.rst │ ├── comment-empty │ ├── comment-empty.html │ └── comment-empty.rst │ ├── comment │ ├── comment.html │ └── comment.rst │ ├── comments-block-with-header │ ├── comments-block-with-header.html │ └── comments-block-with-header.rst │ ├── comments-block │ ├── comments-block.html │ └── comments-block.rst │ ├── comments │ ├── comments.html │ └── comments.rst │ ├── crlf │ ├── crlf.html │ └── crlf.rst │ ├── css │ ├── css.html │ └── css.rst │ ├── definition-list │ ├── definition-list.html │ └── definition-list.rst │ ├── div │ ├── div.html │ └── div.rst │ ├── empty-p │ ├── empty-p.html │ └── empty-p.rst │ ├── empty │ ├── empty.html │ └── empty.rst │ ├── enumerated-ignored │ ├── enumerated-ignored.html │ └── enumerated-ignored.rst │ ├── enumerated │ ├── enumerated.html │ └── enumerated.rst │ ├── escape │ ├── escape.html │ └── escape.rst │ ├── figure │ ├── figure.html │ └── figure.rst │ ├── image-follow │ ├── image-follow.html │ └── image-follow.rst │ ├── image-inline │ ├── image-inline.html │ └── image-inline.rst │ ├── image │ ├── image.html │ ├── image.rst │ └── image.tex │ ├── include-comments │ ├── comments.rst │ ├── include-comments.html │ └── include-comments.rst │ ├── include-external │ ├── include-external.html │ └── include-external.rst │ ├── italic │ ├── italic.html │ └── italic.rst │ ├── link-span │ ├── link-span.html │ └── link-span.rst │ ├── link-with-new-line-inside-list │ ├── link-with-new-line-inside-list.html │ └── link-with-new-line-inside-list.rst │ ├── link-with-new-line │ ├── link-with-new-line.html │ └── link-with-new-line.rst │ ├── link-with-no-name │ ├── link-with-no-name.html │ └── link-with-no-name.rst │ ├── link-with-special-char │ ├── link-with-special-char.html │ └── link-with-special-char.rst │ ├── links │ ├── links.html │ └── links.rst │ ├── list-alternate-syntax │ ├── list-alternate-syntax.html │ └── list-alternate-syntax.rst │ ├── list-dash │ ├── list-dash.html │ └── list-dash.rst │ ├── list-indented │ ├── list-indented.html │ └── list-indented.rst │ ├── list-mix │ ├── list-mix.html │ └── list-mix.rst │ ├── list │ ├── list.html │ ├── list.rst │ └── list.tex │ ├── literal │ ├── literal.html │ └── literal.rst │ ├── main-directive │ ├── main-directive.html │ ├── main-directive.rst │ └── main-directive.tex │ ├── nbsp │ ├── nbsp.html │ └── nbsp.rst │ ├── no-eager-literals │ ├── no-eager-literals.html │ └── no-eager-literals.rst │ ├── paragraph │ ├── paragraph.html │ ├── paragraph.rst │ └── paragraph.tex │ ├── pretty-table-col-span │ ├── pretty-table-col-span.html │ └── pretty-table-col-span.rst │ ├── pretty-table-error1 │ ├── pretty-table-error1.html │ └── pretty-table-error1.rst │ ├── pretty-table-header │ ├── pretty-table-header.html │ └── pretty-table-header.rst │ ├── pretty-table-multiline-header │ ├── pretty-table-multiline-header.html │ └── pretty-table-multiline-header.rst │ ├── pretty-table-no-header │ ├── pretty-table-no-header.html │ └── pretty-table-no-header.rst │ ├── pretty-table-row-span │ ├── pretty-table-row-span.html │ └── pretty-table-row-span.rst │ ├── quote-title │ ├── quote-title.html │ └── quote-title.rst │ ├── quote │ ├── quote.html │ ├── quote.rst │ └── quote.tex │ ├── quote2 │ ├── quote2.html │ └── quote2.rst │ ├── quote3 │ ├── quote3.html │ └── quote3.rst │ ├── raw │ ├── raw.html │ └── raw.rst │ ├── section-nesting │ ├── section-nesting.html │ └── section-nesting.rst │ ├── separator │ ├── separator.html │ ├── separator.rst │ └── separator.tex │ ├── simple-table-error1 │ ├── simple-table-error1.html │ └── simple-table-error1.rst │ ├── simple-table │ ├── simple-table.html │ └── simple-table.rst │ ├── standalone-email-addresses │ ├── standalone-email-addresses.html │ └── standalone-email-addresses.rst │ ├── standalone-hyperlinks │ ├── standalone-hyperlinks.html │ └── standalone-hyperlinks.rst │ ├── strong │ ├── strong.html │ └── strong.rst │ ├── table-grid-nested-list │ ├── table-grid-nested-list.html │ └── table-grid-nested-list.rst │ ├── table-grid-utf8 │ ├── table-grid-utf8.html │ └── table-grid-utf8.rst │ ├── table-grid │ ├── table-grid.html │ └── table-grid.rst │ ├── table-simple-indented-header │ ├── table-simple-indented-header.html │ └── table-simple-indented-header.rst │ ├── table-simple-nested-list │ ├── table-simple-nested-list.html │ └── table-simple-nested-list.rst │ ├── table-simple │ ├── table-simple.html │ ├── table-simple.rst │ └── table-simple.tex │ ├── table-simple3 │ ├── table-simple3.html │ └── table-simple3.rst │ ├── tip-multiline │ ├── tip-multiline.html │ └── tip-multiline.rst │ ├── tip │ ├── tip.html │ └── tip.rst │ ├── titles-auto │ ├── titles-auto.html │ └── titles-auto.rst │ ├── titles │ ├── titles.html │ ├── titles.rst │ └── titles.tex │ ├── unknown-directive │ ├── unknown-directive.html │ └── unknown-directive.rst │ ├── variable-wrap │ ├── variable-wrap.html │ └── variable-wrap.rst │ └── wrap │ ├── wrap.html │ └── wrap.rst ├── GlobSearcherTest.php ├── HTML ├── IndentHTMLTest.php ├── SpanTest.php └── files │ └── section-nesting.rst ├── LinkParserTest.php ├── LiteralNestedInDirective ├── BuilderTest.php ├── TipDirective.php └── input │ └── index.rst ├── Meta └── CachedMetasLoaderTest.php ├── MetasTest.php ├── NodeInstantiatorTest.php ├── Parser ├── DocumentParserTest.php ├── LineCheckerTest.php ├── LineDataParserTest.php ├── ParserTest.php ├── TableParserTest.php └── files │ ├── code-block-lastline.rst │ ├── code-block-with-options.rst │ ├── code-with-whitespace.rst │ ├── code.rst │ ├── comment.rst │ ├── definition-list.rst │ ├── directive.rst │ ├── empty.rst │ ├── include.rst │ ├── inclusion-bad.rst │ ├── inclusion-newline-include.rst │ ├── inclusion-newline.rst │ ├── inclusion-policy.rst │ ├── inclusion-scope-include.rst │ ├── inclusion-scope.rst │ ├── inclusion.rst │ ├── indented-list.rst │ ├── list-empty.rst │ ├── list.rst │ ├── mixed-titles-1.rst │ ├── mixed-titles-2.rst │ ├── multi-comment.rst │ ├── paragraph.rst │ ├── paragraphs.rst │ ├── pretty-table.rst │ ├── quote.rst │ ├── replace.rst │ ├── subdir │ └── test.rst │ ├── table.rst │ ├── title.rst │ ├── title2.rst │ └── titles.rst ├── RefInsideDirective ├── .gitignore ├── BuilderTest.php ├── VersionAddedDirective.php └── input │ ├── file.rst │ └── index.rst ├── References ├── ResolvedReferenceTest.php └── ResolverTest.php ├── Templates └── TwigEnvironmentFactoryTest.php ├── ToctreeBuilderTest.php ├── UrlGeneratorTest.php └── sphinx /.doctrine-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "active": true, 3 | "name": "RST Parser", 4 | "slug": "rst-parser", 5 | "docsSlug": "doctrine-rst-parser", 6 | "versions": [ 7 | { 8 | "name": "1.0", 9 | "branchName": "1.0.x", 10 | "slug": "latest", 11 | "upcoming": true 12 | }, 13 | { 14 | "name": "0.6", 15 | "branchName": "0.6.x", 16 | "slug": "0.6", 17 | "upcoming": true 18 | }, 19 | { 20 | "name": "0.5", 21 | "branchName": "0.5.x", 22 | "slug": "0.5", 23 | "current": true 24 | }, 25 | { 26 | "name": "0.4", 27 | "branchName": "0.4.x", 28 | "slug": "0.4", 29 | "maintained": false 30 | }, 31 | { 32 | "name": "0.3", 33 | "branchName": "0.3.x", 34 | "slug": "0.3", 35 | "maintained": false 36 | }, 37 | { 38 | "name": "0.2", 39 | "branchName": "0.2.x", 40 | "slug": "0.2", 41 | "maintained": false 42 | }, 43 | { 44 | "name": "0.1", 45 | "branchName": "0.1.x", 46 | "slug": "0.1", 47 | "maintained": false 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /.github/workflows/coding-standards.yml: -------------------------------------------------------------------------------- 1 | 2 | name: "Coding Standards" 3 | 4 | on: 5 | pull_request: 6 | branches: 7 | - "*.x" 8 | paths: 9 | - ".github/workflows/coding-standards.yml" 10 | - "composer.*" 11 | - "lib/**" 12 | - "phpcs.xml.dist" 13 | - "tests/**" 14 | push: 15 | branches: 16 | - "*.x" 17 | paths: 18 | - ".github/workflows/coding-standards.yml" 19 | - "composer.*" 20 | - "lib/**" 21 | - "phpcs.xml.dist" 22 | - "tests/**" 23 | 24 | jobs: 25 | coding-standards: 26 | name: "Coding Standards" 27 | uses: "doctrine/.github/.github/workflows/coding-standards.yml@3.0.0" 28 | with: 29 | php-version: "8.1" 30 | -------------------------------------------------------------------------------- /.github/workflows/composer-lint.yml: -------------------------------------------------------------------------------- 1 | name: "Composer Lint" 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "*.x" 7 | paths: 8 | - ".github/workflows/composer-lint.yml" 9 | - "composer.json" 10 | push: 11 | branches: 12 | - "*.x" 13 | paths: 14 | - ".github/workflows/composer-lint.yml" 15 | - "composer.json" 16 | 17 | jobs: 18 | composer-lint: 19 | name: "Composer Lint" 20 | uses: "doctrine/.github/.github/workflows/composer-lint.yml@3.0.0" 21 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration.yml: -------------------------------------------------------------------------------- 1 | 2 | name: "Continuous Integration" 3 | 4 | on: 5 | push: 6 | branches: 7 | - "*.x" 8 | paths: 9 | - ".github/workflows/continuous-integration.yml" 10 | - "composer.*" 11 | - "lib/**" 12 | - "phpunit.xml.dist" 13 | - "tests/**" 14 | pull_request: 15 | branches: 16 | - "*.x" 17 | paths: 18 | - ".github/workflows/continuous-integration.yml" 19 | - "composer.*" 20 | - "lib/**" 21 | - "phpunit.xml.dist" 22 | - "tests/**" 23 | 24 | env: 25 | fail-fast: true 26 | 27 | jobs: 28 | phpunit: 29 | name: "PHPUnit" 30 | uses: "doctrine/.github/.github/workflows/continuous-integration.yml@3.0.0" 31 | with: 32 | php-versions: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]' 33 | -------------------------------------------------------------------------------- /.github/workflows/release-on-milestone-closed.yml: -------------------------------------------------------------------------------- 1 | name: "Automatic Releases" 2 | 3 | on: 4 | milestone: 5 | types: 6 | - "closed" 7 | 8 | jobs: 9 | release: 10 | name: "Git tag, release & create merge-up PR" 11 | uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@3.0.0" 12 | secrets: 13 | GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} 14 | GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} 15 | ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} 16 | SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }} 17 | -------------------------------------------------------------------------------- /.github/workflows/website-schema.yml: -------------------------------------------------------------------------------- 1 | name: "Website config validation" 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "*.x" 7 | paths: 8 | - ".doctrine-project.json" 9 | - ".github/workflows/website-schema.yml" 10 | push: 11 | branches: 12 | - "*.x" 13 | paths: 14 | - ".doctrine-project.json" 15 | - ".github/workflows/website-schema.yml" 16 | 17 | jobs: 18 | json-validate: 19 | name: "Validate JSON schema" 20 | uses: "doctrine/.github/.github/workflows/website-schema.yml@7.2.2" 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /composer.lock 2 | /vendor/ 3 | /.phpcs-cache 4 | /tests/*/output 5 | /.phpunit.result.cache 6 | /tests/Functional/_sphinx/ 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Doctrine has [general contributing guidelines][contributor workflow], make 2 | sure you follow them. 3 | 4 | [contributor workflow]: https://www.doctrine-project.org/contribute/index.html -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2018 Doctrine Project 2 | Copyright (c) <2013> Grégoire Passault 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is furnished 9 | to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Doctrine RST Parser 2 | 3 | [![Continuous Integration](https://github.com/doctrine/rst-parser/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/doctrine/rst-parser/actions/workflows/continuous-integration.yml) 4 | 5 | PHP library to parse [reStructuredText](https://en.wikipedia.org/wiki/ReStructuredText) documents. 6 | This library is used to generate documentation for the [Doctrine](https://www.doctrine-project.org) 7 | project [website](https://github.com/doctrine/doctrine-website). 8 | 9 | https://www.doctrine-project.org/projects/rst-parser.html 10 | -------------------------------------------------------------------------------- /docs/en/attribution.rst: -------------------------------------------------------------------------------- 1 | Attribution 2 | =========== 3 | 4 | This repository was forked from `Gregwar `_ for the `Doctrine 5 | Website `_. 6 | -------------------------------------------------------------------------------- /docs/en/customizing-rendering.rst: -------------------------------------------------------------------------------- 1 | Customizing Rendering 2 | ===================== 3 | 4 | You can customize individual templates used during the rendering process by configuring 5 | the ``customTemplateDirs`` option using ``setCustomTemplateDirs()`` or ``addCustomTemplateDir()`` 6 | methods: 7 | 8 | .. code-block:: php 9 | 10 | use Doctrine\RST\Formats\Format; 11 | 12 | $configuration->setFileExtension(Format::HTML); // default is html 13 | $configuration->setCustomTemplateDirs([ 14 | '/path/to/custom/templates' 15 | ]); 16 | 17 | The files that you can override can be found `here `_. 18 | 19 | For example, the file ``default/html/anchor.html.twig`` could be overwritten by creating the same file at 20 | ``/path/to/custom/templates/default/html/anchor.html.twig``. All of the other templates will still use 21 | the core templates. 22 | 23 | If you wanted to customize the LaTeX output you can do so like this: 24 | 25 | .. code-block:: php 26 | 27 | $configuration->setFileExtension(Format::LATEX); 28 | 29 | Now you can customize the LaTeX output by overriding files in ``/path/to/custom/templates/default/tex``. 30 | -------------------------------------------------------------------------------- /docs/en/sidebar.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :depth: 3 3 | 4 | index 5 | builder 6 | configuration 7 | customizing-rendering 8 | themes 9 | formats 10 | events 11 | custom-directives 12 | attribution 13 | -------------------------------------------------------------------------------- /docs/en/themes.rst: -------------------------------------------------------------------------------- 1 | Themes 2 | ====== 3 | 4 | Similar to customizing individual parts of the rendering, you can have different themes that can be shared. 5 | 6 | .. code-block:: php 7 | 8 | use Doctrine\RST\Formats\Format; 9 | 10 | $configuration->setFileExtension(Format::HTML); 11 | $configuration->setCustomTemplateDirs([ 12 | '/path/to/custom/templates' 13 | ]); 14 | $configuration->setTheme('my_theme'); 15 | 16 | Now create a new directory for your theme at ``/path/to/custom/templates/my_theme/html``. Create a file 17 | named ``layout.html.twig`` and you can customize the layout that wraps all generated html files. 18 | 19 | .. code-block:: twig 20 | 21 | 22 | 23 | 24 | 25 | 26 | {% block head '' %} 27 | 28 | 29 | 30 | {% block body '' %} 31 | 32 | 33 | 34 | Even with a theme, the rendering engine will continue to 35 | use a ``default`` directory (e.g. ``/path/to/custom/templates/default/html`` 36 | as a fallback for any templates (see :doc:`/customizing-rendering`). 37 | -------------------------------------------------------------------------------- /lib/Directives/Dummy.php: -------------------------------------------------------------------------------- 1 | getNodeFactory()->createDummyNode([ 25 | 'data' => $data, 26 | 'options' => $options, 27 | ]); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/Directives/Raw.php: -------------------------------------------------------------------------------- 1 | Undelined! 17 | */ 18 | final class Raw extends Directive 19 | { 20 | public function getName(): string 21 | { 22 | return 'raw'; 23 | } 24 | 25 | /** @param string[] $options */ 26 | public function process( 27 | Parser $parser, 28 | ?Node $node, 29 | string $variable, 30 | string $data, 31 | array $options 32 | ): void { 33 | if ($node === null) { 34 | return; 35 | } 36 | 37 | $kernel = $parser->getKernel(); 38 | 39 | if ($node instanceof CodeNode) { 40 | $node->setRaw(true); 41 | } 42 | 43 | if ($variable !== '') { 44 | $environment = $parser->getEnvironment(); 45 | $environment->setVariable($variable, $node); 46 | } else { 47 | $document = $parser->getDocument(); 48 | $document->addNode($node); 49 | } 50 | } 51 | 52 | public function wantCode(): bool 53 | { 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/Directives/Replace.php: -------------------------------------------------------------------------------- 1 | createSpanNode($data); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/Directives/Tip.php: -------------------------------------------------------------------------------- 1 | builder = $builder; 27 | $this->directory = $directory; 28 | $this->targetDirectory = $targetDirectory; 29 | } 30 | 31 | public function getBuilder(): Builder 32 | { 33 | return $this->builder; 34 | } 35 | 36 | public function getDirectory(): string 37 | { 38 | return $this->directory; 39 | } 40 | 41 | public function getTargetDirectory(): string 42 | { 43 | return $this->targetDirectory; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/Event/OnLinkParsedEvent.php: -------------------------------------------------------------------------------- 1 | url = $url; 25 | $this->linkType = $linkType; 26 | $this->currentFileName = $currentFileName; 27 | } 28 | 29 | public function getUrl(): string 30 | { 31 | return $this->url; 32 | } 33 | 34 | public function getLinkType(): string 35 | { 36 | return $this->linkType; 37 | } 38 | 39 | public function getCurrentFileName(): string 40 | { 41 | return $this->currentFileName; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/Event/PostBuildRenderEvent.php: -------------------------------------------------------------------------------- 1 | node = $node; 20 | } 21 | 22 | public function getNode(): Node 23 | { 24 | return $this->node; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Event/PostNodeRenderEvent.php: -------------------------------------------------------------------------------- 1 | renderedNode = $renderedNode; 20 | } 21 | 22 | public function getRenderedNode(): RenderedNode 23 | { 24 | return $this->renderedNode; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Event/PostParseDocumentEvent.php: -------------------------------------------------------------------------------- 1 | documentNode = $documentNode; 20 | } 21 | 22 | public function getDocumentNode(): DocumentNode 23 | { 24 | return $this->documentNode; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Event/PreBuildParseEvent.php: -------------------------------------------------------------------------------- 1 | parseQueue = $parseQueue; 21 | } 22 | 23 | public function getParseQueue(): Builder\ParseQueue 24 | { 25 | return $this->parseQueue; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/Event/PreBuildRenderEvent.php: -------------------------------------------------------------------------------- 1 | node = $node; 20 | } 21 | 22 | public function getNode(): Node 23 | { 24 | return $this->node; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Event/PreParseDocumentEvent.php: -------------------------------------------------------------------------------- 1 | parser = $parser; 23 | $this->contents = $contents; 24 | } 25 | 26 | public function getParser(): Parser 27 | { 28 | return $this->parser; 29 | } 30 | 31 | public function setContents(string $contents): void 32 | { 33 | $this->contents = $contents; 34 | } 35 | 36 | public function getContents(): string 37 | { 38 | return $this->contents; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/Exception/InvalidTableStructure.php: -------------------------------------------------------------------------------- 1 | renderTemplate('div-open.html.twig', ['class' => $data]); 30 | 31 | return $parser->getNodeFactory()->createWrapperNode($document, $divOpen, ''); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/HTML/Directives/Image.php: -------------------------------------------------------------------------------- 1 | getEnvironment(); 36 | 37 | $url = $environment->relativeUrl($data); 38 | 39 | if ($url === null) { 40 | throw new Exception(sprintf('Could not get relative url for %s', $data)); 41 | } 42 | 43 | return $parser->getNodeFactory()->createImageNode($url, $options); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/HTML/Directives/Meta.php: -------------------------------------------------------------------------------- 1 | getDocument(); 33 | 34 | $nodeFactory = $parser->getNodeFactory(); 35 | 36 | foreach ($options as $key => $value) { 37 | $meta = $nodeFactory->createMetaNode($key, $value); 38 | 39 | $document->addHeaderNode($meta); 40 | } 41 | 42 | if ($node === null) { 43 | return; 44 | } 45 | 46 | $document->addNode($node); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/HTML/Directives/Stylesheet.php: -------------------------------------------------------------------------------- 1 | getDocument(); 32 | $document->addCss($data); 33 | 34 | if ($node === null) { 35 | return; 36 | } 37 | 38 | $document->addNode($node); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/HTML/Directives/Title.php: -------------------------------------------------------------------------------- 1 | getDocument(); 32 | 33 | $title = $parser->renderTemplate('title.html.twig', ['title' => $data]); 34 | 35 | $document->addHeaderNode( 36 | $parser->getNodeFactory()->createRawNode($title) 37 | ); 38 | 39 | if ($node === null) { 40 | return; 41 | } 42 | 43 | $document->addNode($node); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/HTML/Directives/Url.php: -------------------------------------------------------------------------------- 1 | getEnvironment(); 30 | 31 | $environment->setUrl(trim($data)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/AnchorNodeRenderer.php: -------------------------------------------------------------------------------- 1 | anchorNode = $anchorNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('anchor.html.twig', [ 28 | 'anchorNode' => $this->anchorNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/CodeNodeRenderer.php: -------------------------------------------------------------------------------- 1 | codeNode = $codeNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | if ($this->codeNode->isRaw()) { 28 | return $this->codeNode->getValue(); 29 | } 30 | 31 | return $this->templateRenderer->render('code.html.twig', [ 32 | 'codeNode' => $this->codeNode, 33 | ]); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/DefinitionListNodeRenderer.php: -------------------------------------------------------------------------------- 1 | definitionListNode = $definitionListNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('definition-list.html.twig', [ 28 | 'definitionListNode' => $this->definitionListNode, 29 | 'definitionList' => $this->definitionListNode->getDefinitionList(), 30 | ]); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/FigureNodeRenderer.php: -------------------------------------------------------------------------------- 1 | figureNode = $figureNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('figure.html.twig', [ 28 | 'figureNode' => $this->figureNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/ImageNodeRenderer.php: -------------------------------------------------------------------------------- 1 | imageNode = $imageNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('image.html.twig', [ 28 | 'imageNode' => $this->imageNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/ListNodeRenderer.php: -------------------------------------------------------------------------------- 1 | listNode = $listNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | $template = 'bullet-list.html.twig'; 28 | if ($this->listNode->isOrdered()) { 29 | $template = 'enumerated-list.html.twig'; 30 | } 31 | 32 | return $this->templateRenderer->render($template, ['listNode' => $this->listNode]); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/MetaNodeRenderer.php: -------------------------------------------------------------------------------- 1 | metaNode = $metaNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('meta.html.twig', [ 28 | 'metaNode' => $this->metaNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/ParagraphNodeRenderer.php: -------------------------------------------------------------------------------- 1 | paragraphNode = $paragraphNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('paragraph.html.twig', [ 28 | 'paragraphNode' => $this->paragraphNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/QuoteNodeRenderer.php: -------------------------------------------------------------------------------- 1 | quoteNode = $quoteNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('quote.html.twig', [ 28 | 'quoteNode' => $this->quoteNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/SectionBeginNodeRenderer.php: -------------------------------------------------------------------------------- 1 | sectionBeginNode = $sectionBeginNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('section-begin.html.twig', [ 28 | 'sectionBeginNode' => $this->sectionBeginNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/SectionEndNodeRenderer.php: -------------------------------------------------------------------------------- 1 | sectionEndNode = $sectionEndNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('section-end.html.twig', [ 28 | 'sectionEndNode' => $this->sectionEndNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/SeparatorNodeRenderer.php: -------------------------------------------------------------------------------- 1 | templateRenderer = $templateRenderer; 18 | } 19 | 20 | public function render(): string 21 | { 22 | return $this->templateRenderer->render('separator.html.twig'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/HTML/Renderers/TitleNodeRenderer.php: -------------------------------------------------------------------------------- 1 | titleNode = $titleNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('header-title.html.twig', [ 28 | 'titleNode' => $this->titleNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/InvalidLink.php: -------------------------------------------------------------------------------- 1 | name = $name; 15 | } 16 | 17 | public function getName(): string 18 | { 19 | return $this->name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/Image.php: -------------------------------------------------------------------------------- 1 | getEnvironment(); 36 | 37 | $url = $environment->relativeUrl($data); 38 | 39 | if ($url === null) { 40 | throw new Exception(sprintf('Could not build relative url for %s', $data)); 41 | } 42 | 43 | return $parser->getNodeFactory()->createImageNode($url, $options); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/LaTeXMain.php: -------------------------------------------------------------------------------- 1 | getNodeFactory()->createMainNode(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/Meta.php: -------------------------------------------------------------------------------- 1 | getDocument(); 33 | 34 | $nodeFactory = $parser->getNodeFactory(); 35 | 36 | foreach ($options as $key => $value) { 37 | $meta = $nodeFactory->createMetaNode($key, $value); 38 | 39 | $document->addHeaderNode($meta); 40 | } 41 | 42 | if ($node === null) { 43 | return; 44 | } 45 | 46 | $document->addNode($node); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/Stylesheet.php: -------------------------------------------------------------------------------- 1 | getDocument(); 32 | 33 | $document->addHeaderNode( 34 | $parser->getNodeFactory()->createRawNode('\title{' . $data . '}') 35 | ); 36 | 37 | if ($node === null) { 38 | return; 39 | } 40 | 41 | $document->addNode($node); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/Url.php: -------------------------------------------------------------------------------- 1 | getEnvironment(); 30 | $environment->setUrl(trim($data)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/LaTeX/Directives/Wrap.php: -------------------------------------------------------------------------------- 1 | class = $class; 22 | } 23 | 24 | public function getName(): string 25 | { 26 | return $this->class; 27 | } 28 | 29 | /** @param string[] $options */ 30 | public function processSub( 31 | Parser $parser, 32 | ?Node $document, 33 | string $variable, 34 | string $data, 35 | array $options 36 | ): ?Node { 37 | return $document; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/AnchorNodeRenderer.php: -------------------------------------------------------------------------------- 1 | anchorNode = $anchorNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('anchor.tex.twig', [ 28 | 'anchorNode' => $this->anchorNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/CodeNodeRenderer.php: -------------------------------------------------------------------------------- 1 | codeNode = $codeNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('code.tex.twig', [ 28 | 'codeNode' => $this->codeNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/ImageNodeRenderer.php: -------------------------------------------------------------------------------- 1 | imageNode = $imageNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('image.tex.twig', [ 28 | 'imageNode' => $this->imageNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/LaTexMainNodeRenderer.php: -------------------------------------------------------------------------------- 1 | listNode = $listNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | $template = 'bullet-list.tex.twig'; 28 | if ($this->listNode->isOrdered()) { 29 | $template = 'enumerated-list.tex.twig'; 30 | } 31 | 32 | return $this->templateRenderer->render($template, [ 33 | 'listNode' => $this->listNode, 34 | ]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/MetaNodeRenderer.php: -------------------------------------------------------------------------------- 1 | metaNode = $metaNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('meta.tex.twig', [ 28 | 'metaNode' => $this->metaNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/ParagraphNodeRenderer.php: -------------------------------------------------------------------------------- 1 | paragraphNode = $paragraphNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('paragraph.tex.twig', [ 28 | 'paragraphNode' => $this->paragraphNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/QuoteNodeRenderer.php: -------------------------------------------------------------------------------- 1 | quoteNode = $quoteNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | return $this->templateRenderer->render('quote.tex.twig', [ 28 | 'quoteNode' => $this->quoteNode, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/SeparatorNodeRenderer.php: -------------------------------------------------------------------------------- 1 | templateRenderer = $templateRenderer; 18 | } 19 | 20 | public function render(): string 21 | { 22 | return $this->templateRenderer->render('separator.tex.twig'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/LaTeX/Renderers/TitleNodeRenderer.php: -------------------------------------------------------------------------------- 1 | titleNode = $titleNode; 22 | $this->templateRenderer = $templateRenderer; 23 | } 24 | 25 | public function render(): string 26 | { 27 | $type = 'chapter'; 28 | 29 | if ($this->titleNode->getLevel() > 1) { 30 | $type = 'section'; 31 | 32 | for ($i = 2; $i < $this->titleNode->getLevel(); $i++) { 33 | $type = 'sub' . $type; 34 | } 35 | } 36 | 37 | return $this->templateRenderer->render('title.tex.twig', [ 38 | 'type' => $type, 39 | 'titleNode' => $this->titleNode, 40 | ]); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Meta/CachedMetasLoader.php: -------------------------------------------------------------------------------- 1 | getMetaCachePath($targetDirectory); 21 | if (! file_exists($metaCachePath)) { 22 | return; 23 | } 24 | 25 | $contents = file_get_contents($metaCachePath); 26 | 27 | if ($contents === false) { 28 | throw new LogicException(sprintf('Could not load file "%s"', $contents)); 29 | } 30 | 31 | $metas->setMetaEntries(unserialize($contents)); 32 | } 33 | 34 | public function cacheMetaEntries(string $targetDirectory, Metas $metas): void 35 | { 36 | file_put_contents($this->getMetaCachePath($targetDirectory), serialize($metas->getAll())); 37 | } 38 | 39 | private function getMetaCachePath(string $targetDirectory): string 40 | { 41 | return $targetDirectory . '/metas.php'; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/Nodes/AnchorNode.php: -------------------------------------------------------------------------------- 1 | value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/Nodes/BlockNode.php: -------------------------------------------------------------------------------- 1 | normalizeLines($lines)); 16 | } 17 | 18 | public function getValue(): string 19 | { 20 | return $this->value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/Nodes/CallableNode.php: -------------------------------------------------------------------------------- 1 | callable = $callable; 17 | } 18 | 19 | public function getCallable(): callable 20 | { 21 | return $this->callable; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Nodes/DefinitionListNode.php: -------------------------------------------------------------------------------- 1 | definitionList = $definitionList; 19 | } 20 | 21 | public function getDefinitionList(): DefinitionList 22 | { 23 | return $this->definitionList; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/Nodes/DummyNode.php: -------------------------------------------------------------------------------- 1 | data = $data; 18 | } 19 | 20 | protected function doRender(): string 21 | { 22 | return ''; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/Nodes/FigureNode.php: -------------------------------------------------------------------------------- 1 | image = $image; 20 | $this->document = $document; 21 | } 22 | 23 | public function getImage(): ImageNode 24 | { 25 | return $this->image; 26 | } 27 | 28 | public function getDocument(): ?Node 29 | { 30 | return $this->document; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Nodes/ImageNode.php: -------------------------------------------------------------------------------- 1 | url = $url; 21 | $this->options = $options; 22 | } 23 | 24 | public function getUrl(): string 25 | { 26 | return $this->url; 27 | } 28 | 29 | /** @return string[] */ 30 | public function getOptions(): array 31 | { 32 | return $this->options; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/Nodes/ListNode.php: -------------------------------------------------------------------------------- 1 | items = $items; 23 | $this->ordered = $ordered; 24 | } 25 | 26 | /** @return ListItem[] */ 27 | public function getItems(): array 28 | { 29 | return $this->items; 30 | } 31 | 32 | public function isOrdered(): bool 33 | { 34 | return $this->ordered; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/Nodes/MainNode.php: -------------------------------------------------------------------------------- 1 | key = $key; 20 | $this->value = $value; 21 | } 22 | 23 | public function getKey(): string 24 | { 25 | return $this->key; 26 | } 27 | 28 | public function getValue(): string 29 | { 30 | return $this->value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Nodes/ParagraphNode.php: -------------------------------------------------------------------------------- 1 | value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/Nodes/QuoteNode.php: -------------------------------------------------------------------------------- 1 | value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Nodes/RawNode.php: -------------------------------------------------------------------------------- 1 | titleNode = $titleNode; 17 | } 18 | 19 | public function getTitleNode(): TitleNode 20 | { 21 | return $this->titleNode; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Nodes/SectionEndNode.php: -------------------------------------------------------------------------------- 1 | titleNode = $titleNode; 17 | } 18 | 19 | public function getTitleNode(): TitleNode 20 | { 21 | return $this->titleNode; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Nodes/SeparatorNode.php: -------------------------------------------------------------------------------- 1 | level = $level; 17 | } 18 | 19 | public function getLevel(): int 20 | { 21 | return $this->level; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Nodes/TitleNode.php: -------------------------------------------------------------------------------- 1 | level = $level; 31 | $this->token = $token; 32 | $this->id = Environment::slugify($this->value->getText()); 33 | } 34 | 35 | public function getValue(): SpanNode 36 | { 37 | return $this->value; 38 | } 39 | 40 | public function getLevel(): int 41 | { 42 | return $this->level; 43 | } 44 | 45 | public function setTarget(string $target): void 46 | { 47 | $this->target = $target; 48 | } 49 | 50 | public function getTarget(): string 51 | { 52 | return $this->target; 53 | } 54 | 55 | public function getId(): string 56 | { 57 | return $this->id; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/Nodes/WrapperNode.php: -------------------------------------------------------------------------------- 1 | node = $node; 23 | $this->before = $before; 24 | $this->after = $after; 25 | } 26 | 27 | protected function doRender(): string 28 | { 29 | $contents = $this->node !== null ? $this->node->render() : ''; 30 | 31 | return $this->before . $contents . $this->after; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Parser/DefinitionList.php: -------------------------------------------------------------------------------- 1 | terms = $terms; 16 | } 17 | 18 | /** @return DefinitionListTerm[] */ 19 | public function getTerms(): array 20 | { 21 | return $this->terms; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Parser/Directive.php: -------------------------------------------------------------------------------- 1 | variable = $variable; 25 | $this->name = $name; 26 | $this->data = $data; 27 | $this->options = $options; 28 | } 29 | 30 | public function getVariable(): string 31 | { 32 | return $this->variable; 33 | } 34 | 35 | public function getName(): string 36 | { 37 | return $this->name; 38 | } 39 | 40 | public function getData(): string 41 | { 42 | return $this->data; 43 | } 44 | 45 | /** @return mixed[] */ 46 | public function getOptions(): array 47 | { 48 | return $this->options; 49 | } 50 | 51 | /** @param mixed $value */ 52 | public function setOption(string $key, $value): void 53 | { 54 | $this->options[$key] = $value; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/Parser/DirectiveOption.php: -------------------------------------------------------------------------------- 1 | name = $name; 19 | $this->value = $value; 20 | } 21 | 22 | public function getName(): string 23 | { 24 | return $this->name; 25 | } 26 | 27 | /** @return mixed */ 28 | public function getValue() 29 | { 30 | return $this->value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Parser/Lines.php: -------------------------------------------------------------------------------- 1 | */ 10 | final class Lines implements Iterator 11 | { 12 | /** @var string[] */ 13 | private $lines = []; 14 | 15 | /** @var int */ 16 | private $position = 0; 17 | 18 | /** @param string[] $lines */ 19 | public function __construct(array $lines) 20 | { 21 | $this->lines = $lines; 22 | } 23 | 24 | public function getPreviousLine(): string 25 | { 26 | return $this->lines[$this->position - 1] ?? ''; 27 | } 28 | 29 | public function getNextLine(): string 30 | { 31 | return $this->lines[$this->position + 1] ?? ''; 32 | } 33 | 34 | public function rewind(): void 35 | { 36 | $this->position = 0; 37 | } 38 | 39 | public function current(): string 40 | { 41 | return $this->lines[$this->position]; 42 | } 43 | 44 | public function key(): int 45 | { 46 | return $this->position; 47 | } 48 | 49 | public function next(): void 50 | { 51 | ++$this->position; 52 | } 53 | 54 | public function valid(): bool 55 | { 56 | return isset($this->lines[$this->position]); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Parser/Link.php: -------------------------------------------------------------------------------- 1 | name = $name; 24 | $this->url = $url; 25 | $this->type = $type; 26 | } 27 | 28 | public function getName(): string 29 | { 30 | return $this->name; 31 | } 32 | 33 | public function getUrl(): string 34 | { 35 | return $this->url; 36 | } 37 | 38 | public function getType(): string 39 | { 40 | return $this->type; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/Parser/State.php: -------------------------------------------------------------------------------- 1 | callableNode = $callableNode; 17 | } 18 | 19 | public function render(): string 20 | { 21 | return $this->callableNode->getCallable()(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Renderers/CallableNodeRendererFactory.php: -------------------------------------------------------------------------------- 1 | callable = $callable; 17 | } 18 | 19 | public function create(Node $node): NodeRenderer 20 | { 21 | return ($this->callable)($node); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/Renderers/DefaultNodeRenderer.php: -------------------------------------------------------------------------------- 1 | node = $node; 17 | } 18 | 19 | public function render(): string 20 | { 21 | $value = $this->node->getValue(); 22 | 23 | if ($value instanceof Node) { 24 | return $value->render(); 25 | } 26 | 27 | if ($value === null) { 28 | return ''; 29 | } 30 | 31 | return $value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/Renderers/DocumentNodeRenderer.php: -------------------------------------------------------------------------------- 1 | document = $document; 17 | } 18 | 19 | public function render(): string 20 | { 21 | $document = ''; 22 | foreach ($this->document->getNodes() as $node) { 23 | $document .= $node->render() . "\n"; 24 | } 25 | 26 | return $document; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/Renderers/FormatListRenderer.php: -------------------------------------------------------------------------------- 1 | node = $node; 20 | $this->rendered = $rendered; 21 | } 22 | 23 | public function getNode(): Node 24 | { 25 | return $this->node; 26 | } 27 | 28 | public function setRendered(string $rendered): void 29 | { 30 | $this->rendered = $rendered; 31 | } 32 | 33 | public function getRendered(): string 34 | { 35 | return $this->rendered; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/Renderers/SpanRenderer.php: -------------------------------------------------------------------------------- 1 | type = $type; 26 | $this->id = $id; 27 | $this->token = $token; 28 | $this->token['type'] = $type; 29 | } 30 | 31 | public function getType(): string 32 | { 33 | return $this->type; 34 | } 35 | 36 | public function getId(): string 37 | { 38 | return $this->id; 39 | } 40 | 41 | public function get(string $key): string 42 | { 43 | return $this->token[$key] ?? ''; 44 | } 45 | 46 | /** @return string[] */ 47 | public function getTokenData(): array 48 | { 49 | return $this->token; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/Templates/TemplateEngineAdapter.php: -------------------------------------------------------------------------------- 1 | configuration = $configuration; 21 | } 22 | 23 | public function getTemplateEngine(): TwigEnvironment 24 | { 25 | if ($this->twigEnvironment === null) { 26 | $this->twigEnvironment = TwigEnvironmentFactory::createTwigEnvironment($this->configuration); 27 | } 28 | 29 | return $this->twigEnvironment; 30 | } 31 | 32 | /** @param mixed[] $parameters */ 33 | public function render(string $template, array $parameters = []): string 34 | { 35 | return $this->getTemplateEngine()->render($template, $parameters); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/Templates/TwigTemplateRenderer.php: -------------------------------------------------------------------------------- 1 | configuration = $configuration; 19 | } 20 | 21 | /** @param mixed[] $parameters */ 22 | public function render(string $template, array $parameters = []): string 23 | { 24 | return rtrim($this->configuration->getTemplateEngine()->render($template, $parameters), "\n"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/Templates/default/html/anchor.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/br.html.twig: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/bullet-list.html.twig: -------------------------------------------------------------------------------- 1 | 2 | {% for item in listNode.items -%} 3 | {{ include('list-item.html.twig', {text: item.contentsAsString, prefix: item.prefix}) }} 4 | {%- endfor %} 5 | 6 | -------------------------------------------------------------------------------- /lib/Templates/default/html/code.html.twig: -------------------------------------------------------------------------------- 1 | {{ codeNode.value }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/definition-list.html.twig: -------------------------------------------------------------------------------- 1 | 2 | {% for definitionListTerm in definitionList.terms %} 3 | {% if definitionListTerm.classifiers is empty %} 4 |
{{ definitionListTerm.term.render()|raw }}
5 | {% else %} 6 |
7 | {{ definitionListTerm.term.render()|raw }} 8 | 9 | {% for classifier in definitionListTerm.classifiers %} 10 | : 11 | {{ classifier.render()|raw }} 12 | {% endfor %} 13 |
14 | {% endif %} 15 | 16 |
17 | {% for definition in definitionListTerm.definitions %} 18 | {{ definition.render()|raw }} 19 | {% endfor %} 20 |
21 | {% endfor %} 22 | 23 | -------------------------------------------------------------------------------- /lib/Templates/default/html/div-open.html.twig: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/document.html.twig: -------------------------------------------------------------------------------- 1 | {% extends "layout.html.twig" %} 2 | 3 | {% block head %} 4 | {{ headerNodes|raw }} 5 | {% endblock %} 6 | 7 | {% block body %} 8 | {{ bodyNodes|raw }} 9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /lib/Templates/default/html/emphasis.html.twig: -------------------------------------------------------------------------------- 1 | {{ text|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/enumerated-list.html.twig: -------------------------------------------------------------------------------- 1 |
    2 | {% for item in listNode.items -%} 3 | {{ include('list-item.html.twig', {text: item.contentsAsString, prefix: item.prefix}) }} 4 | {%- endfor %} 5 |
6 | -------------------------------------------------------------------------------- /lib/Templates/default/html/favicon.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/figure.html.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 |
3 | {{ figureNode.image.render()|raw }} 4 | 5 | {% if figureNode.document %} 6 | {% set caption = figureNode.document.render()|trim %} 7 | 8 | {% if caption %} 9 |
{{ caption|raw }}
10 | {% endif %} 11 | {% endif %} 12 |
13 | {% endapply %} 14 | -------------------------------------------------------------------------------- /lib/Templates/default/html/header-title.html.twig: -------------------------------------------------------------------------------- 1 | {{ titleNode.value.render()|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/image.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/javascript.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/layout.html.twig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {% block head '' %} 7 | 8 | 9 | 10 | {% block body '' %} 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/Templates/default/html/link.html.twig: -------------------------------------------------------------------------------- 1 | {{ title|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/list-item.html.twig: -------------------------------------------------------------------------------- 1 | {{ text|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/literal.html.twig: -------------------------------------------------------------------------------- 1 | {{ text|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/meta.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/nbsp.html.twig: -------------------------------------------------------------------------------- 1 |   2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/paragraph.html.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | {% set text = paragraphNode.value.render()|trim %} 3 | 4 | {% if text %} 5 | {{ text|raw }}

6 | {% endif %} 7 | {% endapply %} 8 | -------------------------------------------------------------------------------- /lib/Templates/default/html/quote.html.twig: -------------------------------------------------------------------------------- 1 | {{ quoteNode.value.render()|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/section-begin.html.twig: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/section-end.html.twig: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/separator.html.twig: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/strong-emphasis.html.twig: -------------------------------------------------------------------------------- 1 | {{ text|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/stylesheet-link.html.twig: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/table.html.twig: -------------------------------------------------------------------------------- 1 | 2 | {% if tableHeaderRows is not empty %} 3 | 4 | {% for tableHeaderRow in tableHeaderRows %} 5 | 6 | {% for column in tableHeaderRow.columns %} 7 | 1 %} colspan="{{ column.colspan }}"{% endif %}>{{ column.render|raw }} 8 | {% endfor %} 9 | 10 | {% endfor %} 11 | 12 | {% endif %} 13 | 14 | {% for tableRow in tableRows %} 15 | 16 | {% for column in tableRow.columns %} 17 | 1 %} colspan="{{ column.colSpan }}"{% endif %}{% if column.rowSpan > 1 %} rowspan="{{ column.rowSpan }}"{% endif %}>{{ column.render|raw }} 18 | {% endfor %} 19 | 20 | {% endfor %} 21 | 22 | 23 | -------------------------------------------------------------------------------- /lib/Templates/default/html/title.html.twig: -------------------------------------------------------------------------------- 1 | {{ title }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/html/toc-item.html.twig: -------------------------------------------------------------------------------- 1 |
  • 2 | {{ tocItem.title|raw }} 3 | 4 | {% if tocItem.children|length %} 5 | {% include "toc-level.html.twig" with { 6 | tocItems:tocItem.children 7 | } %} 8 | {% endif %} 9 |
  • 10 | -------------------------------------------------------------------------------- /lib/Templates/default/html/toc-level.html.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 |
      3 | {% for tocItem in tocItems %} 4 | {% include "toc-item.html.twig" %} 5 | {% endfor %} 6 |
    7 | {% endapply %} 8 | -------------------------------------------------------------------------------- /lib/Templates/default/html/toc.html.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 |
    3 | {% include "toc-level.html.twig" %} 4 |
    5 | {% endapply %} 6 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/anchor.tex.twig: -------------------------------------------------------------------------------- 1 | \label{{ '{' }}{{ anchorNode.value }}{{ '}' }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/br.tex.twig: -------------------------------------------------------------------------------- 1 | \\\\\\\\\n 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/bullet-list.tex.twig: -------------------------------------------------------------------------------- 1 | \begin{{ '{' }}itemize{{ '}' }} 2 | {%- for item in listNode.items -%} 3 | {{ include('list-item.tex.twig', {text: item.contentsAsString, prefix: item.prefix}) }} 4 | {%- endfor %} 5 | \end{{ '{' }}itemize{{ '}' }} 6 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/code.tex.twig: -------------------------------------------------------------------------------- 1 | \lstset{language={{ codeNode.language }}{{ '}'}} 2 | \begin{lstlisting} 3 | {{ codeNode.value|raw }} 4 | \end{lstlisting} 5 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/document.tex.twig: -------------------------------------------------------------------------------- 1 | {% if isMain %} 2 | \documentclass[11pt]{report} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage[T1]{fontenc} 5 | \usepackage[french]{babel} 6 | \usepackage{cite} 7 | \usepackage{amssymb} 8 | \usepackage{amsmath} 9 | \usepackage{mathrsfs} 10 | \usepackage{graphicx} 11 | \usepackage{hyperref} 12 | \usepackage{listings} 13 | {% for node in document.headerNodes %} 14 | {{ node.render() }} 15 | {% endfor %} 16 | \begin{document} 17 | {% endif %} 18 | \label{{ '{' }}{{ document.environment.url}}{{ '}' }} 19 | {{ body|raw }} 20 | {% if isMain %} 21 | \end{document} 22 | {% endif %} 23 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/emphasis.tex.twig: -------------------------------------------------------------------------------- 1 | \textit{{ '{' }}{{ text|raw }}{{ '}' }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/enumerated-list.tex.twig: -------------------------------------------------------------------------------- 1 | \begin{{ '{' }}enumerate{{ '}' }} 2 | {%- for item in listNode.items -%} 3 | {{ include('list-item.tex.twig', {text: item.contentsAsString, prefix: item.prefix}) }} 4 | {%- endfor %} 5 | \end{{ '{' }}enumerate{{ '}' }} 6 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/image.tex.twig: -------------------------------------------------------------------------------- 1 | \includegraphics{{ '{' }}{{ imageNode.url }}{{ '}' }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/link.tex.twig: -------------------------------------------------------------------------------- 1 | {% if type == 'ref' %} 2 | \ref{{ '{' }}{{ url }}{{ '}' }} 3 | {% else %} 4 | \href{{ '{' }}{{ url }}{{ '}' }}{{ '{' }}{{ title }}{{ '}' }} 5 | {% endif %} 6 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/list-item.tex.twig: -------------------------------------------------------------------------------- 1 | \item {{ text|raw }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/literal.tex.twig: -------------------------------------------------------------------------------- 1 | \verb|{{ text|raw }}| 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/meta.tex.twig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doctrine/rst-parser/98ad0ba6edeafd50792db77f7c997352c88a793a/lib/Templates/default/tex/meta.tex.twig -------------------------------------------------------------------------------- /lib/Templates/default/tex/nbsp.tex.twig: -------------------------------------------------------------------------------- 1 | ~ 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/paragraph.tex.twig: -------------------------------------------------------------------------------- 1 | {% apply spaceless %} 2 | {% set text = paragraphNode.value.render() %} 3 | 4 | {% if text|trim %} 5 | {{ text|raw }} 6 | 7 | {% endif %} 8 | {% endapply %} 9 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/quote.tex.twig: -------------------------------------------------------------------------------- 1 | \begin{quotation} 2 | {{ quoteNode.value.render()|raw }} 3 | \end{quotation} 4 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/separator.tex.twig: -------------------------------------------------------------------------------- 1 | \ \ 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/strong-emphasis.tex.twig: -------------------------------------------------------------------------------- 1 | \textbf{{ '{' }}{{ text|raw }}{{ '}' }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/title.tex.twig: -------------------------------------------------------------------------------- 1 | \{{ type }}{{ '{' }}{{ titleNode.value.render() }}{{ '}' }} 2 | -------------------------------------------------------------------------------- /lib/Templates/default/tex/toc.tex.twig: -------------------------------------------------------------------------------- 1 | \tableofcontents 2 | {% for tocItem in tocItems %} 3 | \input{{ '{' }}{{ tocItem.url }}{{ '}' }} 4 | {% endfor %} 5 | -------------------------------------------------------------------------------- /phpcs.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | lib 15 | tests 16 | 17 | tests/*/output/metas.php 18 | tests/*/output/*/metas.php 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | includes: 2 | - vendor/phpstan/phpstan-phpunit/extension.neon 3 | - vendor/phpstan/phpstan-strict-rules/rules.neon 4 | 5 | parameters: 6 | level: 7 7 | paths: 8 | - lib 9 | - tests 10 | polluteScopeWithLoopInitialAssignments: true 11 | reportMaybesInPropertyPhpDocTypes: false 12 | 13 | ignoreErrors: 14 | - '#Variable method call on Doctrine\\RST\\Nodes\\DocumentNode\.#' 15 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ./tests 7 | 8 | 9 | 10 | 11 | 12 | ./lib/ 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/Builder/CopierTest.php: -------------------------------------------------------------------------------- 1 | filesystem->expects(self::once()) 23 | ->method('copy') 24 | ->with('/source/from', '/target/to'); 25 | 26 | $this->copier->copy('from', 'to'); 27 | 28 | $this->copier->doCopy('/source', '/target'); 29 | } 30 | 31 | public function testDoMkdir(): void 32 | { 33 | $this->filesystem->expects(self::once()) 34 | ->method('mkdir') 35 | ->with('/target/directory'); 36 | 37 | $this->copier->mkdir('directory'); 38 | 39 | $this->copier->doMkdir('/target'); 40 | } 41 | 42 | protected function setUp(): void 43 | { 44 | $this->filesystem = $this->createMock(Filesystem::class); 45 | 46 | $this->copier = new Copier($this->filesystem); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/Builder/ParseQueueTest.php: -------------------------------------------------------------------------------- 1 | addFile('file_needs_parsing1', true); 16 | $parseQueue->addFile('file_no_parsing1', false); 17 | 18 | self::assertTrue($parseQueue->isFileKnownToParseQueue('file_needs_parsing1')); 19 | self::assertTrue($parseQueue->isFileKnownToParseQueue('file_no_parsing1')); 20 | self::assertFalse($parseQueue->isFileKnownToParseQueue('other_file')); 21 | 22 | self::assertTrue($parseQueue->doesFileRequireParsing('file_needs_parsing1')); 23 | self::assertFalse($parseQueue->doesFileRequireParsing('file_no_parsing1')); 24 | 25 | self::assertSame(['file_needs_parsing1'], $parseQueue->getAllFilesThatRequireParsing()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/Builder/input/another.rst: -------------------------------------------------------------------------------- 1 | 2 | .. url:: magic-link 3 | 4 | Another page 5 | ============ 6 | 7 | Hello! 8 | 9 | See also 10 | -------- 11 | 12 | test 13 | ---- 14 | 15 | title with ampersand & 16 | ---------------------- 17 | 18 | A ``title with ticks`` 19 | ---------------------- 20 | 21 | This same title named test exists in other documents. Make sure the link below goes to the one 22 | in this doc and not the one in the other docs. 23 | 24 | See also: :doc:`subdirective` 25 | 26 | see `See also`_ 27 | 28 | see `Another page`_ 29 | 30 | see `test`_ 31 | 32 | see `title with ampersand &`_ 33 | 34 | see `A title with ticks`_ 35 | -------------------------------------------------------------------------------- /tests/Builder/input/file.txt: -------------------------------------------------------------------------------- 1 | Example of static file! 2 | -------------------------------------------------------------------------------- /tests/Builder/input/index.rst: -------------------------------------------------------------------------------- 1 | Summary 2 | ======= 3 | 4 | This is the builder test summary 5 | 6 | .. _toc: 7 | 8 | .. toctree:: 9 | 10 | introduction 11 | subdirective 12 | another 13 | subdir/index 14 | /subdir/file 15 | 16 | .. _reference_anchor: 17 | 18 | Link to :ref:`the same doc reference ` 19 | 20 | .. _same_doc_reference: 21 | 22 | Link to :ref:`the same doc reference with ticks ` 23 | 24 | .. _`same_doc_reference_ticks`: 25 | 26 | Link to :ref:`Subdirectory ` 27 | 28 | Link to :ref:`Subdirectory Test ` 29 | 30 | Link to :ref:`Subdirectory Child ` 31 | 32 | Link to :ref:`Subdirectory Child Test ` 33 | 34 | Link to :ref:`Subdirectory Child Level 2 ` 35 | 36 | Link to :ref:`Subdirectory Child Level 2 Test ` 37 | 38 | Link to :ref:`Subdirectory Child Level 3 ` 39 | 40 | Link to :ref:`Subdirectory Child Level 3 Test ` 41 | 42 | .. note:: 43 | :ref:`Reference in directory ` 44 | 45 | Another h1 46 | ========== 47 | -------------------------------------------------------------------------------- /tests/Builder/input/introduction.rst: -------------------------------------------------------------------------------- 1 | Introduction page 2 | ================= 3 | 4 | This is an introduction page! 5 | 6 | Reference to the :doc:`index` 7 | 8 | Reference to the :doc:`Link index absolutely ` 9 | 10 | Reference to the :doc:`Index ` 11 | 12 | Reference to the :doc:`Index, paragraph toc ` 13 | 14 | Reference to the :doc:`Glob TOC ` 15 | 16 | Reference to the :ref:`Summary Reference ` 17 | 18 | Reference to the :ref:`Test Reference ` 19 | 20 | Reference to the :ref:`Camel Case Reference ` 21 | -------------------------------------------------------------------------------- /tests/Builder/input/link-to-index.rst: -------------------------------------------------------------------------------- 1 | Document with a Link to Index 2 | ----------------------------- 3 | 4 | I have a reference to :doc:`index` and this link 5 | is dependent on the title of that page. 6 | -------------------------------------------------------------------------------- /tests/Builder/input/subdir/file.rst: -------------------------------------------------------------------------------- 1 | Heading 1 2 | ######### 3 | 4 | Heading 2 5 | ......... 6 | 7 | Heading 3 8 | ::::::::: 9 | 10 | Heading 4 11 | _________ 12 | 13 | Heading 5 14 | ````````` 15 | 16 | Heading 6 17 | ''''''''' 18 | -------------------------------------------------------------------------------- /tests/Builder/input/subdir/include.rst.inc: -------------------------------------------------------------------------------- 1 | This file is included 2 | -------------------------------------------------------------------------------- /tests/Builder/input/subdir/toc.rst: -------------------------------------------------------------------------------- 1 | TOC in Subdir 2 | ============= 3 | 4 | .. toctree:: 5 | 6 | /introduction 7 | /subdirective 8 | /another 9 | /subdir/index 10 | file 11 | -------------------------------------------------------------------------------- /tests/Builder/input/subdirective.rst: -------------------------------------------------------------------------------- 1 | Sub directives 2 | ============== 3 | 4 | Testing sub directives 5 | 6 | .. note:: 7 | This is a simple note! 8 | 9 | There is a title here 10 | --------------------- 11 | 12 | .. note:: 13 | * This is a list 14 | * With two points 15 | -------------------------------------------------------------------------------- /tests/Builder/input/toc-glob-reversed.rst: -------------------------------------------------------------------------------- 1 | TOC Reversed 2 | ============ 3 | 4 | .. toctree:: 5 | :glob: 6 | :reversed: 7 | 8 | index 9 | * 10 | introduction 11 | -------------------------------------------------------------------------------- /tests/Builder/input/toc-glob.rst: -------------------------------------------------------------------------------- 1 | TOC Glob 2 | ======== 3 | 4 | .. toctree:: 5 | :glob: 6 | 7 | index 8 | * 9 | toc-glob 10 | introduction 11 | -------------------------------------------------------------------------------- /tests/BuilderCustomScannerFinder/BuilderCustomScannerFinderTest.php: -------------------------------------------------------------------------------- 1 | targetFile('path1/file1.html')); 19 | self::assertFileNotExists($this->targetFile('path2/file2.html')); 20 | } 21 | 22 | protected function getFixturesDirectory(): string 23 | { 24 | return 'BuilderCustomScannerFinder'; 25 | } 26 | 27 | protected function configureBuilder(Builder $builder): void 28 | { 29 | $finder = new Finder(); 30 | $finder->exclude('path2'); 31 | 32 | $builder->setScannerFinder($finder); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/BuilderCustomScannerFinder/input/index.rst: -------------------------------------------------------------------------------- 1 | Index 2 | ===== 3 | 4 | a file 5 | -------------------------------------------------------------------------------- /tests/BuilderCustomScannerFinder/input/path1/file1.rst: -------------------------------------------------------------------------------- 1 | File1 2 | ===== 3 | 4 | a file 5 | -------------------------------------------------------------------------------- /tests/BuilderCustomScannerFinder/input/path2/file2.rst: -------------------------------------------------------------------------------- 1 | Path 2 File 2 | =========== 3 | 4 | a file 5 | -------------------------------------------------------------------------------- /tests/BuilderInclude/BuilderIncludeTest.php: -------------------------------------------------------------------------------- 1 | targetFile('index.html'))); 21 | $contents = file_get_contents($this->targetFile('index.html')); 22 | assert($contents !== false); 23 | 24 | self::assertStringContainsString('This file is included', $contents); 25 | 26 | foreach ($this->builder->getDocuments()->getAll() as $document) { 27 | foreach ($document->getEnvironment()->getMetas()->getAll() as $meta) { 28 | foreach ($meta->getTocs() as $toc) { 29 | foreach ($toc as $tocLine) { 30 | self::assertStringNotContainsString('include.inc', $tocLine); 31 | } 32 | } 33 | } 34 | } 35 | } 36 | 37 | protected function getFixturesDirectory(): string 38 | { 39 | return 'BuilderInclude'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/BuilderInclude/input/file.rst: -------------------------------------------------------------------------------- 1 | File 2 | ==== 3 | 4 | a file 5 | -------------------------------------------------------------------------------- /tests/BuilderInclude/input/include.rst.inc: -------------------------------------------------------------------------------- 1 | This file is included 2 | -------------------------------------------------------------------------------- /tests/BuilderInclude/input/index.rst: -------------------------------------------------------------------------------- 1 | Test include 2 | ============ 3 | 4 | .. include:: include.rst.inc 5 | 6 | .. toctree:: 7 | :glob: 8 | 9 | * 10 | -------------------------------------------------------------------------------- /tests/BuilderInvalidReferences/input/index.rst: -------------------------------------------------------------------------------- 1 | Unresolved Reference 2 | ==================== 3 | 4 | Test :ref:`unresolved reference ` 5 | 6 | Test :ref:`resolved reference ` 7 | 8 | Test :ref:`test anchor ` 9 | 10 | .. _test_anchor: 11 | -------------------------------------------------------------------------------- /tests/BuilderInvalidReferences/input/reference.rst: -------------------------------------------------------------------------------- 1 | Reference 2 | ========= 3 | 4 | Test 5 | -------------------------------------------------------------------------------- /tests/BuilderMalformedReference/input/index.rst: -------------------------------------------------------------------------------- 1 | Index -------------------------------------------------------------------------------- /tests/BuilderMalformedReference/input/subdir/another.rst: -------------------------------------------------------------------------------- 1 | Test :doc:`link to <_test_reference>` 2 | -------------------------------------------------------------------------------- /tests/BuilderMalformedReference/input/subdir/index.rst: -------------------------------------------------------------------------------- 1 | Example: 2 | 3 | .. _test_reference: 4 | -------------------------------------------------------------------------------- /tests/BuilderReferenceDoesNotExist/input/index.rst: -------------------------------------------------------------------------------- 1 | Index -------------------------------------------------------------------------------- /tests/BuilderReferenceDoesNotExist/input/subdir/index.rst: -------------------------------------------------------------------------------- 1 | Example: 2 | 3 | Test :ref:`link 1 to ` 4 | 5 | Test :ref:`link 2 to ` 6 | -------------------------------------------------------------------------------- /tests/BuilderReferences/BuilderReferencesTest.php: -------------------------------------------------------------------------------- 1 | getConfiguration()->abortOnError(false); 19 | $builder->getConfiguration()->silentOnError(); 20 | } 21 | 22 | public function test(): void 23 | { 24 | $indenter = new Indenter(); 25 | 26 | foreach (Finder::create()->files()->in($this->targetFile() . '/../expected') as $file) { 27 | $target = $this->targetFile($file->getRelativePathname()); 28 | self::assertFileExists($target); 29 | self::assertEquals(rtrim($file->getContents()), rtrim($indenter->indent($this->getFileContents($target)))); 30 | } 31 | } 32 | 33 | protected function getFixturesDirectory(): string 34 | { 35 | return 'BuilderReferences'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/BuilderReferences/expected/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    8 |

    9 | References 10 |

    11 |

    Test referencing a document

    12 |

    Test referencing an anchor in another document

    13 |

    Test referencing a Sub section and Some Sub Section (invalid)

    14 |
    15 |

    16 | Sub section 17 |

    18 |
    19 |
    20 | 21 | 22 | -------------------------------------------------------------------------------- /tests/BuilderReferences/expected/reference/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    8 |

    9 | Reference Page 10 |

    11 | 16 |

    And what about the test anchor?

    17 |
    18 |

    19 | Some Sub Section 20 |

    21 | 22 | 23 |
    24 |
    25 |

    26 | Other Sub Section 27 |

    28 |
    29 |
    30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/BuilderReferences/input/index.rst: -------------------------------------------------------------------------------- 1 | References 2 | ========== 3 | 4 | Test :ref:`referencing a document ` 5 | 6 | Test :ref:`referencing an anchor in another document ` 7 | 8 | Test referencing a `Sub section`_ and `Some Sub Section`_ (invalid) 9 | 10 | Sub section 11 | ----------- 12 | -------------------------------------------------------------------------------- /tests/BuilderReferences/input/reference.rst: -------------------------------------------------------------------------------- 1 | .. _test_anchor: 2 | 3 | Reference 4 | ========= 5 | 6 | Test 7 | -------------------------------------------------------------------------------- /tests/BuilderReferences/input/reference/page.rst: -------------------------------------------------------------------------------- 1 | Reference Page 2 | ============== 3 | 4 | * `Some Sub Section`_ 5 | * :ref:`Other Sub Section ` 6 | * :ref:`Section on another subpage ` 7 | 8 | And what about :ref:`the test anchor `? 9 | 10 | Some Sub Section 11 | ---------------- 12 | 13 | .. _other: 14 | 15 | Other Sub Section 16 | ----------------- 17 | -------------------------------------------------------------------------------- /tests/BuilderReferences/input/reference/page1.rst: -------------------------------------------------------------------------------- 1 | Reference Page 1 2 | ================ 3 | 4 | .. _another-page: 5 | 6 | Section on Another Page 7 | ----------------------- 8 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/index.rst: -------------------------------------------------------------------------------- 1 | Title 2 | ===== 3 | 4 | .. toctree:: 5 | 6 | subdir/toctree 7 | 8 | Max Depth Level 2 9 | --------- 10 | 11 | Max Depth Level 3 12 | ~~~~~~~ 13 | 14 | Max Depth Level 4 15 | +++++++++++++++++ 16 | 17 | maxdepth 1 TOC: 18 | 19 | .. toctree:: 20 | :depth: 1 21 | 22 | index 23 | 24 | maxdepth 2 TOC: 25 | 26 | .. toctree:: 27 | :maxdepth: 2 28 | 29 | index 30 | 31 | maxdepth 3 TOC: 32 | 33 | .. toctree:: 34 | :maxdepth: 3 35 | 36 | index 37 | 38 | maxdepth 4 TOC: 39 | 40 | .. toctree:: 41 | :maxdepth: 4 42 | 43 | index 44 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/orphaned/file.rst: -------------------------------------------------------------------------------- 1 | This file should not be parsed 2 | ============================== 3 | 4 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/subdir/toctree.rst: -------------------------------------------------------------------------------- 1 | Toctree 2 | ======= 3 | 4 | .. toctree:: 5 | :glob: 6 | 7 | * 8 | 9 | .. toctree:: 10 | :glob: 11 | 12 | /subdir/* 13 | 14 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/wildcards/bugfix1.rst: -------------------------------------------------------------------------------- 1 | Feature 3 2 | ========= 3 | 4 | Lorem Ispusm dolor 5 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/wildcards/feature1.rst: -------------------------------------------------------------------------------- 1 | Feature 1 2 | ========= 3 | 4 | Lorem Ispusm dolor 5 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/wildcards/feature2.rst: -------------------------------------------------------------------------------- 1 | Feature 2 2 | ========= 3 | 4 | Lorem Ispusm dolor 5 | -------------------------------------------------------------------------------- /tests/BuilderToctree/input/wildcards/index.rst: -------------------------------------------------------------------------------- 1 | Wildcards 2 | ========= 3 | 4 | Features 5 | ======== 6 | 7 | .. toctree:: 8 | :glob: 9 | 10 | feature* 11 | 12 | Bugfixes 13 | ======== 14 | 15 | .. toctree:: 16 | :glob: 17 | 18 | bugfix* 19 | 20 | -------------------------------------------------------------------------------- /tests/BuilderUrl/input/index.rst: -------------------------------------------------------------------------------- 1 | Base URL 2 | ======== 3 | 4 | :ref:`Test reference url
    ` 5 | :ref:`Subdir ` 6 | :ref:`Subdir file ` 7 | 8 | .. toctree:: 9 | :glob: 10 | 11 | index 12 | * 13 | -------------------------------------------------------------------------------- /tests/BuilderUrl/input/subdir/file.rst: -------------------------------------------------------------------------------- 1 | Subdirectory File 2 | ================= 3 | 4 | :ref:`Test subdir reference url ` 5 | 6 | .. toctree:: 7 | :glob: 8 | 9 | /* 10 | -------------------------------------------------------------------------------- /tests/BuilderUrl/input/subdir/index.rst: -------------------------------------------------------------------------------- 1 | Subdirectory Index 2 | ================== 3 | 4 | :ref:`Test subdir reference url ` 5 | :ref:`Test subdir file reference path ` 6 | 7 | .. toctree:: 8 | :glob: 9 | 10 | /* 11 | -------------------------------------------------------------------------------- /tests/BuilderWithErrors/input/index.rst: -------------------------------------------------------------------------------- 1 | .. toctree:: 2 | :glob: 3 | 4 | no_content_directive 5 | -------------------------------------------------------------------------------- /tests/BuilderWithErrors/input/no_content_directive.rst: -------------------------------------------------------------------------------- 1 | Testing wrapper node at end of file 2 | 3 | .. note:: 4 | 5 | And here is more text. 6 | -------------------------------------------------------------------------------- /tests/ErrorManagerTest.php: -------------------------------------------------------------------------------- 1 | createMock(Configuration::class); 16 | $configuration->expects(self::atLeastOnce()) 17 | ->method('isAbortOnError') 18 | ->willReturn(false); 19 | $configuration->expects(self::atLeastOnce()) 20 | ->method('isSilentOnError') 21 | ->willReturn(true); 22 | 23 | $errorManager = new ErrorManager($configuration); 24 | $errorManager->error('ERROR FOO'); 25 | $errorManager->error('ERROR BAR'); 26 | 27 | $errors = $errorManager->getErrors(); 28 | self::assertSame('ERROR FOO', $errors[0]->asString()); 29 | self::assertSame('ERROR BAR', $errors[1]->asString()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree-titlesonly/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree-titlesonly/index.rst: -------------------------------------------------------------------------------- 1 | 2 | .. toctree:: 3 | :titlesonly: 4 | 5 | page1 6 | page2 -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree-titlesonly/page1.rst: -------------------------------------------------------------------------------- 1 | Page 1 2 | ====== 3 | 4 | Chapter 1 5 | --------- 6 | 7 | Chapter 2 8 | --------- 9 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree-titlesonly/page2.rst: -------------------------------------------------------------------------------- 1 | Page 2 2 | ====== 3 | 4 | Lorem Ipsum Dolor 5 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |

    index

    12 | 13 |
    14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree/index.rst: -------------------------------------------------------------------------------- 1 | index 2 | ===== 3 | 4 | .. toctree:: 5 | 6 | page1 7 | page2 -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree/page1.rst: -------------------------------------------------------------------------------- 1 | Page 1 2 | ====== 3 | 4 | Chapter 1 5 | --------- 6 | 7 | Chapter 2 8 | --------- 9 | -------------------------------------------------------------------------------- /tests/Functional/tests/build/toctree/page2.rst: -------------------------------------------------------------------------------- 1 | Page 2 2 | ====== 3 | 4 | Lorem Ipsum Dolor 5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anchor-failure/anchor-failure.html: -------------------------------------------------------------------------------- 1 |

    @Anchor Section

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anchor-failure/anchor-failure.rst: -------------------------------------------------------------------------------- 1 | `@Anchor Section`_ 2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anchor/anchor.html: -------------------------------------------------------------------------------- 1 |
    2 |

    3 | Anchors 4 |

    5 | 6 | 7 |

    go to lists

    8 |
    9 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anchor/anchor.rst: -------------------------------------------------------------------------------- 1 | Anchors 2 | ------- 3 | 4 | .. _lists: 5 | 6 | `go to lists <#lists>`_ 7 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anchor/anchor.tex: -------------------------------------------------------------------------------- 1 | \chapter{Anchors} 2 | \label{lists} 3 | \ref{#lists} 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anonymous/anonymous.html: -------------------------------------------------------------------------------- 1 |

    I love GitHub, GitLab and Facebook. But I don't affect references to __CLASS__.

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anonymous/anonymous.rst: -------------------------------------------------------------------------------- 1 | I love GitHub__, GitLab__ and `Facebook`__. But I don't affect references to __CLASS__. 2 | 3 | .. __: https://github.com/ 4 | .. __: https://gitlab.com/ 5 | .. __: https://facebook.com/ 6 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/anonymous/anonymous.tex: -------------------------------------------------------------------------------- 1 | I love \href{https://github.com/}{GitHub}, \href{https://gitlab.com/}{GitLab} and \href{https://facebook.com/}{Facebook}. But I don't affect references to __CLASS__. 2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/bom/bom.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/bom/bom.rst: -------------------------------------------------------------------------------- 1 | .. Should be a comment, with BOM 2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/class-directive/class-directive.html: -------------------------------------------------------------------------------- 1 |

    Test special-paragraph1 1.

    2 |

    Test special-paragraph1 2.

    3 |

    Test special-paragraph2 1.

    4 |

    Test special-paragraph2 2.

    5 |
    6 |

    Test

    7 |
    8 |
      9 |
    • Test list item 1.
    • 10 |
    • Test list item 2.
    • 11 |
    12 |

    Weird class names.

    13 |

    Level 1

    14 |
    15 |

    Level2 1

    16 |

    Level2 2

    17 |
    18 |
    19 |
    term 1
    20 |
    Definition 1
    21 |
    22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
    First colSecond col
    Second rowOther col
    36 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/class-directive/class-directive.rst: -------------------------------------------------------------------------------- 1 | .. class:: special-paragraph1 2 | 3 | Test special-paragraph1 1. 4 | 5 | Test special-paragraph1 2. 6 | 7 | .. class:: special-paragraph2 8 | 9 | Test special-paragraph2 1. 10 | 11 | Test special-paragraph2 2. 12 | 13 | .. note:: 14 | 15 | .. class:: special-paragraph3 16 | 17 | Test 18 | 19 | .. class:: special-list 20 | 21 | - Test list item 1. 22 | - Test list item 2. 23 | 24 | .. class:: Rot-Gelb.Blau Grün:+2008 25 | 26 | Weird class names. 27 | 28 | .. class:: level1 29 | 30 | Level 1 31 | 32 | .. class:: level2 33 | 34 | Level2 1 35 | 36 | Level2 2 37 | 38 | .. class:: special-definition-list 39 | 40 | term 1 41 | Definition 1 42 | 43 | .. class:: special-table 44 | 45 | =========== ========== 46 | First col Second col 47 | =========== ========== 48 | Second row Other col 49 | =========== ========== 50 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block-diff/code-block-diff.html: -------------------------------------------------------------------------------- 1 |
    + Added line
     2 | - Removed line
     3 |   Normal line
     4 | - Removed line
     5 | + Added line
     6 | 
     7 | 
    8 |
      Normal line
     9 | + Added line
    10 | - Removed line
    11 |   Normal line
    12 | - Removed line
    13 | + Added line
    14 | 
    15 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block-diff/code-block-diff.rst: -------------------------------------------------------------------------------- 1 | 2 | .. code-block:: diff 3 | 4 | + Added line 5 | - Removed line 6 | Normal line 7 | - Removed line 8 | + Added line 9 | 10 | 11 | .. code-block:: diff 12 | 13 | Normal line 14 | + Added line 15 | - Removed line 16 | Normal line 17 | - Removed line 18 | + Added line 19 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block-lastline/code-block-lastline.html: -------------------------------------------------------------------------------- 1 |
    A
    2 | B C
    3 | 
    4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block-lastline/code-block-lastline.rst: -------------------------------------------------------------------------------- 1 | .. code-block:: 2 | 3 | A 4 | B 5 | C 6 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block/code-block.html: -------------------------------------------------------------------------------- 1 |
    #include <iostream> using namespace std; int main(void)
    2 | { cout << "Hello world!" << endl;
    3 | }
    4 | 
    5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-block/code-block.rst: -------------------------------------------------------------------------------- 1 | .. code-block:: c++ 2 | 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main(void) 8 | { 9 | cout << "Hello world!" << endl; 10 | } 11 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-java/code-java.html: -------------------------------------------------------------------------------- 1 |
    protected void f()
    2 | {
    3 | }
    4 | 
    5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-java/code-java.rst: -------------------------------------------------------------------------------- 1 | .. code-block:: java 2 | 3 | protected void f() 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-list/code-list.html: -------------------------------------------------------------------------------- 1 |
    * Testing
    2 | * Hey
    3 | 
    4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-list/code-list.rst: -------------------------------------------------------------------------------- 1 | .. This should not be interpreted as a list 2 | 3 | .. code-block:: 4 | 5 | * Testing 6 | * Hey 7 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-with-whitespace/code-with-whitespace.html: -------------------------------------------------------------------------------- 1 |
    Test code block with whitespace.
    2 | 
    3 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code-with-whitespace/code-with-whitespace.rst: -------------------------------------------------------------------------------- 1 | :: 2 | 3 | Test code block with whitespace. 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code/code.html: -------------------------------------------------------------------------------- 1 |

    Code block:

    2 |
    This is a code block You hou!
    3 | 
    4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code/code.rst: -------------------------------------------------------------------------------- 1 | Code block:: 2 | 3 | This is a code block 4 | 5 | You hou! 6 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/code/code.tex: -------------------------------------------------------------------------------- 1 | Code block: 2 | \lstset{language=} 3 | \begin{lstlisting} 4 | This is a code block 5 | 6 | You hou! 7 | 8 | \end{lstlisting} 9 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment-3/comment-3.html: -------------------------------------------------------------------------------- 1 |

    ... This is not a comment!

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment-3/comment-3.rst: -------------------------------------------------------------------------------- 1 | .. This is a comment! 2 | ... This is not a comment! 3 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment-empty/comment-empty.html: -------------------------------------------------------------------------------- 1 |

    this is not a comment

    2 |
    3 |

    this is a blockquote

    4 |
    5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment-empty/comment-empty.rst: -------------------------------------------------------------------------------- 1 | .. 2 | this is not a comment 3 | 4 | .. 5 | 6 | this is a blockquote 7 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment/comment.html: -------------------------------------------------------------------------------- 1 |

    Text before

    2 |

    Text after

    3 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comment/comment.rst: -------------------------------------------------------------------------------- 1 | Text before 2 | .. Testing comment 3 | Text after 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments-block-with-header/comments-block-with-header.html: -------------------------------------------------------------------------------- 1 |

    this is not a comment

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments-block-with-header/comments-block-with-header.rst: -------------------------------------------------------------------------------- 1 | .. header comment 2 | this is a comment 3 | this is not a comment 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments-block/comments-block.html: -------------------------------------------------------------------------------- 1 |

    this is not a comment

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments-block/comments-block.rst: -------------------------------------------------------------------------------- 1 | .. 2 | this is a comment 3 | this is not a comment 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments/comments.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/comments/comments.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/crlf/crlf.html: -------------------------------------------------------------------------------- 1 |
    2 |

    3 | Hello world 4 |

    5 |

    Hey!

    6 |
    7 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/crlf/crlf.rst: -------------------------------------------------------------------------------- 1 | Hello world 2 | =========== 3 | 4 | Hey! 5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/css/css.html: -------------------------------------------------------------------------------- 1 |

    Testing page!

    2 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/css/css.rst: -------------------------------------------------------------------------------- 1 | .. stylesheet:: style.css 2 | 3 | Testing page! 4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/div/div.html: -------------------------------------------------------------------------------- 1 |
    2 |

    Hello!

    3 |
    4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/div/div.rst: -------------------------------------------------------------------------------- 1 | .. div:: testing 2 | Hello! 3 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/empty-p/empty-p.html: -------------------------------------------------------------------------------- 1 |

    Empty paragraph:

    2 |
    Code 
    3 |

    Hello

    4 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/empty-p/empty-p.rst: -------------------------------------------------------------------------------- 1 | Empty paragraph: 2 | 3 | :: 4 | 5 | Code 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Hello 17 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/empty/empty.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doctrine/rst-parser/98ad0ba6edeafd50792db77f7c997352c88a793a/tests/Functional/tests/render/empty/empty.html -------------------------------------------------------------------------------- /tests/Functional/tests/render/empty/empty.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doctrine/rst-parser/98ad0ba6edeafd50792db77f7c997352c88a793a/tests/Functional/tests/render/empty/empty.rst -------------------------------------------------------------------------------- /tests/Functional/tests/render/enumerated-ignored/enumerated-ignored.html: -------------------------------------------------------------------------------- 1 |

    The second line of each enumerated list item is checked for validity:

    2 |

    1. This is not a list. 3 | It's a paragraph starting with a number.

    4 |

    1. Single line paragraphs starting with a number may use an escape.

    5 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/enumerated-ignored/enumerated-ignored.rst: -------------------------------------------------------------------------------- 1 | The second line of each enumerated list item is checked for validity: 2 | 3 | 1. This is not a list. 4 | It's a paragraph starting with a number. 5 | 6 | \1. Single line paragraphs starting with a number may use an escape. 7 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/enumerated/enumerated.html: -------------------------------------------------------------------------------- 1 |

    Testing an arabic numerals list:

    2 |
      3 |
    1. First item
    2. 4 |
    3. Second item
    4. 5 |
    5. Third item 6 | Multiline
    6. 7 |
    8 |

    And an auto-enumerated list:

    9 |
      10 |
    1. First item 11 | Multiline
    2. 12 |
    3. Second item
    4. 13 |
    14 |

    Using parentheses:

    15 |
      16 |
    1. First item
    2. 17 |
    3. Second item
    4. 18 |
    19 |

    Using right-parenthesis:

    20 |
      21 |
    1. First item
    2. 22 |
    3. Second item
    4. 23 |
    24 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/enumerated/enumerated.rst: -------------------------------------------------------------------------------- 1 | Testing an arabic numerals list: 2 | 3 | 1. First item 4 | 2. Second item 5 | 3. Third item 6 | Multiline 7 | 8 | And an auto-enumerated list: 9 | 10 | #. First item 11 | Multiline 12 | #. Second item 13 | 14 | Using parentheses: 15 | 16 | (1) First item 17 | (2) Second item 18 | 19 | Using right-parenthesis: 20 | 21 | 1) First item 22 | 2) Second item 23 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/escape/escape.html: -------------------------------------------------------------------------------- 1 |

    Testing that this is escaped: <script>

    2 |

    And escape characters are ignored, but this one isn't: \stdClass

    3 | -------------------------------------------------------------------------------- /tests/Functional/tests/render/escape/escape.rst: -------------------------------------------------------------------------------- 1 | Testing that this is escaped: