From c8bbc25228a7d199ca6868db7375f1661c3ef6e4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 23 Mar 2022 16:52:53 +0300 Subject: _includes: move everything to jekyll-theme/ --- README.md | 4 +- _includes/categories/all.html | 21 ------- _includes/categories/category.html | 11 ---- _includes/common/footer.html | 72 ---------------------- _includes/common/ga.html | 9 --- _includes/common/header.html | 80 ------------------------- _includes/common/navbar.html | 66 -------------------- _includes/common/sidebar.html | 47 --------------- _includes/common/sidebar_entry.html | 4 -- _includes/jekyll-theme/categories/all.html | 21 +++++++ _includes/jekyll-theme/categories/category.html | 11 ++++ _includes/jekyll-theme/footer.html | 72 ++++++++++++++++++++++ _includes/jekyll-theme/ga.html | 9 +++ _includes/jekyll-theme/header.html | 80 +++++++++++++++++++++++++ _includes/jekyll-theme/mathjax.html | 4 ++ _includes/jekyll-theme/navbar.html | 66 ++++++++++++++++++++ _includes/jekyll-theme/posts/feed.html | 23 +++++++ _includes/jekyll-theme/posts/paginator.html | 36 +++++++++++ _includes/jekyll-theme/shell.html | 24 ++++++++ _includes/jekyll-theme/sidebar.html | 47 +++++++++++++++ _includes/jekyll-theme/sidebar_entry.html | 4 ++ _includes/jekyll-theme/snippets/footer.html | 5 ++ _includes/jekyll-theme/snippets/header.html | 14 +++++ _includes/jekyll-theme/snippets/section.html | 25 ++++++++ _includes/mathjax.html | 4 -- _includes/posts/feed.html | 23 ------- _includes/posts/paginator.html | 36 ----------- _includes/shell.html | 24 -------- _includes/snippets/footer.html | 5 -- _includes/snippets/header.html | 14 ----- _includes/snippets/section.html | 25 -------- _layouts/default.html | 6 +- _layouts/plain.html | 4 +- _posts/2021-04-09-snippets.md | 4 +- _posts/2021-04-10-collapsible.md | 4 +- _posts/2022-03-21-shell.md | 16 ++--- archive/index.html | 2 +- feed/index.html | 2 +- life/index.html | 2 +- work/index.html | 2 +- 40 files changed, 464 insertions(+), 464 deletions(-) delete mode 100644 _includes/categories/all.html delete mode 100644 _includes/categories/category.html delete mode 100644 _includes/common/footer.html delete mode 100644 _includes/common/ga.html delete mode 100644 _includes/common/header.html delete mode 100644 _includes/common/navbar.html delete mode 100644 _includes/common/sidebar.html delete mode 100644 _includes/common/sidebar_entry.html create mode 100644 _includes/jekyll-theme/categories/all.html create mode 100644 _includes/jekyll-theme/categories/category.html create mode 100644 _includes/jekyll-theme/footer.html create mode 100644 _includes/jekyll-theme/ga.html create mode 100644 _includes/jekyll-theme/header.html create mode 100644 _includes/jekyll-theme/mathjax.html create mode 100644 _includes/jekyll-theme/navbar.html create mode 100644 _includes/jekyll-theme/posts/feed.html create mode 100644 _includes/jekyll-theme/posts/paginator.html create mode 100644 _includes/jekyll-theme/shell.html create mode 100644 _includes/jekyll-theme/sidebar.html create mode 100644 _includes/jekyll-theme/sidebar_entry.html create mode 100644 _includes/jekyll-theme/snippets/footer.html create mode 100644 _includes/jekyll-theme/snippets/header.html create mode 100644 _includes/jekyll-theme/snippets/section.html delete mode 100644 _includes/mathjax.html delete mode 100644 _includes/posts/feed.html delete mode 100644 _includes/posts/paginator.html delete mode 100644 _includes/shell.html delete mode 100644 _includes/snippets/footer.html delete mode 100644 _includes/snippets/header.html delete mode 100644 _includes/snippets/section.html diff --git a/README.md b/README.md index c419c89..7afd40c 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ And then you can just format an entire section of snippets using a single `include`: ``` -{% include snippets/section.html section_id='hello' %} +{% include jekyll-theme/snippets/section.html section_id='hello' %} ``` The line above would output both hello.hpp and hello.cpp to the page. @@ -181,7 +181,7 @@ The gist is: [shell]: _posts/2022-03-21-shell.md ``` -{% include shell.html cmd='echo 123' out='123' %} +{% include jekyll-theme/shell.html cmd='echo 123' out='123' %} ``` ### Typesetting math diff --git a/_includes/categories/all.html b/_includes/categories/all.html deleted file mode 100644 index 71b4bb6..0000000 --- a/_includes/categories/all.html +++ /dev/null @@ -1,21 +0,0 @@ -{% if site.posts.size == 0 %} -

Sorry, no posts have been added yet.

-{% else %} - {% for category in site.categories %} -

{{ category[0] }}

- - {% endfor %} - {% assign uncategorized = site.posts | where_exp: "post","post.categories.size == 0" %} - {% if uncategorized.size != 0 %} -

Other

- - {% endif %} -{% endif %} diff --git a/_includes/categories/category.html b/_includes/categories/category.html deleted file mode 100644 index f7b7a8c..0000000 --- a/_includes/categories/category.html +++ /dev/null @@ -1,11 +0,0 @@ -

This is a list of posts in category "{{ include.category }}".

-{% if site.categories[include.category].size > 0 %} - -{% endif %} -{% if include.archive_link %} -

For a complete list of posts grouped by category, please see this page.

-{% endif %} diff --git a/_includes/common/footer.html b/_includes/common/footer.html deleted file mode 100644 index 9331784..0000000 --- a/_includes/common/footer.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - {% assign scripts = '' | split: '' %} - {% if site.settings.scripts %} - {% assign scripts = scripts | concat: site.settings.scripts %} - {% endif %} - {% if page.scripts %} - {% assign scripts = scripts | concat: page.scripts %} - {% endif %} - - {% for script in scripts %} - {% assign abs_check = script.src | downcase | split: '//' %} - {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == '' %} - {% assign url = script.src %} - {% else %} - {% assign abs_check = script.src | slice: 0 %} - {% if abs_check == '/' %} - {% assign url = script.src %} - {% else %} - {% assign url = script.src | relative_url %} - {% endif %} - {% endif %} - - {% endfor %} - - diff --git a/_includes/common/ga.html b/_includes/common/ga.html deleted file mode 100644 index 56eaca7..0000000 --- a/_includes/common/ga.html +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/_includes/common/header.html b/_includes/common/header.html deleted file mode 100644 index 07ba1c5..0000000 --- a/_includes/common/header.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - {% assign project_name = site.settings.project.name %} - {% unless project_name %} - {% if site.github %} - {% comment %} - What the damn hell? site.github.is_project_page is set to true even - for my root user site (the one with the .github.io suffix). - TODO: remove the following workaround and replace with a simple check - site.github.is_project_page above when this is fixed? - {% endcomment %} - {% capture assumed_user_name %}{{ site.github.owner_name }}.github.io{% endcapture %} - {% if site.github.repository_name != assumed_user_name %} - {% assign project_name = site.github.repository_name %} - {% endif %} - {% endif %} - {% endunless %} - {% assign author_name = site.settings.author.name %} - {% unless author_name %} - {% if site.github %} - {% assign author_name = site.github.owner_name %} - {% endif %} - {% endunless %} - {% assign author_name = author_name | default: 'John Doe' %} - {% if project_name %} - {% capture title %}{{ project_name }} - {{ author_name }}{% endcapture %} - {% else %} - {% capture title %}{{ author_name }}{% endcapture %} - {% endif %} - {% if page.url != '/' %} - {% capture title %}{{ page.title }} - {{ title }}{% endcapture %} - {% endif %} - {{ title }} - - - - - {% include mathjax.html %} - - - - {% assign links = '' | split: '' %} - {% if site.settings.links %} - {% assign links = links | concat: site.settings.links %} - {% endif %} - {% if page.links %} - {% assign links = links | concat: page.links %} - {% endif %} - - {% for link in links %} - {% assign abs_check = link.href | downcase | split: '//' %} - {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == '' %} - {% assign url = link.href %} - {% else %} - {% assign abs_check = link.href | slice: 0 %} - {% if abs_check == '/' %} - {% assign url = link.href %} - {% else %} - {% assign url = link.href | relative_url %} - {% endif %} - {% endif %} - - {% endfor %} - - {% if site.settings.ga_tag %} - {% include common/ga.html ga_tag=site.settings.ga_tag %} - {% endif %} - - -
- {% include common/navbar.html %} -
diff --git a/_includes/common/navbar.html b/_includes/common/navbar.html deleted file mode 100644 index 67db12e..0000000 --- a/_includes/common/navbar.html +++ /dev/null @@ -1,66 +0,0 @@ -{% unless site.settings.navbar.hide or page.navbar.hide %} - -{% endunless %} diff --git a/_includes/common/sidebar.html b/_includes/common/sidebar.html deleted file mode 100644 index 4eeeac2..0000000 --- a/_includes/common/sidebar.html +++ /dev/null @@ -1,47 +0,0 @@ -{% unless site.settings.sidebar.hide or page.sidebar.hide %} -
- -{% capture about_content %} -{% assign project_desc = site.settings.project.description %} -{% unless project_desc %} - {% if site.github %} - {% assign project_desc = site.github.project_tagline %} - {% endif %} -{% endunless %} -{% if project_desc %} - {% capture project_desc %}{{ project_desc }}. {% endcapture %} -{% endif %} -{% capture project_desc %}{{ project_desc }}Feel free to contribute or contact me.{% endcapture %} -

