Skip to content

Conversation

@johnnychen94
Copy link
Contributor

@johnnychen94 johnnychen94 commented Mar 17, 2022

Address some of the issues in #256 with some extra changes.

Briefly speaking, DemoCards.makedemos would parse the title, description, and other information from the demo files. Unless explicitly specified by the YAML frontmatter, the description is the first markdown paragraph, the title is the first H1 header. Title, description, cover image will be displayed as a card in the index page.

#256 (comment)
I don't get, why I get the titles for skipped examples for GR but not for the other backends.

This is strange and is perhaps system-related. I noticed that generated files produced by generate_cards are sometimes empty when passing to makedemos. This makes DemoCards try to parsing information from empty files, and thus the title is inferred from their filenames, e.g., GR_ref19. bf52b07 is an attempt for this; it improves the status but doesn't fix all the issues.

#256 (comment)
I tried it and it gave wierd results like not only displaying the title, but also text from the body on the card

This is because the theme will display the title, cover and description. By default the description is the first paragraph. e1bd117 fixes this by forcing an empty description. I thus used the "bulmagrid" theme and removed your custom src/gallery.css file in c2c5bb0

Extra changes:

  • I would expect that contributors can directly add more demos to contrib/demos in the future. If we want this then it is not convenient to use explicit order for the auto-generated demos, thus I removed the order section in 2287f78
  • the backend title is corrected in 7b30331, e.g., Plotlyjs => PlotlyJS.
  • 5086592: a few comments on DemoCards for future contributors.

I still can't build the entire documentation for unknown reasons...; it just hangs forever... The following is the result of building GR and plotlyjs with bulmagrid theme. The layout looks okay to me.

preview

cc: @BeastyBlacksmith

By default DemoCards sort the demos by their filenames.
For unknown reasons, the generated files are still empty when calling
`makedemos` unless we wrap the `jl` file with IOBuffer.
@johnnychen94
Copy link
Contributor Author

I think all the difficulties and tricks here come from the fact that demos are stored in the main Plots.jl repo. This isn't very friendly for new contributors. For instance, I don't want to build the entire documentation in 30mins when I only want to add one single demo file. DemoCards's solution is to preview_demos(file_or_folder) but this becomes a little bit difficult for the current arch.

I would suggest that legacy examples in Plots.jl repo be kept for unit test purposes only, and start PlotDocs' own version of demos and folder structures.

@BeastyBlacksmith
Copy link
Member

BeastyBlacksmith commented Mar 17, 2022

Thank you for me helping me out with this!

I would suggest that legacy examples in Plots.jl repo be kept for unit test purposes only, and start PlotDocs' own version of demos and folder structures.

Since we can't run visual regression tests for all the backends, eyeballing the generated examples and comparing them is currently our best method to test and compare backend functionality. Which is why we need a consistent order and keep things in sync with the Plots.jl repo.

That said I am all in for an extra user or showcase gallery, but we don't need that for every backend I'd say and that should be added in another PR.
Crossref: #52

@BeastyBlacksmith BeastyBlacksmith merged commit af4ee6d into JuliaPlots:democards Mar 17, 2022
@johnnychen94 johnnychen94 deleted the jc/democards branch March 17, 2022 14:07
BeastyBlacksmith added a commit that referenced this pull request Mar 17, 2022
* Create docs.yml

* Delete .travis.yml

* run on democards-branch

* remove hyphens

* a start

* usable gr-examples

* remove TagBot, add manual trigger to build

* fix #src

* disable notebook generation

* specify order

* fix animations

* change back devbranch

* add attributes, empty cards, fix assets

* don't write to file for unicodeplots

* add gaston workaround

* Update docs.yml

* generate demo page per backend (#275)

* generate demo page per backend

Instead of generating all backend demos in one demo page, this commit
generates one page per backend. This makes exploring the demos easier.

- entry "id" is added to resolve the url-link issue
- notebook generation is disabled
- attributes are generated as hidden page

* Update PlotDocs.jl

Co-authored-by: Simon Christ <SimonChrist@gmx.de>

* disable link redirection, add consistent order

* tweak configs

* Update src/PlotDocs.jl

Co-authored-by: Johnny Chen <johnnychen94@hotmail.com>

* patches for democards branch (#276)

* use default order for demos

By default DemoCards sort the demos by their filenames.

* wrap source cards generation using IOBuffer

For unknown reasons, the generated files are still empty when calling
`makedemos` unless we wrap the `jl` file with IOBuffer.

* correct backend name titlecase

* try bulmagrid theme

* add a few DemoCards comments

* use empty card description

* debug: try to sleep a while after each demo generation

* restore order

Co-authored-by: Simon Christ <SimonChrist@gmx.de>

* init order

* mover order

* don't skip writing files

Co-authored-by: Johnny Chen <johnnychen94@hotmail.com>
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