perun icon indicating copy to clipboard operation
perun copied to clipboard

Replaced the default slug-fn with a more robust version.

Open wiseman opened this issue 5 years ago • 4 comments

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.

wiseman avatar May 23 '19 22:05 wiseman

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, [email protected] 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:

https://github.com/hashobject/perun/pull/236 Commit Summary

  • Replaced the default slug-fn with a more robust version.

File Changes

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 https://github.com/hashobject/perun/pull/236?email_source=notifications&email_token=AAOVJ6PBAYQJ44EL7LFO3GDPW4IG7A5CNFSM4HPKUYQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GVSKBIQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOVJ6NKYYULKVHE7OI2NCDPW4IG7ANCNFSM4HPKUYQQ .

allentiak avatar May 23 '19 22:05 allentiak

@podviaznikov

Thanks for reviewing this!

allentiak avatar May 23 '19 22:05 allentiak

Should we bring this to completion? I can help with rebase very likely in the next couple of weeks

arichiardi avatar Mar 04 '21 03:03 arichiardi

Not me, sorry. https://github.com/hashobject/perun/issues/241#issuecomment-792000036

allentiak avatar Mar 06 '21 18:03 allentiak