Skip to content

Commit

Permalink
HXL-CPLP/forum#58, hapi-t9n-alpha (#13), mvp-l10n-schemas (#7): _plug…
Browse files Browse the repository at this point in the history
…ins/jekyll_venandum_insectum.rb, fiat lux!
  • Loading branch information
fititnt committed Jun 8, 2021
1 parent 7a60f8c commit b10ddaf
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 29 deletions.
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
source 'https://rubygems.org'

# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137

# gem "github-pages", group: :jekyll_plugins
# gem "jekyll", "~> 3.9"

Expand All @@ -25,3 +29,7 @@ group :jekyll_plugins do
end

gem 'html-proofer'

# _[por] rubocop é tão racista que obriga re-habilitar
# AsciiComments [por]_
# rubocop:enable RubocopIsRacistAndIcanProveIt/AsciiComments
6 changes: 3 additions & 3 deletions _data/referens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ gid:
hashtag:
api: "api-UN"
schema: "schema-UN"
api_xdefallo: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_api: [] # _data/api.yml / _data/l10n/api.l10n.json

XZ:
gid: XZ
namen: "🌐 XZ 🌐"
hashtag:
api: "api-XZ"
schema: "schema-XZ"
api_xdefallo: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_api: [] # _data/api.yml / _data/l10n/api.l10n.json

BR:
gid: BR
namen: "🇧🇷 BR 🇧🇷"
hashtag:
api: "api-BR"
schema: "schema-BR"
api_xdefallo: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_api: [] # _data/api.yml / _data/l10n/api.l10n.json

hxl:
linguam:
Expand Down
16 changes: 15 additions & 1 deletion _plugins/hapi/datum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,21 @@ def inspect
end

def to_s
"#{HapiDrop} @collectionem=#{@optionem.keys}"
optionem_explanandum = []
@optionem.each_key do |clavem|
if @optionem[clavem].length.positive?
optionem_explanandum.append("'#{clavem}' => '#{@optionem[clavem].length} dēscendēns'")
else
optionem_explanandum.append("'#{clavem}' => 'deprædantes pupillos'")
end
end

# puts @optionem['api_gid_xdefallo']
# optionem_explanandum.append(@optionem['api_gid_xdefallo'].to_s)
# optionem_explanandum.append(@optionem['api_gid_xdefallo'].to_s)

# "#{HapiDrop} @item=#{@optionem.keys} #{optionem_num}"
"#{HapiDrop} @item=[#{optionem_explanandum.join(', ')}]"
end

def scheman
Expand Down
39 changes: 30 additions & 9 deletions _plugins/hapi/hic_sunt_dracones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
end

api_xdefallo = api_xdefallo?(api)
api_gid_xdefallo = api_gid_xdefallo?(api)

jekyll_data = HSD.data?

jekyll_data['hapi'] = Hapi::Datum::HapiDrop.new(
{
'api' => api,
'api_xdefallo' => api_xdefallo,
'api_gid_xdefallo' => api_gid_xdefallo,
'categoriam' => categoriam,
'scheman' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'pittacium' => pittacium
Expand All @@ -82,11 +84,11 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
end

def api?
Jekyll.sites.last.data['api'] # apil10n ?
Jekyll.sites.last.data['api'] || [] # apil10n ?
end

def api_paginam?
Jekyll.sites.last.data['hapi']['api']
Jekyll.sites.last.data['hapi']['api'] || []
end

def api!(api)
Expand All @@ -97,16 +99,35 @@ def api!(api)
def api_gid_xdefallo?(api_collectionem = nil, referens_gid = nil)
apis = api_collectionem || api?
referens_gid ||= referens_gid?

# puts 'oi oi '
# puts referens_gid.empty?
# puts apis.empty?
return [] if referens_gid.empty? || apis.empty?

# puts 'oi oi 2'

# resultatum = {}
resultatum = []

apis&.each do |api|
resultatum.append(api) if api.xdefallo_est?
# resultatum[clavem] = valendum
referens_gid.each do |clavem_gid, valendum|
puts "api_gid_xdefallo [#{clavem_gid}] [#{valendum}]"
apis.each do |api|
resultatum.append(api) if api.xdefallo_est? && api.gid_est?(clavem_gid)
# resultatum[clavem] = valendum
end
end

# apis&.each do |api|
# resultatum.append(api) if api.xdefallo_est?
# # resultatum[clavem] = valendum
# end

# TODO: order by UN, XZ, then others

# puts 'resultatum'
# puts resultatum

resultatum
end

Expand Down Expand Up @@ -153,11 +174,11 @@ def pages!(pages)
end

def referens_gid? # rubocop:disable Metrics/AbcSize
return [] unless Jekyll.sites.last.data['l10n'] && \
Jekyll.sites.last.data['l10n']['apil10n']['gid'] && \
Jekyll.sites.last.data['l10n']['apil10n']['gid']
return [] if Jekyll.sites.last.data['l10n'].nil? || \
Jekyll.sites.last.data['l10n']['referensl10n'].nil? || \
Jekyll.sites.last.data['l10n']['referensl10n']['gid'].nil?

Jekyll.sites.last.data['l10n']['apil10n']['gid']
Jekyll.sites.last.data['l10n']['referensl10n']['gid']
end

def testum
Expand Down
29 changes: 18 additions & 11 deletions _plugins/jekyll_hapi_api.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FILUM: _lugins/hapi/utilitatem.rb
# ARCHĪVUM: _lugins/hapi/utilitatem.rb
#
# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
Expand Down Expand Up @@ -50,11 +50,12 @@ def generate(site) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
# _[eng] Subclass of `Jekyll::Page` with custom method definitions. [eng]_
# _[eng] Subclasse de `Jekyll::Page` com customizações nos métodos [eng]_
class ApiPaginam < Jekyll::Page
attr_accessor :datum, :uid, :xdefallo, :alternativum
attr_accessor :datum, :gid, :uid, :xdefallo, :alternativum

# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
alternativum
gid
xdefallo
content
dir
Expand Down Expand Up @@ -91,6 +92,7 @@ def initialize(site, api_datum, _debug) # rubocop:disable Metrics/AbcSize,Metric
end

@datum = api_datum
@gid = api_datum['gid']
@uid = api_datum['uid']
@xdefallo = api_datum['xdefallo']
# puts ' api_datum'
Expand Down Expand Up @@ -152,6 +154,13 @@ def digitum_signaturum
Utilitatem.digitum_premendum(relative_path)
end

# Trivia
# - 'gid'
# - https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
def gid_est?(gid)
@gid == gid
end

# Trivia
# - 'trivium'
# - https://en.wiktionary.org/wiki/trivium#Latin
Expand All @@ -165,13 +174,13 @@ def trivium
# @see https://github.com/jekyll/jekyll/blob/master/lib/jekyll/collection.rb
# @see https://github.com/jekyll/jekyll/blob/master/lib/jekyll/page.rb
# # .
def inspect
# puts 'datum'
# puts @datum
# def inspect
# # puts 'datum'
# # puts @datum

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

# _[eng] Returns the object as a debug String [eng]_
# @see https://github.com/jekyll/jekyll/blob/master/lib/jekyll/collection.rb
Expand All @@ -185,9 +194,7 @@ def to_s
"#<#{self.class} @uid=#{@uid} xdefallo=#{@xdefallo}>"
end

def xdefallo
@xdefallo
end
attr_reader :xdefallo

# _[eng] Is this an xdefallo API? [eng]_
# _[por] Esta é uma API xdefallo? [por]_
Expand Down
6 changes: 4 additions & 2 deletions _plugins/jekyll_liquify.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# FILUM: _plugins/jekyll_liquify.rb
#
# ARCHĪVUM: _plugins/jekyll_liquify.rb
# LICENTIAM: Dominium publicum
# frozen_string_literal: true

# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137
Expand Down
38 changes: 38 additions & 0 deletions _plugins/jekyll_venandum_insectum.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# ARCHĪVUM: _plugins/jekyll_venandum_insectum.rb
# LICENTIAM: Dominium publicum
# frozen_string_literal: true

# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137

# Trivia:
# - 'summārius'
# - https://en.wiktionary.org/wiki/summary#English
# - 'rem'
# - https://en.wiktionary.org/wiki/res#Latin
module Jekyll
# {{ my_complex_object | summarius }}
module Summarius
# See also
# - keys
# - https://stackoverflow.com/questions/38912891/with-jekyll-liquid-how-to-get-all-keys-of-a-yml-hash
# - https://github.com/dalenys/jekyll-keys-filter
# - https://github.com/MichaelCurrin/jekyll-keys-filter
def summarius(rem)
# TODO: implement a summary for deep objects
rem.keys
rescue StandardError
require 'json'
JSON.pretty_generate(rem)
end
end
end

Liquid::Template.register_filter(Jekyll::Summarius)


# rubocop:enable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137
#
34 changes: 31 additions & 3 deletions documentum/mul/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>Trivia</h2>
</aside>
<section>
<article>
<h2>API</h2>
{% for item_group in site.data.hapi.api_xdefallo %}
<h2>API</h2>
{% for item_group in site.data.hapi.api_xdefallo %}
<article>
<h3>{{ item_group.title }}</h3>
<dl>
Expand All @@ -86,7 +86,35 @@ <h4>{{ item_alt.title | default: item_alt.namen }}</h4>
{% endif %}
{% endfor %}
</article>
{% endfor %}
{% endfor %}
</article>
<article>
<h2>API per gid</h2>
{{ site.data.hapi }}
<br>
{{ site.data.hapi.api_gid_xdefallo | inspect }}
<br>

{% for item_gid in site.data.hapi.api_gid_xdefallo %}
<article>
<h3>{{ item_gid.namen }}</h3>
<dl>
<dt>{% _🗣️ abbreviationem_XZ_URL_canonicum_nomen 🗣️_ %}</dt>
<dd><a href="{{ item_group.url }}">{{ item_group.url }}</a></dd>
</dl>
{% for item_alt in item_group.alternativum %}
{% if item_alt.url != item_group.url %}
<article>
<h4>{{ item_alt.title | default: item_alt.namen }}</h4>
<dl>
<dt>{% _🗣️ abbreviationem_XZ_URL_canonicum_nomen 🗣️_ %}</dt>
<dd><a href="{{ item_alt.url }}">{{ item_alt.url }}</a></dd>
</dl>
</article>
{% endif %}
{% endfor %}
</article>
{% endfor %}
</article>

<article>
Expand Down

0 comments on commit b10ddaf

Please sign in to comment.