hashobject / perun

Programmable static site generator built with Clojure and Boot (HELP NEEDED!)
https://perun.io
Eclipse Public License 1.0
351 stars 38 forks source link

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

Open wiseman opened 5 years ago

wiseman commented 5 years ago

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.

allentiak commented 5 years ago

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, notifications@github.com 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:

— 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 commented 5 years ago

@podviaznikov

Thanks for reviewing this!

arichiardi commented 3 years ago

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

allentiak commented 3 years ago

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