From c4b2441727be014f34c09d7be759a9383095cee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 09:23:50 +0200 Subject: [PATCH 1/9] rm useless _static --- doc/conf.py | 2 +- test/_static/.gitignore | 0 test/conf.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 test/_static/.gitignore diff --git a/doc/conf.py b/doc/conf.py index deb030f..39131ca 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -120,7 +120,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/test/_static/.gitignore b/test/_static/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/test/conf.py b/test/conf.py index 6ad727d..e3bde51 100644 --- a/test/conf.py +++ b/test/conf.py @@ -120,7 +120,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. From 097f62c454a61f656ad8d156ff94943db25f7249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 09:25:01 +0200 Subject: [PATCH 2/9] run CI on push and cron --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed89fc2..3ff941d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,10 @@ name: CI on: - push: - branches: - - master pull_request: - branches: - - '*' + push: + schedule: + - cron: '0 0/2 * * *' jobs: build: From dcbf1ffacef3502a762faf04ba9408bfb832c9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 09:54:09 +0200 Subject: [PATCH 3/9] more docs cleanup --- .github/workflows/ci.yml | 6 +++--- .github/workflows/doc.yml | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ff941d..20f0e39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,13 +11,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.7', '3.8', '3.9'] + python: ['3.7', '3.8', '3.9', '3.10', '3.11'] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index a035656..120f7ea 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -21,8 +21,8 @@ concurrency: cancel-in-progress: false jobs: - # Build job build: + if: github.repository_owner == 'markstory' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -35,7 +35,7 @@ jobs: id: pages uses: actions/configure-pages@v3 - - name: Build doct + - name: Build doc run: make -C doc html - name: Upload artifact @@ -43,7 +43,6 @@ jobs: with: path: doc/_build/html - # Deployment job deploy: environment: name: github-pages From 42406c7c913a19254d8c136cb156cc1823cbf528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 12:12:40 +0200 Subject: [PATCH 4/9] rename original tests to "must-build" --- .github/workflows/ci.yml | 10 +++++----- .gitignore | 2 +- test/{ => must-build}/Makefile | 0 test/{ => must-build}/conf.py | 0 test/{ => must-build}/index.rst | 0 test/{ => must-build}/make.bat | 0 test/{ => must-build}/test_doc.rst | 0 test/{ => must-build}/test_doc2.rst | 0 test/{ => must-build}/test_nesting_regression.rst | 0 9 files changed, 6 insertions(+), 6 deletions(-) rename test/{ => must-build}/Makefile (100%) rename test/{ => must-build}/conf.py (100%) rename test/{ => must-build}/index.rst (100%) rename test/{ => must-build}/make.bat (100%) rename test/{ => must-build}/test_doc.rst (100%) rename test/{ => must-build}/test_doc2.rst (100%) rename test/{ => must-build}/test_nesting_regression.rst (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20f0e39..f3485e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,18 +27,18 @@ jobs: pip install -r requirements.txt pip install . - - name: Build test/ + - name: Build Test run: | - cd test && make html SPHINXOPTS='-W' + cd test/must-build && make html SPHINXOPTS='-W' - name: Build Test with toc show_parents=hide run: | - cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide' + cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide' - name: Build Test with toc show_parents=domain run: | - cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain' + cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain' - name: Build Test with toc show_parents=all run: | - cd test && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all' + cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all' diff --git a/.gitignore b/.gitignore index c28a058..2d5f945 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ dist/ build/ doc/_build -test/_build +test/must-build/_build *.pyc *.egg-info .DS_Store diff --git a/test/Makefile b/test/must-build/Makefile similarity index 100% rename from test/Makefile rename to test/must-build/Makefile diff --git a/test/conf.py b/test/must-build/conf.py similarity index 100% rename from test/conf.py rename to test/must-build/conf.py diff --git a/test/index.rst b/test/must-build/index.rst similarity index 100% rename from test/index.rst rename to test/must-build/index.rst diff --git a/test/make.bat b/test/must-build/make.bat similarity index 100% rename from test/make.bat rename to test/must-build/make.bat diff --git a/test/test_doc.rst b/test/must-build/test_doc.rst similarity index 100% rename from test/test_doc.rst rename to test/must-build/test_doc.rst diff --git a/test/test_doc2.rst b/test/must-build/test_doc2.rst similarity index 100% rename from test/test_doc2.rst rename to test/must-build/test_doc2.rst diff --git a/test/test_nesting_regression.rst b/test/must-build/test_nesting_regression.rst similarity index 100% rename from test/test_nesting_regression.rst rename to test/must-build/test_nesting_regression.rst From bd2d2e34867adecacf587eee68e3dfcc328f9086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 12:12:52 +0200 Subject: [PATCH 5/9] Add Unit Testing --- .github/workflows/ci.yml | 33 +++++ .gitignore | 1 + test/unit/Makefile | 130 +++++++++++++++++++ test/unit/conf.py | 17 +++ test/unit/index.rst | 7 ++ test/unit/make.bat | 155 +++++++++++++++++++++++ test/unit/method.html | 27 ++++ test/unit/method.rst | 5 + test/unit/ns.html | 261 +++++++++++++++++++++++++++++++++++++++ test/unit/ns.rst | 63 ++++++++++ 10 files changed, 699 insertions(+) create mode 100644 test/unit/Makefile create mode 100644 test/unit/conf.py create mode 100644 test/unit/index.rst create mode 100644 test/unit/make.bat create mode 100644 test/unit/method.html create mode 100644 test/unit/method.rst create mode 100644 test/unit/ns.html create mode 100644 test/unit/ns.rst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3485e1..255928e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,16 @@ on: jobs: build: + if: endsWith(github.head_ref || github.ref_name, '.changes') == false runs-on: ubuntu-latest strategy: matrix: python: ['3.7', '3.8', '3.9', '3.10', '3.11'] fail-fast: false + permissions: + contents: write + steps: - uses: actions/checkout@v3 @@ -21,6 +25,10 @@ jobs: with: python-version: ${{ matrix.python }} + - name: Install tools + run: | + sudo apt -y install libxml2-utils + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -42,3 +50,28 @@ jobs: - name: Build Test with toc show_parents=all run: | cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all' + + - name: Run Unit Testing + run: | + cd test/unit + find . -name '*.html' -exec rm {} \; + make html SPHINXOPTS='-W' + (cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;) + rm genindex.html index.html search.html php-modindex.html + + - name: Diff Unit Outputs + run: | + cd test/unit + rm -r _build + git add . -N && git diff --exit-code + + - name: Push Unit Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: ${{ github.head_ref || github.ref_name }}.changes + create_branch: true + push_options: '--force' + commit_message: Unit Changes + commit_user_name: Bot + commit_user_email: bot@example.com + commit_author: Bot diff --git a/.gitignore b/.gitignore index 2d5f945..508e0cc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ dist/ build/ doc/_build test/must-build/_build +test/unit/_build *.pyc *.egg-info .DS_Store diff --git a/test/unit/Makefile b/test/unit/Makefile new file mode 100644 index 0000000..f61d988 --- /dev/null +++ b/test/unit/Makefile @@ -0,0 +1,130 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/sphinxcontrib-rubydomain-acceptancetest.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/sphinxcontrib-rubydomain-acceptancetest.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/sphinxcontrib-rubydomain-acceptancetest" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/sphinxcontrib-rubydomain-acceptancetest" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +latexpdf: latex + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/test/unit/conf.py b/test/unit/conf.py new file mode 100644 index 0000000..d081966 --- /dev/null +++ b/test/unit/conf.py @@ -0,0 +1,17 @@ +import sys, os + +sys.path.append(os.path.abspath('..')) + +extensions = [ + 'sphinxcontrib.phpdomain', +] + +source_suffix = '.rst' + +master_doc = 'index' + +exclude_patterns = ['_build'] + +pygments_style = 'sphinx' + +html_theme = 'default' diff --git a/test/unit/index.rst b/test/unit/index.rst new file mode 100644 index 0000000..0a71fcf --- /dev/null +++ b/test/unit/index.rst @@ -0,0 +1,7 @@ +Test: Build all files +===================== + +.. toctree:: + :glob: + + ** diff --git a/test/unit/make.bat b/test/unit/make.bat new file mode 100644 index 0000000..4310ae1 --- /dev/null +++ b/test/unit/make.bat @@ -0,0 +1,155 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\sphinxcontrib-rubydomain-acceptancetest.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\sphinxcontrib-rubydomain-acceptancetest.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff --git a/test/unit/method.html b/test/unit/method.html new file mode 100644 index 0000000..c16f601 --- /dev/null +++ b/test/unit/method.html @@ -0,0 +1,27 @@ + +
+
+
+ + simplify + + ( + ) + +
+
+

