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

adding language support for standard template #112

Merged
merged 1 commit into from
Nov 12, 2019

Conversation

ahus1
Copy link
Contributor

@ahus1 ahus1 commented Nov 12, 2019

The current template has "en" as the only language. This PR uses the lang and nolang attribute to determine the HTML lang attribute like the html5.rb in Asciidoctor.

I placed the test cases quite at the top as the <html> is also at the top of the created file.

@ggrossetie
Copy link
Owner

Thanks!
Speaking of language, we should probably set the /Lang entry in the document catalog (if it's not yet implemented in Chrome or Paged.js).

https://www.w3.org/TR/WCAG20-TECHS/PDF16.html

I'm not able to test it just yet, could you please confirm (or not) that the /Lang entry is present in the PDF document?

@ahus1
Copy link
Contributor Author

ahus1 commented Nov 12, 2019

The /Lang property is set in the PDF (I looked at the source and into the properties of the PDF in a reader). The pdfoptions doesn't have a documented property for a language: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagepdfoptions

So I think we're out of luck here.

@ggrossetie
Copy link
Owner

The /Lang property is set in the PDF

You mean not set?

So I think we're out of luck here.

We are now using pdf-lib so we can add this entry once the PDF has been generated.

Copy link
Owner

@ggrossetie ggrossetie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@ahus1
Copy link
Contributor Author

ahus1 commented Nov 12, 2019

Sorry I meant, "not set". Sorry for the confusion.

@ahus1
Copy link
Contributor Author

ahus1 commented Nov 12, 2019

I've looked at pdf-lib and didn't find a language attribute. I suspected it near setTitle(), but it's not there: https://pdf-lib.js.org/docs/api/classes/pdfdocument#settitle.

Would you merge without that feature?

@ggrossetie
Copy link
Owner

I've looked at pdf-lib and didn't find a language attribute. I suspected it near setTitle(), but it's not there: https://pdf-lib.js.org/docs/api/classes/pdfdocument#settitle.

I didn't find an API to set the Lang entry either but we should be able to do it using the low-level API to add the Lang entry in the PDFCatalog.

Would you merge without that feature?

Sure.
I will create a follow-up issue.

@ggrossetie ggrossetie merged commit cd6763d into ggrossetie:master Nov 12, 2019
@ahus1 ahus1 deleted the support_language branch November 12, 2019 14:18
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.

2 participants