-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add :update-article-fn to customize parsed page/.. #130
Conversation
Let's leave it at that, naming is hard 😆. Will you update the docs site again? A couple of examples that illustrates the flexibility/power this adds would be great! |
That's the plan, after this is merged.
Thanks!
…On Mon, 9 Dec 2019, 17:02 Carmen La, ***@***.***> wrote:
I have fallen back on the HTML standard and adopted the name it uses for
the "main content", i.e. "article". Any better ideas?
Let's leave it at that, naming is hard 😆.
Will you update the docs site again? A couple of examples that illustrates
the flexibility/power this adds would be great!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#130?email_source=notifications&email_token=AAEYSPQH4GDNWARLWYKVBCDQXZTYPA5CNFSM4JYG6DP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGJWD5Q#issuecomment-563306998>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYSPVYKQ7GW3CFJJ2UQQTQXZTYPANCNFSM4JYG6DPQ>
.
|
DON'T MERGE pls I realized it would be better to pass also config to the function so I will add that (so that we have access e.g. to |
Allow users to supply a function run on every parsed page/post to update it. Example uses: - support for a custom `:slug` metadata in a post to override the defaul uri - post-process the HTML to add self-links to every heading
Ready to merge. I have updated it to send also the |
See cryogen-project/cryogen-docs#27 for the corresponding docs change. |
Looks great -- good call on passing in the config and returning nil to exclude articles :) Will push out new versions now! |
And thank you again for all the great features you've been adding! |
([overrides] | ||
([{:keys [extend-params-fn update-article-fn] | ||
:or {extend-params-fn (fn [params _] params) | ||
update-article-fn identity} |
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.
Oh, this can't be identity
because it's called with 2 args, but I can fix it :)
My bad, thank you!
…On Tue, Dec 10, 2019 at 3:36 PM Carmen La ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/cryogen_core/compiler.clj
<#130 (comment)>
:
> ([]
(compile-assets {}))
- ([overrides]
+ ([{:keys [extend-params-fn update-article-fn]
+ :or {extend-params-fn (fn [params _] params)
+ update-article-fn identity}
Oh, this can't be identity because it's called with 2 args, but I can fix
it :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#130?email_source=notifications&email_token=AAEYSPVPMS55QA32UAJYKSLQX6SPNA5CNFSM4JYG6DP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCOUZINA#pullrequestreview-329880628>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEYSPQL7O3FAHT72MIM5STQX6SPNANCNFSM4JYG6DPQ>
.
|
Allow users to supply a function run on every parsed page/post to
update it.
Example uses:
:slug
metadata in a post to override the defauluri
NOTE
I struggled to find a good name for "post or page". In the end I have fallen back on the HTML standard and adopted the name it uses for the "main content", i.e. "article". Any better ideas?
NOTE 2
Notice that while
extend-params-fn
runs very late in the process, this runs very early so it can modify the base data used to create the various site data such as posts and posts-by-tags, whileextend-params-fn
would need to modify all the places where e..g a particular post is used.