Skip to content

Commit

Permalink
mvp-tema-i18n (#9): Limpeza de código
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Jun 20, 2021
1 parent 8a62ced commit 170383b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 148 deletions.
3 changes: 2 additions & 1 deletion _includes/caput.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

{% assign paginam_iri = site.pages | map: "url" %}
{%- capture paginam_l10n -%}{% _🗣️ 🔎🔕🔍 L10N_ego_codicem 🔎🔕🔍 🗣️_ %}{%- endcapture -%}
{% assign paginam_l10n_initialle = paginam_l10n | prepend: '/' | append: '/' %}

<header class="site-header">
<nav aria-label="Main navbar of site"
class="navbar navbar-expand-lg navbar-light"
style="background-color: #e3f2fd;">
<div class="container">

{%- if paginam_l10n != '' and paginam_l10n != 'lat-Latn' and paginam_l10n != 'mul-Zyyy' -%}
{%- if paginam_l10n != '' and paginam_l10n != 'lat-Latn' and paginam_l10n != 'mul-Zyyy' and paginam_iri contains paginam_l10n_initialle -%}
<a class="navbar-brand" href="/{% _🗣️ 🔎🔕🔍 L10N_ego_codicem 🔎🔕🔍 🗣️_ %}/">
{% _🗣️ Hapi_breve_nomen 🗣️_ %} <sup><em>{% _🗣️ 🔎🔕🔍 L10N_ego_codicem 🔎🔕🔍 🗣️_ %}</em></sup>
</a>
Expand Down
92 changes: 9 additions & 83 deletions _plugins/hapi/datum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class L10nTag
:contextum_archivum_extensionem, :objectivum_textum,
:contextum_linguam, :contextum_sos, :paratum_est,
:contextum_url, :alternandum_textum, :alternandum_linguam,
:textum_solum_est, :contextum_textum_solum_est
:textum_solum_est, :contextum_textum_solum_est,
:alternandum_linguam_neo

# :initiale_processum

Expand Down Expand Up @@ -97,8 +98,8 @@ def initiale_datum # rubocop:disable Metrics/MethodLength
end

def est_html?
# @contextum_archivum_extensionem.end_with?('html')
false
@contextum_archivum_extensionem.end_with?('html')
# false
end

# Trivia:
Expand Down Expand Up @@ -162,12 +163,16 @@ class Linguam
# :referens

def initialize(argumentum = {})
# def initialize(linguam)
optionem = initiale_datum.merge(argumentum)

# @linguam = linguam
@linguam = optionem['linguam']


unless @linguam.nil?
referens = optionem['referens']
# referens = optionem['referens']
referens = Hapi::HSD.data?['referens']
@iso15924 = Utilitatem.iso15924_de_linguam(@linguam)
@iso6391 = Utilitatem.iso6391_de_linguam(@linguam, referens['praeiudico'])
@bcp47 = @iso6391
Expand Down Expand Up @@ -205,82 +210,3 @@ def ==(other)
end

end

# module Jekyll
# module Drops
# # ...
# class HapiDrop < Liquid::Drop
# attr_accessor :api, :api_xdefallo, :categoriam, :scheman, :pittacium

# class << self
# def global
# @global ||= HapiDrop.new
# end
# end

# # Create a new Drop
# #
# # obj - the Jekyll Site, Collection, or Document required by the
# # drop.
# #
# # Returns nothing
# @obj = obj
# end

# def api
# @obj.api
# end

# def version
# Jekyll::VERSION
# end

# def environment
# Jekyll.env
# end

# def inspect
# # puts 'datum'
# # puts @datum

# # "#<#{self.class} @relative_path=#{relative_path.inspect} xdefallo=#{@trivum}>"
# # "#<#{self.class} @uid=#{@uid} xdefallo=#{@xdefallo}>"
# "#<#{self.class}>"
# end

# # Generates a list of keys with user content as their values.
# # This gathers up the Drop methods and keys of the mutations and
# # underlying data hashes and performs a set union to ensure a list
# # of unique keys for the Drop.
# #
# # Returns an Array of unique keys for content for the Drop.
# def keys
# ['api']
# end

# # Generate a Hash representation of the Drop by resolving each key's
# # value. It includes Drop methods, mutations, and the underlying object's
# # data. See the documentation for Drop#keys for more.
# #
# # Returns a Hash with all the keys and values resolved.
# def to_h
# # keys.each_with_object({}) do |(key, _), result|
# # result[key] = self[key]
# # end
# @obj
# end
# alias to_hash to_h

# # def to_h
# # @to_h ||= {
# # 'version' => version,
# # 'environment' => environment
# # }
# # end

# def to_json(state = nil)
# JSON.generate(to_h, state)
# end
# end
# end
# end
5 changes: 2 additions & 3 deletions _plugins/hapi/hic_sunt_dracones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,12 @@ def tm_paginam?
def translationem_memoriam_rememorandum_non_perfectionem(rem)
puts "\n\n\t[🔎🐛 #{self.class.name}:#{__LINE__}] non_perfectionem [#{rem}]" if rem.est_sos?

puts 'test' if rem.est_sos?
end

# _[lat-Latn] Translationem memoriam rememorandum, fallendum [lat-Latn]_
def translationem_memoriam_rememorandum_fallendum(rem)
# puts "\n\n\t[🔎🐛 #{self.class.name}:#{__LINE__}] fallendum [#{rem}]" if rem.est_sos?
puts "\n\n\t[🔎🐛 #{self.class.name}:#{__LINE__}] fallendum [#{rem.inspect}]"
puts "\n\n\t[🔎🐛 #{self.class.name}:#{__LINE__}] fallendum [#{rem}]" if rem.est_sos?
# puts "\n\n\t[🔎🐛 #{self.class.name}:#{__LINE__}] fallendum [#{rem.inspect}]"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions _plugins/hapi/paginam/commune.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def alternativum
# - 'extēnsionem'
# - https://en.wiktionary.org/wiki/extensio#Latin
def archivum_extensionem
# '.html'
''
'.html'
# ''
end

# Trivia
Expand Down
70 changes: 13 additions & 57 deletions _plugins/jekyll_hapi_translationem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,57 +334,6 @@ def hashtag_exemplum
module Translationem # rubocop:disable Metrics/ModuleLength
module_function

# def datum_l10n(l10n_codice, context, linguam = nil)
# linguam = linguam.nil? ? context['page']['linguam'] : linguam
# # TODO: _[por] Implementar mensagem de erro se usuário errar linguam
# # como usar 'linguam: por' em vez de 'linguam: por-Latn'
# # [por]_
# hxlattrs = context['site']['data']['referens']['linguam'][linguam]['hxlattrs']
# context['site']['data']['L10nhxl'].each do |line|
# # if line['#item+code'] == l10n_codice
# next if line['#item+code'] != l10n_codice

# hxlattrs.each do |hxlattr|
# # puts hxlattr
# next unless line["#item+l10n#{hxlattr}"]

# # puts hxlattr
# # puts line["#item+l10n#{hxlattr}"]

# return line["#item+l10n#{hxlattr}"]
# end
# end

# nil
# end

# def datum_l10n_de_textum(textum, context, linguam_fontem, linguam_objectivum = nil)
# linguam_objectivum = linguam_objectivum.nil? ? context['page']['linguam'] : linguam_objectivum
# hxlattrs_fontem = context['site']['data']['referens']['linguam'][linguam_fontem]['hxlattrs']
# hxlattrs_objectivum = context['site']['data']['referens']['linguam'][linguam_objectivum]['hxlattrs']

# context['site']['data']['L10nhxl'].each do |line|
# # if line['#item+code'] == l10n_codice
# # puts "#item+l10n#{hxlattrs_fontem}"

# hxlattrs_fontem.each do |hxlattr_fon|
# next if line["#item+l10n#{hxlattr_fon}"] != textum

# hxlattrs_objectivum.each do |hxlattr_obj|
# # puts hxlattr
# next unless line["#item+l10n#{hxlattr_obj}"]

# # puts hxlattr
# # puts line["#item+l10n#{hxlattr}"]

# return line["#item+l10n#{hxlattr_obj}"]
# end
# end
# end

# nil
# end

# TODO: esta meio feio isso. Melhorar. Um problema é que cria
# tags <p> mesmo em elementos inline.
# @deprecated
Expand Down Expand Up @@ -446,9 +395,9 @@ def farmatum_alternandum_neo(rem) # rubocop:disable Metrics/MethodLength,Metrics
return rem.objectivum_textum if rem.est_textum_solum_est? && rem.objectivum_textum
return rem.fontem_textum if rem.est_textum_solum_est?

puts 'oi est_sos' if rem.est_sos?
puts rem.contextum_archivum_extensionem if rem.est_sos?
puts 'oi est_html' if rem.est_sos? && rem.est_html?
# puts 'oi est_sos' if rem.est_sos?
# puts rem.contextum_archivum_extensionem if rem.est_sos?
# puts 'oi est_html' if rem.est_sos? && rem.est_html?
# puts 'oi est_html' if rem.est_html?

# attrs = {
Expand All @@ -458,9 +407,13 @@ def farmatum_alternandum_neo(rem) # rubocop:disable Metrics/MethodLength,Metrics
# }

if rem.est_html? && !rem.est_textum_solum_est?
# puts 'oooi' if rem.est_sos?
# puts rem.objectivum_linguam.bcp47 if rem.est_sos?
# puts rem.alternandum_linguam.bcp47 if rem.est_sos?
attrs_str = Utilitatem.quod_html_attributum_markup_nunc?(
{
'lang' => rem.fontem_linguam.bcp47,
# 'lang' => rem.fontem_linguam.bcp47,
'lang' => rem.objectivum_linguam.bcp47,
'data-l10n-fontem-linguam' => rem.fontem_linguam.linguam,
'data-l10n-objectivum-linguam' => rem.objectivum_linguam.linguam,
'class' => 'incognitum-phrasim'
Expand Down Expand Up @@ -501,13 +454,15 @@ def farmatum_praefectum_neo(rem) # rubocop:disable Metrics/MethodLength,Metrics/
if rem.est_html?
attrs_str = Utilitatem.quod_html_attributum_markup_nunc?(
{
# TODO: fix the rem.fontem_linguam.bcp47
'lang' => rem.fontem_linguam.bcp47,
'data-l10n-fontem-linguam' => rem.fontem_linguam.linguam,
'data-l10n-objectivum-linguam' => rem.objectivum_linguam.linguam
}
)

return "<span #{attrs_str}>#{rem.fontem_textum}</span>"
# return "<span #{attrs_str}>#{rem.fontem_textum}</span>"
return "<span #{attrs_str}>#{rem.objectivum_textum}</span>"
end

puts "\n\n\t[🔎🆘🔍 #{self.class.name}] #{__LINE__} [#{rem.inspect}]" if rem.est_sos?
Expand All @@ -531,7 +486,7 @@ def farmatum_ultima_mundi_quo_steterit(rem)
if rem.est_html?
return "<span lang='#{rem.fontem_linguam.bcp47}' data-l10n-fontem-textum='#{rem.fontem_textum}' " \
"data-l10n-fontem-linguam='#{rem.fontem_linguam.linguam}' " \
"data-l10n-errorem='1' data-l10n-objectivum-linguam='#{rem.objectivum_linguam.linguam}'>" \
"data-l10n-errorem='1' data-l10n-objectivum-linguam4444='#{rem.objectivum_linguam.linguam}'>" \
"#{rem.fontem_textum}</span>"
end
rem.fontem_textum
Expand Down Expand Up @@ -844,6 +799,7 @@ def render(context) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metri
if l10nval_lat != false && !l10nval_lat.nil?
rem.alternandum_textum = l10nval_lat
rem.alternandum_linguam = 'lat-Latn'
# rem.alternandum_linguam_neo = Hapi::Datum::Linguam('lat-Latn')
# puts rem.inspect if rem.est_textum_solum_est?
# return Translationem.farmatum_alternandum(
# context, rem.fontem_textum, l10nval_lat,
Expand Down
2 changes: 0 additions & 2 deletions documentum/arb-Arab/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ translationem_debug: false # true
# [eng]_
---

teste->{% _🗣️ 🔎🆘🔍 licentiam_nomen 🔎🆘🔍 🗣️_ %}<-teste

{%- include index-corporeum.html -%}

0 comments on commit 170383b

Please sign in to comment.