mquinson / po4a

Maintain the translations of your documentation with ease (PO for anything)
http://po4a.org/
GNU General Public License v2.0
121 stars 58 forks source link

Asciidoc: Problem with + in list items #444

Closed suddenfall closed 6 months ago

suddenfall commented 8 months ago

Hi,

I got a problem with the + at the end of the line in line items:

. List item section 1
. List item section 2 +
 +
Another section of list item 2

Further text

* List item section A
* List item section B +
 +
Another section of list item B

Further text

After processing with po4a, two spaces are prepend to the text "Another section of list item 2" and "Another section of list item B". Therefore, these lines are interpreted from asciidoctor as preformatted code. Example added as attachment: test.zip

jnavila commented 8 months ago

Hi,

Thanks for bringing up another corner case :wink:

I'm quite surprised by this unexpected use of the break/paragraph format. A break followed by a paragraph in the same div. How does this render? What is the use case?

Anyway, I'll try to fix this too.

jnavila commented 8 months ago

Sorry, I just understood. There is space before the second +, which generates another break. So that's two following breaks.

suddenfall commented 6 months ago

Sorry for the corner case. I don't intend to find such cases. They find me. But I promise that I won't write any more Asciidoc until the end of this year ;-).

Anyhow, I had cloned the latest version from the master branch of https://github.com/mquinson/po4a.git. The problem still persists. Do I have cloned the wrong version or can you also reproduce the problem with this version?

jnavila commented 6 months ago

That's surprising: the tests files have been updated with your example:

https://github.com/mquinson/po4a/pull/450/files

So maybe, your case is slightly different from the example, or I missed something.

suddenfall commented 6 months ago

The master branch fails even with my test file. That is, what me confuses.

jnavila commented 6 months ago

How did you run your test?

~/Developpement/po4a (master ✘)✭ $ cat test.adoc
. List item section 1
. List item section 2 +
 +
Another section of list item 2

Further text

* List item section A
* List item section B +
 +
Another section of list item B

Further text
~/Developpement/po4a (master ✘)✭ $ PERL5LIB=./lib perl ./po4a-updatepo --format asciidoc --master test.adoc --master-charset UTF-8 --po test.pot
po4a-updatepo est obsolète. Le programme unifié po4a(1) est plus pratique et moins sujet aux erreurs.
test.adoc:4: Il semblerait que vous ajoutiez du contenu sans indentation dans un item. Bien que cela 
             soit autorisé par le standard, vous devriez réindenter votre document pour offrir plus 
             d'indices visuels aux auteurs.
test.adoc:12: Il semblerait que vous ajoutiez du contenu sans indentation dans un item. Bien que cela 
              soit autorisé par le standard, vous devriez réindenter votre document pour offrir plus 
              d'indices visuels aux auteurs.
...... terminé.
~/Developpement/po4a (master ✘)✭ $  cat test.pot
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2023-12-17 19:09+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: Plain text
#: test.adoc:2
msgid "List item section 1"
msgstr ""

#. type: Plain text
#: test.adoc:5
#, no-wrap
msgid ""
"List item section 2\n"
"\n"
"Another section of list item 2"
msgstr ""

#. type: Plain text
#: test.adoc:7 test.adoc:14
msgid "Further text"
msgstr ""

#. type: Plain text
#: test.adoc:10
msgid "List item section A"
msgstr ""

#. type: Plain text
#: test.adoc:13
#, no-wrap
msgid ""
"List item section B\n"
"\n"
"Another section of list item B"
msgstr ""
suddenfall commented 6 months ago

Finally I have found my mistake. I had checkout HEAD not MASTER. Now, I get the correct result. Also the warning as you:

test.adoc:4: It seems that you are adding unindented content to an item. The standard allows this, but you may still want to change your document to use indented text to provide better visual clues to writers.

Because I like clean a console, I have tried to modify my adoc to aviod the warning. I found this syntax:

. List item section 1
. List item section 2 +
  +
 Another section of list item 2

Further text

* List item section A
* List item section B +
          +
     Another section of list item B

Further text

* List item section A
* List item section B +
          +
         Another section of list item B

Further text

The rule seems to be that the plus must be indented with at least one whitespace more than the following paragraph in order for the following paragraph to be formatted correctly in Asciidoctor. Otherwise, the following paragraph becomes a code section. I find this rule a bit "unconventional".

Unfortunately, the version from the MASTER branch cannot handle the formatting described above.

I'm afraid that by now you'll hate me for looking at everything so meticulously. 🫣

suddenfall commented 6 months ago

Excellent! Thank you.

I wish you a merry Xmas!