sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
178 stars 20 forks source link

Case insensitivity in page titles and tags #187

Open SeanFromIT opened 4 years ago

SeanFromIT commented 4 years ago

Suggested enhancement: ignore case for tags and titles. It could be a chore to keep tidy for a larger site without this.

sbrl commented 4 years ago

Ooh, that would be really nice actually. The problem is though we'd then have to store the page title and tags in both their case-insensitive format (for referencing), and case-sensitive format (for displaying) - which I'm pretty sure would be complicated undertaking under-the-hood - 'cause page names are displayed in lots of different places - so we'd have to update all of them to instead of using $env->page to use something like $pageindex->$page->title.

Tags would be easier, since we can store them as a list of objects or arrays instead of a list of strings.

[
    { "display": "Tag name", "sort": "tag name" },
    // ......
]

Though thinking about it, how would we determine the "canonical" casing for a tag to display?

RyanGreenup commented 4 years ago

Semi-related to this, in vimwiki you can follow [[links]] made from pepperminty, but you have to make sure that the first letter of the link is always capitalised because on linux file names are case sensitive (and I don't know how it deals with whitespace).

sbrl commented 4 years ago

@RyanGreenup Yeah, Pepperminty Wiki has a simple resolution algorithm, and whitespace matters:

  1. Try the page name as-is
  2. Try uppercasing the first letter (PHP's ucfirst() function)
  3. Try uppercasing the first letter of each word (PHP's ucwords() function)

Specifically, the current algorithm is implemented here: https://github.com/sbrl/Pepperminty-Wiki/blob/79ddc23/modules/parser-parsedown.php#L444-L464

It sounds like vimwiki doesn't currently support that page name resolution.

Additional steps to this process that would resolve more page names in the mean time are welcome.

sbrl commented 3 years ago

Oh, I've just thought of something. Since Pepperminty Wiki is currently case-sensitive, migrating to non-case-sensitive page names has the potential to break existing wikis - should one have 2 different pages with the same name but different casings.

We'd also need to handle migration too, which isn't as simple as it sounds either - because Pepperminty Wiki doesn't yet have a migration system in place. Currently Pepperminty Wiki upgrades things dynamically as it encounters them, but that doesn't really work with upgrading the page index structure.

Hmmmmmmm.......