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

Non-RST source text is parsed as RST after translation #6855

Closed
jpmckinney opened this issue Nov 22, 2019 · 1 comment
Closed

Non-RST source text is parsed as RST after translation #6855

jpmckinney opened this issue Nov 22, 2019 · 1 comment

Comments

@jpmckinney
Copy link
Contributor

jpmckinney commented Nov 22, 2019

Describe the bug

a12399d introduced a regression: If the source text is in Markdown, it gets parsed as RST after translation.

In Sphinx 1.6.7 (and earlier), in publish_msgstr, reader.read() (i.e. SphinxBaseReader.read()) would select the parser based on the source_path suffix. After that commit, the parser is instead set by:

parser = app.registry.create_source_parser(app, '')

This means that it's always RST that parses the translated text. Obviously, if the translated text is in Markdown syntax, this will not result in a correct translation.

I'll submit a PR that determines the filetype based on the source_path. Ideally, this can be applied to 2.2.x.

To Reproduce

I have open PRs on CommonMark.py and recommonmark that also need to be merged to be able to translate Markdown in Sphinx, so it will be hard to create a 'small' example.

Expected behavior

I expect the translated text to be parsed as Markdown (not RST) if the source text is Markdown.

Your project

https://github.com/open-contracting-extensions/public-private-partnerships

Screenshots

N/A

Environment info

  • OS: Mac
  • Python version: 3.6.1
  • Sphinx version: 2.2.1
  • Sphinx extensions: recommonmark
  • Extra tools: N/A

Additional context

This was originally fixed in aefab51 and then broken in a12399d

I have open PRs on CommonMark.py and recommonmark that also need to be merged to be able to translate Markdown in Sphinx:

@tk0miya
Copy link
Member

tk0miya commented Dec 15, 2019

Fixed by #6927.
Thank you for reporting.

@tk0miya tk0miya closed this as completed Dec 15, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants