diff options
author | Volpeon <git@volpeon.ink> | 2020-12-26 23:37:48 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2020-12-26 23:37:48 +0100 |
commit | afaa48b03c8d9dcbc7bbce47b94ec6bdd2da3502 (patch) | |
tree | 17c7e522f3d0c3fef647cf0a6daae03debbd8394 | |
parent | Improved SCSS structure, keep less glyphs in fonts (diff) | |
download | volpeon.ink-afaa48b03c8d9dcbc7bbce47b94ec6bdd2da3502.tar.gz volpeon.ink-afaa48b03c8d9dcbc7bbce47b94ec6bdd2da3502.tar.bz2 volpeon.ink-afaa48b03c8d9dcbc7bbce47b94ec6bdd2da3502.zip |
Improved CSS variable names, improved script variable names, added initial support for finding child pages
-rw-r--r-- | assets/css/_basics.scss | 32 | ||||
-rw-r--r-- | assets/css/_vars.scss | 64 | ||||
-rw-r--r-- | assets/css/components/_nav.scss | 20 | ||||
-rw-r--r-- | assets/css/components/_page-header.scss | 2 | ||||
-rw-r--r-- | assets/css/layouts/_container.scss | 14 | ||||
-rw-r--r-- | assets/css/scopes/_page.scss | 29 | ||||
-rw-r--r-- | content/blog/index.md | 4 | ||||
-rw-r--r-- | content/blog/test1.md | 0 | ||||
-rw-r--r-- | content/blog/test2/index.md | 0 | ||||
-rw-r--r-- | content/index.md | 4 | ||||
-rw-r--r-- | content/projects/index.md | 4 | ||||
-rw-r--r-- | metadata/metadata.json | 25 | ||||
-rw-r--r-- | metadata/metadata.yaml | 15 | ||||
-rwxr-xr-x | scripts/build_content.sh | 74 | ||||
-rwxr-xr-x | scripts/watch_content.sh | 10 | ||||
-rwxr-xr-x | scripts/watch_metadata.sh | 2 | ||||
-rwxr-xr-x | scripts/watch_sass.sh | 2 | ||||
-rwxr-xr-x | scripts/watch_templates.sh | 2 | ||||
-rw-r--r-- | templates/base.html | 4 |
19 files changed, 172 insertions, 135 deletions
diff --git a/assets/css/_basics.scss b/assets/css/_basics.scss index da971d4..9505cdd 100644 --- a/assets/css/_basics.scss +++ b/assets/css/_basics.scss | |||
@@ -13,8 +13,8 @@ | |||
13 | } | 13 | } |
14 | 14 | ||
15 | ::selection { | 15 | ::selection { |
16 | color: var(--select-fg); | 16 | color: var(--select--fg); |
17 | background-color: var(--select-bg); | 17 | background-color: var(--select--bg); |
18 | } | 18 | } |
19 | 19 | ||
20 | html, | 20 | html, |
@@ -38,14 +38,14 @@ body { | |||
38 | } | 38 | } |
39 | 39 | ||
40 | code { | 40 | code { |
41 | color: var(--code-fg); | 41 | color: var(--code--fg); |
42 | } | 42 | } |
43 | 43 | ||
44 | pre { | 44 | pre { |
45 | margin: 0; | 45 | margin: 0; |
46 | color: var(--code-block-fg); | 46 | color: var(--code-block--fg); |
47 | font-size: $code-block-font-size; | 47 | font-size: $code-block--font-size; |
48 | line-height: $code-block-line-height; | 48 | line-height: $code-block--line-height; |
49 | text-overflow: ""; | 49 | text-overflow: ""; |
50 | overflow: hidden; | 50 | overflow: hidden; |
51 | 51 | ||
@@ -68,13 +68,13 @@ ol { | |||
68 | 68 | ||
69 | li { | 69 | li { |
70 | position: relative; | 70 | position: relative; |
71 | padding-left: $subcontent-indent; | 71 | padding-left: $subcontent--indent; |
72 | 72 | ||
73 | &::before { | 73 | &::before { |
74 | position: absolute; | 74 | position: absolute; |
75 | display: inline-block; | 75 | display: inline-block; |
76 | width: $subcontent-indent; | 76 | width: $subcontent--indent; |
77 | margin-left: -1 * $subcontent-indent; | 77 | margin-left: -1 * $subcontent--indent; |
78 | color: var(--fg-minus); | 78 | color: var(--fg-minus); |
79 | } | 79 | } |
80 | } | 80 | } |
@@ -110,12 +110,12 @@ h3 { | |||
110 | h1 { | 110 | h1 { |
111 | text-transform: uppercase; | 111 | text-transform: uppercase; |
112 | font-size: 1em; | 112 | font-size: 1em; |
113 | color: var(--heading-fg); | 113 | color: var(--heading--fg); |
114 | } | 114 | } |
115 | 115 | ||
116 | h2 { | 116 | h2 { |
117 | font-size: 1em; | 117 | font-size: 1em; |
118 | color: var(--heading-fg); | 118 | color: var(--heading--fg); |
119 | } | 119 | } |
120 | 120 | ||
121 | h3 { | 121 | h3 { |
@@ -133,17 +133,17 @@ p { | |||
133 | z-index: 1000; | 133 | z-index: 1000; |
134 | padding: 0.2em 0.3em; | 134 | padding: 0.2em 0.3em; |
135 | margin: 0 -0.3em; | 135 | margin: 0 -0.3em; |
136 | color: var(--link-idle-fg); | 136 | color: var(--link--idle--fg); |
137 | 137 | ||
138 | &:hover { | 138 | &:hover { |
139 | background-color: var(--link-hover-bg); | 139 | background-color: var(--link--hover--bg); |
140 | color: var(--link-hover-fg); | 140 | color: var(--link--hover--fg); |
141 | text-decoration: none; | 141 | text-decoration: none; |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | :visited { | 145 | :visited { |
146 | color: var(--link-visited-fg); | 146 | color: var(--link--visited--fg); |
147 | } | 147 | } |
148 | 148 | ||
149 | hr { | 149 | hr { |
@@ -156,6 +156,6 @@ hr { | |||
156 | blockquote { | 156 | blockquote { |
157 | position: relative; | 157 | position: relative; |
158 | margin: ($line-height * 1em) 0 0; | 158 | margin: ($line-height * 1em) 0 0; |
159 | padding-left: calc(#{$subcontent-indent} - 2px); | 159 | padding-left: calc(#{$subcontent--indent} - 2px); |
160 | border-left: 2px solid var(--bg-plus); | 160 | border-left: 2px solid var(--bg-plus); |
161 | } | 161 | } |
diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss index c061f4f..96e56c6 100644 --- a/assets/css/_vars.scss +++ b/assets/css/_vars.scss | |||
@@ -1,27 +1,27 @@ | |||
1 | $font-size: 17px; | 1 | $font-size: 17px; |
2 | $nav-font-size: $font-size - 1; | ||
3 | $code-block-font-size: $font-size - 1; | ||
4 | $content-h1-font-size: $font-size + 1; | ||
5 | |||
6 | $line-height: 1.5; | 2 | $line-height: 1.5; |
7 | $code-block-line-height: 1.4; | ||
8 | 3 | ||
9 | $content-width: 80ch; | 4 | $code-block--font-size: $font-size - 1; |
5 | $code-block--line-height: 1.4; | ||
6 | |||
7 | $content--width: 80ch; | ||
8 | $content--h1--font-size: $font-size + 1; | ||
10 | 9 | ||
11 | $container-pad-h: 2rem; | 10 | $subcontent--indent: 4ch; |
12 | $container-pad-h-sm: 1rem; | ||
13 | $container-pad-v: $line-height * 2rem; | ||
14 | 11 | ||
15 | $nav-item-spacing: 4ch; | 12 | $container--pad-h: 2rem; |
16 | $nav-item-spacing-sm: 3ch; | 13 | $container--pad-h-sm: 1rem; |
17 | $nav-item-pad-h: 1ch; | 14 | $container--pad-v: $line-height * 2rem; |
18 | $nav-item-pad-v: 1em; | ||
19 | 15 | ||
20 | $page-item-prefix-max-chars: 3ch; | 16 | $nav--font-size: $font-size - 1; |
21 | $page-item-prefix-pad: 2ch; | 17 | $nav--item--spacing: 4ch; |
22 | $page-item-prefix-width: $page-item-prefix-max-chars + $page-item-prefix-pad; | 18 | $nav--item--spacing-sm: 3ch; |
19 | $nav--item--pad-h: 1ch; | ||
20 | $nav--item--pad-v: 1em; | ||
23 | 21 | ||
24 | $subcontent-indent: 4ch; | 22 | $page--item-prefix--max-chars: 3ch; |
23 | $page--item-prefix--pad: 2ch; | ||
24 | $page--item-prefix--width: $page--item-prefix--max-chars + $page--item-prefix--pad; | ||
25 | 25 | ||
26 | $breakpoints: ( | 26 | $breakpoints: ( |
27 | xs: 380px, | 27 | xs: 380px, |
@@ -45,24 +45,24 @@ $breakpoints: ( | |||
45 | --fg-plus: var(--gray5); | 45 | --fg-plus: var(--gray5); |
46 | --fg-plus-2: var(--gray6); | 46 | --fg-plus-2: var(--gray6); |
47 | 47 | ||
48 | --heading-fg: var(--fg-plus-2); | 48 | --heading--fg: var(--fg-plus-2); |
49 | 49 | ||
50 | --select-bg: hsla(270, 2%, 100%, 0.996); | 50 | --select--bg: hsla(270, 2%, 100%, 0.996); |
51 | --select-fg: var(--bg-minus); | 51 | --select--fg: var(--bg-minus); |
52 | 52 | ||
53 | --code-fg: var(--fg-minus); | 53 | --code--fg: var(--fg-minus); |
54 | --code-block-fg: var(--fg-minus); | 54 | --code-block--fg: var(--fg-minus); |
55 | 55 | ||
56 | --page-item-prefix-fg: var(--fg-minus); | 56 | --page--item-prefix--fg: var(--fg-minus); |
57 | 57 | ||
58 | --link-idle-fg: var(--fg-plus-2); //#90acf2; | 58 | --link--idle--fg: var(--fg-plus-2); //#90acf2; |
59 | --link-visited-fg: var(--fg-plus); //#bc9df2; | 59 | --link--visited--fg: var(--fg-plus); //#bc9df2; |
60 | --link-hover-bg: var(--fg-plus-2); | 60 | --link--hover--bg: var(--fg-plus-2); |
61 | --link-hover-fg: var(--bg-minus); | 61 | --link--hover--fg: var(--bg-minus); |
62 | 62 | ||
63 | --nav-bg: var(--bg-minus); | 63 | --nav--bg: var(--bg-minus); |
64 | --nav-logo-fg: var(--fg-minus); | 64 | --nav--logo--fg: var(--fg-minus); |
65 | --nav-item-idle-fg: var(--fg); | 65 | --nav--item--idle--fg: var(--fg); |
66 | --nav-item-hover-fg: var(--fg-plus-2); | 66 | --nav--item--hover--fg: var(--fg-plus-2); |
67 | --nav-item-active-fg: var(--fg-plus-2); | 67 | --nav--item--active--fg: var(--fg-plus-2); |
68 | } | 68 | } |
diff --git a/assets/css/components/_nav.scss b/assets/css/components/_nav.scss index 7f5eb19..a3f7004 100644 --- a/assets/css/components/_nav.scss +++ b/assets/css/components/_nav.scss | |||
@@ -1,6 +1,6 @@ | |||
1 | .c-nav { | 1 | .c-nav { |
2 | background-color: var(--nav-bg); | 2 | background-color: var(--nav--bg); |
3 | font-size: $nav-font-size; | 3 | font-size: $nav--font-size; |
4 | 4 | ||
5 | &__items { | 5 | &__items { |
6 | display: flex; | 6 | display: flex; |
@@ -10,15 +10,15 @@ | |||
10 | &__logo { | 10 | &__logo { |
11 | display: inline-block; | 11 | display: inline-block; |
12 | margin: 0; | 12 | margin: 0; |
13 | padding: $nav-item-pad-v 0; | 13 | padding: $nav--item--pad-v 0; |
14 | color: var(--nav-logo-fg); | 14 | color: var(--nav--logo--fg); |
15 | text-decoration: none; | 15 | text-decoration: none; |
16 | 16 | ||
17 | &:link, | 17 | &:link, |
18 | &:visited { | 18 | &:visited { |
19 | &:hover { | 19 | &:hover { |
20 | background-color: transparent; | 20 | background-color: transparent; |
21 | color: var(--nav-item-hover-fg); | 21 | color: var(--nav--item--hover--fg); |
22 | font-weight: bold; | 22 | font-weight: bold; |
23 | } | 23 | } |
24 | } | 24 | } |
@@ -26,22 +26,22 @@ | |||
26 | 26 | ||
27 | &__item { | 27 | &__item { |
28 | display: inline-block; | 28 | display: inline-block; |
29 | padding: $nav-item-pad-v $nav-item-pad-h calc(#{$nav-item-pad-v} - 2px); | 29 | padding: $nav--item--pad-v $nav--item--pad-h calc(#{$nav--item--pad-v} - 2px); |
30 | margin: 0 (-1 * $nav-item-pad-h) 0 ($nav-item-spacing - $nav-item-pad-h); | 30 | margin: 0 (-1 * $nav--item--pad-h) 0 ($nav--item--spacing - $nav--item--pad-h); |
31 | color: var(--nav-item-idle-fg); | 31 | color: var(--nav--item--idle--fg); |
32 | text-decoration: none; | 32 | text-decoration: none; |
33 | border-bottom: 2px solid transparent; | 33 | border-bottom: 2px solid transparent; |
34 | 34 | ||
35 | &:hover { | 35 | &:hover { |
36 | background-color: transparent; | 36 | background-color: transparent; |
37 | color: var(--nav-item-hover-fg); | 37 | color: var(--nav--item--hover--fg); |
38 | font-weight: bold; | 38 | font-weight: bold; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | @media (max-width: map-get($breakpoints, "sm")) { | 42 | @media (max-width: map-get($breakpoints, "sm")) { |
43 | &__item { | 43 | &__item { |
44 | margin-left: $nav-item-spacing-sm - $nav-item-pad-h; | 44 | margin-left: $nav--item--spacing-sm - $nav--item--pad-h; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
diff --git a/assets/css/components/_page-header.scss b/assets/css/components/_page-header.scss index ada20ab..dd273df 100644 --- a/assets/css/components/_page-header.scss +++ b/assets/css/components/_page-header.scss | |||
@@ -12,6 +12,6 @@ | |||
12 | padding-top: px-to-em(2px); | 12 | padding-top: px-to-em(2px); |
13 | color: var(--fg-minus); | 13 | color: var(--fg-minus); |
14 | border-top: 1px solid var(--fg-minus); | 14 | border-top: 1px solid var(--fg-minus); |
15 | line-height: $code-block-line-height; | 15 | line-height: $code-block--line-height; |
16 | } | 16 | } |
17 | } | 17 | } |
diff --git a/assets/css/layouts/_container.scss b/assets/css/layouts/_container.scss index 7f6e292..eb71070 100644 --- a/assets/css/layouts/_container.scss +++ b/assets/css/layouts/_container.scss | |||
@@ -1,20 +1,20 @@ | |||
1 | .l-container { | 1 | .l-container { |
2 | padding-left: $container-pad-h; | 2 | padding-left: $container--pad-h; |
3 | padding-right: $container-pad-h; | 3 | padding-right: $container--pad-h; |
4 | 4 | ||
5 | &--content { | 5 | &--content { |
6 | margin-left: auto; | 6 | margin-left: auto; |
7 | margin-right: auto; | 7 | margin-right: auto; |
8 | max-width: $content-width; | 8 | max-width: $content--width; |
9 | } | 9 | } |
10 | 10 | ||
11 | &--pad-v { | 11 | &--pad-v { |
12 | padding-top: $container-pad-v; | 12 | padding-top: $container--pad-v; |
13 | padding-bottom: $container-pad-v; | 13 | padding-bottom: $container--pad-v; |
14 | } | 14 | } |
15 | 15 | ||
16 | @media (max-width: map-get($breakpoints, "sm")) { | 16 | @media (max-width: map-get($breakpoints, "sm")) { |
17 | padding-left: $container-pad-h-sm; | 17 | padding-left: $container--pad-h-sm; |
18 | padding-right: $container-pad-h-sm; | 18 | padding-right: $container--pad-h-sm; |
19 | } | 19 | } |
20 | } | 20 | } |
diff --git a/assets/css/scopes/_page.scss b/assets/css/scopes/_page.scss index cdbdeb4..7c9e2d4 100644 --- a/assets/css/scopes/_page.scss +++ b/assets/css/scopes/_page.scss | |||
@@ -1,6 +1,6 @@ | |||
1 | .s-page { | 1 | .s-page { |
2 | &__content { | 2 | &__content { |
3 | padding-left: $page-item-prefix-width; | 3 | padding-left: $page--item-prefix--width; |
4 | 4 | ||
5 | > :first-child { | 5 | > :first-child { |
6 | margin-top: 0; | 6 | margin-top: 0; |
@@ -13,28 +13,28 @@ | |||
13 | .c-refs__item, | 13 | .c-refs__item, |
14 | pre { | 14 | pre { |
15 | position: relative; | 15 | position: relative; |
16 | margin-left: -1 * $page-item-prefix-width; | 16 | margin-left: -1 * $page--item-prefix--width; |
17 | padding-left: $page-item-prefix-width; | 17 | padding-left: $page--item-prefix--width; |
18 | 18 | ||
19 | &::before { | 19 | &::before { |
20 | position: absolute; | 20 | position: absolute; |
21 | box-sizing: border-box; | 21 | box-sizing: border-box; |
22 | display: inline-block; | 22 | display: inline-block; |
23 | margin-left: -1 * $page-item-prefix-width; | 23 | margin-left: -1 * $page--item-prefix--width; |
24 | padding-right: $page-item-prefix-pad; | 24 | padding-right: $page--item-prefix--pad; |
25 | width: $page-item-prefix-width; | 25 | width: $page--item-prefix--width; |
26 | color: var(--page-item-prefix-fg); | 26 | color: var(--page--item-prefix--fg); |
27 | font-weight: normal; | 27 | font-weight: normal; |
28 | text-align: right; | 28 | text-align: right; |
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | h1 { | 32 | h1 { |
33 | font-size: px-to-em($content-h1-font-size); | 33 | font-size: px-to-em($content--h1--font-size); |
34 | 34 | ||
35 | &::before { | 35 | &::before { |
36 | content: "#"; | 36 | content: "#"; |
37 | font-size: px-to-em($font-size, $content-h1-font-size); | 37 | font-size: px-to-em($font-size, $content--h1--font-size); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
@@ -54,22 +54,21 @@ | |||
54 | &::before { | 54 | &::before { |
55 | content: str-repeat("``\A", 40); | 55 | content: str-repeat("``\A", 40); |
56 | height: 100%; | 56 | height: 100%; |
57 | color: var(--page-item-prefix-fg); | 57 | color: var(--page--item-prefix--fg); |
58 | overflow: hidden; | 58 | overflow: hidden; |
59 | line-height: $code-block-line-height; | ||
60 | } | 59 | } |
61 | } | 60 | } |
62 | 61 | ||
63 | hr { | 62 | hr { |
64 | margin-left: -1 * $page-item-prefix-width; | 63 | margin-left: -1 * $page--item-prefix--width; |
65 | } | 64 | } |
66 | 65 | ||
67 | .c-page-header { | 66 | .c-page-header { |
68 | margin-left: -1 * $page-item-prefix-width; | 67 | margin-left: -1 * $page--item-prefix--width; |
69 | padding-left: $page-item-prefix-width; | 68 | padding-left: $page--item-prefix--width; |
70 | 69 | ||
71 | &::after { | 70 | &::after { |
72 | margin-left: -1 * $page-item-prefix-width; | 71 | margin-left: -1 * $page--item-prefix--width; |
73 | } | 72 | } |
74 | } | 73 | } |
75 | 74 | ||
diff --git a/content/blog/index.md b/content/blog/index.md index 486c57b..d6de86f 100644 --- a/content/blog/index.md +++ b/content/blog/index.md | |||
@@ -1,6 +1,6 @@ | |||
1 | --- | 1 | --- |
2 | id: "blog" | 2 | id: blog |
3 | title: "Blog" | 3 | title: Blog |
4 | --- | 4 | --- |
5 | 5 | ||
6 | # Blog | 6 | # Blog |
diff --git a/content/blog/test1.md b/content/blog/test1.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/blog/test1.md | |||
diff --git a/content/blog/test2/index.md b/content/blog/test2/index.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/content/blog/test2/index.md | |||
diff --git a/content/index.md b/content/index.md index 403eab5..d7ee4f8 100644 --- a/content/index.md +++ b/content/index.md | |||
@@ -1,6 +1,6 @@ | |||
1 | --- | 1 | --- |
2 | id: "home" | 2 | id: home |
3 | title: "Home" | 3 | title: Home |
4 | 4 | ||
5 | isHome: true | 5 | isHome: true |
6 | --- | 6 | --- |
diff --git a/content/projects/index.md b/content/projects/index.md index bc6204f..da34c2d 100644 --- a/content/projects/index.md +++ b/content/projects/index.md | |||
@@ -1,6 +1,6 @@ | |||
1 | --- | 1 | --- |
2 | id: "projects" | 2 | id: projects |
3 | title: "Projects" | 3 | title: Projects |
4 | --- | 4 | --- |
5 | 5 | ||
6 | # Projects | 6 | # Projects |
diff --git a/metadata/metadata.json b/metadata/metadata.json deleted file mode 100644 index b53ac32..0000000 --- a/metadata/metadata.json +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | { | ||
2 | "site": { | ||
3 | "title": "Volpeon's Den", | ||
4 | "logo": "\\\\\\\\/" | ||
5 | }, | ||
6 | "menus": { | ||
7 | "main": [ | ||
8 | { | ||
9 | "id": "home", | ||
10 | "label": "Home", | ||
11 | "url": "/" | ||
12 | }, | ||
13 | { | ||
14 | "id": "blog", | ||
15 | "label": "Blog", | ||
16 | "url": "/blog/" | ||
17 | }, | ||
18 | { | ||
19 | "id": "projects", | ||
20 | "label": "Projects", | ||
21 | "url": "/projects/" | ||
22 | } | ||
23 | ] | ||
24 | } | ||
25 | } | ||
diff --git a/metadata/metadata.yaml b/metadata/metadata.yaml new file mode 100644 index 0000000..773f155 --- /dev/null +++ b/metadata/metadata.yaml | |||
@@ -0,0 +1,15 @@ | |||
1 | site: | ||
2 | title: Volpeon's Den | ||
3 | logo: \\\\/ | ||
4 | |||
5 | menus: | ||
6 | main: | ||
7 | - id: home | ||
8 | label: Home | ||
9 | url: / | ||
10 | - id: blog | ||
11 | label: Blog | ||
12 | url: /blog/ | ||
13 | - id: projects | ||
14 | label: Projects | ||
15 | url: /projects/ | ||
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 6b50cd8..1344be1 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | target () { | 3 | target_filename () { |
4 | if [ "${1#*.}" = "md" ]; then | 4 | if [ "${1#*.}" = "md" ]; then |
5 | echo "output/$(echo "${1%.md}.html" | cut -sd / -f 2-)" | 5 | echo "output/$(echo "${1%.md}.html" | cut -sd / -f 2-)" |
6 | else | 6 | else |
@@ -8,40 +8,88 @@ target () { | |||
8 | fi | 8 | fi |
9 | } | 9 | } |
10 | 10 | ||
11 | get_subpages_basedir() { | ||
12 | filename=$(basename "$1") | ||
13 | if [ "$filename" = "index.md" ]; then | ||
14 | dirname "$1" | ||
15 | else | ||
16 | echo "${1%.md}" | ||
17 | fi | ||
18 | } | ||
19 | |||
20 | get_subpages() { | ||
21 | basedir=$(get_subpages_basedir "$1") | ||
22 | child_pages=() | ||
23 | |||
24 | if [ -d "$basedir" ]; then | ||
25 | mapfile -d $'\0' child_pages_1 < <(find $basedir/ \ | ||
26 | -type f \ | ||
27 | -name "*.md" ! -name "index.md" \ | ||
28 | -maxdepth 1 \ | ||
29 | -print0) | ||
30 | |||
31 | mapfile -d $'\0' child_pages_2 < <(find $basedir/ \ | ||
32 | -type f \ | ||
33 | -name "index.md" \ | ||
34 | -mindepth 2 \ | ||
35 | -maxdepth 2 \ | ||
36 | -print0) | ||
37 | |||
38 | child_pages=("${child_pages_1[@]}" "${child_pages_2[@]}") | ||
39 | fi | ||
40 | |||
41 | if [ ${#child_pages[@]} -ne 0 ]; then | ||
42 | echo -e "\033[0;90m[////////]\033[0m Child pages:" | ||
43 | |||
44 | for file in "${child_pages[@]}"; do | ||
45 | echo -e "\033[0;90m[////////]\033[0m - $file" | ||
46 | done | ||
47 | fi | ||
48 | } | ||
49 | |||
11 | handle () { | 50 | handle () { |
12 | TARGET=$(target "$1") | 51 | target=$(target_filename "$1") |
13 | mkdir -p $(dirname "$TARGET") | 52 | mkdir -p $(dirname "$target") |
14 | 53 | ||
15 | if [ "${1#*.}" = "md" ]; then | 54 | if [ "${1#*.}" = "md" ]; then |
16 | echo -e "\033[0;32m[COMPILE ]\033[0m $1 -> $TARGET" | 55 | echo -e "\033[0;32m[COMPILE ]\033[0m $1 -> $target" |
56 | |||
57 | subpages_meta=$(mktemp) | ||
58 | |||
59 | # $(get_subpages "$1") > "$subpages_meta" | ||
60 | |||
61 | get_subpages "$1" | ||
17 | 62 | ||
18 | pandoc "$1" \ | 63 | pandoc "$1" \ |
19 | -f markdown \ | 64 | -f markdown \ |
20 | -t html5 \ | 65 | -t html5 \ |
21 | --template templates/base.html \ | 66 | --template templates/base.html \ |
22 | -o "$TARGET" \ | 67 | -o "$target" \ |
23 | --metadata-file metadata/metadata.json | 68 | --metadata-file metadata/metadata.yaml \ |
69 | --metadata-file "$subpages_meta" | ||
70 | |||
71 | rm "$subpages_meta" | ||
24 | else | 72 | else |
25 | echo -e "\033[0;32m[COPY ]\033[0m $1 -> $TARGET" | 73 | echo -e "\033[0;32m[COPY ]\033[0m $1 -> $target" |
26 | 74 | ||
27 | cp "$1" "$TARGET" | 75 | cp "$1" "$target" |
28 | fi | 76 | fi |
29 | } | 77 | } |
30 | 78 | ||
31 | if [ -z "$1" ]; then | 79 | if [ -z "$1" ]; then |
32 | find content/ \ | 80 | find content/ \ |
33 | -type f \ | 81 | -type f \ |
34 | | while read FILE | 82 | | while read file |
35 | do | 83 | do |
36 | handle "$FILE" | 84 | handle "$file" |
37 | done | 85 | done |
38 | elif [ "$1" = "all_md" ]; then | 86 | elif [ "$1" = "all_md" ]; then |
39 | find content/ \ | 87 | find content/ \ |
40 | -type f \ | 88 | -type f \ |
41 | -name "*.md" \ | 89 | -name "*.md" \ |
42 | | while read FILE | 90 | | while read file |
43 | do | 91 | do |
44 | handle "$FILE" | 92 | handle "$file" |
45 | done | 93 | done |
46 | elif [ "$1" = "single" ]; then | 94 | elif [ "$1" = "single" ]; then |
47 | if [ -z "$2" ]; then | 95 | if [ -z "$2" ]; then |
@@ -53,7 +101,7 @@ elif [ "$1" = "delete" ]; then | |||
53 | if [ -z "$2" ]; then | 101 | if [ -z "$2" ]; then |
54 | echo -e "\033[0;31m[ERROR ]\033[0m \"delete\" operation requires file argument" | 102 | echo -e "\033[0;31m[ERROR ]\033[0m \"delete\" operation requires file argument" |
55 | else | 103 | else |
56 | TARGET=$(target "$2") | 104 | TARGET=$(target_filename "$2") |
57 | echo -e "\033[0;32m[DELETE ]\033[0m $2 -> $TARGET" | 105 | echo -e "\033[0;32m[DELETE ]\033[0m $2 -> $TARGET" |
58 | rm -rf $TARGET | 106 | rm -rf $TARGET |
59 | fi | 107 | fi |
diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index 769f2c5..f0d1b42 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh | |||
@@ -1,11 +1,11 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -qrme close_write,delete,move --format "%w%f" content \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" content \ |
4 | | while read FILENAME | 4 | | while read file |
5 | do | 5 | do |
6 | if [ -f "$FILENAME" ]; then | 6 | if [ -f "$file" ]; then |
7 | scripts/build_content.sh "single" "$FILENAME" | 7 | scripts/build_content.sh "single" "$file" |
8 | elif [ ! -d "$FILENAME" ]; then | 8 | elif [ ! -d "$file" ]; then |
9 | scripts/build_content.sh "delete" "$FILENAME" | 9 | scripts/build_content.sh "delete" "$file" |
10 | fi | 10 | fi |
11 | done | 11 | done |
diff --git a/scripts/watch_metadata.sh b/scripts/watch_metadata.sh index 41457e1..780177e 100755 --- a/scripts/watch_metadata.sh +++ b/scripts/watch_metadata.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -qrme close_write,delete,move --format "%w%f" metadata \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" metadata \ |
4 | | while read FILENAME | 4 | | while read file |
5 | do | 5 | do |
6 | scripts/build_content.sh "all_md" | 6 | scripts/build_content.sh "all_md" |
7 | done | 7 | done |
diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index a5649e7..d451135 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -qrme close_write,delete,move --format "%w%f" assets \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" assets \ |
4 | | while read FILENAME | 4 | | while read file |
5 | do | 5 | do |
6 | scripts/build_sass.sh | 6 | scripts/build_sass.sh |
7 | done | 7 | done |
diff --git a/scripts/watch_templates.sh b/scripts/watch_templates.sh index 3482ac6..9b464d4 100755 --- a/scripts/watch_templates.sh +++ b/scripts/watch_templates.sh | |||
@@ -1,7 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -qrme close_write,delete,move --format "%w%f" templates \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" templates \ |
4 | | while read FILENAME | 4 | | while read file |
5 | do | 5 | do |
6 | scripts/build_content.sh "all_md" | 6 | scripts/build_content.sh "all_md" |
7 | done | 7 | done |
diff --git a/templates/base.html b/templates/base.html index cecb657..9bc4de9 100644 --- a/templates/base.html +++ b/templates/base.html | |||
@@ -21,8 +21,8 @@ | |||
21 | <style> | 21 | <style> |
22 | .c-nav__item--$id$ { | 22 | .c-nav__item--$id$ { |
23 | font-weight: bold; | 23 | font-weight: bold; |
24 | color: var(--nav-item-active-fg); | 24 | color: var(--nav--item--active--fg); |
25 | border-bottom-color: var(--nav-item-active-fg); | 25 | border-color: var(--nav--item--active--fg); |
26 | } | 26 | } |
27 | </style> | 27 | </style> |
28 | $endif$ | 28 | $endif$ |