-
Notifications
You must be signed in to change notification settings - Fork 38
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
Replaced the default slug-fn with a more robust version. #236
base: master
Are you sure you want to change the base?
Conversation
The previous default slug-fn used by the slug task assumed Jekyll-style naming, e.g., "2001-01-01-my-post.md", and if this assumption was violated it would return non-sensical results. Previous slug-fn: | Source filename | Slug | Final filename | |-------------------------|---------------------|--------------------------| | "2001-01-01-my-post.md" | "my-post" | "my-post.html" | | "index.md" | "" | ".html" | | "my-great-new-post.md" | "post" | "post.html" | The new default slug-fn handles Jekyll-compliant names in the same way, but if given a filename that doesn't fit the Jekyll format it will just strip the extension. New slug-fn: | Source filename | Slug | Final filename | |-------------------------|---------------------|--------------------------| | "2001-01-01-my-post.md" | "my-post" | "my-post.html" | | "index.md" | "index" | "index.html" | | "my-great-new-post.md" | "my-great-new-post" | "my-great-new-post.html" |
Hi!
Thanks for your PRs!
I will have time to reviewing them in then upcoming days.
…On Thu, 23 May 2019, 19:04 John Wiseman, ***@***.***> wrote:
The previous default slug-fn used by the slug task assumed
Jekyll-style naming, e.g., "2001-01-01-my-post.md", and if this
assumption was violated it would return non-sensical results.
Previous slug-fn:
Source filename Slug Final filename
"2001-01-01-my-post.md" "my-post" "my-post.html"
"index.md" "" ".html"
"my-great-new-post.md" "post" "post.html"
The new default slug-fn handles Jekyll-compliant names in the same
way, but if given a filename that doesn't fit the Jekyll format it
will just strip the extension.
New slug-fn:
Source filename Slug Final filename
"2001-01-01-my-post.md" "my-post" "my-post.html"
"index.md" "index" "index.html"
"my-great-new-post.md" "my-great-new-post" "my-great-new-post.html"
I think think it's worth changing the default to a function that gives
useful results in more cases, especially since stock perun doesn't use the
date info in the filename for anything, making the Jekyll convention
unnecessary.
------------------------------
You can view, comment on, or merge this pull request online at:
#236
Commit Summary
- Replaced the default slug-fn with a more robust version.
File Changes
- *M* src/io/perun.clj
<https://github.com/hashobject/perun/pull/236/files#diff-0> (11)
Patch Links:
- https://github.com/hashobject/perun/pull/236.patch
- https://github.com/hashobject/perun/pull/236.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#236?email_source=notifications&email_token=AAOVJ6PBAYQJ44EL7LFO3GDPW4IG7A5CNFSM4HPKUYQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GVSKBIQ>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOVJ6NKYYULKVHE7OI2NCDPW4IG7ANCNFSM4HPKUYQQ>
.
|
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.
@wiseman this looks great!
Thank you for PR. Especially for giving example of old and new behavior.
I'll approve it. Also if you have time, it will be cool if you can implement this desired behavior in unit tests. We do have some unit tests, so this should be doable - just test slug function itself.
@podviaznikov
Thanks for reviewing this!
|
Should we bring this to completion? I can help with rebase very likely in the next couple of weeks |
Not me, sorry. |
The previous default slug-fn used by the slug task assumed
Jekyll-style naming, e.g., "2001-01-01-my-post.md", and if this
assumption was violated it would return non-sensical results.
Previous slug-fn:
The new default slug-fn handles Jekyll-compliant names in the same
way, but if given a filename that doesn't fit the Jekyll format it
will just strip the extension.
New slug-fn:
I think think it's worth changing the default to a function that gives useful results in more cases, especially since stock perun doesn't use the date info in the filename for anything, making the Jekyll convention unnecessary.