From 8e5d54acf3605438c59174debb10da87515f5d04 Mon Sep 17 00:00:00 2001 From: a-rusi <alejandro@muttdata.ai> Date: Tue, 13 Jul 2021 17:05:41 -0300 Subject: [PATCH] Fix documentation needing escapes for tags --- _plugins/attach_raw_tag.rb | 20 ++++++++++++++++++++ course/adding_a_quiz.md | 8 ++++---- course/adding_content.md | 2 +- course/adding_slides.md | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 _plugins/attach_raw_tag.rb diff --git a/_plugins/attach_raw_tag.rb b/_plugins/attach_raw_tag.rb new file mode 100644 index 0000000..519c1c0 --- /dev/null +++ b/_plugins/attach_raw_tag.rb @@ -0,0 +1,20 @@ +module Jekyll + class RawTag < Liquid::Block + def parse(tokens) + @nodelist ||= [] + @nodelist.clear + + while token = tokens.shift + if token =~ FullToken + if block_delimiter == $1 + end_tag + return + end + end + @nodelist << token if not token.empty? + end + end + end + end + + Liquid::Template.register_tag('raw', Jekyll::RawTag) \ No newline at end of file diff --git a/course/adding_a_quiz.md b/course/adding_a_quiz.md index 8a6e09d..fb1d2dd 100644 --- a/course/adding_a_quiz.md +++ b/course/adding_a_quiz.md @@ -39,7 +39,7 @@ We just created our first multiple choice quiz! To add it to our site, we'll get the `markdown` we got from the **Live Editor** and surround it with the `{% quiz %} {% endquiz %}` tags: ```markdown -{{ "{{ quiz " }}}} +{% raw %}{% quiz %}{% endraw %} --- primary_color: steelblue secondary_color: '#e8e8e8' @@ -59,7 +59,7 @@ Which of these are `git` commands? - [ ] git delete - [x] git commit - [ ] git pop -{{ "{{ endquiz " }}}} +{% raw %}{% endquiz %}{% endraw %} ``` This quiz will end up looking something like this: @@ -91,7 +91,7 @@ Which of these are `git` commands? You can add multiple questions to your quiz: just add the `markdown` underneath your previous quiz! ```markdown -{{ "{{ quiz " }}}} +{% raw %}{% quiz %}{% endraw %} --- primary_color: steelblue secondary_color: '#e8e8e8' @@ -124,7 +124,7 @@ How can you modify your latest commit message? 1. [ ] git modify_commit_message 1. [ ] git restore -{{ "{{ endquiz " }}}} +{% raw %}{% endquiz %}{% endraw %} ``` Click on **Next** to move to the second question! diff --git a/course/adding_content.md b/course/adding_content.md index e181bdc..d8db83f 100644 --- a/course/adding_content.md +++ b/course/adding_content.md @@ -46,7 +46,7 @@ If you want to attach a file, you'll have to store it first. You can use of the one *directories* in the `attached_files/` directory. Let's add a `.pdf` file to our course: we'll have to store it in the `attached_files/pdf` directory. -`{% attach_file {"file_name": "pdf/pro_git.pdf", "title":"Click here to download the Pro Git book"} %}` +`{% raw %}{% attach_file {"file_name": "pdf/pro_git.pdf", "title":"Click here to download the Pro Git book"} %}{% endraw %}` Here's our page after adding all the content we previously mentioned: diff --git a/course/adding_slides.md b/course/adding_slides.md index d367fd9..4f94cb8 100644 --- a/course/adding_slides.md +++ b/course/adding_slides.md @@ -51,7 +51,7 @@ Distributed means that all users have a copy of the repository instead of a cent Now we can attach our slides like we learned: -`{% attach_file {"file_name": "slides_markdown/git_slides.pdf", "title":"Git slide deck"} %}` +`{% raw %}{% attach_file {"file_name": "slides_markdown/git_slides.pdf", "title":"Git slide deck"} %}{% endraw %}` ## Customizing your slides -- GitLab