mquinson / po4a

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

Asciidoc: Handling of comments #307

Closed eevan78 closed 3 years ago

eevan78 commented 3 years ago

I'm translating Weechat documentation using po4a. Source files are in .adoc format and get processed with Asciidoctor to produce HTML.

Asciidoctor is using some tags in comments like this:

// tag::standard[]
   some multiline asciidoc text
// end::standard[]

// tag::debug[]
   some multiline asciidoc text
// end::debug[]

After po4a processing, these tags get into the comments of appropriate .po msgid strings, but discarded on generation to adoc.

Without these tags, Asciidoctor is producing errors.

Is there a way to simply pass the comments to the output, at the same position as where they appear in the original document?

jnavila commented 3 years ago

OH. I didn't know this feature of asciidoctor. This should be easy to add, but I'm not sure to have time soon. If you need it quickly and have basic knowledge of Perl, look at

https://github.com/mquinson/po4a/blob/a69b48eda3ebd66eec30a34a377c7a00c6f8e36c/lib/Locale/Po4a/AsciiDoc.pm#L616-L625

Where comments are processed.

eevan78 commented 3 years ago

Thanks a lot for the tip, I'll give it a try!

eevan78 commented 3 years ago

Here is a working solution in my case. Tested with 2 files from Weechat documentation that contain them. I'm not sure if it is good in general, because I don't know where these special tag comments can be placed. Thanks for the tip. asciidoc-diff.zip

mquinson commented 3 years ago

Hello all. @jnavila just commited a potential fix for this issue.

@eevan78, could you please confirm that this problem is fixed by the current git version? I'm confident since the patch was tested manually in the past, but please reopen this bug if it's not the case.

Thx,

eevan78 commented 3 years ago

@mquinson, I have tried the current git version, and I can confirm that the fix is working as expected in my test files. Comments are passed through correctly.

Thanks!

mquinson commented 3 years ago

Please thank @jnavila for the hard work :) And thanks for the confirmation.

eevan78 commented 3 years ago

Of course, big thanks to @jnavila for solving the issue and pointing me to the right direction! 👏