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

Don't force root path to be absolute when generating cards #148

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

adamslc
Copy link
Contributor

@adamslc adamslc commented Aug 6, 2023

This was causing the postprocess function to crash when trying to compute the
corresponding build dir because the '..' a relative path is lost when making
the path absolute.

@johnnychen94
Copy link
Member

Sorry, I'm not very positive about merging this.

My old memory says it's a bit delicate to modify the path. It could possibly break the existing workflows. I had a hard time computing the path so my "solution" is to use abspath everywhere and to use relpath to compute the relative path.

Could relpath meets the need here?

@adamslc
Copy link
Contributor Author

adamslc commented Aug 7, 2023

Some more information: the issue arrises when doing makedemos(../examples), which results in a absolute path that looks like

/home/user/.julia/dev/Package/examples/section/subsection/card.md

The trouble then arrises in get_build_file, where we are trying to construct the path

/home/user/.julia/dev/Package/docs/build/examples/section/subsection/card.md

using only the source path, and the source dir ../examples. I don't believe that there is a way to go from one path to the other in general. Maybe there could be an additional kwarg for makedemos that defaults to the current behavior, and allows the use of relative paths?

@johnnychen94
Copy link
Member

Maybe there could be an additional kwarg for makedemos that defaults to the current behavior, and allows the use of relative paths?

This seems a bit tricky to me...

The generate function has two keywords build and root, would them be useful to parse and reconstruct the paths?

This resolves issues with generating democards with a relative directory
with .. in it.
@adamslc
Copy link
Contributor Author

adamslc commented Aug 8, 2023

I believe that this new commit should work. It passes the package tests
locally, and it also sucessfully builds the docs for me locally with a
package that uses makedemos("../examples").

@johnnychen94
Copy link
Member

johnnychen94 commented Aug 9, 2023

I didn't double-check the path calculation; it just looks like what I would write myself. Thanks for the updates.

@johnnychen94 johnnychen94 merged commit 5b81a6d into JuliaDocs:master Aug 9, 2023
12 checks passed
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