From 9b3ad53e855764e46a9febe395b88d3ca1aeaf45 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 24 Jun 2017 22:54:43 +0300 Subject: add post "static vs. inline vs. namespace {" Also includes a bunch of includes to easily add grouped code snippets to a post. They were present before, but I wiped them away during the recent major history rewriting which I still regret about. --- _includes/snippets/footer.html | 5 +++++ _includes/snippets/header.html | 14 ++++++++++++++ _includes/snippets/section.html | 25 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 _includes/snippets/footer.html create mode 100644 _includes/snippets/header.html create mode 100644 _includes/snippets/section.html (limited to '_includes') diff --git a/_includes/snippets/footer.html b/_includes/snippets/footer.html new file mode 100644 index 0000000..d60469c --- /dev/null +++ b/_includes/snippets/footer.html @@ -0,0 +1,5 @@ + + {% if page.snippets_collapsible %} + + {% endif %} + diff --git a/_includes/snippets/header.html b/_includes/snippets/header.html new file mode 100644 index 0000000..673fc5a --- /dev/null +++ b/_includes/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/snippets/section.html b/_includes/snippets/section.html new file mode 100644 index 0000000..79be3c1 --- /dev/null +++ b/_includes/snippets/section.html @@ -0,0 +1,25 @@ +{% 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 %} +```c++ +{% 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 %} -- cgit v1.2.3