diff --git a/Gemfile b/Gemfile index fed59ad..02a455c 100644 --- a/Gemfile +++ b/Gemfile @@ -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" @@ -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 diff --git a/_data/referens.yml b/_data/referens.yml index 80607d0..c1d5c50 100644 --- a/_data/referens.yml +++ b/_data/referens.yml @@ -33,7 +33,7 @@ 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 @@ -41,7 +41,7 @@ gid: 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 @@ -49,7 +49,7 @@ gid: 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: diff --git a/_plugins/hapi/datum.rb b/_plugins/hapi/datum.rb index eadff93..cab894f 100644 --- a/_plugins/hapi/datum.rb +++ b/_plugins/hapi/datum.rb @@ -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 diff --git a/_plugins/hapi/hic_sunt_dracones.rb b/_plugins/hapi/hic_sunt_dracones.rb index 3aec470..4b7e010 100644 --- a/_plugins/hapi/hic_sunt_dracones.rb +++ b/_plugins/hapi/hic_sunt_dracones.rb @@ -66,6 +66,7 @@ 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? @@ -73,6 +74,7 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, { '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 @@ -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) @@ -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 @@ -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 diff --git a/_plugins/jekyll_hapi_api.rb b/_plugins/jekyll_hapi_api.rb index 6c189c1..79f6dd2 100644 --- a/_plugins/jekyll_hapi_api.rb +++ b/_plugins/jekyll_hapi_api.rb @@ -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 @@ -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 @@ -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' @@ -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 @@ -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 @@ -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]_ diff --git a/_plugins/jekyll_liquify.rb b/_plugins/jekyll_liquify.rb index cc5c5e5..438e0ae 100644 --- a/_plugins/jekyll_liquify.rb +++ b/_plugins/jekyll_liquify.rb @@ -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 diff --git a/_plugins/jekyll_venandum_insectum.rb b/_plugins/jekyll_venandum_insectum.rb new file mode 100644 index 0000000..b648b7b --- /dev/null +++ b/_plugins/jekyll_venandum_insectum.rb @@ -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 +# diff --git a/documentum/mul/index.html b/documentum/mul/index.html index d3932ce..0bc1921 100644 --- a/documentum/mul/index.html +++ b/documentum/mul/index.html @@ -66,8 +66,8 @@

Trivia

-

API

- {% for item_group in site.data.hapi.api_xdefallo %} +

API

+ {% for item_group in site.data.hapi.api_xdefallo %}

{{ item_group.title }}

@@ -86,7 +86,35 @@

{{ item_alt.title | default: item_alt.namen }}

{% endif %} {% endfor %}
- {% endfor %} + {% endfor %} +
+
+

API per gid

+ {{ site.data.hapi }} +
+ {{ site.data.hapi.api_gid_xdefallo | inspect }} +
+ + {% for item_gid in site.data.hapi.api_gid_xdefallo %} +
+

{{ item_gid.namen }}

+
+
{% _🗣️ abbreviationem_XZ_URL_canonicum_nomen 🗣️_ %}
+
{{ item_group.url }}
+
+ {% for item_alt in item_group.alternativum %} + {% if item_alt.url != item_group.url %} +
+

{{ item_alt.title | default: item_alt.namen }}

+
+
{% _🗣️ abbreviationem_XZ_URL_canonicum_nomen 🗣️_ %}
+
{{ item_alt.url }}
+
+
+ {% endif %} + {% endfor %} +
+ {% endfor %}