Skip to content

Commit

Permalink
mvp-tema-i18n (#9): _data/translationem-memoriam.yml iniciado
Browse files Browse the repository at this point in the history
  • Loading branch information
fititnt committed Jun 17, 2021
1 parent b3f6f35 commit 841d4d3
Show file tree
Hide file tree
Showing 6 changed files with 508 additions and 164 deletions.
70 changes: 70 additions & 0 deletions _data/translationem-memoriam.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# @ARCHĪVUM _data/translationem-memoriam.yml
# @see _systema/programma/download-hxl-datum.sh

- uid: /mul-Zyyy/tm/XZ/hapi-miniman
xdefallo: /mul-Zyyy/tm/XZ/hapi-miniman
xdefallo_est: true
linguam: mul-Zyyy
typum: tm
gid: XZ
lid: hapi-miniman
title: "hapi-miniman.tm"
noindex: true
situs_interretialis:
referens_officinale:
- iri: https://github.com/HXL-CPLP/Auxilium-Humanitarium-API
archivum:
referens_officinale:
- iri: https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=816634241
- iri: https://proxy.hxlstandard.org/data/download/hapi-miniman_tm_hxl.csv?dest=data_edit&filter01=cut&filter-label01=Non+%23meta&cut-exclude-tags01=%23meta&cut-skip-untagged01=on&filter02=select&filter-label02=%23status%3E-1&select-query02-01=%23status%3E-1&strip-headers=on&force=on&url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4%2Fedit%3Fpli%3D1%23gid%3D816634241

- uid: /mul-Zyyy/tm/XZ/hapi-api
xdefallo: /mul-Zyyy/tm/XZ/hapi-api
xdefallo_est: true
linguam: mul-Zyyy
typum: tm
gid: XZ
lid: hapi-api
title: "hapi-api.tm"
noindex: true
situs_interretialis:
referens_officinale:
- iri: https://github.com/HXL-CPLP/Auxilium-Humanitarium-API
archivum:
referens_officinale:
- iri: https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=1680147913
- iri: https://proxy.hxlstandard.org/data/download/hapi-api_tm_hxl.csv?dest=data_edit&filter01=cut&filter-label01=Non+%23meta&cut-exclude-tags01=%23meta&cut-skip-untagged01=on&filter02=select&filter-label02=%23status%3E-1&select-query02-01=%23status%3E-1&strip-headers=on&force=on&url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4%2Fedit%3Fpli%3D1%23gid%3D1680147913

- uid: /mul-Zyyy/tm/XZ/schemam
xdefallo: /mul-Zyyy/tm/XZ/schemam
xdefallo_est: true
linguam: mul-Zyyy
typum: tm
gid: XZ
lid: schemam
title: "schemam.tm"
noindex: true
situs_interretialis:
referens_officinale:
- iri: https://github.com/HXL-CPLP/Auxilium-Humanitarium-API
archivum:
referens_officinale:
- iri: https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=1345709789
- iri: https://proxy.hxlstandard.org/data/download/schemam_tm_hxl.csv?dest=data_edit&filter01=cut&filter-label01=Non+%23meta&cut-exclude-tags01=%23meta&cut-skip-untagged01=on&filter02=select&filter-label02=%23status%3E-1&select-query02-01=%23status%3E-1&strip-headers=on&force=on&url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4%2Fedit%3Fpli%3D1%23gid%3D1345709789

- uid: /mul-Zyyy/tm/XZ/commune
xdefallo: /mul-Zyyy/tm/XZ/commune
xdefallo_est: true
linguam: mul-Zyyy
typum: tm
gid: XZ
lid: commune
title: "commune.tm"
noindex: true
situs_interretialis:
referens_officinale:
- iri: https://github.com/HXL-CPLP/Auxilium-Humanitarium-API
archivum:
referens_officinale:
- iri: https://docs.google.com/spreadsheets/d/1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4/edit#gid=355011653
- iri: https://proxy.hxlstandard.org/data/download/commune_tm_hxl.csv?dest=data_edit&filter01=cut&filter-label01=Remove+%23meta&cut-exclude-tags01=%23meta&cut-skip-untagged01=on&filter02=select&filter-label02=%23status%3E-1&select-query02-01=%23status%3E-1&strip-headers=on&force=on&url=https%3A%2F%2Fdocs.google.com%2Fspreadsheets%2Fd%2F1ih3ouvx_n8W5ntNcYBqoyZ2NRMdaA0LRg5F9mGriZm4%2Fedit%23gid%3D355011653
17 changes: 17 additions & 0 deletions _layouts/xtm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: defallo-mul-Zyyy
---
<!-- _[lat-Latn] xtm.html [lat-Latn]_ -->

{% assign h_1sx = include.initiale_html_hN %}
{% assign h_2sx = h_1sx | plus: 1 %}
{% assign h_3sx = h_2sx | plus: 1 %}

{% assign h1sx = h_1sx | prepend: 'h' %}
{% assign h2sx = h_2sx | prepend: 'h' %}
{% assign h3sx = h_3sx | prepend: 'h' %}

{% include xdefallo-linguam-notitia.html %}

{% include schemam/index-xdefallo.html xschemam=page initiale_html_hN=2 %}

1 change: 1 addition & 0 deletions _plugins/hapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ module Hapi
require_relative 'hapi/datum'
require_relative 'hapi/utilitatem'
require_relative 'hapi/hxl'
require_relative 'hapi/commune_paginam'
end
267 changes: 267 additions & 0 deletions _plugins/hapi/commune_paginam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
# @ARCHĪVUM _plugins/hapi/commune_paginam.rb
#
# 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:
# - 'Hapi'
# - https://hapi.etica.ai/
# - 'commūne'
# - https://en.wiktionary.org/wiki/communis#Latin
# frozen_string_literal: true

require 'json'

module Hapi
# _[eng] Subclass of `Jekyll::Page` with custom method definitions. [eng]_
# _[eng] Subclasse de `Jekyll::Page` com customizações nos métodos [eng]_
class HapiCommunePaginam < Jekyll::Page # rubocop:disable Metrics/ClassLength
attr_accessor :datum, :gid, :uid, :xdefallo, :xdefallo_est, :experimentum_est

# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
alternativum
content
descriptionem
experimentum_est
dir
gid
html_body_class
hreflang
linguam
nomen
opus_in_progressu
path
slug
summarius
tags
titulum
trivium
uid
url
xdefallo
xdefallo_est
].freeze
# excerpt
# name

# rubocop:disable Lint/MissingSuper

# _[eng] Initialize a new page [eng]_
# _[por] Inicializa uma nova página [por]_
#
# site - Jekyll site obiectum
# api_datum - API Datum
# debug - Debug est?
def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
# super()
@site = site # the current site instance.
@base = site.source # path to the source directory.
@dir = "#{api_datum['uid']}/"
@name = 'index.html'
# template = api_datum['jekyll-page']['template']

@xdefallo = api_datum['xdefallo']
@xdefallo_est = !!api_datum['xdefallo_est'] # rubocop:disable Style/DoubleNegation

template = if @xdefallo_est
'xtm'
else
'non-existendum-est'
end

@path = if @site.layouts[template].path.end_with? 'html'
@site.layouts[template].path.dup
else
File.join(@site.layouts[template].path, @site.layouts[template].name)
end

@datum = api_datum
@gid = api_datum['gid']
@uid = api_datum['uid']

# opus_in_progressu deprecated, Use experimentum_est
@opus_in_progressu = !!api_datum['opus_in_progressu'] # rubocop:disable Style/DoubleNegation
@experimentum_est = api_datum['experimentum_est'] ? true : false

process(name)

base_path = @site.layouts[template].path
base_path.slice! @site.layouts[template].name

# self.read_yaml, rubocop complaints about self.
read_yaml(base_path, @site.layouts[template].name)

generate_excerpt if site.config['page_excerpts']

# _[por] Não estamos usando Jekyll defaults [por]_
data.default_proc = proc do |_, key|
site.frontmatter_defaults.find(relative_path, type, key)
end

# self.data, rubocop complaints about self.
data['datum'] = api_datum

Jekyll::Hooks.trigger :pages, :post_init, self
end
# rubocop:enable Lint/MissingSuper

# Trivia
# - 'alternātīvum'
# - https://en.wiktionary.org/wiki/alternativus#Latin
def alternativum
# Utilitatem.digitum_premendum(relative_path)
resultatum = []
schemam_collectionem = Hapi::HSD.schemam_paginam?
schemam_collectionem&.each do |schemam|
# puts api.class
resultatum.append(schemam) if @xdefallo == schemam.xdefallo
end

resultatum
end

# Trivia
# - 'digitum'
# - https://en.wiktionary.org/wiki/digitus#Latin
# - 'signātūrum'
# - https://en.wiktionary.org/wiki/signaturus#Latin
def digitum_signaturum
Utilitatem.digitum_premendum(relative_path)
end

# Trivia
# - 'dēscrīptiōnem'
# - https://en.wiktionary.org/wiki/descriptio#Latin
def descriptionem
@datum['summarius']
end

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

def html_body_class
[
'paginam-typum-schemam',
"paginam-linguam-#{@datum['linguam']}"
]
end

def hreflang
return 'x-default' if @xdefallo_est

# TODO: _[eng] maybe initialize this once instead of recalculate [eng]_

site_data = Hapi::HSD.data?

Hapi::Utilitatem.linguam_to_html_lang(linguam, site_data['referens'])
end

def keys
ATTRIBUTES_FOR_LIQUID
end

def linguam
@datum['linguam']
end

def nomen
@datum['nomen']
end

# def openapi_filum
# # @datum['jekyll-page']['openapi_filum2'] || '<mark lang="la">Nulla openapi filum. Adiuva me 🥺</mark>'
# @datum['jekyll-page']['openapi_filum2']
# end

def opus_in_progressu
!!@opus_in_progressu
end

# TODO: remove obsolete parts
def summarius
unless @datum['jekyll-page'].nil?
@summarius || @datum['jekyll-page']['summarius'] || '<mark lang="la">Nulla summarius. Adiuva me 🥺</mark>'
end

@summarius || @datum['summarius']
end

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

# TODO: remove obsolete parts
def titulum
# {% _🗣️ schemam_datum_nomen 🗣️_ %}: {{ schemam.nomen }}
prefix = Hapi::HSD.l10n_simplex('schemam_datum_nomen', linguam)
# @titulum || @nomen || @title || @datum['summarius']

"#{prefix} : #{nomen}"
end

# Trivia
# - 'trivium'
# - https://en.wiktionary.org/wiki/trivium#Latin
# - 'xdefallo'
# - https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
def trivium
Hapi::Utilitatem.digitum_premendum(@xdefallo)
# @datum
end

# _[eng] Returns the object as a debug String [eng]_
# @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

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

def slug
@datum['lid']
end

# _[eng] Returns the object as a debug String [eng]_
# @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 to_s
# puts 'datum'
# puts @datum

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

attr_reader :xdefallo

# _[eng] Is this an xdefallo API? [eng]_
# _[por] Esta é uma API xdefallo? [por]_
# Trivia
# - 'trivium'
# - https://en.wiktionary.org/wiki/trivium#Latin
# - 'xdefallo'
# - https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
attr_reader :xdefallo_est
end
end

# _[por] rubocop é tão racista que obriga re-habilitar
# AsciiComments [por]_
# rubocop:enable RubocopIsRacistAndIcanProveIt/AsciiComments
Loading

0 comments on commit 841d4d3

Please sign in to comment.