Skip to content

Commit

Permalink
mvp-tema-i18n (#9): TranslationemMemoriamPaginam, adições parciais
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Jun 18, 2021
1 parent acdba85 commit 3ff307f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 5 deletions.
2 changes: 2 additions & 0 deletions _includes/tm/index-xdefallo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

{% _🗣️ opus_in_progressu_emoji_nomen 🗣_️ %}

{{ xtm }}

{% for rem in xtm.alternativum %}
<article style="padding: 1em">
{% include tm/item.html tm=rem initiale_html_hN=h_3sx multiplum_linguam=true %}
Expand Down
10 changes: 10 additions & 0 deletions _plugins/hapi/drops/globum_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,19 @@ def collectionem_schemam
@optionem['collectionem_schemam'] || []
end

# NOTE: _[eng] collectionem_xschemam is a draft [eng]_
def collectionem_xschemam
@optionem['collectionem_xschemam'] || []
end

def collectionem_tm
@optionem['collectionem_tm'] || []
end

# NOTE: _[eng] collectionem_xtm is a draft [eng]_
def collectionem_xtm
@optionem['collectionem_xtm'] || []
end
end
end
end
Expand Down
68 changes: 66 additions & 2 deletions _plugins/hapi/hic_sunt_dracones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
# api = {}
api = []
schemam = []
tm = []
categoriam = {}
pittacium = {}
# api
Expand All @@ -88,6 +89,8 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
api.append(page)
elsif page.instance_of?(Hapi::SchemamPaginam)
schemam.append(page)
elsif page.instance_of?(Hapi::TranslationemMemoriamPaginam)
tm.append(page)
elsif page.instance_of?(Jekyll::Page)
# puts 'Generic pages do not have any special feature'
end
Expand All @@ -109,7 +112,8 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
# api_xdefallo = api_xdefallo?(api)
api_gid_xdefallo = api_gid_xdefallo?(api)
xschemam = schemam_xdefallo?(schemam)
globum = globum?(api, schemam)
xtm = tm_xdefallo?(tm)
globum = globum?(api, schemam, tm)

# puts globum[0]['collectionem_api']
# puts globum[0]['collectionem_schemam']
Expand All @@ -124,6 +128,7 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
'xapi' => api_gid_xdefallo,
'xschemam' => xschemam, # Nota: acesse via globum ou entao interaga direto via schemam
# 'xschemam' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'tm' => tm,
'globum' => globum,
'categoriam' => categoriam,
'pittacium' => pittacium
Expand Down Expand Up @@ -350,9 +355,10 @@ def referens_gid? # rubocop:disable Metrics/AbcSize
Jekyll.sites.last.data['l10n']['referensl10n']['gid']
end

def globum?(api_collectionem = nil, schemam_collectionem = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
def globum?(api_collectionem = nil, schemam_collectionem = nil, tm_collectionem = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
apis = api_collectionem || api?
schemam_collectionem ||= schemam?
tm_collectionem ||= tm?
referens_gid = referens_gid?

# puts 'oi oi '
Expand All @@ -372,6 +378,8 @@ def globum?(api_collectionem = nil, schemam_collectionem = nil) # rubocop:disabl
res['collectionem_xapi'] = []
res['collectionem_schemam'] = []
res['collectionem_xschemam'] = []
res['collectionem_tm'] = []
res['collectionem_xtm'] = []

apis.each do |api|
# api_drop = Hapi::Drops::HapiXdefalloApiDrop.new(res)
Expand Down Expand Up @@ -404,13 +412,69 @@ def globum?(api_collectionem = nil, schemam_collectionem = nil) # rubocop:disabl
# # resultatum[clavem] = valendum
end

tm_collectionem.each do |tm|
# api_drop = Hapi::Drops::HapiXdefalloApiDrop.new(res)
res['collectionem_tm'].append(tm) if tm.gid_est?(clavem_gid)
# if api.gid_est?(clavem_gid)
# res['collectionem_api'].append(Hapi::Drops::HapiApiDrop.new(api))
# end

# TODO: this is a draft, needs implement exclusive XTmDrop
if !!tm.xdefallo_est && tm.gid_est?(clavem_gid)
# puts " #{schemam.nomen}"
res['collectionem_xtm'].append(Hapi::Drops::HapiXschemamDrop.new(tm))
end

# res['collectionem_xapi'].append(api) if api.xdefallo_est && api.gid_est?(clavem_gid)
# # resultatum[clavem] = valendum
end

# resultatum.append(res)
drop = Hapi::Drops::HapiGlobumDrop.new(res)
resultatum.append(drop)
end

resultatum
end

# _[eng] Not implemented yet with this strategy [eng]_
def tm?
Jekyll.sites.last.data['translationem-memoriam'] || []
end

# TODO: _[eng] This is a draft; Not ready. [eng]_
def tm_xdefallo?(tm_collectionem = nil) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
# apis = schemam_collectionem
tm_collectionem ||= tm?
referens_gid = referens_gid?

return [] if referens_gid.empty? || tm_collectionem.empty?

# puts 'oi oi 2'

# resultatum = {}
resultatum = []

referens_gid.each do |clavem_gid, valendum|
# puts "api_gid_xdefallo [#{clavem_gid}] [#{valendum}]"
# puts ''
res = valendum
res['collectionem_tm'] = []
tm_collectionem.each do |tm|
res['collectionem_tm'].append(tm) if tm.xdefallo_est && tm.gid_est?(clavem_gid)
# resultatum[clavem] = valendum
end
# resultatum.append(res)
drop = Hapi::Drops::HapiGlobumDrop.new(res)
resultatum.append(drop)
end

resultatum
end

def tm_paginam?
Jekyll.sites.last.data['hapi']['tm'] || []
end
end
end

Expand Down
7 changes: 4 additions & 3 deletions _plugins/hapi/paginam/tm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/Method
def alternativum
# Utilitatem.digitum_premendum(relative_path)
resultatum = []
schemam_collectionem = Hapi::HSD.schemam_paginam?
schemam_collectionem&.each do |schemam|
tm_collectionem = Hapi::HSD.tm_paginam?
# puts tm_collectionem.inspect
tm_collectionem&.each do |tm|
# puts api.class
resultatum.append(schemam) if @xdefallo == schemam.xdefallo
resultatum.append(tm) if @xdefallo == tm.xdefallo
end

resultatum
Expand Down

0 comments on commit 3ff307f

Please sign in to comment.