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

Fill config.md automatically #11

Open
Wikunia opened this issue Jun 12, 2020 · 9 comments
Open

Fill config.md automatically #11

Wikunia opened this issue Jun 12, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@Wikunia
Copy link
Collaborator

Wikunia commented Jun 12, 2020

I just tried out the package. Thanks for the awesome work!

One thing I think would be awesome is to fill some parts of the config.md automatically like:

  • github_repo
  • title
  • authors
  • prepath (whatever that actually is :D ) is that the folder name of the package?
  • docs_url would be the github repo stable docs (would not work for a custom domain)

This could be done with https://github.com/JuliaPackaging/Git.jl which is an old package so maybe not the best thing. Or using run commands to call git directly. Not too sure whether that works in Windows :/
To be save it's done in a try catch block such that nothing breaks.

Ah yeah some of the information can be taken from Project.toml

If interested I would work on a PR.

@tlienart
Copy link
Owner

I'm unclear on whether Git.jl would be more appropriate than JuliaLang/TOML.jl?

also we'd need fallback stuff in case there's no project.toml available etc.

@Wikunia
Copy link
Collaborator Author

Wikunia commented Jun 12, 2020

We don't get the github_repo and docs_url from that, right?

@zlatanvasovic
Copy link
Contributor

It's a good feature, if you want to work on it. You may also want to see how PkgTemplates handles custom parameters on initialization.

Wikunia added a commit to Wikunia/PkgPage.jl that referenced this issue Jun 12, 2020
@tlienart
Copy link
Owner

tlienart commented Jun 15, 2020

So I still think it's a good idea, but now basically it needs something that catches the stuff from the PkgPage/page at the moment of writing them in newpage but it has to be done in the process (can't be done in the source page).

basically it'll be a bunch of

s = read(joinpath(store, "config.md"), String)
s = replace(s, r"@def(\s+)authors(\s*)=\s*\".*?\"" => SubstitutionString("@def\1authors\2= \"$authors\""))

Ps: @Wikunia I added you as contributor

@tlienart tlienart added the enhancement New feature or request label Jun 15, 2020
@Wikunia
Copy link
Collaborator Author

Wikunia commented Jun 15, 2020

I'm not sure I get the new idea so just to be sure:
You define authors in newpage either by a given parameter from the user maybe or using the approach I took with LibGit2 and TOML? but replace it there directly instead of changing the config.md file?

@tlienart
Copy link
Owner

tlienart commented Jun 15, 2020

right so you can't rely on the trick {{...}} anymore because the source file is the config file used on our actual page.

At the moment newpage copies files from PkgPage.jl/page among which config.md.

I'm suggesting not copying over config.md and rather capturing it's content, replacing what you can with information you get from ambient TOML or whatever and then writing config.md in the destination folder with these imputed values.

@Wikunia
Copy link
Collaborator Author

Wikunia commented Jun 15, 2020

Oh I see the reason now. Thanks for clarification

@Wikunia
Copy link
Collaborator Author

Wikunia commented Jun 17, 2020

Then I would probably create three dictionaries. One TOML one Git and one default and use.
merge(default, toml_dict, git_dict).

  • iterate over the keys in replace

@tlienart
Copy link
Owner

tlienart commented Jun 17, 2020

btw this could probably be extended to get the DeployPage.yml file automatically adjust to the path of the source (atm it's hard coded to page and the instructions say that you have to change that yourself but it could also be done automatically by doing the same kind of procedure with DeployPage.yml)

edit: same with .gitattributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants