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

FB2 writer: Add support for "lang" metadata #3625

Merged
merged 1 commit into from
May 2, 2017
Merged

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented May 1, 2017

I need this when converting from Muse to FB2. Muse uses #lang according to its manual and FB2 uses <lang> tag, and EPUB writer also uses lang metadata, so everything is compatible.

@mb21
Copy link
Collaborator

mb21 commented May 1, 2017

Pandoc's lang metadata field is in BCP 47 (e.g. en-GB), which is basically the ISO 639 language code (e.g. en) followed by an optional part indicating the regions/script etc.

Not exactly sure what the Muse people mean with "The language code of the document (2 or 3 letters)", but sounds like the dash and everything following it should be stripped.

@link2xt
Copy link
Collaborator Author

link2xt commented May 1, 2017

@mb21 What Muse uses is irrelevant here, but my Muse documents use something like "ru" instead of "ru-RU". It is really unspecified, directives in Muse are free form, so I am not going to do anything with them in my Muse reader (see PR #3620).

What really matters is what FB2 standard says, and looks like it uses ISO 639.

So I should probably try to convert BCP 47 to ISO 639 when writing lang to FB2.

@link2xt
Copy link
Collaborator Author

link2xt commented May 1, 2017

@link2xt
Copy link
Collaborator Author

link2xt commented May 1, 2017

Looks like FB2 documents actually use "en" and no "en-US" or "en-GB", so just stripping everything up to "-" is enough. Fixed it.

@jgm jgm merged commit 5d529e3 into jgm:master May 2, 2017
@jgm
Copy link
Owner

jgm commented May 2, 2017

Thanks!

@link2xt link2xt deleted the fb2-lang branch May 2, 2017 11:39
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 this pull request may close these issues.

3 participants