Simplify expression.

+
+
Parameters:
+
+
    +
  • +

    $args (array) – Associative array

    +
  • +
+
+
+
+
+
+
diff --git a/test/unit/method.rst b/test/unit/method.rst new file mode 100644 index 0000000..429cdf5 --- /dev/null +++ b/test/unit/method.rst @@ -0,0 +1,5 @@ +.. php:method:: Foo::simplify() + + Simplify expression. + + :param array $args: Associative array diff --git a/test/unit/ns.html b/test/unit/ns.html new file mode 100644 index 0000000..44bfc2a --- /dev/null +++ b/test/unit/ns.html @@ -0,0 +1,261 @@ + +
+
+ +

Simple NS

+
+
+ + Foo\ + + + simplify + + ( + ) + +
+
+
+
+
+ + class + + + Foo\ + + + A + + +
+
+
+
+
+ + Foo\A:: + + + simplify + + ( + ) + +
+
+
+

Cross linking:

+
+
+
- :php:meth:`X::simplify`
+- :php:meth:`A::simplify`
+
+
+
+
+
+ +

NS can be redeclared

+
+
+ + Foo\Bar\ + + + simplify + + ( + ) + +
+
+
+
+
+ + class + + + Foo\Bar\ + + + A + + +
+
+
+
+
+ + Foo\Bar\A:: + + + simplify + + ( + ) + +
+
+
+ +
+
+ + class + + + Bar\ + + + A + + +
+
+
+
+
+ + Bar\A:: + + + simplify + + ( + ) + +
+
+
+

