Skip to content

Commit

Permalink
[DOCS] Switch to PHP based documentation rendering
Browse files Browse the repository at this point in the history
* Create guides.xml
* Resolve rendering warnings, convert
  included .rst files into .rst.txt as all
  .rst files are handled as documents
* Remove now outdated Settings.cfg
* Remove outdated genindex.rst
* Introduce automatic testing for documentation changes
* Introduce make file for easy local rendering
  • Loading branch information
linawolf committed Mar 9, 2024
1 parent 28ec5a0 commit 8d66201
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 81 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: test documentation

on: [ push, pull_request ]

jobs:
tests:
name: documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test if the documentation will render without warnings
run: |
mkdir -p Documentation-GENERATED-temp \
&& docker run --rm --pull always -v $(pwd):/project \
ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log
35 changes: 1 addition & 34 deletions Documentation/Includes.rst.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1 @@
.. More information about this file:
https://docs.typo3.org/m/typo3/docs-how-to-document/main/en-us/GeneralConventions/FileStructure.html#includes-rst-txt
.. ----------
.. text roles
.. ----------
.. role:: aspect(emphasis)
.. role:: bash(code)
.. role:: html(code)
.. role:: js(code)
.. role:: php(code)
.. role:: rst(code)
.. role:: sep(strong)
.. role:: sql(code)

.. role:: tsconfig(code)
:class: typoscript

.. role:: typoscript(code)
.. role:: xml(code)
:class: html

.. role:: yaml(code)

.. default-role:: code

.. ---------
.. highlight
.. ---------
.. By default, code blocks use YAML syntax highlighting
.. highlight:: yaml
.. You can put central messages to display on all pages here
1 change: 0 additions & 1 deletion Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,3 @@ use content types as sub-resources inside extensions.
:hidden:

Sitemap
genindex
29 changes: 0 additions & 29 deletions Documentation/Settings.cfg

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. include:: /Includes.rst.txt

.. confval:: allowedCustomProperties

:Required: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. include:: /Includes.rst.txt

.. confval:: labelField

:Required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here you can find all :ref:`common root options <yaml_reference_common>`.
table: tx_vendor_my_custom_table_name
.. include:: /Snippets/LabelField.rst
.. include:: /Snippets/LabelField.rst.txt

.. confval:: typeField

Expand Down
2 changes: 1 addition & 1 deletion Documentation/YamlReference/FieldTypes/Checkbox/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Settings
* :yaml:`checkboxToggle`
* :yaml:`checkboxLabeledToggle`

.. include:: /Snippets/AllowedCustomProperties.rst
.. include:: /Snippets/AllowedCustomProperties.rst.txt

For advanced configuration refer to the :ref:`TCA documentation <t3tca:columns-check>`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ or gif files. These should be 64x64px.
Settings
========

.. include:: /Snippets/LabelField.rst
.. include:: /Snippets/LabelField.rst.txt

.. confval:: table

Expand Down
2 changes: 1 addition & 1 deletion Documentation/YamlReference/FieldTypes/File/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Settings

It is possible to define crop variants for this specific field and Content
Block. This documentation only covers the most basic configuration. Refer to
the :ref:`TCA documentation <columns-imageManipulation-properties-cropVariants>`
the :ref:`TCA documentation <t3tca:columns-imageManipulation-properties-cropVariants>`
for a complete overview of possibilities.

Example configuration below. The aspect ratios can be defined as a float
Expand Down
2 changes: 1 addition & 1 deletion Documentation/YamlReference/FieldTypes/Radio/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Settings
</trans-unit>
</body>
.. include:: /Snippets/AllowedCustomProperties.rst
.. include:: /Snippets/AllowedCustomProperties.rst.txt

For more advanced configuration refer to the :ref:`TCA documentation <t3tca:columns-radio>`.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/YamlReference/FieldTypes/Select/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Settings
prevents the record from being saved if the limit is not satisfied.
The field can be set as required by setting `minitems` to at least 1.

.. include:: /Snippets/AllowedCustomProperties.rst
.. include:: /Snippets/AllowedCustomProperties.rst.txt

For more advanced configuration refer to the :ref:`TCA documentation <t3tca:columns-select>`.

Expand Down
7 changes: 0 additions & 7 deletions Documentation/genindex.rst

This file was deleted.

19 changes: 19 additions & 0 deletions Documentation/guides.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<guides xmlns="https://www.phpdoc.org/guides" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides ../vendor/phpdocumentor/guides-cli/resources/schema/guides.xsd"
links-are-relative="true">
<extension class="\T3Docs\Typo3DocsTheme\DependencyInjection\Typo3DocsThemeExtension"
project-home="https://typo3.org/community/teams/typo3-development/initiatives/structured-content/content-blocks"
project-contact="https://typo3.org/community/teams/typo3-development/initiatives/structured-content/"
project-repository="https://github.com/nhovratov/content-blocks"
project-issues="https://github.com/nhovratov/content-blocks/issues"
edit-on-github-branch="main"
edit-on-github="nhovratov/content-blocks"
typo3-core-preferred="main"
interlink-shortcode="contentblocks/content-blocks"
/>
<project title="Content Blocks"
release="0.6"
copyright="since 2023 by TYPO3 contributors"
/>
</guides>
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: help
help: ## Displays this list of targets with descriptions
@echo "The following commands are available:\n"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: docs
docs: ## Generate projects documentation (from "Documentation" directory)
mkdir -p Documentation-GENERATED-temp

docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation

.PHONY: test-docs
test-docs: ## Test the documentation rendering
mkdir -p Documentation-GENERATED-temp

docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ Build/Scripts/runTests.sh -s functional

Be sure to exclude the `.Build/public/typo3temp` directory from indexing in your IDE (e.g. PhpStorm) before starting the tests.

## Rendering the documentation

When you update the documentation you can try out rendering it locally
(Docker required):

```
make docs
```

You can test if the syntax and references are ok with

```
make test-docs
```

## Feedback

You can reach us on the TYPO3 Slack channel `#cig-structuredcontent`. We
Expand Down

0 comments on commit 8d66201

Please sign in to comment.