From bf064390b36c7ad3e0db447aa88debed09c09c32 Mon Sep 17 00:00:00 2001 From: octospacc Date: Thu, 19 Jun 2025 23:29:50 +0200 Subject: [PATCH] Support series/collections fully & add lots of tomes --- _includes/tome-cover | 9 ++++ _includes/tome-field | 20 ++++++++ _includes/tome-id | 2 +- _includes/tome-info.html | 22 +++++++++ _includes/tome-lang | 1 + _includes/tome-parent | 20 ++++++++ _includes/tome.json | 19 +++++--- _layouts/index.html | 48 ++++++++++++++++--- _layouts/tome.html | 38 ++++++--------- _tomes/en/toradora/1.md | 15 +++--- _tomes/en/toradora/10.md | 15 ++++++ _tomes/en/toradora/2.md | 13 +++++ _tomes/en/toradora/3.md | 13 +++++ _tomes/en/toradora/4.md | 15 ++++++ _tomes/en/toradora/5.md | 13 +++++ _tomes/en/toradora/6.md | 13 +++++ _tomes/en/toradora/7.md | 13 +++++ _tomes/en/toradora/8.md | 13 +++++ _tomes/en/toradora/9.md | 13 +++++ _tomes/en/toradora/index.md | 11 +++++ _tomes/it/i-manga-delle-scienze/1-fisica.md | 2 +- .../10-algebra-lineare.md | 11 +++++ ...regressione-analisi-statistica-dei-dati.md | 11 +++++ .../it/i-manga-delle-scienze/12-anatomia.md | 11 +++++ .../2-analisi-matematica.md | 2 +- .../it/i-manga-delle-scienze/3-relativita.md | 2 +- .../4-biologia-dna-e-genetica.md | 2 +- .../it/i-manga-delle-scienze/5-statistica.md | 11 +++++ .../it/i-manga-delle-scienze/6-astronomia.md | 11 +++++ _tomes/it/i-manga-delle-scienze/7-database.md | 11 +++++ .../8-elettromagnetismo.md | 12 +++++ .../it/i-manga-delle-scienze/9-biochimica.md | 11 +++++ _tomes/it/i-manga-delle-scienze/index.md | 8 ++++ .../it/il-lato-oscuro-dei-social-network.md | 1 + _tomes/it/le-mie-palle/1.md | 8 ++++ _tomes/it/le-mie-palle/2.md | 8 ++++ _tomes/it/le-mie-palle/3.md | 8 ++++ _tomes/it/le-mie-palle/4.md | 8 ++++ _tomes/it/le-mie-palle/5.md | 8 ++++ _tomes/it/le-mie-palle/6.md | 8 ++++ _tomes/it/le-mie-palle/index.md | 11 +++++ _tomes/it/welcome-to-the-nhk.md | 1 + assets/scss/_layout.scss | 24 ++++++---- create-tome.js | 37 ++++++++++++++ reader/index.html | 2 +- tomes.json | 12 +++-- 46 files changed, 507 insertions(+), 60 deletions(-) create mode 100644 _includes/tome-cover create mode 100644 _includes/tome-field create mode 100644 _includes/tome-info.html create mode 100644 _includes/tome-lang create mode 100644 _includes/tome-parent create mode 100644 _tomes/en/toradora/10.md create mode 100644 _tomes/en/toradora/2.md create mode 100644 _tomes/en/toradora/3.md create mode 100644 _tomes/en/toradora/4.md create mode 100644 _tomes/en/toradora/5.md create mode 100644 _tomes/en/toradora/6.md create mode 100644 _tomes/en/toradora/7.md create mode 100644 _tomes/en/toradora/8.md create mode 100644 _tomes/en/toradora/9.md create mode 100644 _tomes/en/toradora/index.md create mode 100644 _tomes/it/i-manga-delle-scienze/10-algebra-lineare.md create mode 100644 _tomes/it/i-manga-delle-scienze/11-regressione-analisi-statistica-dei-dati.md create mode 100644 _tomes/it/i-manga-delle-scienze/12-anatomia.md create mode 100644 _tomes/it/i-manga-delle-scienze/5-statistica.md create mode 100644 _tomes/it/i-manga-delle-scienze/6-astronomia.md create mode 100644 _tomes/it/i-manga-delle-scienze/7-database.md create mode 100644 _tomes/it/i-manga-delle-scienze/8-elettromagnetismo.md create mode 100644 _tomes/it/i-manga-delle-scienze/9-biochimica.md create mode 100644 _tomes/it/i-manga-delle-scienze/index.md create mode 100644 _tomes/it/le-mie-palle/1.md create mode 100644 _tomes/it/le-mie-palle/2.md create mode 100644 _tomes/it/le-mie-palle/3.md create mode 100644 _tomes/it/le-mie-palle/4.md create mode 100644 _tomes/it/le-mie-palle/5.md create mode 100644 _tomes/it/le-mie-palle/6.md create mode 100644 _tomes/it/le-mie-palle/index.md create mode 100644 create-tome.js diff --git a/_includes/tome-cover b/_includes/tome-cover new file mode 100644 index 0000000..b64d804 --- /dev/null +++ b/_includes/tome-cover @@ -0,0 +1,9 @@ +{%- capture prefix -%}{{ site.extra.store }}/tomes/{%- endcapture -%} +{%- if include.tome -%} +{%- assign tome = include.tome -%} +{%- capture id %}{%- include tome-id tome=tome -%}{%- endcapture -%} +{%- capture folder %}{%- include tome-field tome=tome field='folder' -%}{%- endcapture -%} +{{ site.extra.store }}/tomes/{% if folder != '' %}{{ id | split: '/' | first }}{% else %}{{ id }}{% endif %}/{{ tome.cover }} +{%- else -%} +{{ prefix }} +{%- endif -%} \ No newline at end of file diff --git a/_includes/tome-field b/_includes/tome-field new file mode 100644 index 0000000..7d91d01 --- /dev/null +++ b/_includes/tome-field @@ -0,0 +1,20 @@ +{%- assign key = include.field -%} +{%- assign tome = include.tome -%} + +{%- assign this-field = tome[key] | strip -%} + +{%- capture parent-field -%} + {%- include tome-parent tome=tome key=key -%} +{%- endcapture -%} + +{%- if parent-field == '' -%} + {{- this-field -}} +{%- elsif key == 'title' -%} + {{- parent-field }} — {{ this-field -}} +{%- else -%} + {%- if this-field != '' -%} + {{- this-field -}} + {%- else -%} + {{- parent-field -}} + {%- endif -%} +{%- endif -%} \ No newline at end of file diff --git a/_includes/tome-id b/_includes/tome-id index 67a1db7..fc646d2 100644 --- a/_includes/tome-id +++ b/_includes/tome-id @@ -1 +1 @@ -{{ include.tome.id | split: '/' | slice: 2,3 | join: '/' }} \ No newline at end of file +{{- include.tome.path | split: '.' | slice: -2 | join: '.' | split: '/' | slice: 2,3 | join: '/' -}} \ No newline at end of file diff --git a/_includes/tome-info.html b/_includes/tome-info.html new file mode 100644 index 0000000..ba918fa --- /dev/null +++ b/_includes/tome-info.html @@ -0,0 +1,22 @@ +{% capture authors %}{% include tome-field tome=page field='authors' %}{% endcapture %} +{% if authors != '' %} +Authors +

{{ authors }}

+{% endif %} + +{% capture publisher %}{% include tome-field tome=page field='publisher' %}{% endcapture %} +{% if publisher != '' %} +{% capture publisher_query %}inpublisher:"{{ publisher }}"{% endcapture %} +Publisher +{{ publisher }} +{% endif %} + +{% if page.year or page.date %} +Date +

{{ page.year }} / {{ page.date | split: ' ' | first }}

+{% endif %} + +{% if page.webpage %} +Webpage +{{ page.webpage }} +{% endif %} \ No newline at end of file diff --git a/_includes/tome-lang b/_includes/tome-lang new file mode 100644 index 0000000..3c6cfec --- /dev/null +++ b/_includes/tome-lang @@ -0,0 +1 @@ +{{ include.tome.id | split: '/' | slice: 1 }} \ No newline at end of file diff --git a/_includes/tome-parent b/_includes/tome-parent new file mode 100644 index 0000000..da61035 --- /dev/null +++ b/_includes/tome-parent @@ -0,0 +1,20 @@ +{%- capture tome-id -%} + {%- include tome-id tome=include.tome -%} +{%- endcapture -%} +{%- assign id-parts = tome-id | split: '/' -%} +{%- assign key = include.key | strip -%} +{%- if id-parts.size == 2 and id-parts[1] != 'index' -%} + {%- if key != '' -%} + {%- for tome in site.tomes -%} + {%- capture parent-id -%} + {%- include tome-id tome=tome -%} + {%- endcapture -%} + {%- assign parents-parts = parent-id | strip | tome-id | split: '/' -%} + {%- if parents-parts[1] == 'index' and parents-parts[0] == id-parts[0] -%} + {{- tome[include.key] -}} + {%- endif -%} + {%- endfor -%} + {%- else -%} + {{- id-parts[0] -}} + {%- endif -%} +{%- endif -%} \ No newline at end of file diff --git a/_includes/tome.json b/_includes/tome.json index 2363b12..4f047a4 100644 --- a/_includes/tome.json +++ b/_includes/tome.json @@ -1,8 +1,15 @@ -{% assign tome = include.tome %} -{% capture tome-id %}{% include tome-id tome=tome %}{% endcapture %} +{%- assign tome = include.tome -%} +{%- capture tome-id %}{% include tome-id tome=tome %}{% endcapture -%} +{%- capture tome-lang %}{% include tome-lang tome=tome %}{% endcapture -%} +{%- capture tome-title %}{% include tome-field tome=tome field='title' %}{% endcapture -%} +{%- capture tome-folder %}{% include tome-field tome=tome field='folder' %}{% endcapture -%} { - "slug": {{ tome-id | jsonify }}, - "folder": {{ tome.folder | jsonify }}, + {%- if include.full == true %} + "title": {{ tome-title | jsonify }}, + "folder": {{ tome-folder | jsonify }}, "file": {{ tome.file | jsonify }}, - "chapters": {{ tome.chapters | jsonify }} -} + "chapters": {{ tome.chapters | jsonify }}, + {%- endif %} + "locale": {{ tome-lang | jsonify }}, + "slug": {{ tome-id | jsonify }} +} \ No newline at end of file diff --git a/_layouts/index.html b/_layouts/index.html index 493154f..b68c276 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -9,27 +9,61 @@ {% include head.html %} + {%- capture this-id -%} + {%- include tome-id tome=page -%} + {%- endcapture -%} + {%- assign this-id = this-id | split: '/' | first | strip -%} {% include header.html %}
+ {% if this-id == '' %}

About site

-

{{ site.description }}

+

{{ site.description }}

+ {% endif %} + + {% assign content = page.content | strip %} + {% if this-id != '' %} + Collection +

{{ page.title }}

+

{{ page.subtitle }}

+ + {% if content != '' %} +

About collection

+

{{ page.content }}

+ {% endif %} + + {% include tome-info.html %} + {% endif %}

Available tomes

{% include footer.html %} - - + + \ No newline at end of file diff --git a/_layouts/tome.html b/_layouts/tome.html index 74db721..cfb99fa 100644 --- a/_layouts/tome.html +++ b/_layouts/tome.html @@ -1,15 +1,17 @@ - + - {% capture id %}{% include tome-id tome=page %}{% endcapture %} - {% capture cover %}{{ site.extra.store }}/tomes/{{ id }}/{{ page.cover }}{% endcapture %} - {{ page.title }} | {{ site.name }} + {%- capture id %}{% include tome-id tome=page %}{%- endcapture -%} + {%- capture title %}{% include tome-field tome=page field='title' %}{%- endcapture -%} + {%- capture folder %}{% include tome-field tome=page field='folder' %}{%- endcapture -%} + {%- capture cover %}{% include tome-cover tome=page %}{%- endcapture -%} + {{ title }} | {{ site.name }} {% include head.html %} - {% capture tome_json %}{% include tome.json tome=page %}{% endcapture %} + {% capture tome_json %}{% include tome.json tome=page full=true %}{% endcapture %} {% capture embed %}{ "page": {{ tome_json }}, "extra": {{ site.extra | jsonify }} @@ -22,25 +24,20 @@
- Title -

{{ page.title }}

+ Tome +

{{ title }}

{{ page.subtitle }}

Cover Cover + {% assign content = page.content | strip %} + {% if content != '' %} About {{ page.content }} - - {% if page.authors %} - Authors -

{{ page.authors }}

{% endif %} - {% if page.year or page.date %} - Date -

{{ page.year }} / {{ page.date | split: ' ' | first }}

- {% endif %} + {% include tome-info.html %} {% if page.isbn %} ISBN @@ -49,12 +46,7 @@ {% if page.gbooks %} Google Books -
{{ page.gbooks }} - {% endif %} - - {% if page.webpage %} - Webpage - {{ page.webpage }} + {{ page.gbooks }} {% endif %}