Cross linking:

+
+
+
- :php:meth:`X::simplify`
+- :php:meth:`A::simplify`
+
+
+
+
+
+

Leading \ implies absolute class name

+
+
+ + \X::simplify() + +
+
+
+
+
+ + Bar\X2:: + + + simplify + + ( + ) + +
+
+
+
+
+ + \A + +
+
+
+
+
+ + Bar\A:: + + + simplify + + ( + ) +
+
+
+
+
+ + class + + + Bar\ + + + A2 + + +
+
+
+
+
+ + Bar\A2:: + + + simplify + + ( + ) + +
+
+
+

Cross linking:

+
+
+
- :php:meth:`X::simplify`
+- :php:meth:`A::simplify`
+
+
+
+ +
+
+
diff --git a/test/unit/ns.rst b/test/unit/ns.rst new file mode 100644 index 0000000..dfd267d --- /dev/null +++ b/test/unit/ns.rst @@ -0,0 +1,63 @@ +Simple NS +========= + +.. php:namespace:: Foo + +.. php:method:: X::simplify() + +.. php:class:: A + +.. php:method:: simplify() + +Cross linking:: + +- :php:meth:`X::simplify` +- :php:meth:`A::simplify` + +NS can be redeclared +==================== + +.. php:namespace:: Foo\Bar + +.. php:method:: X::simplify() + +.. php:class:: A + +.. php:method:: simplify() + +.. php:namespace:: Bar + +.. php:class:: A + +.. php:method:: simplify() + +Cross linking:: + +- :php:meth:`X::simplify` +- :php:meth:`A::simplify` + +Leading ``\`` implies absolute class name +========================================= + +.. php:method:: \X::simplify() + +.. php:method:: X2::simplify() + +.. php:class:: \A + +.. php:method:: simplify() + +.. php:class:: A2 + +.. php:method:: simplify() + +Cross linking:: + +- :php:meth:`X::simplify` +- :php:meth:`A::simplify` + +- :php:meth:`\X::simplify` +- :php:meth:`\A::simplify` + +- :php:meth:`X2::simplify` +- :php:meth:`A2::simplify` From e4bf98b5772b56849beee6eabb756654df7c5a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 12:51:30 +0200 Subject: [PATCH 6/9] do not rely on rst parser only --- .github/workflows/ci.yml | 2 ++ test/unit/conf.py | 6 +++--- test/unit/{index.rst => index.md} | 2 ++ test/unit/{method.rst => method.md} | 2 ++ test/unit/{ns.rst => ns.md} | 2 ++ test/unit/requirements.txt | 2 ++ 6 files changed, 13 insertions(+), 3 deletions(-) rename test/unit/{index.rst => index.md} (80%) rename test/unit/{method.rst => method.md} (84%) rename test/unit/{ns.rst => ns.md} (98%) create mode 100644 test/unit/requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 255928e..933c36f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + pip install -r test/unit/requirements.txt pip install . - name: Build Test @@ -66,6 +67,7 @@ jobs: git add . -N && git diff --exit-code - name: Push Unit Changes + if: failure() uses: stefanzweifel/git-auto-commit-action@v4 with: branch: ${{ github.head_ref || github.ref_name }}.changes diff --git a/test/unit/conf.py b/test/unit/conf.py index d081966..2487b29 100644 --- a/test/unit/conf.py +++ b/test/unit/conf.py @@ -4,14 +4,14 @@ extensions = [ 'sphinxcontrib.phpdomain', + 'myst_parser', ] -source_suffix = '.rst' +myst_enable_extensions = ['colon_fence'] +source_suffix = '.rst' master_doc = 'index' exclude_patterns = ['_build'] -pygments_style = 'sphinx' - html_theme = 'default' diff --git a/test/unit/index.rst b/test/unit/index.md similarity index 80% rename from test/unit/index.rst rename to test/unit/index.md index 0a71fcf..e6b52b8 100644 --- a/test/unit/index.rst +++ b/test/unit/index.md @@ -1,3 +1,4 @@ +```{eval-rst} Test: Build all files ===================== @@ -5,3 +6,4 @@ Test: Build all files :glob: ** +``` diff --git a/test/unit/method.rst b/test/unit/method.md similarity index 84% rename from test/unit/method.rst rename to test/unit/method.md index 429cdf5..7436a61 100644 --- a/test/unit/method.rst +++ b/test/unit/method.md @@ -1,5 +1,7 @@ +```{eval-rst} .. php:method:: Foo::simplify() Simplify expression. :param array $args: Associative array +``` diff --git a/test/unit/ns.rst b/test/unit/ns.md similarity index 98% rename from test/unit/ns.rst rename to test/unit/ns.md index dfd267d..4ac3319 100644 --- a/test/unit/ns.rst +++ b/test/unit/ns.md @@ -1,3 +1,4 @@ +```{eval-rst} Simple NS ========= @@ -61,3 +62,4 @@ Cross linking:: - :php:meth:`X2::simplify` - :php:meth:`A2::simplify` +``` diff --git a/test/unit/requirements.txt b/test/unit/requirements.txt new file mode 100644 index 0000000..98a3c62 --- /dev/null +++ b/test/unit/requirements.txt @@ -0,0 +1,2 @@ +sphinx +myst-parser From 946875d94711af5d0324e455bb518d21d7d06a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 13:07:54 +0200 Subject: [PATCH 7/9] test only simple NS for now --- test/unit/ns.html | 238 +++------------------------------------------- test/unit/ns.md | 56 +---------- 2 files changed, 17 insertions(+), 277 deletions(-) diff --git a/test/unit/ns.html b/test/unit/ns.html index 44bfc2a..bf0c670 100644 --- a/test/unit/ns.html +++ b/test/unit/ns.html @@ -3,20 +3,6 @@

