aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-09-08 03:28:59 +0200
committerMax Magorsch <arzano@gentoo.org>2020-09-08 03:28:59 +0200
commit35e29d9ec982a52b5ba92f76c30cc7553e1abb82 (patch)
tree5992c4249aa403322ae7554a1956e5fd652f6162
parentFix the base url (diff)
downloadwww-35e29d9ec982a52b5ba92f76c30cc7553e1abb82.tar.gz
www-35e29d9ec982a52b5ba92f76c30cc7553e1abb82.tar.bz2
www-35e29d9ec982a52b5ba92f76c30cc7553e1abb82.zip
Add news item pages as well
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules3
-rwxr-xr-xbin/update-news.sh20
-rwxr-xr-xbin/update.sh1
-rw-r--r--config.toml1
-rw-r--r--content/support/news-items/_index.html2
m---------data/gentoo-news0
-rw-r--r--layouts/shortcodes/gentoo-news.html10
-rw-r--r--static/assets/css/screen.css14
-rw-r--r--static/css/screen.css14
10 files changed, 65 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 98ca327..c251d4d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ data/
public/
static/.well-known/openpgpkey/hu/
+content/support/news-items/
.tmp
diff --git a/.gitmodules b/.gitmodules
index 56b6cca..9d0b44c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
[submodule "content/glep"]
path = content/glep
url = https://anongit.gentoo.org/git/data/glep.git
+[submodule "data/gentoo-news"]
+ path = data/gentoo-news
+ url = https://anongit.gentoo.org/git/data/gentoo-news.git
diff --git a/bin/update-news.sh b/bin/update-news.sh
new file mode 100755
index 0000000..e5b4f26
--- /dev/null
+++ b/bin/update-news.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+echo -n 'Updating gentoo-news'
+for f in $(find ./data/gentoo-news/ -name '*.txt')
+do
+ file=${f##*/}
+
+ year="$(cut -d'-' -f1 <<<"$file")"
+ month="$(cut -d'-' -f2 <<<"$file")"
+ day="$(cut -d'-' -f3 <<<"$file")"
+
+ rawTitle="$(grep -m1 'Title:' $f)"
+ title=${rawTitle/Title: /}
+ title=${title//\"/\\\"}
+ cp "$f" "content/support/news-items/${file/.en.txt/}.html"
+ echo -e "---\nsection: \"support\"\ngentoonews: true\ntitle: \"${title}\"\ndate: ${year}-${month}-${day}T00:00:00+00:00\n---\n\n<pre class=\"gentoo-news\">$(cat "content/support/news-items/${file/.en.txt/}.html")\n</pre>" > "content/support/news-items/${file/.en.txt/}.html"
+done
+echo '...done.'
+
+
diff --git a/bin/update.sh b/bin/update.sh
index 1ba3e48..8931e0a 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -8,6 +8,7 @@ bin/update-downloads.sh || exit 1
bin/update-glsa.sh || exit 1
bin/update-keys.sh || exit 1
bin/update-mirrors.sh || exit 1
+bin/update-news.sh || exit 1
bin/update-packages.sh || exit 1
bin/update-planet.sh || exit 1
bin/update-use.sh || exit 1
diff --git a/config.toml b/config.toml
index 662245d..1848eed 100644
--- a/config.toml
+++ b/config.toml
@@ -2,6 +2,7 @@ baseURL = "/"
languageCode = "en-us"
title = "Gentoo Linux"
enableGitInfo = true
+ignorefiles = [ "data/gentoo-news/.*" ]
[markup.goldmark.renderer]
unsafe= true
diff --git a/content/support/news-items/_index.html b/content/support/news-items/_index.html
index e175012..4ee27b4 100644
--- a/content/support/news-items/_index.html
+++ b/content/support/news-items/_index.html
@@ -37,7 +37,7 @@ layout: news-items
<th>Title</th>
</tr>
- <!-- TODO: News items here -->
+ {{< gentoo-news >}}
</tbody>
</table>
diff --git a/data/gentoo-news b/data/gentoo-news
new file mode 160000
+Subproject 28c8d820d4912d5e86d6b64d6ed5ae19dee5ace
diff --git a/layouts/shortcodes/gentoo-news.html b/layouts/shortcodes/gentoo-news.html
new file mode 100644
index 0000000..21d0306
--- /dev/null
+++ b/layouts/shortcodes/gentoo-news.html
@@ -0,0 +1,10 @@
+{{ range $key, $value := (where .Site.RegularPages.ByTitle "Section" "support" ).ByDate.Reverse }}
+
+ {{if .Params.gentoonews }}
+ <tr>
+ <td>{{.Date.Format "2006-01-02" }}</td>
+ <td><a href="{{.Permalink}}">{{.Title}}</a></td>
+ </tr>
+ {{end}}
+
+{{end}} \ No newline at end of file
diff --git a/static/assets/css/screen.css b/static/assets/css/screen.css
index 2d73761..638472c 100644
--- a/static/assets/css/screen.css
+++ b/static/assets/css/screen.css
@@ -428,4 +428,18 @@ article.newsitem {
background-color: #fafafa !important;
}
+pre.gentoo-news {
+ display: block;
+ padding: 9.5px;
+ margin: 0 0 10px;
+ font-size: 13px;
+ line-height: 1.42857143;
+ color: #333;
+ word-break: break-all;
+ word-wrap: break-word;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
/*# sourceMappingURL=screen.css.map */
diff --git a/static/css/screen.css b/static/css/screen.css
index 2d73761..638472c 100644
--- a/static/css/screen.css
+++ b/static/css/screen.css
@@ -428,4 +428,18 @@ article.newsitem {
background-color: #fafafa !important;
}
+pre.gentoo-news {
+ display: block;
+ padding: 9.5px;
+ margin: 0 0 10px;
+ font-size: 13px;
+ line-height: 1.42857143;
+ color: #333;
+ word-break: break-all;
+ word-wrap: break-word;
+ background-color: #f5f5f5;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
/*# sourceMappingURL=screen.css.map */