-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Document each store type on its own page #9504
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
Merged
fricklerhandwerk
merged 1 commit into
NixOS:master
from
fricklerhandwerk:store-implementation-per-page
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,20 @@ | ||
| let | ||
| inherit (builtins) attrValues mapAttrs; | ||
| inherit (import <nix/utils.nix>) concatStrings optionalString squash; | ||
| inherit (builtins) attrNames listToAttrs concatStringsSep readFile replaceStrings; | ||
| inherit (import <nix/utils.nix>) optionalString filterAttrs trim squash toLower unique indent; | ||
| showSettings = import <nix/generate-settings.nix>; | ||
| in | ||
|
|
||
| inlineHTML: storesInfo: | ||
| { | ||
| # data structure describing all stores and their parameters | ||
| storeInfo, | ||
| # whether to add inline HTML tags | ||
| # `lowdown` does not eat those for one of the output modes | ||
| inlineHTML, | ||
| }: | ||
|
|
||
| let | ||
|
|
||
| showStore = name: { settings, doc, experimentalFeature }: | ||
| showStore = { name, slug }: { settings, doc, experimentalFeature }: | ||
fricklerhandwerk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| let | ||
| result = squash '' | ||
| # ${name} | ||
|
|
@@ -22,9 +28,6 @@ let | |
| ${showSettings { prefix = "store-${slug}"; inherit inlineHTML; } settings} | ||
| ''; | ||
|
|
||
| # markdown doesn't like spaces in URLs | ||
| slug = builtins.replaceStrings [ " " ] [ "-" ] name; | ||
|
|
||
| experimentalFeatureNote = optionalString (experimentalFeature != null) '' | ||
| > **Warning** | ||
| > | ||
|
|
@@ -42,4 +45,13 @@ let | |
| ''; | ||
| in result; | ||
|
|
||
| in concatStrings (attrValues (mapAttrs showStore storesInfo)) | ||
| storesList = map | ||
| (name: rec { | ||
| inherit name; | ||
| slug = replaceStrings [ " " ] [ "-" ] (toLower name); | ||
| filename = "${slug}.md"; | ||
| page = showStore { inherit name slug; } storeInfo.${name}; | ||
| }) | ||
| (attrNames storeInfo); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. off-topic: We could get ourselves a |
||
|
|
||
| in storesList | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| let | ||
| inherit (builtins) attrNames listToAttrs concatStringsSep readFile replaceStrings; | ||
| showSettings = import <nix/generate-settings.nix>; | ||
| showStoreDocs = import <nix/generate-store-info.nix>; | ||
| in | ||
|
|
||
| storeInfo: | ||
|
|
||
| let | ||
| storesList = showStoreDocs { | ||
| inherit storeInfo; | ||
| inlineHTML = true; | ||
| }; | ||
|
|
||
| index = | ||
| let | ||
| showEntry = store: | ||
| "- [${store.name}](./${store.filename})"; | ||
| in | ||
| concatStringsSep "\n" (map showEntry storesList); | ||
|
|
||
| "index.md" = replaceStrings | ||
| [ "@store-types@" ] [ index ] | ||
| (readFile ./src/store/types/index.md.in); | ||
|
|
||
| tableOfContents = | ||
| let | ||
| showEntry = store: | ||
| " - [${store.name}](store/types/${store.filename})"; | ||
| in | ||
| concatStringsSep "\n" (map showEntry storesList) + "\n"; | ||
|
|
||
| "SUMMARY.md" = tableOfContents; | ||
|
|
||
| storePages = listToAttrs | ||
| (map (s: { name = s.filename; value = s.page; }) storesList); | ||
|
|
||
| in | ||
| storePages // { inherit "index.md" "SUMMARY.md"; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say
infois for dumping info about instances of the noun rather than docs about the concept (or subtypes).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's an intentional difference :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these are just ramblings.