Simple NS

-
-
- - Foo\ - - - simplify - - ( - ) - -
-
-
@@ -46,216 +32,20 @@

Simple NS -
-
- :php:meth:`X::simplify`
-- :php:meth:`A::simplify`
-
-
-

- -
- -

NS can be redeclared

-
-
- - Foo\Bar\ - - - simplify - - ( - ) - -
-
-
-
-
- - class - - - Foo\Bar\ - - - A - - -
-
-
-
-
- - Foo\Bar\A:: - - - simplify - - ( - ) - -
-
-
- -
-
- - class - - - Bar\ - - - A - - -
-
-
-
-
- - Bar\A:: - - - simplify - - ( - ) - -
-
-
-

Cross linking:

-
-
-
- :php:meth:`X::simplify`
-- :php:meth:`A::simplify`
-
-
-
-
-
-

Leading \ implies absolute class name

-
-
- - \X::simplify() - -
-
-
-
-
- - Bar\X2:: - - - simplify - - ( - ) - -
-
-
-
-
- - \A - -
-
-
-
-
- - Bar\A:: - - - simplify - - ( - ) -
-
-
-
-
- - class - - - Bar\ - - - A2 - - -
-
-
-
-
- - Bar\A2:: - - - simplify - - ( - ) - -
-
-
-

Cross linking:

-
-
-
- :php:meth:`X::simplify`
-- :php:meth:`A::simplify`
-
-
-
- +
+

Cross linking

