diff options
| -rw-r--r-- | assets/css/_basics.scss | 4 | ||||
| -rw-r--r-- | assets/css/components/_page-header.scss | 5 | ||||
| -rw-r--r-- | assets/css/components/_page.scss | 7 | ||||
| -rw-r--r-- | assets/css/scopes/_code.scss | 22 | ||||
| -rw-r--r-- | assets/css/style.scss | 1 | ||||
| -rw-r--r-- | content/blog/test2/index.md (renamed from content/blog/test2/_index.md) | 0 | ||||
| -rw-r--r-- | content/index.md | 15 | ||||
| -rw-r--r-- | filters/common_actions.lua | 45 | ||||
| -rw-r--r-- | filters/element_classes.lua | 15 | ||||
| -rw-r--r-- | filters/macros.lua | 23 | ||||
| -rwxr-xr-x | scripts/build_content.sh | 6 | ||||
| -rw-r--r-- | templates/base.html | 9 | ||||
| -rw-r--r-- | templates/partials/pageHeader.html | 2 | ||||
| -rw-r--r-- | templates/partials/pageHeaderSm.html | 2 |
14 files changed, 112 insertions, 44 deletions
diff --git a/assets/css/_basics.scss b/assets/css/_basics.scss index 0b785d5..05d2974 100644 --- a/assets/css/_basics.scss +++ b/assets/css/_basics.scss | |||
| @@ -44,8 +44,8 @@ code { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | pre { | 46 | pre { |
| 47 | margin: 0; | 47 | margin: ($line-height * 1em) 0 0; |
| 48 | overflow: hidden; | 48 | overflow-x: auto; |
| 49 | color: var(--code-block--fg); | 49 | color: var(--code-block--fg); |
| 50 | font-size: $code-block--font-size; | 50 | font-size: $code-block--font-size; |
| 51 | line-height: $code-block--line-height; | 51 | line-height: $code-block--line-height; |
diff --git a/assets/css/components/_page-header.scss b/assets/css/components/_page-header.scss index 7cf2aa1..e97aaf7 100644 --- a/assets/css/components/_page-header.scss +++ b/assets/css/components/_page-header.scss | |||
| @@ -18,6 +18,11 @@ | |||
| 18 | line-height: $code-block--line-height; | 18 | line-height: $code-block--line-height; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | &__pre { | ||
| 22 | margin-top: 0; | ||
| 23 | overflow: hidden; | ||
| 24 | } | ||
| 25 | |||
| 21 | @media (max-width: map-get($breakpoints, 'sm')) { | 26 | @media (max-width: map-get($breakpoints, 'sm')) { |
| 22 | margin-left: 0; | 27 | margin-left: 0; |
| 23 | padding-left: 0; | 28 | padding-left: 0; |
diff --git a/assets/css/components/_page.scss b/assets/css/components/_page.scss index 21969d7..c9a4650 100644 --- a/assets/css/components/_page.scss +++ b/assets/css/components/_page.scss | |||
| @@ -7,6 +7,11 @@ | |||
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | &__code { | ||
| 11 | padding-left: calc(#{$subcontent--indent} - 2px); | ||
| 12 | border-left: 2px solid var(--obj); | ||
| 13 | } | ||
| 14 | |||
| 10 | &__prefixed { | 15 | &__prefixed { |
| 11 | position: relative; | 16 | position: relative; |
| 12 | margin-left: -1 * $page--item-prefix--width; | 17 | margin-left: -1 * $page--item-prefix--width; |
| @@ -44,9 +49,9 @@ | |||
| 44 | &--pre { | 49 | &--pre { |
| 45 | $scale-factor: $font-size / $code-block--font-size; | 50 | $scale-factor: $font-size / $code-block--font-size; |
| 46 | 51 | ||
| 47 | margin-top: $line-height * 1em; | ||
| 48 | // margin-left: calc(#{-1 * $page--item-prefix--width} * #{$scale-factor}); | 52 | // margin-left: calc(#{-1 * $page--item-prefix--width} * #{$scale-factor}); |
| 49 | // padding-left: calc(#{$page--item-prefix--width} * #{$scale-factor}); | 53 | // padding-left: calc(#{$page--item-prefix--width} * #{$scale-factor}); |
| 54 | border-left: 0; | ||
| 50 | 55 | ||
| 51 | &::before { | 56 | &::before { |
| 52 | content: str-repeat('``\A', 40); | 57 | content: str-repeat('``\A', 40); |
diff --git a/assets/css/scopes/_code.scss b/assets/css/scopes/_code.scss new file mode 100644 index 0000000..cdc9425 --- /dev/null +++ b/assets/css/scopes/_code.scss | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | .s-code { | ||
| 2 | pre { | ||
| 3 | overflow-x: auto; | ||
| 4 | color: var(--fg-lo); | ||
| 5 | font-size: 1em; | ||
| 6 | line-height: $line-height; | ||
| 7 | } | ||
| 8 | |||
| 9 | .c { | ||
| 10 | color: var(--fg-hi); | ||
| 11 | } | ||
| 12 | |||
| 13 | .nt, | ||
| 14 | .kt, | ||
| 15 | .k, | ||
| 16 | .kr, | ||
| 17 | .o, | ||
| 18 | .si, | ||
| 19 | .p { | ||
| 20 | color: var(--fg); | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/assets/css/style.scss b/assets/css/style.scss index 7986bd9..e89cbd6 100644 --- a/assets/css/style.scss +++ b/assets/css/style.scss | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | @import 'layouts/container'; | 11 | @import 'layouts/container'; |
| 12 | 12 | ||
| 13 | @import 'scopes/code'; | ||
| 13 | @import 'scopes/page'; | 14 | @import 'scopes/page'; |
| 14 | 15 | ||
| 15 | @import 'utils'; | 16 | @import 'utils'; |
diff --git a/content/blog/test2/_index.md b/content/blog/test2/index.md index 9d1ebd2..9d1ebd2 100644 --- a/content/blog/test2/_index.md +++ b/content/blog/test2/index.md | |||
diff --git a/content/index.md b/content/index.md index 8c49e44..3d2462c 100644 --- a/content/index.md +++ b/content/index.md | |||
| @@ -12,6 +12,21 @@ Welcome to my website! I'm Volpeon and here's an [inline link](#c). | |||
| 12 | 12 | ||
| 13 | Welcome to my website! I'm Volpeon and here's an [inline link](#d). | 13 | Welcome to my website! I'm Volpeon and here's an [inline link](#d). |
| 14 | 14 | ||
| 15 | ```lua | ||
| 16 | function Header(el) | ||
| 17 | if el.level == 1 then | ||
| 18 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h1'} | ||
| 19 | elseif el.level == 2 then | ||
| 20 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h2'} | ||
| 21 | elseif el.level == 3 then | ||
| 22 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h3'} | ||
| 23 | end | ||
| 24 | return el | ||
| 25 | end | ||
| 26 | ``` | ||
| 27 | |||
| 28 | Welcome to my website! I'm Volpeon and here's an [inline link](#e). | ||
| 29 | |||
| 15 | ## Subtitle | 30 | ## Subtitle |
| 16 | 31 | ||
| 17 | ### Last one | 32 | ### Last one |
diff --git a/filters/common_actions.lua b/filters/common_actions.lua new file mode 100644 index 0000000..1d13e3a --- /dev/null +++ b/filters/common_actions.lua | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | function CodeBlock(el) | ||
| 2 | if next(el.classes) == nil then | ||
| 3 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--pre'} | ||
| 4 | else | ||
| 5 | local formatted = pandoc.pipe('pygmentize', {'-l', el.classes[1], '-f', 'html', '-O', 'cssclass=c-page__code s-code'}, el.text) | ||
| 6 | el = pandoc.RawBlock('html', formatted) | ||
| 7 | end | ||
| 8 | |||
| 9 | return el | ||
| 10 | end | ||
| 11 | |||
| 12 | function Header(el) | ||
| 13 | if el.level == 1 then | ||
| 14 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h1'} | ||
| 15 | elseif el.level == 2 then | ||
| 16 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h2'} | ||
| 17 | elseif el.level == 3 then | ||
| 18 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--h3'} | ||
| 19 | end | ||
| 20 | return el | ||
| 21 | end | ||
| 22 | |||
| 23 | function Div(el) | ||
| 24 | if el.attributes.macro == nil then | ||
| 25 | return el | ||
| 26 | end | ||
| 27 | |||
| 28 | if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then | ||
| 29 | local newchildren = pandoc.List() | ||
| 30 | |||
| 31 | newchildren:insert(pandoc.RawBlock('html', '<ul>')) | ||
| 32 | |||
| 33 | for k, children in ipairs(el.content[1].content) do | ||
| 34 | newchildren:insert(pandoc.RawBlock('html', '<li class="c-page__prefixed c-page__prefixed--ref">')) | ||
| 35 | newchildren:extend(children) | ||
| 36 | newchildren:insert(pandoc.RawBlock('html', '</li>')) | ||
| 37 | end | ||
| 38 | |||
| 39 | newchildren:insert(pandoc.RawBlock('html', '</ul>')) | ||
| 40 | |||
| 41 | el.content = newchildren | ||
| 42 | end | ||
| 43 | |||
| 44 | return el.content | ||
| 45 | end | ||
diff --git a/filters/element_classes.lua b/filters/element_classes.lua deleted file mode 100644 index 643ff75..0000000 --- a/filters/element_classes.lua +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | function CodeBlock(el) | ||
| 2 | el.attributes.class = 'c-page__prefixed c-page__prefixed--pre' | ||
| 3 | return el | ||
| 4 | end | ||
| 5 | |||
| 6 | function Header(el) | ||
| 7 | if el.level == 1 then | ||
| 8 | el.attributes.class = 'c-page__prefixed c-page__prefixed--h1' | ||
| 9 | elseif el.level == 2 then | ||
| 10 | el.attributes.class = 'c-page__prefixed c-page__prefixed--h2' | ||
| 11 | elseif el.level == 3 then | ||
| 12 | el.attributes.class = 'c-page__prefixed c-page__prefixed--h3' | ||
| 13 | end | ||
| 14 | return el | ||
| 15 | end | ||
diff --git a/filters/macros.lua b/filters/macros.lua deleted file mode 100644 index 86e94ba..0000000 --- a/filters/macros.lua +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | function Div(el) | ||
| 2 | if el.attributes.macro == nil then | ||
| 3 | return el | ||
| 4 | end | ||
| 5 | |||
| 6 | if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then | ||
| 7 | local newchildren = pandoc.List() | ||
| 8 | |||
| 9 | newchildren:insert(pandoc.RawBlock('html', '<ul>')) | ||
| 10 | |||
| 11 | for k, children in ipairs(el.content[1].content) do | ||
| 12 | newchildren:insert(pandoc.RawBlock('html', '<li class="c-page__prefixed c-page__prefixed--ref">')) | ||
| 13 | newchildren:extend(children) | ||
| 14 | newchildren:insert(pandoc.RawBlock('html', '</li>')) | ||
| 15 | end | ||
| 16 | |||
| 17 | newchildren:insert(pandoc.RawBlock('html', '</ul>')) | ||
| 18 | |||
| 19 | el.content = newchildren | ||
| 20 | end | ||
| 21 | |||
| 22 | return el.content | ||
| 23 | end | ||
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index fcabf9f..c640b12 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
| @@ -54,13 +54,15 @@ get_metadata() { | |||
| 54 | pandoc "$1" \ | 54 | pandoc "$1" \ |
| 55 | -f markdown \ | 55 | -f markdown \ |
| 56 | -t plain \ | 56 | -t plain \ |
| 57 | --no-highlight \ | ||
| 57 | --template scripts/metadata_tpl.json | 58 | --template scripts/metadata_tpl.json |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | get_content() { | 61 | get_content() { |
| 61 | pandoc "$1" \ | 62 | pandoc "$1" \ |
| 62 | -f markdown \ | 63 | -f markdown \ |
| 63 | -t plain | 64 | -t plain \ |
| 65 | --no-highlight | ||
| 64 | } | 66 | } |
| 65 | 67 | ||
| 66 | get_section() { | 68 | get_section() { |
| @@ -251,6 +253,7 @@ handle () { | |||
| 251 | pandoc "$1" \ | 253 | pandoc "$1" \ |
| 252 | -f markdown \ | 254 | -f markdown \ |
| 253 | -t html5 \ | 255 | -t html5 \ |
| 256 | --no-highlight \ | ||
| 254 | --template "${TEMPLATES_DIR}feed.xml" \ | 257 | --template "${TEMPLATES_DIR}feed.xml" \ |
| 255 | -o "${target_file%.html}.xml" \ | 258 | -o "${target_file%.html}.xml" \ |
| 256 | --metadata-file metadata/metadata.yaml \ | 259 | --metadata-file metadata/metadata.yaml \ |
| @@ -263,6 +266,7 @@ handle () { | |||
| 263 | pandoc "$1" \ | 266 | pandoc "$1" \ |
| 264 | -f markdown \ | 267 | -f markdown \ |
| 265 | -t html5 \ | 268 | -t html5 \ |
| 269 | --no-highlight \ | ||
| 266 | --template "${TEMPLATES_DIR}base.html" \ | 270 | --template "${TEMPLATES_DIR}base.html" \ |
| 267 | -o "$target_file" \ | 271 | -o "$target_file" \ |
| 268 | --metadata-file metadata/metadata.yaml \ | 272 | --metadata-file metadata/metadata.yaml \ |
diff --git a/templates/base.html b/templates/base.html index 225ef3f..18d65c8 100644 --- a/templates/base.html +++ b/templates/base.html | |||
| @@ -5,7 +5,9 @@ | |||
| 5 | <meta charset="utf-8" /> | 5 | <meta charset="utf-8" /> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1" /> | 6 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 7 | <meta name="robots" content="noindex" /> | 7 | <meta name="robots" content="noindex" /> |
| 8 | |||
| 8 | <link rel="shortcut icon" href="/favicon.ico" /> | 9 | <link rel="shortcut icon" href="/favicon.ico" /> |
| 10 | |||
| 9 | $for(author)$ | 11 | $for(author)$ |
| 10 | <meta name="author" content="$it.name$$if(it.email)$ <$it.email$>$endif$" /> | 12 | <meta name="author" content="$it.name$$if(it.email)$ <$it.email$>$endif$" /> |
| 11 | $endfor$ | 13 | $endfor$ |
| @@ -15,10 +17,17 @@ | |||
| 15 | $if(keywords)$ | 17 | $if(keywords)$ |
| 16 | <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> | 18 | <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> |
| 17 | $endif$ | 19 | $endif$ |
| 20 | |||
| 18 | $for(feeds)$ | 21 | $for(feeds)$ |
| 19 | <link href="$it.url$" type="application/atom+xml" rel="alternate" title="$it.title$ – $site.title$" /> | 22 | <link href="$it.url$" type="application/atom+xml" rel="alternate" title="$it.title$ – $site.title$" /> |
| 20 | $endfor$ | 23 | $endfor$ |
| 24 | |||
| 21 | <title>$if(is_home)$$else$$title$ – $endif$$site.title$</title> | 25 | <title>$if(is_home)$$else$$title$ – $endif$$site.title$</title> |
| 26 | |||
| 27 | <link rel="preload" href="/style.css" as="style" /> | ||
| 28 | <link rel="preload" href="/iosevka-term-ss09-regular.woff2" as="font" type="font/woff2" crossorigin /> | ||
| 29 | <link rel="preload" href="/iosevka-term-ss09-bold.woff2" as="font" type="font/woff2" crossorigin /> | ||
| 30 | |||
| 22 | <link rel="stylesheet" href="/style.css" /> | 31 | <link rel="stylesheet" href="/style.css" /> |
| 23 | $if(section.id)$ | 32 | $if(section.id)$ |
| 24 | <style> | 33 | <style> |
diff --git a/templates/partials/pageHeader.html b/templates/partials/pageHeader.html index b44f394..95e55f7 100644 --- a/templates/partials/pageHeader.html +++ b/templates/partials/pageHeader.html | |||
| @@ -7,7 +7,7 @@ $-- '| \__,~"´ /:) / |:\ \ ,~( ) . | | ) `, ' | |||
| 7 | $-- ___\___.___:____(:/\_-,______\:.\_-,____.__\_.\______.__:___\__.___)_.___,/_____ | 7 | $-- ___\___.___:____(:/\_-,______\:.\_-,____.__\_.\______.__:___\__.___)_.___,/_____ |
| 8 | $-- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 8 | $-- ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ |
| 9 | 9 | ||
| 10 | <pre class="c-page__prefixed c-page__prefixed--pre u-mt0 u-hidden@sm-down"> | 10 | <pre class="c-page-header__pre c-page__prefixed c-page__prefixed--pre u-mt0 u-hidden@sm-down"> |
| 11 | ' | ' ' ' ' ' | | | ' ' | 11 | ' | ' ' ' ' ' | | | ' ' |
| 12 | | ' ' ' <strong>//\_</strong> ' | ' . | ' ' | 12 | | ' ' ' <strong>//\_</strong> ' | ' . | ' ' |
| 13 | .| ' <strong>____,...,______..,_~`` -`..,</strong> ' | ' | ' ' | 13 | .| ' <strong>____,...,______..,_~`` -`..,</strong> ' | ' | ' ' |
diff --git a/templates/partials/pageHeaderSm.html b/templates/partials/pageHeaderSm.html index 4db186c..4255de0 100644 --- a/templates/partials/pageHeaderSm.html +++ b/templates/partials/pageHeaderSm.html | |||
| @@ -3,7 +3,7 @@ $-- | _.~-"""-----~`` ,-´ ' ' |' | ' ' | |||
| 3 | $-- '| .´ ,~'\ ).,__,)/,," ' . ' | | | ' .' | 3 | $-- '| .´ ,~'\ ).,__,)/,," ' . ' | | | ' .' |
| 4 | $-- |_ `~´ (/\\, (/\\, _' '_ _| ' |_ _' '_ | 4 | $-- |_ `~´ (/\\, (/\\, _' '_ _| ' |_ _' '_ |
| 5 | 5 | ||
| 6 | <pre class="c-page__prefixed c-page__prefixed--pre u-mt0 $if(is_home)$u-hidden@sm-up$endif$"> | 6 | <pre class="c-page-header__pre c-page__prefixed c-page__prefixed--pre u-mt0 $if(is_home)$u-hidden@sm-up$endif$"> |
| 7 | .| <strong> //\__</strong> ' .' | . | ' . ' | 7 | .| <strong> //\__</strong> ' .' | . | ' . ' |
| 8 | | <strong> _.~-"""-----~`` ,-´</strong> ' ' |' | ' ' | 8 | | <strong> _.~-"""-----~`` ,-´</strong> ' ' |' | ' ' |
| 9 | '| <strong>.´ ,~'\ ).,__,)/,," </strong> ' . ' | | | ' .' | 9 | '| <strong>.´ ,~'\ ).,__,)/,," </strong> ' . ' | | | ' .' |