{{ project_desc }}

-
- {% if site.github %} - {% assign github_link = site.settings.navbar.github.link | default: 'GitHub' %} - {% assign github_icon = site.settings.navbar.github.icon | default: 'globe' %} - {% capture github_icon %} {% endcapture %} - {{ github_icon }}{{ github_link }} - {% endif %} - {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %} -  {{ author_email }} -
-{% endcapture %} - -{% include common/sidebar_entry.html header='About' content=about_content %} - -{% if site.posts.size > 0 %} - -{% capture latest_posts_content %} -
- {% for post in site.posts limit: 5 %} - -  {{ post.date | date: '%-d %b %Y' }} -  {{ post.title }} - - {% endfor %} -
-{% endcapture %} - -{% include common/sidebar_entry.html header='Latest posts' content=latest_posts_content %} -{% endif %} - -
-{% endunless %} diff --git a/_includes/common/sidebar_entry.html b/_includes/common/sidebar_entry.html deleted file mode 100644 index 761119d..0000000 --- a/_includes/common/sidebar_entry.html +++ /dev/null @@ -1,4 +0,0 @@ -
-

{{ include.header }}

- {{ include.content }} -
diff --git a/_includes/jekyll-theme/categories/all.html b/_includes/jekyll-theme/categories/all.html new file mode 100644 index 0000000..71b4bb6 --- /dev/null +++ b/_includes/jekyll-theme/categories/all.html @@ -0,0 +1,21 @@ +{% if site.posts.size == 0 %} +

Sorry, no posts have been added yet.

+{% else %} + {% for category in site.categories %} +

{{ category[0] }}

+ + {% endfor %} + {% assign uncategorized = site.posts | where_exp: "post","post.categories.size == 0" %} + {% if uncategorized.size != 0 %} +

Other

+ + {% endif %} +{% endif %} diff --git a/_includes/jekyll-theme/categories/category.html b/_includes/jekyll-theme/categories/category.html new file mode 100644 index 0000000..f7b7a8c --- /dev/null +++ b/_includes/jekyll-theme/categories/category.html @@ -0,0 +1,11 @@ +

This is a list of posts in category "{{ include.category }}".

+{% if site.categories[include.category].size > 0 %} + +{% endif %} +{% if include.archive_link %} +

For a complete list of posts grouped by category, please see this page.

+{% endif %} diff --git a/_includes/jekyll-theme/footer.html b/_includes/jekyll-theme/footer.html new file mode 100644 index 0000000..9331784 --- /dev/null +++ b/_includes/jekyll-theme/footer.html @@ -0,0 +1,72 @@ +
+
+
+
+
+ +{% if site.settings.project.license_file %} + {% capture license_file %}{{ '/' | relative_url }}{{ site.settings.project.license_file }}{% endcapture %} +{% else %} + {% for file in site.static_files %} + {% assign path = file.path | downcase %} + {% if path == 'license' or path == 'license.txt' %} + {% assign license_file = file.path | relative_url %} + {% endif %} + {% endfor %} +{% endif %} +{% if site.settings.project.license %} + {% assign license = site.settings.project.license %} + {% unless license_file %} + {% capture license_file %}https://spdx.org/licenses/{{ license }}.html{% endcapture %} + {% capture license %}{{ license }} License{% endcapture %} + {% endunless %} +{% elsif site.github.license %} + {% assign license = site.github.license.name %} + {% unless license_file %} + {% capture license_file %}https://spdx.org/licenses/{{ site.github.license.spdx_id }}.html{% endcapture %} + {% endunless %} +{% endif %} +{% if license %} + {% capture license_text %}License: {{ license }}{% endcapture %} +{% elsif license_file %} + {% capture license_text %}License: click here{% endcapture %} +{% endif %} + +{% capture sep %}|{% endcapture %} +{% capture timestamp_text %}Last update: {{ site.time | date: '%-d %B %Y' }}{% endcapture %} +
+ {% if license_text %}{{ license_text }}{{ sep }}{% endif %}{{ timestamp_text }} +
+ +
+
+
+
+
+ + + + {% assign scripts = '' | split: '' %} + {% if site.settings.scripts %} + {% assign scripts = scripts | concat: site.settings.scripts %} + {% endif %} + {% if page.scripts %} + {% assign scripts = scripts | concat: page.scripts %} + {% endif %} + + {% for script in scripts %} + {% assign abs_check = script.src | downcase | split: '//' %} + {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == '' %} + {% assign url = script.src %} + {% else %} + {% assign abs_check = script.src | slice: 0 %} + {% if abs_check == '/' %} + {% assign url = script.src %} + {% else %} + {% assign url = script.src | relative_url %} + {% endif %} + {% endif %} + + {% endfor %} + + diff --git a/_includes/jekyll-theme/ga.html b/_includes/jekyll-theme/ga.html new file mode 100644 index 0000000..56eaca7 --- /dev/null +++ b/_includes/jekyll-theme/ga.html @@ -0,0 +1,9 @@ + + + diff --git a/_includes/jekyll-theme/header.html b/_includes/jekyll-theme/header.html new file mode 100644 index 0000000..0e83d50 --- /dev/null +++ b/_includes/jekyll-theme/header.html @@ -0,0 +1,80 @@ + + + + + + + + {% assign project_name = site.settings.project.name %} + {% unless project_name %} + {% if site.github %} + {% comment %} + What the damn hell? site.github.is_project_page is set to true even + for my root user site (the one with the .github.io suffix). + TODO: remove the following workaround and replace with a simple check + site.github.is_project_page above when this is fixed? + {% endcomment %} + {% capture assumed_user_name %}{{ site.github.owner_name }}.github.io{% endcapture %} + {% if site.github.repository_name != assumed_user_name %} + {% assign project_name = site.github.repository_name %} + {% endif %} + {% endif %} + {% endunless %} + {% assign author_name = site.settings.author.name %} + {% unless author_name %} + {% if site.github %} + {% assign author_name = site.github.owner_name %} + {% endif %} + {% endunless %} + {% assign author_name = author_name | default: 'John Doe' %} + {% if project_name %} + {% capture title %}{{ project_name }} - {{ author_name }}{% endcapture %} + {% else %} + {% capture title %}{{ author_name }}{% endcapture %} + {% endif %} + {% if page.url != '/' %} + {% capture title %}{{ page.title }} - {{ title }}{% endcapture %} + {% endif %} + {{ title }} + + + + + {% include jekyll-theme/mathjax.html %} + + + + {% assign links = '' | split: '' %} + {% if site.settings.links %} + {% assign links = links | concat: site.settings.links %} + {% endif %} + {% if page.links %} + {% assign links = links | concat: page.links %} + {% endif %} + + {% for link in links %} + {% assign abs_check = link.href | downcase | split: '//' %} + {% if abs_check[0] == 'http:' or abs_check[0] == 'https:' or abs_check[0] == '' %} + {% assign url = link.href %} + {% else %} + {% assign abs_check = link.href | slice: 0 %} + {% if abs_check == '/' %} + {% assign url = link.href %} + {% else %} + {% assign url = link.href | relative_url %} + {% endif %} + {% endif %} + + {% endfor %} + + {% if site.settings.ga_tag %} + {% include jekyll-theme/ga.html ga_tag=site.settings.ga_tag %} + {% endif %} + + +
+ {% include jekyll-theme/navbar.html %} +
diff --git a/_includes/jekyll-theme/mathjax.html b/_includes/jekyll-theme/mathjax.html new file mode 100644 index 0000000..e01e380 --- /dev/null +++ b/_includes/jekyll-theme/mathjax.html @@ -0,0 +1,4 @@ +{% if page.mathjax %} + + +{% endif %} diff --git a/_includes/jekyll-theme/navbar.html b/_includes/jekyll-theme/navbar.html new file mode 100644 index 0000000..67db12e --- /dev/null +++ b/_includes/jekyll-theme/navbar.html @@ -0,0 +1,66 @@ +{% unless site.settings.navbar.hide or page.navbar.hide %} + +{% endunless %} diff --git a/_includes/jekyll-theme/posts/feed.html b/_includes/jekyll-theme/posts/feed.html new file mode 100644 index 0000000..dac6798 --- /dev/null +++ b/_includes/jekyll-theme/posts/feed.html @@ -0,0 +1,23 @@ +{% if site.posts.size == 0 %} +

Sorry, no posts have been added yet.

+{% else %} + {% for post in paginator.posts %} +
+
+

{{ post.title }}

+ +
+ {{ post.excerpt | markdownify }} +
+ {% endfor %} +
+ {% include jekyll-theme/posts/paginator.html %} +
+{% endif %} diff --git a/_includes/jekyll-theme/posts/paginator.html b/_includes/jekyll-theme/posts/paginator.html new file mode 100644 index 0000000..471383c --- /dev/null +++ b/_includes/jekyll-theme/posts/paginator.html @@ -0,0 +1,36 @@ +{% comment %} + Page links, inspired by the example at the bottom of + https://jekyllrb.com/docs/pagination/. +{% endcomment %} +{% if site.posts.size != 0 %} + {% comment %} + Link to page 1 is tricky. If site.paginate_path is used, then we cannot + simply use /. This is a silly attempt to get the proper page 1 link. + {% endcomment %} + {% if paginator.page == 1 %} + {% assign page1_url = page.url %} + {% else %} + {% assign page1_url = page.url | split: '/' | pop | join: '/' | append: '/' %} + {% endif %} +
    + {% if paginator.previous_page %} +
  •  Prev
  • + {% else %} +
  •  Prev
  • + {% endif %} + {% for page_number in (1..paginator.total_pages) %} + {% if page_number == paginator.page %} +
  • {{ page_number }}
  • + {% elsif page_number == 1 %} +
  • {{ page_number }}
  • + {% else %} +
  • {{ page_number }}
  • + {% endif %} + {% endfor %} + {% if paginator.next_page %} +
  • Next 
  • + {% else %} +
  • Next 
  • + {% endif %} +
