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

Footer in PDF only says "undefined" #526

Closed
gurbindersingh opened this issue Feb 28, 2022 · 3 comments · Fixed by #528
Closed

Footer in PDF only says "undefined" #526

gurbindersingh opened this issue Feb 28, 2022 · 3 comments · Fixed by #528

Comments

@gurbindersingh
Copy link
Contributor

gurbindersingh commented Feb 28, 2022

Description

The PDF generated using wkthtmltopdf only has the word "undefined" in the footer. I double checked by running it manually and it didn't happen. I believe it's because this statement

if (footerCenter !== null) {

is missing a && footerCenter !== undefined.

System Information

Version: 1.64.2 (user setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044

To Reproduce

Steps to reproduce the issue:

  1. Create a AsciiDoc file with the following content
= Doc
:toc: auto
:sectnums: all
:sectnumlevels: 5
:nofooter:

== Undefined Footer

Foo bar.
  1. Export the document as a PDF
@ggrossetie
Copy link
Member

Indeed, the code is wrong, it should be:

if (footerCenter) {
  cmdArguments.push('--footer-center', footerCenter)
}

The type declaration should also be fixed on the html2pdf function since footerCenter is either string | undefined.

@gurbindersingh are you willing to submit a fix?

@gurbindersingh
Copy link
Contributor Author

Sure thing. Is there anything I should keep in mind? The contribution guidelines don't mention pull requests.

gurbindersingh added a commit to gurbindersingh/asciidoctor-vscode that referenced this issue Feb 28, 2022
Changes:
- Fix if-statement
- Fix type of footerCenter
- Reformat method signature (line exceeded 160 characters)

Resolves asciidoctor#526
@ggrossetie
Copy link
Member

You should run the linter before opening a pull request: npm run lint.

You can also run the tests suite even though we currently have very few tests: npm t.

Our plan is to progressively add more tests 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants