diff --git a/about.md.html b/meta/.overrides/about.md similarity index 100% rename from about.md.html rename to meta/.overrides/about.md diff --git a/meta/.overrides/about.md.zip/about.md.html b/meta/.overrides/about.md.zip/about.md.html new file mode 100644 index 0000000..5d35968 --- /dev/null +++ b/meta/.overrides/about.md.zip/about.md.html @@ -0,0 +1 @@ +
Welcome :)
\ No newline at end of file diff --git a/meta/.overrides/config.yaml b/meta/.overrides/config.yaml new file mode 100644 index 0000000..eb1102b --- /dev/null +++ b/meta/.overrides/config.yaml @@ -0,0 +1,8 @@ +title: the title of my blog +theme: anubis +params: + author: bel + email: bel@bel.bel + social: + - id: email + name: bel@bel.bel diff --git a/meta/.overrides/config.yaml.zip/config.yaml.html b/meta/.overrides/config.yaml.zip/config.yaml.html new file mode 100644 index 0000000..edb6731 --- /dev/null +++ b/meta/.overrides/config.yaml.zip/config.yaml.html @@ -0,0 +1 @@ +title: the title of my blog
theme: anubis
params:
author: bel
email: bel@bel.bel
social:
- id: email
name: bel@bel.bel
\ No newline at end of file diff --git a/meta/about.md b/meta/about.md deleted file mode 120000 index ff160f6..0000000 --- a/meta/about.md +++ /dev/null @@ -1 +0,0 @@ -.default/about.md \ No newline at end of file diff --git a/meta/about.md b/meta/about.md new file mode 100644 index 0000000..85b0c1a --- /dev/null +++ b/meta/about.md @@ -0,0 +1,31 @@ +--- +title: "About" +description: "Hugo, the world’s fastest framework for building websites" +date: "2019-02-28" +aliases: + - "about-us" + - "about-hugo" + - "contact" +author: "Hugo Authors" +--- + +Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. + +Hugo makes use of a variety of open source projects including: + +* https://github.com/yuin/goldmark +* https://github.com/alecthomas/chroma +* https://github.com/muesli/smartcrop +* https://github.com/spf13/cobra +* https://github.com/spf13/viper + +Hugo is ideal for blogs, corporate websites, creative portfolios, online magazines, single page applications or even a website with thousands of pages. + +Hugo is for people who want to hand code their own website without worrying about setting up complicated runtimes, dependencies and databases. + +Websites built with Hugo are extremelly fast, secure and can be deployed anywhere including, AWS, GitHub Pages, Heroku, Netlify and any other hosting provider. + +Learn more and contribute on [GitHub](https://github.com/gohugoio). + + + diff --git a/meta/config.yaml b/meta/config.yaml deleted file mode 120000 index eca3135..0000000 --- a/meta/config.yaml +++ /dev/null @@ -1 +0,0 @@ -.default/config.yaml \ No newline at end of file diff --git a/meta/config.yaml b/meta/config.yaml new file mode 100644 index 0000000..b3312ee --- /dev/null +++ b/meta/config.yaml @@ -0,0 +1,76 @@ +baseURL: '' +languageCode: 'en-us' +title: 'Site Title' +theme: "anubis" +paginate: 5 +paginatePath: "posts/-/pages" +enableRobotsTXT: true +disableLiveReload: true +minify: true +noHTTPCache: true +disableFastRender: true +rssLimit: 5 +canonifyurls: true +relativeurls: false + +params: + toc: true + author: "me" + email: "" + avatar: "" + description: "" + #customJS: [ "js/main.js" ] # relative to ./assets/ + dateFormat: "2006-01-02" + paginationSinglePost: false + style: light + #style: auto-without-switcher + #style: light-without-switcher + readMore: true + disableSummary: false + social: + - id: email + name: contact + #- id: linkedin + # name: lapoba16 + #- id: rss + # name: rss + # url: '/index.xml' + +menu: + main: + - identifier: archive + name: Archive + title: Archive + url: /posts/ + weight: 0 + - identifier: about + name: About + title: About + url: /about/ + weight: 1 + +markup: + defaultMarkdownHandler: goldmark + goldmark: + extensions: + linkify: true + strikethrough: true + table: true + taskList: true + parser: + autoHeadingID: true + autoHeadingIDType: github + renderer: + unsafe: true # raw HTML OK + highlight: + anchorLineNos: true + guessSyntax: true + lineNos: true + tabWidth: 3 + tableOfContents: + endLevel: 3 + ordered: false + startLevel: 2 + +permalinks: + posts: /posts/:year-:month-:day-:filename diff --git a/posts.sh b/posts.sh index f3d394c..76f1d58 100644 --- a/posts.sh +++ b/posts.sh @@ -11,7 +11,7 @@ TMPDIR="${TMPDIR:-"/tmp"}" main() { flags "$@" - posts + #posts meta } @@ -66,10 +66,7 @@ posts() ( mkdir -p "$extracted_dir" 7z x -o"$extracted_dir" "$pulled_file" - cat "$extracted_dir"/*.html \ - | sed 's/.*.*/<\/body>/' \ - > "$index_html" + cat "$extracted_dir"/*.html | html_only_body > "$index_html" local tags=($(cat "$index_html" | html_to_plaintext | grep -o '#[a-zA-Z0-9]*' | grep '[a-zA-Z]' | sed 's/^#//' | sort -u)) local tags_csv="$(first=false; for tag in "${tags[@]}"; do true; if $first; then echo -n ", "; fi; first=true; echo -n "$tag"; done)" @@ -171,6 +168,35 @@ meta() { test -f "$(meta_file "$1")" && test "$1" == "$(cat "$(meta_file "$1")")" } + extracted_dir() { + echo "./meta/.overrides/$(echo "$1" | jq -r .Name)" + } + + extracted() { + echo "./meta/.overrides/$(echo "$1" | jq -r .Name | sed 's/.zip$//')" + } + + extract() { + local extracted_dir="$(extracted_dir "$1")" + rm -rf "$extracted_dir" "${extracted_dir%.zip}" + mkdir -p "$extracted_dir" + 7z x -o"$extracted_dir" "$(pulled "$1")" + local extracted_file="$(ls "$extracted_dir"/*.html)" + if [ $(ls "$extracted_dir" | wc -l) == 1 ]; then + cp "$extracted_file" "$(extracted "$1")" + extracted_file="$(extracted "$1")" + else + mv "$extracted_file" "$(dirname "$extracted_file")"/index.md + mv "$extracted_dir" "$(extracted "$1")" + fi + local extracted="$(extracted "$1")" + case "${extracted##*.}" in + yaml ) true ;; + * ) return ;; + esac + cat "$extracted" | html_to_plaintext > "$extracted.2"; mv "$extracted.2" "$extracted" + } + for b64_json in $(list); do local json="$(echo "$b64_json" | base64 --decode | jq .)" local filename="$(echo "$json" | jq -r .Name)" @@ -178,8 +204,11 @@ meta() { log "$filename: up to date" continue fi - log json=$json + log "$filename: pulling" pull "$json" + log "$filename: extracting" + extract "$json" + merge "$json" # todo: echo "$json" > "$(meta_file $json)" done false @@ -213,7 +242,6 @@ gd() ( pull "$RCLONE_FOLDER_POSTS/$1" } pull_meta() { - set -x pull "$RCLONE_FOLDER_META/$1" } pull() { @@ -231,7 +259,13 @@ gd() ( ) html_to_plaintext() { - sed 's/<[^>]*>//g' + sed 's/