Skip to content

Commit

Permalink
mvp-schemam-paginam (#14): reorganização de arquivos
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Jun 15, 2021
1 parent c508a59 commit 308cb2f
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 108 deletions.
52 changes: 48 additions & 4 deletions _plugins/hapi/hic_sunt_dracones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def initiale_after_reset(site)
def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
# api = {}
api = []
schemam = []
categoriam = {}
pittacium = {}
# api
Expand All @@ -98,6 +99,8 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,

# [page.digitum_signaturum] = page
api.append(page)
elsif page.instance_of?(Hapi::SchemamPaginam)
schemam.append(page)
elsif page.instance_of?(Jekyll::Page)
# puts 'Generic pages do not have any special feature'
end
Expand All @@ -118,6 +121,7 @@ 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)

jekyll_data = HSD.data?
Expand All @@ -126,11 +130,12 @@ def initiale_pre_render # rubocop:disable Metrics/AbcSize, Metrics/MethodLength,
{
'api' => api,
# 'api_xdefallo' => api_xdefallo,
'schemam' => schemam,
'xapi' => api_gid_xdefallo,
'xschemam' => xschemam,
# 'xschemam' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'globum' => globum,
'categoriam' => categoriam,
'scheman' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'xscheman' => { 'TODO' => '_[eng] To be implemented also here [eng]_' },
'pittacium' => pittacium
}
)
Expand Down Expand Up @@ -209,7 +214,7 @@ def data!(data)

# _[mul-Zyyy] _data/schemam.yml => _data/expandendum/schemam.json [mul-Zyyy]_
# _[lat-Latn] Expandendum schēmam archīvum [lat-Latn]_
def expandendum_schemam_archivum(schemam_collectionem, referens_schemam) # rubocop:disable Metrics/MethodLength
def expandendum_schemam_archivum(schemam_collectionem, referens_schemam)
resultatum = []
schemam_collectionem.each do |item|
if item['farmulam'].nil?
Expand Down Expand Up @@ -266,8 +271,47 @@ def schemam?
[]
end

def schemam_paginam?
Jekyll.sites.last.data['hapi']['schemam'] || []
end

def schemam_xdefallo?(schemam_collectionem) # rubocop:disable Metrics/MethodLength
# apis = schemam_collectionem
referens_gid = referens_gid?

# puts 'oi oi '
# puts referens_gid.empty?
# puts apis.empty?
return [] if referens_gid.empty? || schemam_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_schemam'] = []
schemam_collectionem.each do |schema|
res['collectionem_schemam'].append(schema) if schema.xdefallo_est && schema.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 xschemam?
# NOTE: _[eng] the 'schemam_xdefallo?' is not using this method,
# neither 'globum?'
# [eng]_

[]
end

Expand Down Expand Up @@ -309,7 +353,7 @@ 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
def globum?(api_collectionem = nil, _schemam_collectionem = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
apis = api_collectionem || api?
referens_gid = referens_gid?

Expand Down
14 changes: 4 additions & 10 deletions _plugins/jekyll_hapi_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ 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, :gid, :uid, :xdefallo, :xdefallo_est, :alternativum,
:opus_in_progressu
attr_accessor :datum, :gid, :uid, :xdefallo, :xdefallo_est,
:opus_in_progressu

# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
Expand Down Expand Up @@ -194,6 +194,7 @@ def opus_in_progressu
def summarius
@summarius || @datum['jekyll-page']['summarius'] || '<mark lang="la">Nulla summarius. Adiuva me 🥺</mark>'
end

# TODO: remove obsolete parts
def titulum
@titulum || @namen || @title
Expand Down Expand Up @@ -245,14 +246,7 @@ def to_s
# - https://en.wiktionary.org/wiki/trivium#Latin
# - 'xdefallo'
# - https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
def xdefallo_est
# @datum['linguam'] == 'mul' || @datum['linguam'] == 'mul-Zyyy'
# puts "#{@uid} == #{@xdefallo}"
# puts @uid == @xdefallo
# puts ''
# @uid == @xdefallo
@xdefallo_est
end
attr_reader :xdefallo_est
end
end

Expand Down
18 changes: 17 additions & 1 deletion _plugins/jekyll_hapi_schemam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class SchemamPaginam < Jekyll::Page
uid
titulum
html_body_class
tags
linguam
namen
summarius
opus_in_progressu
Expand Down Expand Up @@ -239,6 +241,10 @@ def keys
ATTRIBUTES_FOR_LIQUID
end

def linguam
@datum['linguam']
end

def openapi_filum
# @datum['jekyll-page']['openapi_filum2'] || '<mark lang="la">Nulla openapi filum. Adiuva me 🥺</mark>'
@datum['jekyll-page']['openapi_filum2']
Expand All @@ -255,6 +261,15 @@ def summarius
end
end

def tags
# @see Utilitatem.tags_de_api
[
'schemam',
"schemam-linguam-#{linguam}",
"schemam-trivium-#{trivium}"
]
end

# TODO: remove obsolete parts
def titulum
@titulum || @namen || @title
Expand All @@ -270,7 +285,8 @@ def namen
# - 'xdefallo'
# - https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
def trivium
@datum
Hapi::Utilitatem.digitum_premendum(xdefallo)
# @datum
end

# _[eng] Returns the object as a debug String [eng]_
Expand Down
4 changes: 4 additions & 0 deletions schema/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# schema
> \_[por] Obsoleto. O diretório `schema/` está sendo migrado para `schemam/`. [por]\_
> \_[eng] Deprecated. The directory `schema/` will be migrated to `schemam/`. [eng]\_
3 changes: 0 additions & 3 deletions schema/UN/cod/adm0.json

This file was deleted.

7 changes: 0 additions & 7 deletions schema/graphql.schema.mjs

This file was deleted.

36 changes: 0 additions & 36 deletions schema/testum/testum.graphql

This file was deleted.

47 changes: 0 additions & 47 deletions schema/testum/testum.schema.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 308cb2f

Please sign in to comment.