+ +
diff --git a/test/unit/ns.md b/test/unit/ns.md index 4ac3319..0891c47 100644 --- a/test/unit/ns.md +++ b/test/unit/ns.md @@ -4,62 +4,12 @@ Simple NS .. php:namespace:: Foo -.. php:method:: X::simplify() - -.. php:class:: A - -.. php:method:: simplify() - -Cross linking:: - -- :php:meth:`X::simplify` -- :php:meth:`A::simplify` - -NS can be redeclared -==================== - -.. php:namespace:: Foo\Bar - -.. php:method:: X::simplify() - -.. php:class:: A - -.. php:method:: simplify() - -.. php:namespace:: Bar - .. php:class:: A .. php:method:: simplify() -Cross linking:: - -- :php:meth:`X::simplify` -- :php:meth:`A::simplify` - -Leading ``\`` implies absolute class name -========================================= - -.. php:method:: \X::simplify() - -.. php:method:: X2::simplify() - -.. php:class:: \A - -.. php:method:: simplify() - -.. php:class:: A2 - -.. php:method:: simplify() - -Cross linking:: - -- :php:meth:`X::simplify` -- :php:meth:`A::simplify` - -- :php:meth:`\X::simplify` -- :php:meth:`\A::simplify` +Cross linking +************* -- :php:meth:`X2::simplify` -- :php:meth:`A2::simplify` +* :php:meth:`A::simplify` ``` From 48a3c237599b05a29d1b2b6b0c04d3fd8213e260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Mon, 17 Jul 2023 13:40:37 +0200 Subject: [PATCH 8/9] declare using MyST -> AST --- test/unit/index.md | 12 ++++---- test/unit/method.html | 68 ++++++++++++++++++++++++++++--------------- test/unit/method.md | 18 +++++++++--- test/unit/ns.md | 19 ++++++------ 4 files changed, 73 insertions(+), 44 deletions(-) diff --git a/test/unit/index.md b/test/unit/index.md index e6b52b8..4cc47cd 100644 --- a/test/unit/index.md +++ b/test/unit/index.md @@ -1,9 +1,7 @@ -```{eval-rst} -Test: Build all files -===================== +# Test: Build all files -.. toctree:: - :glob: +:::{toctree} +:glob: - ** -``` +** +::: diff --git a/test/unit/method.html b/test/unit/method.html index c16f601..f826a3a 100644 --- a/test/unit/method.html +++ b/test/unit/method.html @@ -1,27 +1,49 @@
-
-
- - simplify - - ( - ) - -
-
-

Simplify expression.

-
-
Parameters:
-
-
    -
  • -

    $args (array) – Associative array

    -
  • -
-
-
-
-
+
+

Simple method

+
+
+ + class + + + Foo + + +
+
+
+
+
Foo::test($a, ...$args)
+
+

Simple test method.

+
+
Parameters:
+
+
    +
  • +

    $args (array) – Associative array

    +
  • +
+
+
+
+
+
+

Cross linking

+ +
+
diff --git a/test/unit/method.md b/test/unit/method.md index 7436a61..e7d0c1f 100644 --- a/test/unit/method.md +++ b/test/unit/method.md @@ -1,7 +1,17 @@ -```{eval-rst} -.. php:method:: Foo::simplify() +# Simple method + +:::{php:class} Foo +::: + +:::{php:method} test($a, ...$args) - Simplify expression. +Simple test method. - :param array $args: Associative array +```{eval-rst} +:param array $args: Associative array ``` +::: + +## Cross linking + +- {php:meth}`Foo::test()` diff --git a/test/unit/ns.md b/test/unit/ns.md index 0891c47..1ebfe4d 100644 --- a/test/unit/ns.md +++ b/test/unit/ns.md @@ -1,15 +1,14 @@ -```{eval-rst} -Simple NS -========= +# Simple NS -.. php:namespace:: Foo +:::{php:namespace} Foo +::: -.. php:class:: A +:::{php:class} A +::: -.. php:method:: simplify() +:::{php:method} simplify() +::: -Cross linking -************* +## Cross linking -* :php:meth:`A::simplify` -``` +- {php:meth}`A::simplify` From aac1a7f4c84f7bed04197aad2467584d68821dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Wed, 19 Jul 2023 21:31:58 +0200 Subject: [PATCH 9/9] no implicit "xxx.changes" branch create --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 933c36f..7595a41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,6 @@ jobs: uses: stefanzweifel/git-auto-commit-action@v4 with: branch: ${{ github.head_ref || github.ref_name }}.changes - create_branch: true push_options: '--force' commit_message: Unit Changes commit_user_name: Bot