diff --git a/meta/.default/config.yaml.json b/meta/.default/config.yaml.json new file mode 100644 index 0000000..ab1587e --- /dev/null +++ b/meta/.default/config.yaml.json @@ -0,0 +1,84 @@ +{ + "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": "", + "dateFormat": "2006-01-02", + "paginationSinglePost": false, + "style": "light", + "readMore": true, + "disableSummary": false, + "social": [ + { + "id": "email", + "name": "contact" + } + ] + }, + "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 + } + }, + "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/meta/.overrides/about.md.zip/.meta b/meta/.overrides/about.md.zip/.meta new file mode 100644 index 0000000..ca78be0 --- /dev/null +++ b/meta/.overrides/about.md.zip/.meta @@ -0,0 +1,9 @@ +{ + "Path": "about.md.zip", + "Name": "about.md.zip", + "Size": -1, + "MimeType": "application/zip", + "ModTime": "2021-11-29T20:24:55.218Z", + "IsDir": false, + "ID": "14F-QFbXLWuXm3ScC1nr4iEnRcwBLMBFLQfDWmDeLcKM" +} diff --git a/meta/.overrides/config.yaml.json b/meta/.overrides/config.yaml.json new file mode 100644 index 0000000..2c6891f --- /dev/null +++ b/meta/.overrides/config.yaml.json @@ -0,0 +1,14 @@ +{ + "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/.meta b/meta/.overrides/config.yaml.zip/.meta new file mode 100644 index 0000000..1a26fb9 --- /dev/null +++ b/meta/.overrides/config.yaml.zip/.meta @@ -0,0 +1,9 @@ +{ + "Path": "config.yaml.zip", + "Name": "config.yaml.zip", + "Size": -1, + "MimeType": "application/zip", + "ModTime": "2021-11-29T20:24:37.024Z", + "IsDir": false, + "ID": "1MpoWp-78TfLI5_Iz0ygMg5gu-JHux68t-LM49u0mACA" +} diff --git a/meta/about.md b/meta/about.md index 85b0c1a..5d35968 100644 --- a/meta/about.md +++ b/meta/about.md @@ -1,31 +1 @@ ---- -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). - - - +

Welcome :)

\ No newline at end of file diff --git a/meta/config.yaml b/meta/config.yaml index b3312ee..fa59bc3 100644 --- a/meta/config.yaml +++ b/meta/config.yaml @@ -1,9 +1,9 @@ -baseURL: '' -languageCode: 'en-us' -title: 'Site Title' -theme: "anubis" +baseURL: "" +languageCode: en-us +title: the title of my blog +theme: anubis paginate: 5 -paginatePath: "posts/-/pages" +paginatePath: posts/-/pages enableRobotsTXT: true disableLiveReload: true minify: true @@ -12,43 +12,32 @@ 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' - + toc: true + author: bel + email: bel@bel.bel + avatar: "" + description: "" + dateFormat: "2006-01-02" + paginationSinglePost: false + style: light + readMore: true + disableSummary: false + social: + - id: email + name: bel@bel.bel menu: main: - - identifier: archive - name: Archive - title: Archive - url: /posts/ - weight: 0 - - identifier: about - name: About - title: About - url: /about/ - weight: 1 - + - identifier: archive + name: Archive + title: Archive + url: /posts/ + weight: 0 + - identifier: about + name: About + title: About + url: /about/ + weight: 1 markup: defaultMarkdownHandler: goldmark goldmark: @@ -61,7 +50,7 @@ markup: autoHeadingID: true autoHeadingIDType: github renderer: - unsafe: true # raw HTML OK + unsafe: true highlight: anchorLineNos: true guessSyntax: true @@ -71,6 +60,5 @@ markup: endLevel: 3 ordered: false startLevel: 2 - permalinks: posts: /posts/:year-:month-:day-:filename diff --git a/posts.sh b/posts.sh index 76f1d58..d04860e 100644 --- a/posts.sh +++ b/posts.sh @@ -11,7 +11,7 @@ TMPDIR="${TMPDIR:-"/tmp"}" main() { flags "$@" - #posts + posts meta } @@ -161,11 +161,11 @@ meta() { } meta_file() { - echo "$TMPDIR/.meta.$(echo "$1" | jq -r .Name)" + echo "./meta/.overrides/$(echo "$1" | jq -r .Name)/.meta" } up_to_date() { - test -f "$(meta_file "$1")" && test "$1" == "$(cat "$(meta_file "$1")")" + test -f "$(meta_file "$1")" && test "$1" == "$(cat "$(meta_file "$1")")" && test -e "$(must "$1")" } extracted_dir() { @@ -176,6 +176,10 @@ meta() { echo "./meta/.overrides/$(echo "$1" | jq -r .Name | sed 's/.zip$//')" } + must() { + echo "./meta/$(basename "$(extracted "$1")")" + } + extract() { local extracted_dir="$(extracted_dir "$1")" rm -rf "$extracted_dir" "${extracted_dir%.zip}" @@ -197,6 +201,38 @@ meta() { cat "$extracted" | html_to_plaintext > "$extracted.2"; mv "$extracted.2" "$extracted" } + merge() { + local extracted="$(extracted "$1")" + case "${extracted##*.}" in + yaml ) merge_yaml "$1" ;; + * ) + esac + } + + merge_yaml() { + local override="$(extracted "$1")" + local default="$(echo "$override" | sed 's/\.overrides/\.default/')" + if [ ! -f "$default" ]; then + return + fi + cat "$override" | yq -j eval - | jq > "$override.json" + cat "$default" | yq -j eval - | jq > "$default.json" + jq -s '.[0] * .[1]' "$default.json" "$override.json" | yq -P eval - > ./meta/"$(basename "$override")" + } + + import() { + local must="$(must "$1")" + if [ -f "$must" ]; then + rm "$must" + fi + merge "$1" + if [ -f "$must" ]; then + return + fi + log cp -r "${must%/*}/.overrides/${must##*/}" "$must" + cp -r "${must%/*}/.overrides/${must##*/}" "$must" + } + for b64_json in $(list); do local json="$(echo "$b64_json" | base64 --decode | jq .)" local filename="$(echo "$json" | jq -r .Name)" @@ -208,10 +244,9 @@ meta() { pull "$json" log "$filename: extracting" extract "$json" - merge "$json" - # todo: echo "$json" > "$(meta_file $json)" + import "$json" + echo "$json" > "$(meta_file "$json")" done - false } fatal() { diff --git a/rclone.conf b/rclone.conf index 08959cd..3d25573 100644 --- a/rclone.conf +++ b/rclone.conf @@ -6,5 +6,5 @@ scope = drive #team_drive = 1-p043gwMk88rj4-Sm5otARi_AJZYskbj #root_folder_id = 1-p043gwMk88rj4-Sm5otARi_AJZYskbj formats = zip,html,rtf,odt,docx,xlsx,pptx,svg -token = {"access_token":"ya29.a0ARrdaM-P6wKzub3feWIaQlG3YXq2REc0rfS1LDxfeV1m1rr5Zwhe_XqYTInCEcCHP4bHNPvcBcZufAnJpgLZlVBte-abfEOvwfk4Qz25__FboaddAXthlv_EeIxPwVTlKJTy7MOKGLz2Rhg47CjjagfFYMcCKw","token_type":"Bearer","refresh_token":"1//04sQD4800FsqyCgYIARAAGAQSNwF-L9IrB1_7BV8ScFnqmIz8FNWgXfr80--6VG6KX1pTnneQKAz6Ss3YtxqmCdf2tRBy2ndkhek","expiry":"2021-11-29T14:49:21.903576-07:00"} +token = {"access_token":"ya29.a0ARrdaM-gyIY7jtRZuCMXsXx0apjLSVmd1dpGeuluOlVHoOcEPNpghYjqOfWK7aM_RQRC2xwomdQqLgsSzEHNAkQ0Jv9v6_QqiGwbqscPxTnVIaeMpmDLsxMFVYse29Ofba9bSsOyqfOhb1BeS_7KW3CVtDlTuA","token_type":"Bearer","refresh_token":"1//04sQD4800FsqyCgYIARAAGAQSNwF-L9IrB1_7BV8ScFnqmIz8FNWgXfr80--6VG6KX1pTnneQKAz6Ss3YtxqmCdf2tRBy2ndkhek","expiry":"2021-11-29T15:49:20.965947-07:00"}