manunamz / jekyll-wikilinks

Add [[wikilinks]] support for jekyll.
https://rubygems.org/gems/jekyll-wikilinks
GNU General Public License v3.0
37 stars 1 forks source link

Notes’ title wrong capitalization #12

Closed xplosionmind closed 3 years ago

xplosionmind commented 3 years ago

The plugin automatically parses notes which do not preserve original title capitalization, but it capitalize exclusively the first letter of the whole title.

Some title examples:

Instead, title capitalization should be preserved.

Nevertheless, a note called Hello world.md and called as [[Hello world|heLLo WoRLd]] is correctly displayed as heLLo WoRLd.

manunamz commented 3 years ago

Titles are rendered from the jekyll document's title data attribute. (See here).

I imagine jekyll is doing this. Might want to double check how the title data attribute is being set, whether that is your note frontmatter's title attribute or somewhere in your configs.

At least, this is in the scenario you're talking about how capitalization is handled in the wikilink itself -> [[the importance of rss feeds]], [[being lucky]]. Otherwise, I'm not 100% sure what you're referring to. 😅

xplosionmind commented 3 years ago

(See here).

I know no Ruby, but isn’t the .downcase addition that changes the behavior of how titles are parsed?
Furthermore, most of the time I have no title specified in a file’s front matter, the name is retrieved from the name of the file.

manunamz commented 3 years ago

.downcase should lowercase all letters, so if there are any capitalized letters then that line is probably not producing that title's end result. I take this to mean that this plugin is not the cause of that capitalization...But I could be wrong.

How exactly is the casing show up...?

[For anyone else reading this, jekyll does do some default capitalization. Code you can see here, and someone wrote a vaguely-related-blog-post here]

xplosionmind commented 3 years ago

So… I was about to test the title capitalization to answer your last reply, but this came out of the blue at build time:

Configuration file: /Users/tommi/tommi.space/_config.yml
            Source: /Users/tommi/tommi.space
       Destination: /Users/tommi/tommi.space/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
bundler: failed to load command: jekyll (/Users/tommi/.rbenv/versions/3.0.1/bin/jekyll)
/Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:82:in `block in parse_wiki_links': undefined method `downcase' for nil:NilClass (NoMethodError)
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:71:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:71:in `parse_wiki_links'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:45:in `block in generate'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:44:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-wikilinks-0.0.3/lib/jekyll-wikilinks.rb:44:in `generate'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:193:in `block in generate'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:191:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:191:in `generate'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/profiler.rb:43:in `block in profile_process'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/profiler.rb:41:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/profiler.rb:41:in `profile_process'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/site.rb:75:in `process'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:28:in `process_site'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:65:in `build'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/build.rb:36:in `process'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve.rb:86:in `block (2 levels) in init_with_program'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/jekyll-4.2.0/exe/jekyll:15:in `<top (required)>'
    from /Users/tommi/.rbenv/versions/3.0.1/bin/jekyll:23:in `load'
    from /Users/tommi/.rbenv/versions/3.0.1/bin/jekyll:23:in `<top (required)>'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:494:in `exec'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/cli.rb:24:in `start'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/libexec/bundle:49:in `block in <top (required)>'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
    from /Users/tommi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/libexec/bundle:37:in `<top (required)>'
    from /Users/tommi/.rbenv/versions/3.0.1/bin/bundle:23:in `load'
    from /Users/tommi/.rbenv/versions/3.0.1/bin/bundle:23:in `<main>'
xplosionmind commented 3 years ago

I do not understand the above mentioned problem. If it is going to be hard to fix, I will open a separate issue, but it appears to be somewhat related to the .downcase we were discussing. This happened out of the blue, the only thing I did was to update ffi from version 1.15.1 to 1.15.3.

manunamz commented 3 years ago

Hmm...Ok. I will look into this more deeply.

In the meantime, I added a test to reflect what I expect to be happening, currently. (I didn't add it before because I was thinking of making capitalization behavior more robust/have-better-defaults-somehow).

manunamz commented 3 years ago

Ha! Ok, so I guess that means you don't have the title metadata set anywhere? 🤔 I'm looking at this SO comment.

I will keep investigating...🧐💭

xplosionmind commented 3 years ago

you don't have the title metadata set anywhere?

Nope, I do not.


I will keep investigating...🧐💭

Thank you very much! ❤️

xplosionmind commented 3 years ago

In the meantime, I added a test to reflect what I expect to be happening, currently.

So what should I do to avoid the build error?

manunamz commented 3 years ago

Is this build error produced by your repo's current state? Can I clone the most recent commit on the main branch to test it? And is it a local build or a netlify build?

xplosionmind commented 3 years ago

Is this build error produced by your repo's current state? Can I clone the most recent commit on the main branch to test it? And is it a local build or a netlify build?

By updating to version 0.0.4, everything got back to normal

manunamz commented 3 years ago

By updating to version 0.0.4, everything got back to normal

I'll close this then. Good to hear an update fixed it. 🎉

xplosionmind commented 3 years ago

Actually, the error at build time is solved but the wrong capitalization is still happening…

I am sorry, I should have opened a new issue for the build error. Nevertheless, this issue is still relevant, @manunamz!