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

generateSite: Problem with meta data parsing #1209

Closed
rdmueller opened this issue Jul 7, 2023 · 3 comments · Fixed by #1212
Closed

generateSite: Problem with meta data parsing #1209

rdmueller opened this issue Jul 7, 2023 · 3 comments · Fixed by #1212

Comments

@rdmueller
Copy link
Member

Describe the bug

If jbake meta data is not defined the right way, the generateSite-Task throws an exception:

FAILURE: Build failed with an exception.
* Where:
Script '/home/dtcuser/docToolchain/scripts/generateSite.gradle' line: 269
* What went wrong:
Execution failed for task ':generateSite'.
> Index 1 out of bounds for length 1

To Reproduce

use :jbake-title:test in one of your .adoc files. Hint: there is a space missing.

Expected behavior
Let's output a warning and ignore the line

Location of bug: https://github.com/docToolchain/docToolchain/blob/ng/scripts/generateSite.gradle#L269C1-L271C37

@PacoVK
Copy link
Collaborator

PacoVK commented Jul 12, 2023

instead of ignoring the line, what about changing the split mechanism to be able to support non-whitespace separated config?

line = (line - ":jbake-").split(": +", 2)
            jbake[line[0]] = line[1]

to something like

line = (line - ":jbake-").split(":", 2)
            jbake[line[0]] = line[1].trim()

this should work as the first ":" always will mark the end of the property, right? Everything afterwards will be treated as value. The trim will ensure it behaves the same as the currently used regex pattern.

WDYT?

@rdmueller
Copy link
Member Author

You are right. The reason behind my solution was that I thought, without the space is not asciidoc conform and should be fixed...

WDYT?

@PacoVK
Copy link
Collaborator

PacoVK commented Jul 12, 2023

Totally agree with your approach. Thanks for clarification 👍 we should encourage to be in line with asciidoc specs

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 a pull request may close this issue.

2 participants