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

feat: use new collection functionality #186

Merged
merged 7 commits into from
Nov 7, 2022
Merged

feat: use new collection functionality #186

merged 7 commits into from
Nov 7, 2022

Conversation

ronaldtse
Copy link
Contributor

Fixes #185.

Related to metanorma/metanorma-cli#205

Metanorma PR checklist

@ronaldtse ronaldtse added the bug Something isn't working label Sep 7, 2022
@ronaldtse
Copy link
Contributor Author

@abunashir there are several problems with the current functionality implemented in metanorma/metanorma-cli#205.

metanorma collection collection.yaml does not work without explicit options

Right now,

bundle exec metanorma collection collection.yml
> No value provided for required options '--output-folder'

This is wrong, because the option is already provided in the collection.yaml file.

output_folder: brochure

Clearly the metanorma collection command is not reading the YAML options properly. This needs to be fixed.

metanorma site generate with a collection source file generates output in the wrong location

Notice that collection.yaml has this line:

output_folder: brochure

But the site generate command output location should override the specified output folder, because the whole point of site generate is to keep the generated output under /site/ for deployment to a website.

This case is similar to when we run the normal metanorma command:

$ metanorma compile path/document.adoc
# => generates under path/document.xml
$ metanorma site generate config.yml # which points to path/document.adoc
# => generates under site/path/document.xml

Methods to generate a defined collection

As I updated in the README, there are two ways to generate a collection.

Method 1: single command to generate the dependencies and then the collection (with the order fixed in the "site generate" file)

$ metanorma site generate -c brochure.yml --agree-to-terms

Problem: This method works, but generates the collection in the originally defined location, not the "site generate" location.

Method 2: separately compile the source components and create the collection

$ metanorma sources/si-brochure-en.adoc
$ metanorma sources/si-brochure-fr.adoc
$ mkdir -p site/documents
$ mv sources/si-brochure-en.xml site/documents
$ mv sources/si-brochure-fr.xml site/documents
$ metanorma collection collection.yml

Problem: This method is not working because of the CLI argument issue.

@abunashir
Copy link
Member

Thanks for the all the details @ronaldtse, I guess previously I only implemented it for the site interface that might explains the first issue but I will also check the other and get back to you :)

ronaldtse and others added 5 commits November 7, 2022 15:28
This commit tries to use the in-progress gem from github to verify
that it works as expected. Once, those are merged then please switch
back to the stable releases.
@ronaldtse
Copy link
Contributor Author

ronaldtse commented Nov 7, 2022

This works! Thank you @abunashir.

There is just one problem -- the si-brochure-en.pdf and si-brochure-fr.pdf files are compiled twice, once under site/documents and once under site/brochure, which is not ideal. Let's do that in a new ticket.

Proof:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use site generate to build collection
2 participants