Skip to content

Commit

Permalink
mvp-tema-i18n (#9), menus (#10): jekyll_hapi_api.rb; testando variave…
Browse files Browse the repository at this point in the history
…is com caracteres alem de ASCII
  • Loading branch information
fititnt committed May 19, 2021
1 parent 60ffb14 commit 117bc11
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions _plugins/jekyll_hapi_api.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# WTF!? @see https://github.com/rubocop/ruby-style-guide/issues/301
# rubocop:disable AsciiComments
# WTF!? @see https://github.com/rubocop/ruby-style-guide/issues/137
# rubocop:disable RubocopIsRacist/AsciiComments
# rubocop:disable Metrics/MethodLength

# frozen_string_literal: true

# Testando variaveis com caracteres alem de ASCII
@ááá = 'aa'

# Trivia:
# - 'pāginam'
# - https://en.wiktionary.org/wiki/pagina#Latin
# - ūtilitātem
# - https://en.wiktionary.org/wiki/utilitas#Latin

# TODO: document
# lorem ipsum..
# TODO: document
module HapiApi
# TODO: document
# lorem ipsum..
# HapiApiGenerator is (TODO: document)
class HapiApiGenerator < Jekyll::Generator
safe true

Expand All @@ -27,6 +31,7 @@ def generate(site)
# Subclass of `Jekyll::Page` with custom method definitions.
class ApiPaginam < Jekyll::Page
def initialize(site, category, posts)
super()
@site = site # the current site instance.
@base = site.source # path to the source directory.
@dir = category # the directory the page will reside in.
Expand Down Expand Up @@ -58,9 +63,28 @@ def url_placeholders
}
end
end

# class ūtilitātem
class Utilitatem
def sanitize_filename_i18n(name)
return name.to_s if name.is_a? Integer

# TODO: investigate usage of
# /[[:word:]]/ - A character in one of the following Unicode
# general categories Letter, Mark, Number, Connector_Punctuation
name.strip
# Whitespace character ([:blank:], newline, carriage return, etc.)
# replaced by -
.gsub(/[[:space:]]/, '-')
# /[[:cntrl:]]/ - Control character
# remove any one present
.gsub(/[[:cntrl:]]/, '')
end
end
end

# Liquid::Template.register_filter(Jekyll::DataPageLinkGenerator)
# rubocop:enable Metrics/MethodLength

# WTF!? @see https://github.com/rubocop/ruby-style-guide/issues/301
# Essa porra é tão racista que obriga por rubocop:enable AsciiComments
# rubocop:enable AsciiComments
# rubocop:enable RubocopIsRacist/AsciiComments

0 comments on commit 117bc11

Please sign in to comment.