diff --git a/add_archive.sh b/add_archive.sh
new file mode 100755
index 0000000..8d5a48a
--- /dev/null
+++ b/add_archive.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+err() {
+ echo "${1}"
+ zenity --error --no-wrap --text "${1}"
+}
+
+warn() {
+ echo "${1}"
+ zenity --warning --no-wrap --text "${1}"
+}
+
+if ! command -v unzip &> /dev/null
+then
+ err "'unzip' could not be found"
+ exit 1
+fi
+
+
+
+if [ ${#@} -eq 0 ]; then
+ # no arguments
+ IFS=$'\n' files=($(zenity --file-selection --multiple --separator=$'\n' --title="Choose files"))
+else
+ # arguments
+ echo ""
+fi
+
+for i in "${files[@]}"; do
+ if ! unzip -l "${i}"|grep -q "index.de.md"; then
+ err "maybe wrong archive, this is not compatible"
+ exit 1
+ fi
+ fname="$(basename ${i%.*})"
+ if ! [ -d content ]; then
+ err "folder 'content' not found"
+ exit 1
+ fi
+ set -x
+ mkdir -p "content/posts/${fname}/"
+ unzip -d "content/posts/${fname}/" "${i}"
+done
+
+output="Done."
+output_temp=""
+
+for i in "${files[@]}"; do
+ fname="$(basename ${i%.*})"
+ folder="content/posts/${fname}"
+ if ! [ -e "${folder}/banner*" ]; then
+ output_temp="${output_temp}banner missing\n "
+ fi
+done
+
+warn "${output_temp}"
diff --git a/content/posts/2022-06-26-a/banner_2.jpeg b/content/posts/2022-06-26-a/banner_2.jpeg
new file mode 100644
index 0000000..9fde3c4
Binary files /dev/null and b/content/posts/2022-06-26-a/banner_2.jpeg differ
diff --git a/content/posts/2022-06-26-a/index.de.md b/content/posts/2022-06-26-a/index.de.md
new file mode 100644
index 0000000..f680c84
--- /dev/null
+++ b/content/posts/2022-06-26-a/index.de.md
@@ -0,0 +1,11 @@
+---
+title: "a"
+date: 2022-06-26T13:55:00+02:00
+---
+![Describe the Picture for the Blind](redarrot.png)
+
+[Describe the File for the Blind](t60.conf)
+
+![Describe the Picture for the Blind](Buntes.Haus.Celle.Logo.5.png)
+
+[Describe the File for the Blind](reconfigure_pipewire.sh)
\ No newline at end of file
diff --git a/content/posts/2022-06-26-a/ui.jpeg b/content/posts/2022-06-26-a/ui.jpeg
new file mode 100644
index 0000000..9fde3c4
Binary files /dev/null and b/content/posts/2022-06-26-a/ui.jpeg differ
diff --git a/new.sh b/new.sh
deleted file mode 100755
index 0841bbe..0000000
--- a/new.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-echo "Titel des Artikels"
-read -p ": " title
-
-title=${title//[^[:print:]]/}
-title=${title//#/}
-newfoldername="${title//[^[:alnum:][:blank:]-]/}"
-newfoldername=${newfoldername// /-}
-newfoldername=${newfoldername/%-/}
-newfoldername=${newfoldername/-/}
-
-title="${title//\//\\\/}" # / -> \/
-title="${title//\"/\\\"}" # " -> \"
-
-date_long=$(date +%Y-%m-%dT%H:%M:00+0200)
-date=$(date +%Y-%m-%d)
-mkdir -p "content/posts/${date}-${newfoldername}"
-touch "content/posts/${date}-${newfoldername}/index.de.md"
-# echo "---" > "content/posts/${date}-${newfoldername}/index.de.md"
-# echo "title: \"${title}\"" >> "content/posts/${date}-${newfoldername}/index.de.md"
-# echo "date: ${date_long}" >> "content/posts/${date}-${newfoldername}/index.de.md"
-# echo "---" >> "content/posts/${date}-${newfoldername}/index.de.md"
-
-git add "content/posts/${date}-${newfoldername}/"
-git commit -m "New Post: ${date}-${newfoldername}"
-
-for i in vim nano gedit kate; do
- if command -v $i > /dev/null; then
- editor="$i"
- fi
-done
-
-echo ""
-echo ""
-echo "Schreibe nun mit einem einfachen Editor deinen Artikel."
-echo ""
-echo "'${editor} content/posts/${date}-${newfoldername}/index.de.md'"
-echo ""
-echo "'https://buha.rotce.de/de/tools/generator/' hilft dir!"
-echo ""
-echo "Lege vielleicht noch Bilder in den Ordner 'content/posts/${date}-${newfoldername}'"
-echo ""
-echo "Wenn du fertig bist, nutze './push.sh' um das hochzuladen."
diff --git a/themes/buha/assets/scss/generator.scss b/themes/buha/assets/scss/generator.scss
index 22e73b9..46e5ba8 100644
--- a/themes/buha/assets/scss/generator.scss
+++ b/themes/buha/assets/scss/generator.scss
@@ -11,15 +11,10 @@ fieldset {
}
#result {
- white-space: pre; display: flex; background: var(--background-alt);
- padding: 1rem 0 1rem 1rem;
- margin-top: 1rem;
- -webkit-user-select: all;
- user-select: all;
- margin-bottom: 1rem;
- word-wrap: break-word;
- overflow-wrap: break-word;
- max-width: 100vw;
+margin: 1em;
+display: flex;
+flex-direction: column;
+max-width: 80%;
}
form {
diff --git a/themes/buha/content/tools/generator.de.md b/themes/buha/content/tools/generator.de.md
index dff74c8..74182ac 100644
--- a/themes/buha/content/tools/generator.de.md
+++ b/themes/buha/content/tools/generator.de.md
@@ -21,15 +21,16 @@ forms:
input_type: textarea
name: "Zusammenfassung"
expanded: true
- buttons: "url,URL;pic,Bild;bold,Fett;strike,Durchgestrichen;paragraph,Absatz;newline,Neue Zeile"
+ buttons: "url,URL;bold,Fett;strike,Durchgestrichen;paragraph,Absatz;newline,Neue Zeile"
placeholder: "Der erste Absatz des Artkels. Eine Zusammenfassung des Inhalts. Gerne einladend bis reisserisch oder zusammenfassend. Denke an die Formatierungshilfe hinter dem Link oben."
help: ""
- title: content
input_type: textarea
name: "Inhalt"
- buttons: "headline,Überschrift;url,URL;pic,Bild;bold,Fett;strike,Durchgestrichen;paragraph,Absatz;newline,Neue Zeile"
+ buttons: "headline,Überschrift;url,URL;picurl,Bild URL;bold,Fett;strike,Durchgestrichen;paragraph,Absatz;newline,Neue Zeile"
required: true
placeholder: "Der Inhalt des Artikels. Denke an die Formatierungshilfe hinter dem Link oben."
+ pictures: "Dateien Auswählen"
- title: news
input_type: categories
name: "Kategorie"
diff --git a/themes/buha/layouts/_default/_markup/render-image.html b/themes/buha/layouts/_default/_markup/render-image.html
index ab68255..c12fa27 100644
--- a/themes/buha/layouts/_default/_markup/render-image.html
+++ b/themes/buha/layouts/_default/_markup/render-image.html
@@ -7,38 +7,19 @@
{{ .Text }}
{{- else -}}
- {{ $ignore := slice (.Page.Resources.GetMatch "banner*") }}
- {{ $images := .Page.Resources.ByType "image" }}
- {{ $images = complement $ignore $images }}
- {{ if where (.Page.Resources.ByType "image") ".File.TranslationBaseName" "!=" "banner*" }}
- {{ $img_tmp := "" }}
- {{ $dest := string (printf "%s.*" .Destination) }}
- {{ if .Page.Resources.GetMatch $dest }}
- {{- $img_tmp = .Page.Resources.GetMatch $dest -}}
- {{ else }}
- {{ $nr := .Destination }}
- {{- $img_tmp = index $images (sub (int $nr) 1) -}}
- {{ end }}
- {{ if $img_tmp }}
- {{- $image := .Page.Resources.GetMatch (printf "%s" ($img_tmp | safeURL)) -}}
- {{- $permalink := "" -}}
-
- {{- if ne $image nil -}}
- {{- $permalink = $image.Permalink -}}
- {{- else -}}
- {{- $image = imageConfig (printf "static/%s" (.Destination | safeURL)) -}}
- {{- $permalink = (printf "/%s" (.Destination | safeURL)) -}}
- {{- end -}}
-
-
-
- {{ .Text }}
-
- {{ end }}
+ {{ $dest := string (printf "%s*" .Destination) }}
+ {{ if .Page.Resources.GetMatch $dest }}
+ {{- $image := .Page.Resources.GetMatch $dest -}}
+
+
+ {{ .Text }}
+
+ {{ else }}
+ {{ .Destination }} missing..
{{ end }}
{{- end -}}
diff --git a/themes/buha/layouts/index.html.old b/themes/buha/layouts/index.html.old
deleted file mode 100644
index 82bacf1..0000000
--- a/themes/buha/layouts/index.html.old
+++ /dev/null
@@ -1,34 +0,0 @@
-{{ define "main" }}
- {{- $all := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections }}
- {{ $days := int (mul (mul (int .Site.Params.featured_expire) 7) -1) }}
- {{ $featured := where (where (where $all ".Params.featured" "=" true) "Type" "in" .Site.Params.searchSections) ".Params.Lastmod" "gt" (now.AddDate 0 0 $days) }}
- {{ $featured = $all | intersect $featured }}
- {{ $posts := $all | complement $featured }}
- {{- $paginator := .Paginate $posts -}}
- {{ if eq $paginator.PageNumber 1 }}
- {{ if ne .Content "" }}
-
- {{ .Content }}
-
- {{ end }}
- {{ if gt (len $featured) 0 }}
- {{if "featured" | i18n }}{{ "featured" | i18n }}{{ else }}{{ "Featured" }}{{ end }}
- {{ partial "contentlayouts/list.html" (dict "context" . "pages" $featured "amount" "3" ) }}
- {{ end }}
- {{ end }}
- {{ if gt (len $posts) 1 }}
- {{ if "news" | i18n }}{{ "news" | i18n }}{{ else }}{{ "News" }}{{ end }}
- {{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5") }}
-
-
- {{ end }}
-
-
-{{ end }}
-
-{{ define "sidebar" }}
- {{- partial "contentlayouts/menu.html" . }}
-{{ end }}
-
diff --git a/themes/buha/layouts/partials/tools/generator/form.html b/themes/buha/layouts/partials/tools/generator/form.html
index b814ed4..06f4097 100644
--- a/themes/buha/layouts/partials/tools/generator/form.html
+++ b/themes/buha/layouts/partials/tools/generator/form.html
@@ -39,8 +39,12 @@
{{ end }}
- {{ if eq .title "content" }}
-
+ {{ if .pictures }}
+ {{ $nn := printf "%s;%s" .title "addfiles"}}
+
{{ end }}
{{ else if eq .input_type "radio" }}
diff --git a/themes/buha/static/js/generator.js b/themes/buha/static/js/generator.js
index bdf262e..bf62133 100644
--- a/themes/buha/static/js/generator.js
+++ b/themes/buha/static/js/generator.js
@@ -1,4 +1,10 @@
var zip = new JSZip();
+var archive_name = "";
+var fout = document.getElementById('added-files');
+
+function isFileImage(file) {
+ return file && file['type'].split('/')[0] === 'image';
+}
function check_checkboxes(name) {
const checkboxes = document.querySelectorAll(`input[name="${name}"]:checked`);
@@ -58,6 +64,56 @@ function rm_file(fname) {
zip.remove(fname);
}
+function insert_file(fname) {
+ var arr = fname.split(";");
+ let t = arr[2];
+ let x = arr[1];
+ let target = arr[0];
+ var id = document.getElementById(target);
+ function typeInTextarea(newText, el = id) {
+ const [start, end] = [el.selectionStart, el.selectionEnd];
+ el.setRangeText(newText, start, end);
+ }
+ if (t == "image") {
+ var desc = prompt("Desc for ", "Describe the Picture for the Blind");
+ var out = "![" + desc + "](" + x + ") \n\n";
+ } else if (t == "other") {
+ var desc = prompt("Desc for ", "Describe the File for the Blind");
+ var out = "[" + desc + "](" + x + ") \n\n";
+ }
+ if (out != null) {
+ typeInTextarea(out);
+ var end = id.value.length;
+ id.setSelectionRange(end, end);
+ id.focus({preventScroll: true});
+ }
+}
+
+function addfiles(str) {
+ var arr = str.split(";");
+ let x = arr[1];
+ let target = arr[0];
+ var input = document.createElement('input');
+ var type = "image";
+ input.type = 'file';
+ input.multiple = 'multiple';
+ input.id = 'inpic';
+ input.click();
+ input.onchange = e => {
+ var files = e.target.files;
+ for (var i = 0; i < files.length; i++) {
+ var name = files[i].name.trim();
+ if (isFileImage(files[i])) {
+ type = "image";
+ } else {
+ type = "other"
+ }
+ zip.file(name, files[i]);
+ fout.innerHTML += "" + "" + "" + name + "
";
+ }
+ }
+}
+
function button(str) {
var arr = str.split(";");
let x = arr[1];
@@ -74,39 +130,17 @@ function button(str) {
if (desc != null) {var out = "[" + desc + "](" + url + ") ";}
}
}
+ if (x == "picurl") {
+ let url = prompt("Please enter Link to an image", "https://de.wikipedia.org/static/images/project-logos/dewiki.png");
+ if (url != null) {
+ let desc = prompt("Description", "Wikipedia logo");
+ if (desc != null) {var out = "![" + desc + "](" + url + ") ";}
+ }
+ }
if (x == "headline") {
let headline = prompt("Headline", "Act One");
if (headline != null) {var out = "## " + headline + "\n\n";}
}
- if (x == "pic") {
-
-
- var input = document.createElement('input');
- var fout = document.getElementById('added-files');
- input.type = 'file';
- input.multiple = 'multiple';
- input.id = 'inpic';
- input.click();
- input.onchange = e => {
- var files = e.target.files;
-
- for (var i = 0; i < files.length; i++) {
- var name = files[i].name.trim();
- var p = "Desc for " + name;
- var desc = prompt(p, "Wikipedia logo");
- if (desc) {
- zip.file(name, files[i]);
- var pic = name;
- var out = "![" + desc + "](" + pic + ") \n\n";
- typeInTextarea(out);
- var end = id.value.length;
- id.setSelectionRange(end, end);
- id.focus({preventScroll: true});
- fout.innerHTML += "" + pic + "
";
- }
- }
- }
- }
if (x == "bold") {
let bold = prompt("Bold", "");
if (bold != null) {var out = "\*\*" + bold + "\*\* ";}
@@ -145,13 +179,11 @@ function testor(input) {
}
function showInput(e) {
- document.getElementById("result").innerHTML = '';
- e.preventDefault();
- document.getElementById("result").style.display = "flex";
var display = document.getElementById("result");
+ display.innerHTML = '';
+ e.preventDefault();
+ display.style.display = "flex";
-
-
var d = new Date();
var datestring = d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "T" + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2) + ":00+02:00";
var datestring_shorter = d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2);
@@ -271,14 +303,13 @@ function showInput(e) {
if (title) {
var output = "---\n";
var output = output + "title: \"" + title.trim() + "\"\n";
-
-
+
if (lastmod) {
var output = output + "lastmod: " + lastmod.trim() + "\n";
} else {
var output = output + "date: " + datestring.trim() + "\n";
}
-
+
if (featured != '') {
var output = output + "featured: true\n";
}
@@ -294,7 +325,7 @@ function showInput(e) {
if (when) {
var output = output + "when: \"" + when + "\"\n";
}
-
+
if (nnews) {
var output = output + "news: \[" + nnews + "]\n";
}
@@ -302,11 +333,11 @@ function showInput(e) {
if (nevents) {
var output = output + "events: \[" + nevents + "]\n";
}
-
+
if (nfoundations) {
var output = output + "foundations: \[" + nfoundations + "]\n";
}
-
+
if (alltags) {
var output = output + "tags: \[" + alltags + "]\n";
}
@@ -325,14 +356,11 @@ function showInput(e) {
}
var output = output + "---\n";
if (summary) {
- var output = output + summary.trim() + "\n" + "<!--more-->" + "\n";
+ var output = output + summary.trim() + "\n" + "" + "\n";
}
if (content) {
var output = output + content.trim();
}
- if (output) {
- display.innerHTML += output.trim();
- }
// Add an top-level, arbitrary text file with contents
zip.file("index.de.md", output);
@@ -342,15 +370,28 @@ function showInput(e) {
var t = t.replaceAll(/\s+/g, '-');
var t = t.replace(/[^\w.-]+/g, "");
+ archive_name = datestring_shorter + "-" + t + ".zip";
- var archive_name = datestring_shorter + "-" + t + ".zip";
+ var check_banner = false;
- // Generate the zip file asynchronously
- zip.generateAsync({type:"blob"})
- .then(function(cont) {
- // Force down of the Zip file
- saveAs(cont, archive_name);
- });
+ for(let [filename, file] of Object.entries(zip.files)) {
+ console.log(filename);
+ if (filename.startsWith("banner")) { check_banner = true; }
+ }
+ if (output) {
+ display.innerHTML += "
";
+ if (check_banner == false) {
+ display.innerHTML += "
\nA Nice Banner (1920x850px) is missing
"
+ }
+ }
}
}
+function dl_archive() {
+ // Generate the zip file asynchronously
+ zip.generateAsync({type:"blob"})
+ .then(function(cont) {
+ // Force down of the Zip file
+ saveAs(cont, archive_name);
+ });
+}