+{% endif %} diff --git a/_includes/jekyll-theme/shell.html b/_includes/jekyll-theme/shell.html new file mode 100644 index 0000000..9b7ed4d --- /dev/null +++ b/_includes/jekyll-theme/shell.html @@ -0,0 +1,24 @@ +
+{% assign cmd = include.cmd | newline_to_br | strip_newlines %} +{% assign br = '
' %} +{% assign br_len = br | size %} +{% assign prefix = cmd | slice: 0,br_len %} +{% if prefix == br %} + {% assign cmd = cmd | remove_first: br %} +{% endif %} +{% assign cmd = cmd | split: br %} +{% assign new_cmd = '' | split: '' %} +{% for line in cmd %} + {% capture new_line %}{{ line }} +{% endcapture %} + {% assign new_cmd = new_cmd | push: new_line %} +{% endfor %} +{% assign cmd = new_cmd %} +{% assign cmd = cmd | join: '' %} +
+
$
{{ cmd }}
+
+{% if include.out %} +
{{ include.out }}
+{% endif %} +
diff --git a/_includes/jekyll-theme/sidebar.html b/_includes/jekyll-theme/sidebar.html new file mode 100644 index 0000000..e4732f2 --- /dev/null +++ b/_includes/jekyll-theme/sidebar.html @@ -0,0 +1,47 @@ +{% unless site.settings.sidebar.hide or page.sidebar.hide %} +
+ +{% capture about_content %} +{% assign project_desc = site.settings.project.description %} +{% unless project_desc %} + {% if site.github %} + {% assign project_desc = site.github.project_tagline %} + {% endif %} +{% endunless %} +{% if project_desc %} + {% capture project_desc %}{{ project_desc }}. {% endcapture %} +{% endif %} +{% capture project_desc %}{{ project_desc }}Feel free to contribute or contact me.{% endcapture %} +

{{ project_desc }}

+
+ {% if site.github %} + {% assign github_link = site.settings.navbar.github.link | default: 'GitHub' %} + {% assign github_icon = site.settings.navbar.github.icon | default: 'globe' %} + {% capture github_icon %} {% endcapture %} + {{ github_icon }}{{ github_link }} + {% endif %} + {% assign author_email = site.settings.author.email | default: 'John.Doe@example.com' %} +  {{ author_email }} +
+{% endcapture %} + +{% include jekyll-theme/sidebar_entry.html header='About' content=about_content %} + +{% if site.posts.size > 0 %} + +{% capture latest_posts_content %} +
+ {% for post in site.posts limit: 5 %} + +  {{ post.date | date: '%-d %b %Y' }} +  {{ post.title }} + + {% endfor %} +
+{% endcapture %} + +{% include jekyll-theme/sidebar_entry.html header='Latest posts' content=latest_posts_content %} +{% endif %} + +
+{% endunless %} diff --git a/_includes/jekyll-theme/sidebar_entry.html b/_includes/jekyll-theme/sidebar_entry.html new file mode 100644 index 0000000..761119d --- /dev/null +++ b/_includes/jekyll-theme/sidebar_entry.html @@ -0,0 +1,4 @@ +
+

{{ include.header }}

+ {{ include.content }} +
diff --git a/_includes/jekyll-theme/snippets/footer.html b/_includes/jekyll-theme/snippets/footer.html new file mode 100644 index 0000000..d60469c --- /dev/null +++ b/_includes/jekyll-theme/snippets/footer.html @@ -0,0 +1,5 @@ +
+ {% if page.snippets_collapsible %} +
+ {% endif %} + diff --git a/_includes/jekyll-theme/snippets/header.html b/_includes/jekyll-theme/snippets/header.html new file mode 100644 index 0000000..673fc5a --- /dev/null +++ b/_includes/jekyll-theme/snippets/header.html @@ -0,0 +1,14 @@ +{% capture snippet_basename %}{{ include.snippet_path | split:"/" | last }}{% endcapture %} +{% capture snippet_id %}{{ include.snippet_path | replace:'/','_' | replace:'.','_' }}{% endcapture %} +
+
+ {% if page.snippets_collapsible %} + {{ snippet_basename }} + {% else %} +
{{ snippet_basename }}
+ {% endif %} +
+ {% if page.snippets_collapsible %} +
+ {% endif %} +
diff --git a/_includes/jekyll-theme/snippets/section.html b/_includes/jekyll-theme/snippets/section.html new file mode 100644 index 0000000..3e7e748 --- /dev/null +++ b/_includes/jekyll-theme/snippets/section.html @@ -0,0 +1,25 @@ +{% if page.snippets_collapsible %} +
+{% else %} +
+{% endif %} + +{% for i in page.snippets[include.section_id] %} + {% include jekyll-theme/snippets/header.html snippet_path=i section_id=include.section_id %} + +{% capture snippet %} +```{{ page.snippets_language }} +{% include_relative {{ page.snippets_root_directory }}/{{ i }} %}``` +{% endcapture %} + +{{ snippet | markdownify }} + + {% include jekyll-theme/snippets/footer.html %} +{% endfor %} + +
+ +{% for i in page.snippets[include.section_id] %} + {% capture snippet_id %}{{ i | replace:"/","_" | replace:".","_" }}{% endcapture %} +[{{ i }}]: #{{ snippet_id }} +{% endfor %} diff --git a/_includes/mathjax.html b/_includes/mathjax.html deleted file mode 100644 index e01e380..0000000 --- a/_includes/mathjax.html +++ /dev/null @@ -1,4 +0,0 @@ -{% if page.mathjax %} - - -{% endif %} diff --git a/_includes/posts/feed.html b/_includes/posts/feed.html deleted file mode 100644 index 4b4ea8b..0000000 --- a/_includes/posts/feed.html +++ /dev/null @@ -1,23 +0,0 @@ -{% if site.posts.size == 0 %} -

Sorry, no posts have been added yet.

-{% else %} - {% for post in paginator.posts %} -
-
-

{{ post.title }}

- -
- {{ post.excerpt | markdownify }} -
- {% endfor %} -
- {% include posts/paginator.html %} -
-{% endif %} diff --git a/_includes/posts/paginator.html b/_includes/posts/paginator.html deleted file mode 100644 index 471383c..0000000 --- a/_includes/posts/paginator.html +++ /dev/null @@ -1,36 +0,0 @@ -{% comment %} - Page links, inspired by the example at the bottom of - https://jekyllrb.com/docs/pagination/. -{% endcomment %} -{% if site.posts.size != 0 %} - {% comment %} - Link to page 1 is tricky. If site.paginate_path is used, then we cannot - simply use /. This is a silly attempt to get the proper page 1 link. - {% endcomment %} - {% if paginator.page == 1 %} - {% assign page1_url = page.url %} - {% else %} - {% assign page1_url = page.url | split: '/' | pop | join: '/' | append: '/' %} - {% endif %} -
    - {% if paginator.previous_page %} -
  •  Prev
  • - {% else %} -
  •  Prev
  • - {% endif %} - {% for page_number in (1..paginator.total_pages) %} - {% if page_number == paginator.page %} -
  • {{ page_number }}
  • - {% elsif page_number == 1 %} -
  • {{ page_number }}
  • - {% else %} -
  • {{ page_number }}
  • - {% endif %} - {% endfor %} - {% if paginator.next_page %} -
  • Next 
  • - {% else %} -
  • Next 
  • - {% endif %} -
-{% endif %} diff --git a/_includes/shell.html b/_includes/shell.html deleted file mode 100644 index 9b7ed4d..0000000 --- a/_includes/shell.html +++ /dev/null @@ -1,24 +0,0 @@ -
-{% assign cmd = include.cmd | newline_to_br | strip_newlines %} -{% assign br = '
' %} -{% assign br_len = br | size %} -{% assign prefix = cmd | slice: 0,br_len %} -{% if prefix == br %} - {% assign cmd = cmd | remove_first: br %} -{% endif %} -{% assign cmd = cmd | split: br %} -{% assign new_cmd = '' | split: '' %} -{% for line in cmd %} - {% capture new_line %}{{ line }} -{% endcapture %} - {% assign new_cmd = new_cmd | push: new_line %} -{% endfor %} -{% assign cmd = new_cmd %} -{% assign cmd = cmd | join: '' %} -
-
$
{{ cmd }}
-
-{% if include.out %} -
{{ include.out }}
-{% endif %} -
diff --git a/_includes/snippets/footer.html b/_includes/snippets/footer.html deleted file mode 100644 index d60469c..0000000 --- a/_includes/snippets/footer.html +++ /dev/null @@ -1,5 +0,0 @@ -
- {% if page.snippets_collapsible %} -
- {% endif %} -
diff --git a/_includes/snippets/header.html b/_includes/snippets/header.html deleted file mode 100644 index 673fc5a..0000000 --- a/_includes/snippets/header.html +++ /dev/null @@ -1,14 +0,0 @@ -{% capture snippet_basename %}{{ include.snippet_path | split:"/" | last }}{% endcapture %} -{% capture snippet_id %}{{ include.snippet_path | replace:'/','_' | replace:'.','_' }}{% endcapture %} -
-
- {% if page.snippets_collapsible %} - {{ snippet_basename }} - {% else %} -
{{ snippet_basename }}
- {% endif %} -
- {% if page.snippets_collapsible %} -
- {% endif %} -
diff --git a/_includes/snippets/section.html b/_includes/snippets/section.html deleted file mode 100644 index cbb778f..0000000 --- a/_includes/snippets/section.html +++ /dev/null @@ -1,25 +0,0 @@ -{% if page.snippets_collapsible %} -
-{% else %} -
-{% endif %} - -{% for i in page.snippets[include.section_id] %} - {% include snippets/header.html snippet_path=i section_id=include.section_id %} - -{% capture snippet %} -```{{ page.snippets_language }} -{% include_relative {{ page.snippets_root_directory }}/{{ i }} %}``` -{% endcapture %} - -{{ snippet | markdownify }} - - {% include snippets/footer.html %} -{% endfor %} - -
- -{% for i in page.snippets[include.section_id] %} - {% capture snippet_id %}{{ i | replace:"/","_" | replace:".","_" }}{% endcapture %} -[{{ i }}]: #{{ snippet_id }} -{% endfor %} diff --git a/_layouts/default.html b/_layouts/default.html index eaae1b9..1f39d9f 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,4 +1,4 @@ -{% include common/header.html %} +{% include jekyll-theme/header.html %}
{{ content }} @@ -8,7 +8,7 @@ {% endunless %}
- {% include common/sidebar.html %} + {% include jekyll-theme/sidebar.html %}
-{% include common/footer.html %} +{% include jekyll-theme/footer.html %} diff --git a/_layouts/plain.html b/_layouts/plain.html index db09984..59b594f 100644 --- a/_layouts/plain.html +++ b/_layouts/plain.html @@ -1,7 +1,7 @@ -{% include common/header.html %} +{% include jekyll-theme/header.html %}
{{ content }}
-{% include common/footer.html %} +{% include jekyll-theme/footer.html %} diff --git a/_posts/2021-04-09-snippets.md b/_posts/2021-04-09-snippets.md index a320e07..3621e80 100644 --- a/_posts/2021-04-09-snippets.md +++ b/_posts/2021-04-09-snippets.md @@ -14,11 +14,11 @@ snippets: --- It's pretty simple, just use the corresponding include: -{% include snippets/section.html section_id='hello' %} +{% include jekyll-theme/snippets/section.html section_id='hello' %} This is another set of snippets: -{% include snippets/section.html section_id='world' %} +{% include jekyll-theme/snippets/section.html section_id='world' %} Of course, you can insert a code snippet using the regular Markdown syntax without any highlighting: diff --git a/_posts/2021-04-10-collapsible.md b/_posts/2021-04-10-collapsible.md index bb555c0..0997f3a 100644 --- a/_posts/2021-04-10-collapsible.md +++ b/_posts/2021-04-10-collapsible.md @@ -18,8 +18,8 @@ Just set a front matter value to make them collapsible, and voilĂ ! [other post]: {{ site.baseurl }}{% post_url 2021-04-09-snippets %} -{% include snippets/section.html section_id='hello' %} +{% include jekyll-theme/snippets/section.html section_id='hello' %} This is another set of snippets: -{% include snippets/section.html section_id='world' %} +{% include jekyll-theme/snippets/section.html section_id='world' %} diff --git a/_posts/2022-03-21-shell.md b/_posts/2022-03-21-shell.md index 8a330ff..340d0b5 100644 --- a/_posts/2022-03-21-shell.md +++ b/_posts/2022-03-21-shell.md @@ -7,11 +7,11 @@ category: Work It's easy to style shell commands and their outputs. Here's a one-line command and a one-line output. -{% include shell.html cmd='echo 1' out='1' %} +{% include jekyll-theme/shell.html cmd='echo 1' out='1' %} You can pass multiple commands and multi-line output to the include as well: -{% include shell.html cmd='echo 1 +{% include jekyll-theme/shell.html cmd='echo 1 echo 2' out='1 2' %} @@ -30,12 +30,12 @@ touch test.txt && \ 456 {% endcapture %} -{% include shell.html cmd=cmd1 out=out1 %} +{% include jekyll-theme/shell.html cmd=cmd1 out=out1 %} You can display multiple commands one after another. -{% include shell.html cmd="printf 'Hello\n'" out='Hello' %} -{% include shell.html cmd="printf 'World\n'" out='World' %} +{% include jekyll-theme/shell.html cmd="printf 'Hello\n'" out='Hello' %} +{% include jekyll-theme/shell.html cmd="printf 'World\n'" out='World' %} Only the last one will have a bottom margin. @@ -48,11 +48,11 @@ printf '%s\n' 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {% endcapture %} -{% include shell.html cmd=cmd1 out=out1 %} +{% include jekyll-theme/shell.html cmd=cmd1 out=out1 %} This is ugly though, so please don't do that. Commands don't necessarily have to have output: -{% include shell.html cmd='mkdir test' %} -{% include shell.html cmd='cd test' %} +{% include jekyll-theme/shell.html cmd='mkdir test' %} +{% include jekyll-theme/shell.html cmd='cd test' %} diff --git a/archive/index.html b/archive/index.html index 39f465d..aade24b 100644 --- a/archive/index.html +++ b/archive/index.html @@ -5,4 +5,4 @@ navbar: link: true priority: 3 --- -{% include categories/all.html %} +{% include jekyll-theme/categories/all.html %} diff --git a/feed/index.html b/feed/index.html index 7227bab..0288344 100644 --- a/feed/index.html +++ b/feed/index.html @@ -8,4 +8,4 @@ navbar: sidebar: hide: true --- -{% include posts/feed.html %} +{% include jekyll-theme/posts/feed.html %} diff --git a/life/index.html b/life/index.html index 4412437..1df20f1 100644 --- a/life/index.html +++ b/life/index.html @@ -1,4 +1,4 @@ --- title: Life --- -{% include categories/category.html category=page.title archive_link='/archive/' %} +{% include jekyll-theme/categories/category.html category=page.title archive_link='/archive/' %} diff --git a/work/index.html b/work/index.html index 5bd34ca..c2a2f9d 100644 --- a/work/index.html +++ b/work/index.html @@ -1,4 +1,4 @@ --- title: Work --- -{% include categories/category.html category=page.title archive_link='/archive/' %} +{% include jekyll-theme/categories/category.html category=page.title archive_link='/archive/' %} -- cgit v1.2.3