Use Jekyll collections

master
rubenwardy 2018-07-15 15:28:10 +01:00
parent 712b151de6
commit 1ca3ba1e82
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
30 changed files with 66 additions and 151 deletions

View File

@ -32,10 +32,10 @@ fit my idea of quality.
## Adding a new language ## Adding a new language
* Add entry to `_data/languages.yml` * Add entry to `_data/languages.yml`
* Copy links_en, and customise it for your language
* Add your language to the if else in `_includes/header.html` * Add your language to the if else in `_includes/header.html`
* Copy en/ to your language code * Copy `_en/` to your language code
* Translate your language code folder * Translate your language code folder.
You can translate the file paths, just make sure you keep any ids the same.
## Using Jeykll ## Using Jeykll

View File

@ -4,3 +4,7 @@ sass:
gems: gems:
- jekyll-sitemap - jekyll-sitemap
collections:
en:
output: true

View File

@ -1,129 +0,0 @@
- title: Introduction
link: index.html
- hr: true
- title: Folder Structure
description: Learn how to make a mod folder, including init.lua, depends.txt and more.
num: 1
link: chapters/folders.html
- title: Lua Scripts
description: A basic introduction to Lua, including a guide on global/local scope.
num: 2
link: chapters/lua.html
- hr: true
- title: Nodes, Items, and Crafting
description: Learn how to register node, items, and craft recipes using register_node, register_item, and register_craft.
num: 3
link: chapters/nodes_items_crafting.html
- title: Creating Textures
description: An introduction to making textures in your editor of choice, an a guide on GIMP.
num: 4
link: chapters/creating_textures.html
- title: Node Drawtypes
description: Guide to all drawtypes, including node boxes/nodeboxes and mesh nodes.
num: 5
link: chapters/node_drawtypes.html
- hr: true
- title: Basic Map Operations
description: Basic operations like set_node and get_node
num: 6
link: chapters/environment.html
- title: Active Block Modifiers
description: Learn how to make ABMs to change blocks.
num: 7
link: chapters/abms.html
- title: Node Metadata
description: Using get_meta to obtain a NodeMetaRef
num: 8
link: chapters/node_metadata.html
- title: Lua Voxel Manipulators
description: Learn how to use LVMs to speed up map operations.
num: 9
link: chapters/lvm.html
- hr: true
- title: Privileges
description: Registering privs
num: 10
link: chapters/privileges.html
- title: Chat and Commands
description: Register a chatcommand
num: 11
link: chapters/chat.html
- title: Chat Command Builder
description: Use ChatCmdBuilder to make a complex chat command
num: 12
link: chapters/chat_complex.html
- title: Player Physics
num: 13
link: chapters/player_physics.html
- title: Formspecs
num: 14
link: chapters/formspecs.html
- title: HUD
num: 15
link: chapters/hud.html
- title: "SFINV: Inventory Formspec"
num: 16
link: chapters/sfinv.html
- hr: true
- title: ItemStacks
num: 17
link: chapters/itemstacks.html
- title: Inventories
num: 18
link: chapters/inventories.html
- hr: true
- title: Common Mistakes
num: 19
link: chapters/common_mistakes.html
- title: Automatic Error Checking
description: Use LuaCheck as a linter to find errors
num: 20
link: chapters/luacheck.html
- title: Intro to Clean Architectures
description: Separate logic from data and API calls using the MVC pattern - Model View Controller.
num: 21
link: chapters/mvc.html
- title: Automatic Unit Testing
description: Write tests for your mods using Busted.
num: 22
link: chapters/unit_testing.html
- hr: true
- title: Releasing a Mod
num: 23
link: chapters/releasing.html
- title: More Resources
num: 24
link: chapters/readmore.html
- hr: true

View File

@ -2,6 +2,8 @@
title: Folder Structure title: Folder Structure
layout: default layout: default
root: ../../ root: ../../
idx: 1.1
description: Learn how to make a mod folder, including init.lua, depends.txt and more.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Lua Scripts title: Lua Scripts
layout: default layout: default
root: ../../ root: ../../
idx: 1.2
description: A basic introduction to Lua, including a guide on global/local scope.
--- ---
## Introduction ## Introduction

View File

@ -4,6 +4,7 @@ layout: default
homepage: true homepage: true
no_header: true no_header: true
root: ../ root: ../
idx: 0.1
--- ---
<div id="header"> <div id="header">

View File

@ -2,6 +2,7 @@
title: Inventories title: Inventories
layout: default layout: default
root: ../../ root: ../../
idx: 5.2
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: ItemStacks title: ItemStacks
layout: default layout: default
root: ../../ root: ../../
idx: 5.1
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Creating Textures title: Creating Textures
layout: default layout: default
root: ../../ root: ../../
idx: 2.2
description: An introduction to making textures in your editor of choice, an a guide on GIMP.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Node Drawtypes title: Node Drawtypes
layout: default layout: default
root: ../../ root: ../../
idx: 2.3
description: Guide to all drawtypes, including node boxes/nodeboxes and mesh nodes.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Nodes, Items, and Crafting title: Nodes, Items, and Crafting
layout: default layout: default
root: ../../ root: ../../
idx: 2.1
description: Learn how to register node, items, and craft recipes using register_node, register_item, and register_craft.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Active Block Modifiers title: Active Block Modifiers
layout: default layout: default
root: ../../ root: ../../
idx: 3.2
description: Learn how to make ABMs to change blocks.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Basic Map Operations title: Basic Map Operations
layout: default layout: default
root: ../../ root: ../../
idx: 3.1
description: Basic operations like set_node and get_node
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Lua Voxel Manipulators title: Lua Voxel Manipulators
layout: default layout: default
root: ../../ root: ../../
idx: 3.4
description: Learn how to use LVMs to speed up map operations.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Node Metadata title: Node Metadata
layout: default layout: default
root: ../../ root: ../../
idx: 3.3
description: Using get_meta to obtain a NodeMetaRef.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Chat and Commands title: Chat and Commands
layout: default layout: default
root: ../../ root: ../../
idx: 4.2
description: Registering a chatcommand and handling chat messages with register_on_chat_message
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Chat Command Builder title: Chat Command Builder
layout: default layout: default
root: ../../ root: ../../
idx: 4.3
description: Use ChatCmdBuilder to make a complex chat command
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Formspecs title: Formspecs
layout: default layout: default
root: ../../ root: ../../
idx: 4.5
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: HUD title: HUD
layout: default layout: default
root: ../../ root: ../../
idx: 4.6
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Player Physics title: Player Physics
layout: default layout: default
root: ../../ root: ../../
idx: 4.4
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Privileges title: Privileges
layout: default layout: default
root: ../../ root: ../../
idx: 4.1
description: Registering privs.
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: "SFINV: Inventory Formspec" title: "SFINV: Inventory Formspec"
layout: default layout: default
root: ../../ root: ../../
idx: 4.7
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Common Mistakes title: Common Mistakes
layout: default layout: default
root: ../../ root: ../../
idx: 6.1
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,8 @@
title: Automatic Error Checking title: Automatic Error Checking
layout: default layout: default
root: ../../ root: ../../
idx: 6.2
description: Use LuaCheck to find errors
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Intro to Clean Architectures title: Intro to Clean Architectures
layout: default layout: default
root: ../../ root: ../../
idx: 6.3
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Read More title: Read More
layout: default layout: default
root: ../../ root: ../../
idx: 6.6
--- ---
## List of Resources ## List of Resources

View File

@ -2,6 +2,7 @@
title: Releasing a Mod title: Releasing a Mod
layout: default layout: default
root: ../../ root: ../../
idx: 6.5
--- ---
## Introduction ## Introduction

View File

@ -2,6 +2,7 @@
title: Automatic Unit Testing title: Automatic Unit Testing
layout: default layout: default
root: ../../ root: ../../
idx: 6.4
--- ---
## Introduction ## Introduction

View File

@ -14,25 +14,26 @@
{% assign language = pathsplit[1] %} {% assign language = pathsplit[1] %}
{% if language == "en" %} {% if language == "en" %}
{% assign links = site.data.links_en %} {% assign links = site.en | sort: "idx" %}
{% else %} {% else %}
{% assign language = "en" %} {% assign language = "en" %}
{% assign links = site.data.links_en %} {% assign links = site.en | sort: "idx" %}
{% endif %} {% endif %}
{% assign num = 0 %}
<div id="container"> <div id="container">
<nav> <nav>
{% for link in links %} {% for link in links %}
{% if link.hr %} {% assign idsplit = link.id | split: '/' %}
{% assign hr = true %} {% assign section = idsplit[2] %}
{% else %} <li><a href="{{ link.url }}"
<li><a href="{{ page.root }}{{ language }}/{{ link.link }}" class="{% if page.title == link.title %}selected{% endif %}{% if section != last_section and section != 'index' %} hr {% endif %}">
class="{% if page.title == link.title %}selected{% endif %}{% if hr %} hr {% endif %}"> {% if section != "index" %}{{ num }} - {% endif %}
{% if link.num %} {{ link.num }} - {% endif %}
{{ link.title }}</a></li> {{ link.title }}</a></li>
{% assign hr = false %} {% assign last_section = section %}
{% endif %} {% assign num = num | plus:1 %}
{% endfor %} {% endfor %}
<li><a href="{{ page.root }}lua_api.html" class="hr">Lua Modding API Reference</a></li> <li><a href="{{ page.root }}lua_api.html" class="hr">Lua Modding API Reference</a></li>

View File

@ -1,10 +1,12 @@
--- ---
--- ---
{% assign pages = site.en | sort: "idx" %}
[ [
{% for link in site.data.links_en %} {% for link in pages %}
{% if link.hr != true %}
{ {
"idx": {{ link.idx }},
"title": "{{ link.title }}", "title": "{{ link.title }}",
"loc": "https://rubenwardy.com/minetest_modding_book/en/{{ link.link }}", "loc": "https://rubenwardy.com/minetest_modding_book/en/{{ link.link }}",
{% if link.description %} {% if link.description %}
@ -13,7 +15,6 @@
"priority": 1 "priority": 1
{% if link.num %}, "chapter_number": {{ link.num }}{% endif %} {% if link.num %}, "chapter_number": {{ link.num }}{% endif %}
}, },
{% endif %}
{% endfor %} {% endfor %}
{ {