From 065a67e37c7f9a065dfb7e58ac687969dbe62612 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 18 Aug 2020 15:47:47 -0400 Subject: [PATCH] fix: Better styling --- _episodes/03-cmakelists.md | 4 +--- _episodes/04-targets.md | 4 +--- _episodes/06-projectstructure.md | 20 +++++--------------- _episodes/10-root.md | 8 ++------ _includes/hl_code.html | 5 +++++ 5 files changed, 14 insertions(+), 27 deletions(-) create mode 100644 _includes/hl_code.html diff --git a/_episodes/03-cmakelists.md b/_episodes/03-cmakelists.md index be802d5..edba56f 100644 --- a/_episodes/03-cmakelists.md +++ b/_episodes/03-cmakelists.md @@ -88,9 +88,7 @@ cd cmake_workshop/code/00-intro {%- endcapture %} {{ tmp | markdownify }}

Solution

-{% highlight cmake %} -{% include code/00-intro/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/00-intro/CMakeLists.txt" %}
diff --git a/_episodes/04-targets.md b/_episodes/04-targets.md index 0115d5e..be37277 100644 --- a/_episodes/04-targets.md +++ b/_episodes/04-targets.md @@ -128,9 +128,7 @@ definitions on `simple_lib`. {%- endcapture %} {{ tmp | markdownify }}

Solution

-{% highlight cmake %} -{% include code/01-simple/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/01-simple/CMakeLists.txt" %}
diff --git a/_episodes/06-projectstructure.md b/_episodes/06-projectstructure.md index bebe3dc..b003951 100644 --- a/_episodes/06-projectstructure.md +++ b/_episodes/06-projectstructure.md @@ -40,9 +40,7 @@ First, take a look at the main [`CMakeLists.txt`][] file. This is an example of in CMake 3.14, so enjoy it for a minute. Now let's look at specifics!
Click to see CMakeLists.txt -{% highlight cmake%} -{% include code/03-structure/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/03-structure/CMakeLists.txt" %}
### Protect project code @@ -78,9 +76,7 @@ prefer git submodules in `/extern`. Now follow the `add_subdirectory` command to see the src folder, where a library is created.
Click to see src/CMakeLists.txt -{% highlight cmake%} -{% include code/03-structure/src/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/03-structure/src/CMakeLists.txt" %}
@@ -108,9 +104,7 @@ Now take a look at `apps/CMakeLists.txt`. This one is pretty simple, since all t using our library was done on the library target, as it should be.
Click to see apps/CMakeLists.txt -{% highlight cmake%} -{% include code/03-structure/apps/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/03-structure/apps/CMakeLists.txt" %}
### Docs and Tests @@ -119,15 +113,11 @@ using our library was done on the library target, as it should be. Feel free to look at `docs` and `tests` for their `CMakeLists.txt`.
Click to see docs/CMakeLists.txt -{% highlight cmake%} -{% include code/03-structure/docs/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/03-structure/docs/CMakeLists.txt" %}
Click to see tests/CMakeLists.txt -{% highlight cmake%} -{% include code/03-structure/tests/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/03-structure/tests/CMakeLists.txt" %}
> ## More reading diff --git a/_episodes/10-root.md b/_episodes/10-root.md index ba68ac1..8cce9cc 100644 --- a/_episodes/10-root.md +++ b/_episodes/10-root.md @@ -31,9 +31,7 @@ make root -b -q -x ../CheckLoad.C ``` -{% highlight cmake %} -{% include code/05a-root/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/05a-root/CMakeLists.txt" %} @@ -41,8 +39,6 @@ root -b -q -x ../CheckLoad.C Change to the `code/05b-root` directory. Run the same command above. -{% highlight cmake %} -{% include code/05b-root/CMakeLists.txt %} -{% endhighlight %} +{% include hl_code.html lang="cmake" file="code/05b-root/CMakeLists.txt" %} {% include links.md %} diff --git a/_includes/hl_code.html b/_includes/hl_code.html new file mode 100644 index 0000000..96a6e6c --- /dev/null +++ b/_includes/hl_code.html @@ -0,0 +1,5 @@ +
+{% highlight include.lang %} +{% include {{ include.file }} %} +{% endhighlight %} +