From 9e373cfbb0bd98480560a00978fd6d51113ffe06 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 15 Apr 2021 20:21:14 +0200 Subject: Fetch pages of sections --- assets/css/_basics.scss | 2 +- assets/css/layouts/_landing.scss | 5 +- assets/css/layouts/_section.scss | 11 +- content/personal/infinite-skyscrapers.md | 45 ------ content/personal/infinite-skyscrapers/index.md | 45 ++++++ scripts/build_content.sh | 33 +++-- scripts/metadata_filter.lua | 17 ++- templates/layouts/index.html | 192 +++++++++++-------------- templates/symbols.svg | 2 +- 9 files changed, 172 insertions(+), 180 deletions(-) delete mode 100644 content/personal/infinite-skyscrapers.md create mode 100644 content/personal/infinite-skyscrapers/index.md diff --git a/assets/css/_basics.scss b/assets/css/_basics.scss index b739d2a..becf68a 100644 --- a/assets/css/_basics.scss +++ b/assets/css/_basics.scss @@ -31,7 +31,7 @@ html { body { margin: 0; - padding: prop(--dims --outer, $global: true) 0 0; + padding: 0; } pre, diff --git a/assets/css/layouts/_landing.scss b/assets/css/layouts/_landing.scss index aa85679..500849e 100644 --- a/assets/css/layouts/_landing.scss +++ b/assets/css/layouts/_landing.scss @@ -10,7 +10,6 @@ @include layout(namespace()) { display: flex; - box-sizing: border-box; flex-direction: row; align-items: center; @@ -30,9 +29,7 @@ } @include media('<=md') { - flex-direction: column; - align-items: stretch; - justify-content: center; + display: block; @include element('side') { display: none; diff --git a/assets/css/layouts/_section.scss b/assets/css/layouts/_section.scss index 38b20aa..a005ece 100644 --- a/assets/css/layouts/_section.scss +++ b/assets/css/layouts/_section.scss @@ -1,14 +1,15 @@ @include namespace('section') { @include layout(namespace()) { - display: flex; - flex-direction: column; - align-items: stretch; - justify-content: flex-start; + box-sizing: border-box; min-height: 100%; margin-bottom: calc(-1 * #{prop(--dims --outer, $global: true)}); padding-bottom: prop(--dims --outer, $global: true); - @include element('heading') { + @include modifier('no-head') { + padding-top: prop(--dims --outer, $global: true); + } + + @include element('head') { display: flex; position: sticky; z-index: 9000; diff --git a/content/personal/infinite-skyscrapers.md b/content/personal/infinite-skyscrapers.md deleted file mode 100644 index a4a78e1..0000000 --- a/content/personal/infinite-skyscrapers.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -date: 2021-01-09 -title: Infinite Skyscrapers -category: dre ---- - -I'm in some strange world that consist of huge buildings, looking a lot like very simple skyscrapers, except they were all interconnected. -I'm not even sure if there's a floor since I'm just floating, being able to fly around at will. -There is also something chasing me and I'm trying to get away from it. - -The buildings around me get denser and more chaotic, some look like glitches in a computer game. -The creature chasing me seems to absorb buildings into its body, growing larger and more powerful. - -Then there's a cut and I'm presumably inside one of those buildings. -I'm in a dark room with barely any lighting which looks somewhat like a large office. -It's very cluttered, though. -There's another similar room next to this one, separated by a glass wall and a door. -There's also a person with me who I seem to know, and that creature that chased me. -It seems like it managed to capture us. - -It dares us to escape from this situation, and as soon as it said that, the room begins to get locked off. -There are some red lights blinking and the door connecting our current room with the neighboring room is about to close permanently. -Panicked, I quickly run through it, but the other person couldn't make it. - -I suddenly realize I'm a cat and the other person an even smaller critter, I don't know what. -It's obvious that the creature is just playing with us, watching our futile efforts to escape for its amusement. - -The other person tries to get the door to open again by messing with its circuitry, and I do my best to block the creature's view from what was going on without looking suspicious. - -After a while, I start exploring the room and notice that there's a hallway in front of it, also separated by a glass wall and a door. -However, the wall is broken in one place and has a hole large enough for me to jump through. -So that's what I do. -I land in a bunch of glass disks lying on the floor, breaking them, but I'm unharmed. - -Now being a human again, I take a glass shard with me and run through a door which leads to a staircase. -It is huge, having the shape of a pill with stairs going along the edge. -The center is empty so I can see all the floors coming before and after. -There's no end in any direction. -I know the creature will come after me soon and so I run upwards as fast as I can. - -I made it about 5 floors when I hear a door burst open. -I quickly enter the room next to me, hoping that the creature hasn't seen me. - -This floor was very large and open and brightly lit. -The dream starts to make no sense anymore and that's it. diff --git a/content/personal/infinite-skyscrapers/index.md b/content/personal/infinite-skyscrapers/index.md new file mode 100644 index 0000000..a4a78e1 --- /dev/null +++ b/content/personal/infinite-skyscrapers/index.md @@ -0,0 +1,45 @@ +--- +date: 2021-01-09 +title: Infinite Skyscrapers +category: dre +--- + +I'm in some strange world that consist of huge buildings, looking a lot like very simple skyscrapers, except they were all interconnected. +I'm not even sure if there's a floor since I'm just floating, being able to fly around at will. +There is also something chasing me and I'm trying to get away from it. + +The buildings around me get denser and more chaotic, some look like glitches in a computer game. +The creature chasing me seems to absorb buildings into its body, growing larger and more powerful. + +Then there's a cut and I'm presumably inside one of those buildings. +I'm in a dark room with barely any lighting which looks somewhat like a large office. +It's very cluttered, though. +There's another similar room next to this one, separated by a glass wall and a door. +There's also a person with me who I seem to know, and that creature that chased me. +It seems like it managed to capture us. + +It dares us to escape from this situation, and as soon as it said that, the room begins to get locked off. +There are some red lights blinking and the door connecting our current room with the neighboring room is about to close permanently. +Panicked, I quickly run through it, but the other person couldn't make it. + +I suddenly realize I'm a cat and the other person an even smaller critter, I don't know what. +It's obvious that the creature is just playing with us, watching our futile efforts to escape for its amusement. + +The other person tries to get the door to open again by messing with its circuitry, and I do my best to block the creature's view from what was going on without looking suspicious. + +After a while, I start exploring the room and notice that there's a hallway in front of it, also separated by a glass wall and a door. +However, the wall is broken in one place and has a hole large enough for me to jump through. +So that's what I do. +I land in a bunch of glass disks lying on the floor, breaking them, but I'm unharmed. + +Now being a human again, I take a glass shard with me and run through a door which leads to a staircase. +It is huge, having the shape of a pill with stairs going along the edge. +The center is empty so I can see all the floors coming before and after. +There's no end in any direction. +I know the creature will come after me soon and so I run upwards as fast as I can. + +I made it about 5 floors when I hear a door burst open. +I quickly enter the room next to me, hoping that the creature hasn't seen me. + +This floor was very large and open and brightly lit. +The dream starts to make no sense anymore and that's it. diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 8bcf7c2..c20eca8 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -32,6 +32,7 @@ get_metadata() { --metadata content_dir="$CONTENT_DIR" \ --metadata output_dir="$OUTPUT_DIR" \ --metadata file_in="$1" \ + --metadata relative_to="$2" \ --metadata-file metadata/metadata.yaml \ --no-highlight \ --template scripts/metadata_tpl.json \ @@ -50,37 +51,32 @@ get_content() { --lua-filter scripts/metadata_filter.lua } -get_subpages_basedir() { - local filename=$1 - filename=${filename%.md} - if [ "${filename##*/}" = "index" ]; then - filename=${filename%/index} - fi - echo "$filename" -} - get_subpages_metadata() { - local base_dir_in=$(get_subpages_basedir "$1") + local base_dir_in=${1%/index.md} + local relative_to="$2" + if [ -z "$2" ]; then + relative_to="$1" + fi local child_pages=() if [ -d "$base_dir_in" ]; then mapfile -d $'\0' child_pages < <(find "$base_dir_in" \ -maxdepth 2 \ -type f \ - -name "*.md" \ + -wholename "$base_dir_in/*/index.md" \ ! -name "_*.md" \ - ! -wholename "$base_dir_in/index.md" \ - \( -wholename "$base_dir_in/*/index.md" -o ! -wholename "$base_dir_in/*/*.md" \) \ -print0) fi local pages="[]" + local sections="{}" for file_in in "${child_pages[@]}"; do + local section=$(basename "${file_in%/index.md}") local content=$(get_content "$file_in" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\\"/g') - local metadata=$(get_metadata "$file_in" | jq "{ \ file_out: .file_out, \ + url: .url, \ author: .author, \ title: .title, \ date: .date, \ @@ -88,11 +84,18 @@ get_subpages_metadata() { category: .category, \ content: \"$content\" \ } | del(.[] | nulls)") + local title=$(echo "$metadata" | jq ".title") + local subpages="[]" + + if [ -z "$2" ]; then + subpages=$(get_subpages_metadata "$file_in" "$1" | jq ".pages") + fi pages=$(echo "$pages" | jq ". += [ $metadata ]") + sections=$(echo "$sections" | jq ". += { \"$section\": { title: $title, pages: $subpages } }") done - echo "{ \"pages\": $pages }" + echo "{ \"pages\": $pages, \"sections\": $sections }" } handle () { diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 7823130..499cf3e 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -260,8 +260,14 @@ function Meta(meta) meta.file_out = get_file_out(meta.rewrites, meta.content_dir, meta.output_dir, meta.file_in) + if meta.relative_to == nil then + meta.relative_to = meta.file_in + end + meta.relative_to_out = get_file_out(meta.rewrites, meta.content_dir, + meta.output_dir, meta.relative_to) - meta.url = resolve_url(meta.site.url, meta.output_dir, meta.file_out, meta.file_out) + meta.url = resolve_url(meta.site.url, meta.output_dir, meta.relative_to_out, + meta.file_out) meta.date = format_date(meta.date) if meta.last_update ~= nil then @@ -276,14 +282,16 @@ function Meta(meta) if meta.page_type == "feed" then meta.page = pandoc.MetaMap({ - url = resolve_url(meta.site.url, meta.output_dir, meta.file_out, + url = resolve_url(meta.site.url, meta.output_dir, + meta.relative_to_out, meta.file_out:gsub("%.xml$", ".html")) }) end if meta.create_feed then meta.feed = pandoc.MetaMap({ - url = resolve_url(meta.site.url, meta.output_dir, meta.file_out, + url = resolve_url(meta.site.url, meta.output_dir, + meta.relative_to_out, meta.file_out:gsub("%.html$", ".xml")) }) end @@ -296,7 +304,8 @@ function Meta(meta) if meta.pages then local pages, categories = organize_subpages(meta.site.url, meta.output_dir, - meta.file_out, meta.pages) + meta.relative_to_out, + meta.pages) meta.pages = pages meta.categories = categories end diff --git a/templates/layouts/index.html b/templates/layouts/index.html index d39e70a..4163093 100644 --- a/templates/layouts/index.html +++ b/templates/layouts/index.html @@ -1,113 +1,95 @@
-
-
-
-

- - I'm a red fox in disguise. - -

-

- Hi, I'm Volpeon. I enjoy programming, creating vector art and designing user interfaces. -

-
-
+
+
+
+

+ + I'm a red fox in disguise. + +

+

+ Hi, I'm Volpeon. I enjoy programming, creating vector art and designing user interfaces. +

+
+
-
-
-
- $for(profiles)$ - $if(it.featured)$ - $if(it.url)$ - - $else$ - - $endif$ - $endif$ - $endfor$ -
+
+
+
+ $for(profiles)$ + $if(it.featured)$ + $if(it.url)$ + + $else$ + + $endif$ + $endif$ + $endfor$ +
$body$ -
-
-
+ +
+
-
-
- - - - - - - - Projects - - -
+
+
+ + + + + + + + $sections.projects.title$ + + +
-
- -
- Emojis - Blobfox -
- - - -
+
+ $for(sections.projects.pages)$ + +
+ $it.category.name$ + $it.title$ +
+ + + +
+ $endfor$ +
+
- -
- Emojis - BunHD -
- - - -
- - - -
- - +
diff --git a/templates/symbols.svg b/templates/symbols.svg index a5907e1..d884bc0 100644 --- a/templates/symbols.svg +++ b/templates/symbols.svg @@ -37,7 +37,7 @@ stroke="currentColor" /> - + -- cgit v1.2.3-54-g00ecf