Skip to content

Commit

Permalink
HXL-CPLP/forum#58, hapi-t9n-alpha (#13), mvp-l10n-schemas (#7): /mul/…
Browse files Browse the repository at this point in the history
… -> /mul-Zyyy/; fiat lux, _plugins/hapi/drops/xdefallo_api_drop.rb!
  • Loading branch information
fititnt committed Jun 8, 2021
1 parent 698f99c commit 654b80f
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
_site/
docs/
node_modules/
.vscode

# Ignore metadata generated by Jekyll
_site/
Expand Down
6 changes: 4 additions & 2 deletions _data/referens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ api_gid:
schema_gid:
- "XZ"

# @see _plugins/hapi/drops/globum_drop.rb
gid:
UN:
gid: UN
Expand All @@ -34,22 +35,23 @@ gid:
api: "api-UN"
schema: "schema-UN"
# collectionem_api: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_xapi: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_schemam: [] # _data/api.yml / _data/l10n/api.l10n.json
# collectionem_xschemam: [] # _data/api.yml / _data/l10n/api.l10n.json

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

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

hxl:
linguam:
Expand Down
28 changes: 13 additions & 15 deletions _plugins/hapi/drops/globum_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ def initialize(argumentum = {}) # rubocop:disable Lint/MissingSuper
@optionem = argumentum
end

# def api
# @optionem['api']
# end

# def api_xdefallo
# @optionem['api_xdefallo']
# end

# def categoriam
# @optionem['categoriam']
# end

def inspect
# Liquid uses 'self.class.to_s'
# @see https://github.com/Shopify/liquid/blob/master/lib/liquid/drop.rb#L47
Expand All @@ -72,7 +60,7 @@ def to_s
# optionem_explanandum.append(@optionem['api_gid_xdefallo'].to_s)

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

Expand All @@ -88,8 +76,18 @@ def collectionem_api
@optionem['collectionem_api'] || []
end

def collectionem_api_xdefallo
@optionem['collectionem_api_xdefallo'] || []
# @see _plugins/hapi/drops/xdefallo_api_drop.rb
# @see https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
def collectionem_xapi
@optionem['collectionem_xapi'] || []
end

def collectionem_schemam
@optionem['schemam'] || []
end

def collectionem_schemam_xdefallo
@optionem['schemam_xdefallo'] || []
end
end
end
Expand Down
14 changes: 10 additions & 4 deletions _plugins/hapi/drops/hapi_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Hapi
module Drops
# _[lat] Hapi Collectionem [lat]_
class HapiDrop < Liquid::Drop
attr_accessor :argumentum
attr_accessor :optionem

# TODO: _[eng] No idea if this is necessary. Maybe remove later [eng]_
class << self
Expand All @@ -35,9 +35,12 @@ def api
@optionem['api']
end

def api_xdefallo
@optionem['api_xdefallo']
def xapi
@optionem['xapi']
end
# def api_xdefallo
# @optionem['api_xdefallo']
# end

def categoriam
@optionem['categoriam']
Expand Down Expand Up @@ -69,12 +72,15 @@ def to_s
# optionem_explanandum.append(@optionem['api_gid_xdefallo'].to_s)

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

def scheman
@optionem['scheman']
end
def xscheman
@optionem['xscheman']
end

def pittacium
@optionem['pittacium']
Expand Down
69 changes: 69 additions & 0 deletions _plugins/hapi/drops/xdefallo_api_drop.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ARCHĪVUM: _plugins/hapi/drops/hapi_drop.rb
# DESCRIPTIONEM:
#
# rubocop:disable RubocopIsRacistAndIcanProveIt/AsciiComments
# @see https://github.com/rubocop/ruby-style-guide/issues/301
# @see https://github.com/rubocop/ruby-style-guide/issues/137
# frozen_string_literal: true

module Hapi
# TODO: document...
module Drops
# _[por] Conteiner de coleções apis por uma xdefallo ('x-default')
# Sem alguma forma
# de abstrair objetos que há não sejam algo como uma Jekyll:Page
# ou Hapi::Datum::HapiDrop o liquid e Jekyll nem mesmo irá exibir
# informações nas páginas HTML finais.
# [por]_
# @see _data/referens.yml#gid
#
# Trivia
# - 'api':
# - https://www.wikidata.org/wiki/Q165194
# - 'xdefallo':
# - https://en.wikipedia.org/wiki/Hreflang
class HapiXdefalloApiDrop < Liquid::Drop
attr_accessor :optionem

