Skip to content
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

Moneropedia links (created by _plugins/moneropedia.rb) are always lower case #1352

Closed
erciccione opened this issue Dec 4, 2020 · 4 comments · Fixed by #1478
Closed

Moneropedia links (created by _plugins/moneropedia.rb) are always lower case #1352

erciccione opened this issue Dec 4, 2020 · 4 comments · Fixed by #1478
Labels
enhancement New feature or request

Comments

@erciccione
Copy link
Contributor

No description provided.

@ghost
Copy link

ghost commented Feb 22, 2021

What's the expected behavior? Should they all be capitalized? From what I can tell, the Moneropedia plugin just preserves the capitalization of the terms provided in each Moneropedia entry, and the majority of them are lowercase. Several of them (Locally-unique host, Canonically-unique host, and Kovri) are capitalized and are displayed as such.

@erciccione
Copy link
Contributor Author

Should they all be capitalized?

They should be capital when at the beginning of a sentence or after a dot, lowercase if the word is in the middle of a sentence.

@ghost
Copy link

ghost commented Feb 23, 2021

What do you think about replacing the hyperlink text with the regex match instead of whatever term is stored in the entry? That way, the Moneropedia links simply reflect the way that they were written, and it wouldn't require any code to check for punctuation.

content = content.gsub(/(\@#{term})((?=-#{lookahead})|(?![\w-]))/i) { |match_term| '<a class="info-tooltip" data-tooltip="' + entry[:summary] + '" href="/resources/moneropedia/' + entry[:file] + '.html" >' + match_term.gsub(/[@-]/, '@' => '', '-' => ' ') + '</a>' }

For example, @ring-ct would display as ring ct and @Ring-CT as Ring CT. Any existing capitalization errors would need to be fixed manually, but that shouldn't be too difficult.

@erciccione
Copy link
Contributor Author

Good idea. I was slightly worried about how the other languages would have reacted (especially the ones not using latin characters), but i tested your patch quite extensively and there seem to be no problems.

Would you PR your patch? As you said, capitalization errors are not a big deal and we can fix them when we find them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant