Skip to content

Commit

Permalink
mvp-schemam-paginam (#14): adicionadas ao sitemap (#10); rascunho da …
Browse files Browse the repository at this point in the history
…pagina de exibição de um esquema de dados (que pode conter varios arquivos)
  • Loading branch information
fititnt committed Jun 15, 2021
1 parent 308cb2f commit 9178c72
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 34 deletions.
4 changes: 4 additions & 0 deletions _layouts/schema-json.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
layout: none

# TODO: _[por-Latn] Remover schema-json.html assim que novo modo de gerenciar
# esquemas de dados estiver implementado
# [por-Latn]_
---
{% include schema/iso639-3/iso639-3.json %}
31 changes: 31 additions & 0 deletions _layouts/schemam.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
layout: defallo-ltr
---
<h1>TODO: finalizar schemam</h1>


<pre>
{{- page | bellum_json -}}
</pre>

<div class="px-4 py-5 my-5 text-center">
<h1 class="display-5 fw-bold">
{% _🗣️ Hapi_ad_agendum_MMXXI_titulum 🗣️_ %}
</h1>
<div class="col-lg-6 mx-auto">
<p class="lead mb-4">
{% _🗣️ Hapi_ad_agendum_MMXXI_commentarium 🗣️_ %}
</p>
</div>
</div>


<section>
<h2>{% _🗣️ licentiam_nomen 🗣️_ %}</h2>
<a href="https://unlicense.org/">
<img src="https://i.creativecommons.org/p/zero/1.0/88x31.png"
alt="{% _🗣️ dominium_publicum_nomen 🗣️_ %}">
</a>
<br>
{% de_markdown %}{% _🗣️ Hapi_licentiam_Hapi_descriptionem 🗣️_ %}{% endde_markdown %}
</section>
74 changes: 40 additions & 34 deletions _plugins/jekyll_hapi_schemam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,28 @@ def initialize(site, archivum, schemam) # rubocop:disable Metrics/MethodLength,L
# _[eng] Subclass of `Jekyll::Page` with custom method definitions. [eng]_
# _[eng] Subclasse de `Jekyll::Page` com customizações nos métodos [eng]_
class SchemamPaginam < Jekyll::Page
attr_accessor :datum, :gid, :uid, :xdefallo, :xdefallo_est, :alternativum
attr_accessor :datum, :gid, :uid, :xdefallo, :xdefallo_est

# Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w[
alternativum
content
dir
gid
uid
titulum
html_body_class
tags
hreflang
linguam
namen
summarius
opus_in_progressu
xdefallo
xdefallo_est
content
dir
path
summarius
tags
titulum
trivium
uid
url
xdefallo
xdefallo_est
].freeze
# excerpt
# name
Expand All @@ -150,7 +152,15 @@ def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/Method
@dir = "#{api_datum['uid']}/"
@name = 'index.html'
# template = api_datum['jekyll-page']['template']
template = 'xschemam'

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

template = if @xdefallo_est
'xschemam'
else
'schemam'
end

@path = if @site.layouts[template].path.end_with? 'html'
@site.layouts[template].path.dup
Expand All @@ -161,22 +171,9 @@ def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/Method
@datum = api_datum
@gid = api_datum['gid']
@uid = api_datum['uid']
@xdefallo = api_datum['xdefallo']
@xdefallo_est = !!api_datum['xdefallo_est']
@opus_in_progressu = !!api_datum['opus_in_progressu']
# puts api_datum['opus_in_progressu']
# puts api_datum
# @trivum = 'teste'

# Hapi::HapiApiGenerator.quod_datum_api_liquify(site, '/data/api.json')
# HapiApiGenerator.quod_datum_api_liquify(site, '/data/api.json')

# site.pages.each do |paginam|
# puts JSON.parse(paginam.content) if paginam.url == '/data/api.json'
# end
@opus_in_progressu = !!api_datum['opus_in_progressu'] # rubocop:disable Style/DoubleNegation

process(name)
# read_yaml(PathManager.join(base, dir), name)

base_path = @site.layouts[template].path
base_path.slice! @site.layouts[template].name
Expand All @@ -193,7 +190,6 @@ def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/Method

# self.data, rubocop complaints about self.
data['datum'] = api_datum
# data.merge!(api_datum['jekyll-page'])

Jekyll::Hooks.trigger :pages, :post_init, self
end
Expand All @@ -205,10 +201,10 @@ def initialize(site, api_datum) # rubocop:disable Metrics/AbcSize,Metrics/Method
def alternativum
# Utilitatem.digitum_premendum(relative_path)
resultatum = []
apis = Hapi::HSD.api_paginam?
apis&.each do |api|
schemam_collectionem = Hapi::HSD.schemam_paginam?
schemam_collectionem&.each do |schemam|
# puts api.class
resultatum.append(api) if @xdefallo == api.xdefallo
resultatum.append(schemam) if @xdefallo == schemam.xdefallo
end

resultatum
Expand Down Expand Up @@ -237,6 +233,16 @@ def html_body_class
]
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
Expand All @@ -245,10 +251,10 @@ 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']
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
Expand All @@ -272,7 +278,7 @@ def tags

# TODO: remove obsolete parts
def titulum
@titulum || @namen || @title
@titulum || @namen || @title || @datum['summarius']
end

def namen
Expand All @@ -285,7 +291,7 @@ def namen
# - 'xdefallo'
# - https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages
def trivium
Hapi::Utilitatem.digitum_premendum(xdefallo)
Hapi::Utilitatem.digitum_premendum(@xdefallo)
# @datum
end

Expand Down
2 changes: 2 additions & 0 deletions documentum/mul-Zyyy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ speciale_html: >

---

{{ site.data['hapi'] | inspect }}

{%- include index-corporeum-mul-Zyyy.html -%}
40 changes: 40 additions & 0 deletions documentum/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,44 @@ sitemap:
{% endif %}
{%- endfor %}

<!--
typum: schemam
-->
{% for schemam in site.pages -%}
{%- if schemam.tags contains 'schemam' %}
<url>
<loc>{{ site.url }}{{ schemam.url }}</loc>
{%- if schemam.sitemap.lastmod -%}
<lastmod>{{ schemam.sitemap.lastmod | date: "%Y-%m-%d" }}</lastmod>
{% elsif schemam.date %}
<lastmod>{{ schemam.date | date_to_xmlschema }}</lastmod>
{% else %}
<lastmod>{{ "now" | date_to_xmlschema }}</lastmod>
{%- endif -%}
{%- if schemam.sitemap.changefreq -%}
<changefreq>{{ schemam.sitemap.changefreq }}</changefreq>
{% else %}
<changefreq>weekly</changefreq>
{% endif %}
{%- if schemam.sitemap.priority -%}
<priority>{{ schemam.sitemap.priority }}</priority>
{%- elsif schemam.hreflang == 'x-default' -%}
<priority>0.1</priority>
{%- else -%}
<priority>0.3</priority>
{% endif %}
{%- if schemam.trivium %}
{%- for paginam in site.pages -%}
{% capture schemam_trivium_tag %}schemam-trivium-{{ schemam.trivium }}{% endcapture %}
{%- if paginam.tags contains schemam_trivium_tag %}
<xhtml:link
rel="alternate" hreflang="{{ paginam.hreflang }}"
href="{{ site.url | append: paginam.url }}" />
{%- endif %}
{%- endfor %}
{%- endif %}
</url>
{% endif %}
{%- endfor %}

</urlset>

0 comments on commit 9178c72

Please sign in to comment.