Skip to content

Commit

Permalink
_plugins/hapi/hxl.rb Hapi.HXL.HXLOptionem (class) iniciada
Browse files Browse the repository at this point in the history
HXL-CPLP/forum#58, hapi-t9n-alpha (#13), mvp-l10n-schemas (#7)
  • Loading branch information
fititnt committed May 28, 2021
1 parent de98632 commit d864113
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 28 deletions.
2 changes: 2 additions & 0 deletions _data/referens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ hxl:
- '#meta'
attributum:
- '+meta'
referens:
- '#item+id'

linguam:
arb-Arab:
Expand Down
62 changes: 51 additions & 11 deletions _plugins/hapi/hxl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def optionem_de_linguam(contextum, linguam = nil)
raise "_data/referens.yml: Non linguam [#{linguam}]!" if ref['linguam'][linguam].nil?
raise '_data/referens.yml: Non hxl.linguam!' if ref['hxl']['linguam'].nil?

Struct.new(:attributum, :hashtag, :ignorandum).new(
HXLOptionem.new(
ref['linguam'][linguam]['hxlattrs'],
ref['hxl']['linguam']['hashtag'],
ref['hxl']['linguam']['ignorandum']
Expand All @@ -49,25 +49,65 @@ def optionem_de_linguam(contextum, linguam = nil)

# TODO: 'quod obiectum attribūtum existendum?' tá mal traduzido
def quod_obiectum_optionem_existendum(obiectum, hxloptionem)
puts 'hxloptionem obiectum'
# puts 'hxloptionem obiectum'

puts hxloptionem
puts obiectum
puts ''
puts 'oiiiiii'
# puts hxloptionem.dig(':attributum')
puts hxloptionem['attributum']
# puts hxloptionem
# puts obiectum
# puts ''
# puts 'oiiiiii'
# puts ''
# # puts hxloptionem.dig(':attributum')
# puts hxloptionem.attributum
# puts ' quod_columnam'
# puts hxloptionem.quod_columnam(obiectum)
# puts obiectum
true
end

def testum(obiectum, hxlattrs)
puts 'testum'
puts obiectum
puts hxlattrs
# puts 'testum'
# puts obiectum
# puts hxlattrs

"TODO #{hxlattrs}"
end

# _[eng] A quick helper to , for a guiven linguam, make inferences from
# _data/referens.yml to what is likely to be desired column
# [eng]_
class HXLOptionem
attr_accessor :attributum, :hashtag, :ignorandum, :referens

def initialize(attributum = nil, hashtag = nil, ignorandum = nil, referens = ['#item+id'] )
@attributum = attributum
@hashtag = hashtag
@ignorandum = ignorandum
@referens = referens
end

def hashtag_exemplum
prefix = @hashtag.nil? ? [''] : @hashtag
suffix = @attributum.nil? ? [''] : @attributum
resultatum = []
prefix.each do |pre|
suffix.each do |suf|
resultatum.append("#{pre}#{suf}")
end
end
resultatum
end

# Trivia:
# - 'columnam'
# - https://en.wiktionary.org/wiki/columna#Latin
# def quod_columnam(obiectum)
def quod_obiectum_optionem_existendum(obiectum)
puts 'quod_columnam'
puts obiectum.keys
# puts obiectum
false
end
end
end
end

Expand Down
49 changes: 32 additions & 17 deletions _plugins/jekyll_hapi_translationem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,26 +316,40 @@ def translationem_memoriam_collectionem(contextum)
end

def translationem_memoriam_rememorandum(contextum, _codicem, linguam = nil)
tm_collectionem = translationem_memoriam_collectionem(contextum)
tm = translationem_memoriam_collectionem(contextum)
# hxlattrs = HXL.hxlattrs_de_linguam(contextum, linguam)
hxloptionem = HXL.optionem_de_linguam(contextum, linguam)

# return 'n'
# puts ' hxloptionem.hashtag_exemplum'
# puts hxloptionem.hashtag_exemplum
# return true
# tm_collectionem.do |archivum|
tm_collectionem.each do |archivum|
# tm.each do |archivum|
tm.each do |archivum|
# puts 'puts'
# puts archivum[0]
# puts tm_collectionem[archivum]
next unless HXL.quod_obiectum_optionem_existendum(archivum[0], hxloptionem)

archivum.each do |tm_item|
# puts hxlattr
next unless HXL.testum(tm_item, hxloptionem)

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

return HXL.testum(tm_item, hxloptionem)
end
# puts tm[archivum]
# puts archivum
# puts tm[archivum[0]][0]
# # puts tm[archivum[0]]
# puts ''
# puts ''
# puts ''
# puts tm[archivum]
# puts tm[archivum].first
# raise 'stop'
# raise 'stop'
next unless hxloptionem.quod_obiectum_optionem_existendum(tm[archivum[0]][0])

# archivum.each do |tm_item|
# # puts hxlattr
# next unless HXL.testum(tm_item, hxloptionem)

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

# return HXL.testum(tm_item, hxloptionem)
# end
end

# puts 'hxlattrs'
Expand Down Expand Up @@ -436,10 +450,11 @@ def initialize(tag_name, text, tokens)
def render(context)
temp = Translationem.datum_temporarium(context)
# l10nval = Translationem.datum_l10n(@textum, context, @linguam_fontem)
l10nval = nil
# l10nval = nil

# Translationem.translationem_memoriam_collectionem(context)
puts Translationem.translationem_memoriam_rememorandum(context, @textum)
# puts Translationem.translationem_memoriam_rememorandum(context, @textum)
l10nval = Translationem.translationem_memoriam_rememorandum(context, @textum)

return l10nval if l10nval

Expand Down

0 comments on commit d864113

Please sign in to comment.