Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown node rowSpan #11

Closed
ValentinConstantin opened this issue Nov 4, 2021 · 9 comments · May be fixed by #35
Closed

Unknown node rowSpan #11

ValentinConstantin opened this issue Nov 4, 2021 · 9 comments · May be fixed by #35

Comments

@ValentinConstantin
Copy link

ValentinConstantin commented Nov 4, 2021

Failed to build sphinx html with FlatTable using linuxdoc
raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: rowSpan

#: ../../introduction.md:1
msgid "{rspan}1 TEST"
msgstr "{rspan}1 TEST"

The command that I use
python -m sphinx -T -E -b html -d _build/doctrees -D language=ru . _build/html

Update:

I used the same example as in the documentation, but the same problem

index.rst


Test
----

.. flat-table:: table title
   :widths: 2 1 1 3

   * - head col 1
     - head col 2
     - head col 3
     - head col 4

   * - column 1
     - field 1.1
     - field 1.2 with autospan

   * - column 2
     - field 2.1
     - :rspan:`1` :cspan:`1` field 2.2 - 3.3

   * .. _`last row`:

     - column 3

and locales/ru/LC_MESSAGES/index.po

#: ../../test/index.rst:18
msgid ":rspan:`1` :cspan:`1` field 2.2 - 3.3"
msgstr ":rspan:`1` :cspan:`1` test 2.2 - 3.3"
@return42
Copy link
Owner

return42 commented Nov 5, 2021

Sorry, I have a problem to understand what the issue is / what you try to do. Why is there a markdown file named: #: ../../introduction.md:1? Can you please describe what you want and what you have tried / thanks!

@ValentinConstantin
Copy link
Author

I have the following index.rst and into it exists introduction.

PRAIS4 Reporting Manual
=======================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   introduction
   SO1
   SO2
   SO3
   SO4
   SO5
   voluntary_targets_and_others
   implementationFramework
   annex_I
   annex_II

You can find the Introduction.md https://github.com/eaudeweb/Prais4-reporting-manual/blob/master/introduction.md also the repository https://github.com/eaudeweb/Prais4-reporting-manual

The problem is when I try to build HTML from PO-files. To be more clearly, I generated the PO-files using the following commands,

sphinx-build -b gettext . _build/gettext
sphinx-intl update -p _build/gettext -l es -l fr -l ar -l ru -l zh

completed the translation files locales/ru/LC_MESSAGES/introduction.po (which looks like)

#: ../../introduction.md:1
msgid "{rspan}`1` Indicator code"
msgstr "{rspan}`1` Код показателя"

#: ../../introduction.md:2
msgid "{rspan}`1` Indicator name"
msgstr "{rspan}`1` Наименование показателя"

#: ../../introduction.md:3
msgid "{rspan}`1` Metrics / proxies"
msgstr "{rspan}`1` Метрики / вспомогательные параметры"

#: ../../introduction.md:4
msgid "{rspan}`1` Adopted / proposed"
msgstr "{rspan}`1` Принято / предложено"

#: ../../introduction.md:5
msgid "{cspan}`1` Reporting attribution"
msgstr "{cspan}`1` Компетенция отчетности"

and when run the following command

python -m sphinx -T -E -b html -d _build/doctrees -D language=ru . _build/html

I get the error

raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: rowSpan

@return42
Copy link
Owner

return42 commented Nov 5, 2021

Hm, do you mix reST with Mardown markup?

The index.rst is valid reST markup and the introduction.md content has a Mardown markup.

You can't mix these markups into one. Except you are using any special sphinx extension I do not know. Even if you use a extension like myst-parser, the Markdown file can't include reST markup.

It may be that I misunderstand you, but I have the impression that you are trying to mix the different Markup wildly.

@return42 return42 closed this as completed Nov 5, 2021
@melish
Copy link

melish commented Nov 5, 2021

Hi Markus, I am a colleague of Valentin and will try to explain this better. We are indeed using myst-parser, but without mixing in the same file reST and Markdown (it's possible via the eval-rst directive).
However, it's unrelated to the problem we are encountering, which has to do with internationalization.
Here is a simple example using reST: https://github.com/melish/linuxdoc_i18n.

index.rst contains one of the tables from the documentation and it works well when building the English version, but after adding the French translations and running:

make -e SPHINXOPTS="-D language='fr'" html

it fails with

Exception occurred:
  File "/home/andrei/edw/linuxdoc_i18n/.venv/lib/python3.9/site-packages/sphinx/writers/html5.py", line 801, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: rowSpan

That's caused by the translation of the line containing :rspan:

If you try changing that line (either use an empty msgstr string or identical to msgid), the error doesn't occur anymore.

@return42 return42 reopened this Nov 5, 2021
@return42
Copy link
Owner

return42 commented Nov 5, 2021

will try to explain this better.

Ah, thanks a lot / my fail / sorry ..

Here is a simple example using reST: https://github.com/melish/linuxdoc_i18n.

Thanks for this example / I will give it a try the next days .. today and tomorrow I have no time for, so please be patient with me. ...

@melish
Copy link

melish commented Nov 7, 2021

No worries and thanks for reopening this issue. Your time is much appreciated.

@return42
Copy link
Owner

return42 commented Nov 8, 2021

Right now I don't know why, but sphinx-build -M gettext generates PO files with reST Rules in the msgid::

#: ../index.rst:21
msgid ":rspan:`1` :cspan:`1` field 2.2 - 3.3"
msgstr ""

In the translated msgstr, these reST roles must not included:

#: ../index.rst:21
msgid ":rspan:`1` :cspan:`1` field 2.2 - 3.3"
msgstr "test (fr) field 2.2 - 3.3"

Here is a simple example using reST: https://github.com/melish/linuxdoc_i18n.

See my PR https://github.com/melish/linuxdoc_i18n/pull/1/files#r744734541

@melish
Copy link

melish commented Nov 8, 2021

Wow, I didn't think of trying that, thanks a lot for the tip!

@return42
Copy link
Owner

return42 commented Nov 8, 2021

FYI: documentation about reST-roles is updated https://return42.github.io/linuxdoc/linuxdoc-howto/table-markup.html#flat-table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants