diff options
| -rw-r--r-- | _config.yml | 2 | ||||
| -rw-r--r-- | _i18n/ca.yml | 5 | ||||
| -rw-r--r-- | _i18n/ca/_posts/2018-02-17-llegint-capital.html | 68 | ||||
| -rw-r--r-- | _i18n/en.yml | 5 | ||||
| -rw-r--r-- | _layouts/default.html | 26 | ||||
| -rw-r--r-- | _layouts/post.html | 3 | ||||
| -rw-r--r-- | blog/index.html | 4 | ||||
| -rw-r--r-- | feed.en.xml | 2 | ||||
| -rw-r--r-- | feed.xml | 2 | ||||
| -rw-r--r-- | org/ca/_posts/2018-02-17-llegint-capital.org | 60 | ||||
| -rwxr-xr-x | script/new.sh | 67 | ||||
| -rw-r--r-- | templates/post.org | 17 |
12 files changed, 114 insertions, 147 deletions
diff --git a/_config.yml b/_config.yml index c77b9b1..3c3583b 100644 --- a/_config.yml +++ b/_config.yml @@ -5,7 +5,7 @@ email: mikisabate@gmail.com twitter_username: miquelssola description: El meu espai personal en un oceà immens. -exclude: [LICENSE, README.org, yarn.lock, Gemfile, Gemfile.lock, config, node_modules, vendor] +exclude: [LICENSE, README.org, yarn.lock, Gemfile, Gemfile.lock, config, node_modules, vendor, templates] timezone: "Europe/Berlin" markdown: kramdown diff --git a/_i18n/ca.yml b/_i18n/ca.yml index 6298312..74a1fed 100644 --- a/_i18n/ca.yml +++ b/_i18n/ca.yml @@ -21,7 +21,7 @@ blog: posted_on: "Escrit" read: "Llegir" more: "més" - no_english_post: "Aquesta entrada no està disponible en anglès" + no_english_post: "This entry is not available in english" no_catalan_post: "Aquesta entrada no està disponible en català" intro: >- Aquesta és la pàgina que mostra les entrades en català del meu blog. Totes @@ -33,6 +33,3 @@ blog: més. Aquesta entrada està sota la llicència rss: >- Pots subscriure't al - -posts: - first: "Llegint el Capital" diff --git a/_i18n/ca/_posts/2018-02-17-llegint-capital.html b/_i18n/ca/_posts/2018-02-17-llegint-capital.html deleted file mode 100644 index d65c38e..0000000 --- a/_i18n/ca/_posts/2018-02-17-llegint-capital.html +++ /dev/null @@ -1,68 +0,0 @@ ---- -layout: post -title: posts.first -subtitle: Una mirada o quelcom similar -lang: ca -english_available: false ---- -<p> -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean imperdiet -ullamcorper massa at egestas. Suspendisse eget purus sodales, suscipit urna ac, -luctus justo. Duis tristique vehicula congue. Proin dui ante, gravida a laoreet -at, porta tristique quam. Nunc vitae enim a ex molestie eleifend et in -nulla. Sed congue odio eget augue condimentum, vitae sollicitudin sem -eleifend. Proin iaculis porta odio, nec molestie eros convallis suscipit. -</p> - -<p> -Nunc ultrices nisi ipsum, nec blandit lorem pellentesque vitae. Suspendisse -turpis purus, tincidunt nec diam at, dictum imperdiet turpis. Vivamus semper -dapibus turpis, quis bibendum orci. Etiam ac libero sit amet ante mattis -tincidunt ut eget ante. Morbi dictum eget turpis quis consequat. Nullam ut sem -et metus luctus condimentum. Nulla augue urna, tempor eu volutpat eu, finibus -eget metus. Aenean bibendum lacus dolor, ac sagittis lectus consectetur -quis. Vivamus in posuere tortor. Nam et vehicula leo. Mauris at libero eu nibh -feugiat efficitur a eget purus. Vestibulum sem nulla, molestie non sodales non, -dictum fermentum diam. Cras ut commodo tellus. -</p> - -<div id="outline-container-sec-1" class="outline-2"> -<h2 id="sec-1">Una secció</h2> -<div class="outline-text-2" id="text-1"> -<p> -Proin vel feugiat velit. Suspendisse dictum libero risus, eu laoreet justo -placerat vel. Vivamus ac hendrerit turpis. Donec vitae diam malesuada, placerat -sem in, tempus diam. Mauris posuere dignissim accumsan. Suspendisse dignissim, -lacus vel auctor maximus, neque sem posuere nisl, sit amet luctus tellus dui -sagittis neque. Integer non felis sit amet dolor euismod varius id a -est. Pellentesque risus nisi, mollis a erat ac, pulvinar ornare lectus. Morbi -congue erat quis varius dapibus. Vivamus pretium dui et enim porttitor dictum. -</p> - -<p> -Curabitur ornare ex ac nisi condimentum placerat. Pellentesque porttitor mauris -eget libero posuere consequat. Curabitur finibus venenatis convallis. Duis nec -odio eget ipsum luctus congue. Aliquam nec leo semper, egestas sem eget, -lobortis orci. Mauris ac mattis ante. In at lorem odio. Nullam convallis pretium -iaculis. Donec rhoncus, tellus ullamcorper pellentesque maximus, ipsum nunc -consequat lacus, ultricies ultricies arcu libero sed nunc. -</p> -</div> - -<div id="outline-container-sec-1-1" class="outline-3"> -<h3 id="sec-1-1">Més petita</h3> -<div class="outline-text-3" id="text-1-1"> -<p> -Proin sed ex arcu. Nam ac scelerisque risus, eu pretium est. Praesent id neque -et eros interdum ornare. Nulla sed libero magna. Aliquam quis risus imperdiet, -volutpat felis dignissim, sagittis metus. Vestibulum a ligula pharetra, -scelerisque velit eu, vulputate tellus. Sed iaculis, elit sed sagittis mattis, -lacus ligula convallis nisi, quis auctor sapien elit facilisis mauris. In -dictum, felis quis hendrerit consequat, dui leo luctus turpis, eu dictum enim -diam ac nisl. Cras efficitur convallis nulla, sed aliquet tortor dapibus -lacinia. Aliquam pulvinar augue turpis, ac efficitur neque fringilla -rutrum. Nulla non rhoncus tellus. -</p> -</div> -</div> -</div> diff --git a/_i18n/en.yml b/_i18n/en.yml index 04259ea..922da56 100644 --- a/_i18n/en.yml +++ b/_i18n/en.yml @@ -22,7 +22,7 @@ blog: read: "Read" more: "more" no_english_post: "This entry is not available in english" - no_catalan_post: "This entry is not available in catalan" + no_catalan_post: "Aquesta entrada no està disponible en català" intro: >- This is the page that aggregates the english blog posts. All of the opinions stated here are solely my own (unless stated otherwise). Last but not least, @@ -32,6 +32,3 @@ blog: own and do not represent anyone else. This post is released under the rss: >- You can subscribe to the - -posts: - first: "Llegint el Capital" diff --git a/_layouts/default.html b/_layouts/default.html index 8db38f6..10b04b3 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -2,18 +2,36 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <title>{% if page.title %}{{ site.title }} - {% t page.title %}{% else %}{{ site.title }}{% endif %}</title> + + {% comment %} + <!-- + There are three situations: + + 1. We have a page title and it needs translation (it starts with "titles.blabla"). + 2. We have a page title and it has to be as it is. + 3. We don't have a page title (e.g. the main page) + --> + {% endcomment %} + {% if page.title %} + {% if page.title contains "titles." %} + <title>{{ site.title }} - {% t page.title %}</title> + {% else %} + <title>{{ site.title }} - {{ page.title }}</title> + {% endif %} + {% else %} + <title>{{ site.title }}</title> + {% endif %} <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}"> - <!-- We have the same CSS file for all languages --> + {% comment %}<!-- We have the same CSS file for all languages -->{% endcomment %} <link href="{{ "/stylesheets/main.css" | prepend: site.baseurl_root }}" rel="stylesheet" type="text/css" /> - <!-- Empty favicon --> + {% comment %}<!-- Empty favicon -->{% endcomment %} <link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" rel="icon" type="image/x-icon" /> - <!-- Feeds --> + {% comment %}<!-- Feeds -->{% endcomment %} <link href="/feed.xml" type="application/rss+xml" rel="alternate" title="Entrades al blog en català" /> <link href="/feed.en.xml" type="application/rss+xml" rel="alternate" title="Blog posts in english" /> </head> diff --git a/_layouts/post.html b/_layouts/post.html index 71ffb82..f8174f5 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -2,9 +2,8 @@ layout: default --- - <h1 class="post-title-smaller"> - {% t page.title %}{% if page.subtitle %}.<small class="post-subtitle"> {{ page.subtitle }}</small>{% endif %} + {{ page.title }}{% if page.subtitle %}.<small class="post-subtitle"> {{ page.subtitle }}</small>{% endif %} </h1> <p class="post-meta"> diff --git a/blog/index.html b/blog/index.html index 01cdcae..20bf3f3 100644 --- a/blog/index.html +++ b/blog/index.html @@ -14,7 +14,7 @@ permalink_en: /blog/ <small> {% if site.lang == "ca" %} - <a href="/feed.xml">RSS feed</a> + <a href="/feed.xml">RSS Feed</a> {% else %} <a href="/feed.en.xml">RSS Feed</a> {% endif %} @@ -38,7 +38,7 @@ permalink_en: /blog/ <div class="post-preview col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1"> <a href="{{ post.url | prepend: site.baseurl }}"> <h2 class="post-title"> - {% t post.title %}{% if post.subtitle %}.<small class="post-subtitle"> {{ post.subtitle }}</small>{% endif %} + {{ post.title }}{% if post.subtitle %}.<small class="post-subtitle"> {{ post.subtitle }}</small>{% endif %} </h2> </a> diff --git a/feed.en.xml b/feed.en.xml index b9693af..bd88ebd 100644 --- a/feed.en.xml +++ b/feed.en.xml @@ -11,7 +11,7 @@ {% for post in site.posts %} {% if post.lang == "en" %} <item> - {% capture title %}{% t post.title %}{% endcapture %} + {% capture title %}{{ post.title }}. {{ post.subtitle }}{% endcapture %} <title>{{ title | xml_escape }}</title> <dc:creator>{{ site.author | strip_html | xml_escape }}</dc:creator> <description>{{ post.content | truncatewords: 50 | xml_escape }}</description> @@ -11,7 +11,7 @@ {% for post in site.posts %} {% if post.lang == "ca" %} <item> - {% capture title %}{% t post.title %}{% endcapture %} + {% capture title %}{{ post.title }}. {{ post.subtitle }}{% endcapture %} <title>{{ title | xml_escape }}</title> <dc:creator>{{ site.author | strip_html | xml_escape }}</dc:creator> <description>{{ post.content | truncatewords: 50 | xml_escape }}</description> diff --git a/org/ca/_posts/2018-02-17-llegint-capital.org b/org/ca/_posts/2018-02-17-llegint-capital.org deleted file mode 100644 index 720c8a0..0000000 --- a/org/ca/_posts/2018-02-17-llegint-capital.org +++ /dev/null @@ -1,60 +0,0 @@ -#+STARTUP: showall -#+OPTIONS: toc:nil -#+BEGIN_HTML ---- -layout: post -title: posts.first -subtitle: Una mirada o quelcom similar -lang: ca -english_available: false ---- -#+END_HTML -# Local variables: -# after-save-hook: org-publish-current-file -# end: - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean imperdiet -ullamcorper massa at egestas. Suspendisse eget purus sodales, suscipit urna ac, -luctus justo. Duis tristique vehicula congue. Proin dui ante, gravida a laoreet -at, porta tristique quam. Nunc vitae enim a ex molestie eleifend et in -nulla. Sed congue odio eget augue condimentum, vitae sollicitudin sem -eleifend. Proin iaculis porta odio, nec molestie eros convallis suscipit. - -Nunc ultrices nisi ipsum, nec blandit lorem pellentesque vitae. Suspendisse -turpis purus, tincidunt nec diam at, dictum imperdiet turpis. Vivamus semper -dapibus turpis, quis bibendum orci. Etiam ac libero sit amet ante mattis -tincidunt ut eget ante. Morbi dictum eget turpis quis consequat. Nullam ut sem -et metus luctus condimentum. Nulla augue urna, tempor eu volutpat eu, finibus -eget metus. Aenean bibendum lacus dolor, ac sagittis lectus consectetur -quis. Vivamus in posuere tortor. Nam et vehicula leo. Mauris at libero eu nibh -feugiat efficitur a eget purus. Vestibulum sem nulla, molestie non sodales non, -dictum fermentum diam. Cras ut commodo tellus. - -* Una secció - -Proin vel feugiat velit. Suspendisse dictum libero risus, eu laoreet justo -placerat vel. Vivamus ac hendrerit turpis. Donec vitae diam malesuada, placerat -sem in, tempus diam. Mauris posuere dignissim accumsan. Suspendisse dignissim, -lacus vel auctor maximus, neque sem posuere nisl, sit amet luctus tellus dui -sagittis neque. Integer non felis sit amet dolor euismod varius id a -est. Pellentesque risus nisi, mollis a erat ac, pulvinar ornare lectus. Morbi -congue erat quis varius dapibus. Vivamus pretium dui et enim porttitor dictum. - -Curabitur ornare ex ac nisi condimentum placerat. Pellentesque porttitor mauris -eget libero posuere consequat. Curabitur finibus venenatis convallis. Duis nec -odio eget ipsum luctus congue. Aliquam nec leo semper, egestas sem eget, -lobortis orci. Mauris ac mattis ante. In at lorem odio. Nullam convallis pretium -iaculis. Donec rhoncus, tellus ullamcorper pellentesque maximus, ipsum nunc -consequat lacus, ultricies ultricies arcu libero sed nunc. - -** Més petita - -Proin sed ex arcu. Nam ac scelerisque risus, eu pretium est. Praesent id neque -et eros interdum ornare. Nulla sed libero magna. Aliquam quis risus imperdiet, -volutpat felis dignissim, sagittis metus. Vestibulum a ligula pharetra, -scelerisque velit eu, vulputate tellus. Sed iaculis, elit sed sagittis mattis, -lacus ligula convallis nisi, quis auctor sapien elit facilisis mauris. In -dictum, felis quis hendrerit consequat, dui leo luctus turpis, eu dictum enim -diam ac nisl. Cras efficitur convallis nulla, sed aliquet tortor dapibus -lacinia. Aliquam pulvinar augue turpis, ac efficitur neque fringilla -rutrum. Nulla non rhoncus tellus. diff --git a/script/new.sh b/script/new.sh new file mode 100755 index 0000000..04d61be --- /dev/null +++ b/script/new.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# Copyright (C) 2018 Miquel Sabaté Solà <mikisabate@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" +pushd $DIR + +## +# Ask basic stuff like language and the file name. + +catalan=0 + +while true; do + read -p "Catalan only (Y/n)? " choice + case "$choice" in + n|N ) + break + ;; + * ) + catalan=1 + break + ;; + esac +done + +read -p "File name (with dashes but without the date): " base +file="$(date +%Y-%m-%d)-$base.org" + +## +# Copy template and sed away stuff. + +mkdir -p org/ca/_posts +dst=org/ca/_posts/$file +cp templates/post.org $dst +sed -i '/catalan_available/g' $dst + +if [[ $catalan == 0 ]]; then + mkdir -p org/en/_posts + dst=org/en/_posts/$file + cp templates/post.org $dst + sed -i 's/lang: ca/lang: en/g' $dst + sed -i '/english_available/g' $dst +else + sed -i 's/english_available: true/english_available: false/g' $dst +fi + +## +# Final output. + +echo "* Created file: $DIR/org/ca/_posts/$file" +if [[ $catalan == 0 ]]; then + echo "* Created file: $DIR/org/en/_posts/$file" +fi diff --git a/templates/post.org b/templates/post.org new file mode 100644 index 0000000..b6fb2cd --- /dev/null +++ b/templates/post.org @@ -0,0 +1,17 @@ +#+STARTUP: showall +#+OPTIONS: toc:nil +#+BEGIN_HTML +--- +layout: post +title: TITLE +subtitle: SUBTITLE +lang: ca +english_available: true +catalan_available: true +--- +#+END_HTML +# Local variables: +# after-save-hook: org-publish-current-file +# end: + +TEXT |