# TODO: _[eng] No idea if this is necessary. Maybe remove later [eng]_
class << self
def global
@global ||= HapiXdefalloApiDrop.new
end
end

def initialize(argumentum = {}) # rubocop:disable Lint/MissingSuper
@optionem = argumentum
end

def inspect
require 'json'
JSON.pretty_generate(@optionem)
end

def to_s
"<#{self.class} @item=#{@optionem.keys}>"
end

def gid
@optionem['gid']
end

def linguam
@optionem['linguam']
end

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

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

# _[por] rubocop é tão racista que obriga re-habilitar
# AsciiComments [por]_
# rubocop:enable RubocopIsRacistAndIcanProveIt/AsciiComments
24 changes: 18 additions & 6 deletions _plugins/hapi/hic_sunt_dracones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# - https://en.wikipedia.org/wiki/Here_be_dragons
# frozen_string_literal: true

require 'singleton'
# require 'singleton'

module Hapi
# _[lat] HSD, 'HicSuntDracones', Hic Sunt Dracones [lat]_
# @see https://en.wikipedia.org/wiki/Here_be_dragons
module HSD
module HSD # rubocop:disable Metrics/ModuleLength
module_function

# # _[eng] Global Anti-pattern of global variable without global variable [eng]_
Expand Down Expand Up @@ -65,16 +65,17 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
end
end

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

jekyll_data = HSD.data?

jekyll_data['hapi'] = Hapi::Drops::HapiDrop.new(
{
'api' => api,
'api_xdefallo' => api_xdefallo,
# 'api_xdefallo' => api_xdefallo,
'api_gid_xdefallo' => api_gid_xdefallo,
'globum' => api_gid_xdefallo,
'categoriam' => categoriam,
'scheman' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'pittacium' => pittacium
Expand Down Expand Up @@ -136,6 +137,7 @@ def api_gid_xdefallo?(api_collectionem = nil, referens_gid = nil) # rubocop:disa
resultatum
end

# @deprecated remover
def api_xdefallo?(api_collectionem = nil)
apis = api_collectionem || api?
# resultatum = {}
Expand Down Expand Up @@ -178,10 +180,20 @@ def pages!(pages)
Jekyll.sites[idx].pages = pages
end

# @deprecated
def referens_gid? # rubocop:disable Metrics/AbcSize
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']['referensl10n'].nil? || \
Jekyll.sites.last.data['l10n']['referensl10n']['gid'].nil?

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

# @see _data/referens.yml#gid
def globum? # rubocop:disable Metrics/AbcSize
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']['referensl10n']['gid']
end
Expand Down
3 changes: 3 additions & 0 deletions documentum/eng-Latn/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ permalink: /eng-Latn/
# layout: defallo
layout: defallo-ltr

categories: ['index', 'linguam-eng-Latn']
tags: ['index', 'linguam-eng-Latn']

# FIXME: _[eng] Inject the next attriutes based on _data/referens.yml, like
# we would do with automatically generated API pages.
# (Emerson Rocha, 2021-05-25 04:30 UTC)
Expand Down
2 changes: 1 addition & 1 deletion documentum/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h1 class="display-4 fw-bold">
</a>
</div>
<br>
<a href="/mul/" class="btn btn-success btn-md px-4"
<a href="/mul-Zyyy/" class="btn btn-success btn-md px-4"
alt="Mappam Situm">
🌐
</a>
Expand Down
6 changes: 3 additions & 3 deletions documentum/mul/index.html → documentum/mul-Zyyy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
title: "Plures linguae index - Auxilium Humanitarium API documentōrum"
description: Plures linguae index - Auxilium Humanitarium API documentōrum
linguam: mul-Zyyy
permalink: /mul/
categories: ['work', 'code']
tags: ['work', 'code']
permalink: /mul-Zyyy/
categories: ['index', 'linguam-mul-Zyyy']
tags: ['index', 'linguam-mul-Zyyy']
noindex: true
sitemap:
exclude: 'yes'
Expand Down
3 changes: 3 additions & 0 deletions documentum/por-Latn/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ permalink: /por-Latn/
# layout: defallo
layout: defallo-ltr

categories: ['index', 'linguam-por-Latn']
tags: ['index', 'linguam-por-Latn']

# FIXME: _[eng] Inject the next attriutes based on _data/referens.yml, like
# we would do with automatically generated API pages.
# (Emerson Rocha, 2021-05-25 04:30 UTC)
Expand Down

0 comments on commit 654b80f

Please sign in to comment.