jekyll-theme-paperwiki 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd5647356250d27a51862ad94ca40a17ba4ec33bec742b95d09a3dc38c0f3d9b
4
- data.tar.gz: 817ac6d86315dac8b99e4e8c88f07ae5d5ecb0b4028f4fa70ca21127287ece04
3
+ metadata.gz: 96dc441b57acdaf6886f2e20b25d4b95855cef23475163a86fd42dfaafcc282e
4
+ data.tar.gz: 0b11702d89f94b83299c46118f9d7cee573774ba775611cf72168aa5a135a527
5
5
  SHA512:
6
- metadata.gz: c0ead5a13368865eca2b9c0d8c190dd563182b5b3ec085214b34230203583196e2fc2d2c4efe192cec12fb151ae75fba9a19977136c7eda1252de50b5664a163
7
- data.tar.gz: 89ae3bfe1fc0eaf2ef2bf0991bb2eb0e74c44be1f9f8f1c9ae25fd0c08a0e4bf5759c581498e35528ea31d2124a27647071b6644288ce659b1d933b2dfb5cfca
6
+ metadata.gz: 308ed2f06df61653cf4ee6a45c79bb3164a00c42d3cc94a8645530dfda98942f5c345f42588a50317eb78e4491bf1ff1fde52609c983fe96644f71fb2cec5502
7
+ data.tar.gz: 6944c6581d6f26a18f823d50c11ae19dbec6c73a5141473f5ce1a02f657f251afd7b5fc3f23957714f77eb1458a6b466949ff5ec559b9cd8ee54d00350c4c08d
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # jekyll-theme-paperwiki
2
2
 
3
- The intent of this theme is to get all the code out of the way and to allow you to write Markdown articles; the best way to do that is to install the theme as a gem. However, if you want to tinker with the code, just download this repository.
3
+ For storing your worldbuilding notes! The intent of this theme is to get all the code out of the way and to allow you to write Markdown articles; the best way to do that is to install the theme as a gem. However, if you want to tinker with the code, just download this repository.
4
4
 
5
- This theme is not mobile friendly, as I personally do absolutely no worldbuilding on mobile and thus my development skills are lacking. There is also no dark mode or other alternate colour scheme, but please feel free to fork this project and add whatever functionality it's missing.
5
+ For the easiest starting point, I have uploaded a sample site that you can download with everything preconfigured, so if you're unfamiliar with Jekyll you can bypass all the setup and get right to it. See that repo for instructions.
6
+
7
+ I've tried to adhere to accessible and easy to read design principles while retaining the look and layout of a classic wiki that we're all familiar with - I've aped some elements of Wikipedia's organizational system and layout while trying to make it as clean and user friendly as possible.
8
+
9
+ This theme is not mobile friendly, as I personally do absolutely no work on mobile and thus my development skills are lacking. There is also no dark mode or other alternate colour scheme, but please feel free to fork this project and add whatever functionality it's missing.
6
10
 
7
11
 
8
12
 
@@ -15,7 +19,7 @@ In case you're unfamiliar with it, a basic Jekyll site includes the following:
15
19
  + The `_site` folder contains everything that Jekyll outputs when it builds the site. Don't edit anything in this folder, as it will be rewritten the next time you serve the site.
16
20
  + The `assets` folder contains things like fonts, images, and Javascript files. It also contains a `.scss` file importing all of your SCSS so that Jekyll can convert it to regular CSS.
17
21
 
18
- This theme comes with all of these prepackaged, so most of what you have to do is edit the `_config.yaml` file. The theme has some default config set already, but you can override these in your own config file if you wish. You can also add any of the above folders with includes, layouts, or SCSS to override the theme's own files. For example, you will want to add your own `assets` folder to store your own images, including one titled `favicon.png` in order to override the placeholder one i've included.
22
+ This theme comes with all of these prepackaged, so most of what you have to do is edit the `_config.yaml` file. The theme has some default config set already, but you can override these in your own config file if you wish. You can also add any of the above folders to your own project with includes, layouts, or SCSS to override the theme's files. For example, you will want to add your own `assets` folder to store your own images, including one titled `favicon.png` in order to override the placeholder one i've included.
19
23
 
20
24
 
21
25
 
@@ -46,12 +50,10 @@ This will give you a very bare bones Jekyll site, with an index page, a folder f
46
50
 
47
51
  (Don't worry about the .gitignore or the Gemfile.lock.)
48
52
 
49
- (You can also move your `_posts` folder into your `collections` folder if you want; I find it makes things a little neater.)
50
-
51
53
  To use this theme, open your Jekyll site's `Gemfile`, delete the line that says `gem "minima"` and replace it with this line:
52
54
 
53
55
  ```ruby
54
- gem "jekyll-theme-paperwiki", "~> 0.1.2"
56
+ gem "jekyll-theme-paperwiki", "~> 0.1.4"
55
57
  ```
56
58
 
57
59
  And add this line to your Jekyll site's `_config.yml`:
@@ -97,7 +99,11 @@ All of your wiki pages should be written in markdown, and you must begin each `.
97
99
 
98
100
  Between these two lines is where you include *front matter*, such as specifying the layout or the permalink to the page. However, you can leave the front matter blank - wiki pages have layouts and permalinks set by default in the theme's config file, and you only need to specify them if you want to override the defaults. You also do not need to specify a title for the page, as it is automatically taken from the filename. All you absolutely need is the two triple-dashed lines, as Jekyll needs it to know that the front matter is there in order to output the page.
99
101
 
100
-
102
+ Caveats:
103
+ - If the site won't build due to an error with the random page, make sure you have more than one wiki article for it to draw from
104
+ - You may need to specify a permalink and a title if you want to use certain characters that are not allowed in filenames -- say, some IPA characters. Otherwise just title your articles "Article title.md", with spaces, not underscores or hyphens, and the default settings will take care of the rest.
105
+
106
+
101
107
 
102
108
  ## Config
103
109
 
@@ -116,7 +122,8 @@ collections:
116
122
  However, if you would like to have additional collections akin to the Wikimedia Foundation's other projects - such as Wikisource, Wikispecies, or Wiktionary - then you can specify them in the same format as above, also under the `collections` key:
117
123
 
118
124
  ```yaml
119
- collection_name:
125
+ collections:
126
+ COLLECTION_NAME:
120
127
  output: true
121
128
  permalink: /:collection/:name
122
129
  ```
@@ -138,9 +145,9 @@ You will also need to add a data file listing your projects: create a folder tit
138
145
  desc: A brief description here
139
146
  ```
140
147
 
141
- For the icon, find one you like from RemixIcon and copy the code.
148
+ For the icon, find one you like from [RemixIcon](https://remixicon.com/) and copy the code.
142
149
 
143
- This will add links to each different collection on your homepage, and allow you to limit the scope of your searches to a single collection or expand it to cover all of them at once. You do not need to do anything to
150
+ This will add links to each different collection on your homepage, and allow you to limit the scope of your searches to a single collection or expand it to cover all of them at once. The search logic is already taken care of in the theme itself; it just needs the names of your collections.
144
151
 
145
152
 
146
153
 
data/_config.yml CHANGED
@@ -1,14 +1,32 @@
1
1
  # Build settings
2
2
  include: ['_pages'] # forces custom pages to be organized into their own directory
3
3
 
4
+ # Plugins
5
+ # plugins:
6
+ # - jekyll-ipa
7
+
8
+ random_redirect:
9
+ pages: true
10
+
11
+ multi_projects: true
12
+ entry_tags_top: true
13
+
14
+
15
+
16
+ # Sets the collections directory and defines your collections.
4
17
  collections_dir: collections
5
18
  collections:
6
19
  wiki:
7
20
  output: true
8
21
  permalink: /:collection/:name
22
+ works:
23
+ output: true
24
+ permalink: /:collection/:name
25
+ grammars:
26
+ output: true
27
+ permalink: /:collection/:name
28
+
9
29
 
10
- random_redirect:
11
- pages: true
12
30
 
13
31
  # Front matter defaults, so you don't need to set layouts on every new page.
14
32
  # As long as pages are in the correct folder, they'll automatically have the
@@ -33,3 +51,15 @@ defaults:
33
51
  type: "wiki"
34
52
  values:
35
53
  layout: "wiki"
54
+ -
55
+ scope:
56
+ path: "_works" # all pages in the works folder
57
+ type: "works"
58
+ values:
59
+ layout: "work"
60
+ -
61
+ scope:
62
+ path: "_grammars" # all pages in the grammars folder
63
+ type: "grammars"
64
+ values:
65
+ layout: "grammar"
@@ -4,11 +4,7 @@
4
4
  {% for item in site.data.projects %}
5
5
  {% if page.url contains item.link %}
6
6
  Total number of {{ item.name | downcase }} entries:
7
- {% if item.name == "Wiki" %}
8
- {{ site.wiki.size }}
9
- {% else %}
10
- ? for now
11
- {% endif %}
7
+ <strong>{{ site.[page.project].size }}</strong>
12
8
  {% endif %}
13
9
  {% endfor %}
14
10
  </section>
@@ -0,0 +1,36 @@
1
+ <div class="entry-subhead_pair">
2
+
3
+ <span class="entry-subhead_key">Portals:</span>
4
+ <span>
5
+ <a href="/{{ page.collection }}/portal:{{ page.portal }}" class="entry-subhead_value">
6
+ {{ page.portal }}
7
+ </a>
8
+ </span>
9
+
10
+ </div>
11
+
12
+ <div class="entry-subhead_pair">
13
+
14
+ <span class="entry-subhead_key">Categories:</span>
15
+ <span>
16
+ {% for item in page.categories %}
17
+ <a href="/{{ page.collection }}/category:{{ item | slugify }}" class="entry-subhead_value">
18
+ {{ item }}
19
+ </a>
20
+ {% endfor %}
21
+ </span>
22
+
23
+ </div>
24
+
25
+ <div class="entry-subhead_pair">
26
+
27
+ <span class="entry-subhead_key">Tags:</span>
28
+ <span>
29
+ {% for item in page.tags %}
30
+ <a href="/{{ page.category }}/tag:{{ item }}" class="entry-subhead_value">
31
+ {{ item }}
32
+ </a>
33
+ {% endfor %}
34
+ </span>
35
+
36
+ </div>
@@ -0,0 +1,8 @@
1
+ "{{ page.url | slugify }}": {
2
+ "title": "{{ page.title | xml_escape }}",
3
+ "content": {{ page.content | markdownify | strip_newlines | strip_html | jsonify }},
4
+ "portal": "{{ page.portal | xml_escape }}",
5
+ "categories": "{{ page.categories | array_to_sentence_string: "" | xml_escape }}",
6
+ "url": "{{ site.url | append: page.url | xml_escape }}",
7
+ "path": "{{ page.url | xml_escape }}"
8
+ }
@@ -0,0 +1,67 @@
1
+ <section class="entry-sidebar">
2
+
3
+ {% if page.other_projects %}
4
+
5
+ <section class="entry-other_projects">
6
+ View in other collections:
7
+ <ul>
8
+ {% for item in page.other_projects %}
9
+ <li>
10
+ <a href="/{{ item }}{{ page.url | remove_first: "/wiki" }}">{{ item | capitalize }}</a>
11
+ </li>
12
+ {% endfor %}
13
+ </ul>
14
+ </section>
15
+
16
+ {% endif %}
17
+
18
+
19
+ {% if page.image %}
20
+ <figure>
21
+ <img src="{{ page.image }}" width=auto class="entry-image">
22
+ {% if page.image_caption %}
23
+ <figcaption>{{ page.image_caption }}</figcaption>
24
+ {% endif %}
25
+ </figure>
26
+ {% endif %}
27
+
28
+
29
+
30
+ {% if page.quickstats %}
31
+
32
+ <section class="entry-quickstats">
33
+
34
+ <table class="stats-table">
35
+ {% for stat in page.quickstats %}
36
+ {% if stat[0] == "colspan_2" %}
37
+ <tr>
38
+ <td colspan="2" class="entry-quickstats_double">
39
+ {{ stat[1] | replace: "_", " " | capitalize }}
40
+ </td>
41
+ </tr>
42
+ {% else %}
43
+ <tr>
44
+ <td>{{ stat[0] | replace: "_", " " | capitalize }}</td>
45
+ <td>{{ stat[1] }}</td>
46
+ </tr>
47
+ {% endif %}
48
+ {% endfor %}
49
+ </table>
50
+
51
+ </section>
52
+
53
+ {% endif %}
54
+
55
+
56
+
57
+ {% if page.quicknotes %}
58
+
59
+ <section class="entry-quicknotes">
60
+
61
+ {{ page.quicknotes }}
62
+
63
+ </section>
64
+
65
+ {% endif %}
66
+
67
+ <section>
data/_layouts/entry.html CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  <nav class="entry-index">
6
6
 
7
+ <ul class="entry-index_return">
8
+ <li>
9
+ <a href="/{{ page.collection }}">
10
+ ← Return to {{ page.collection | capitalize }}
11
+ </a>
12
+ </li>
13
+ </ul>
14
+
7
15
  </nav>
8
16
 
9
17
  {{ content }}
@@ -0,0 +1,12 @@
1
+ ---
2
+ layout: page
3
+ ---
4
+
5
+ <h1>{{ page.title }}</h1>
6
+
7
+ <dl id="search-results"></dl>
8
+
9
+ {{ content }}
10
+
11
+ <script src="/assets/js/lunr.js"></script>
12
+ <script src="/assets/js/search.js"></script>
data/_layouts/wiki.html CHANGED
@@ -4,121 +4,24 @@
4
4
 
5
5
  <article class="entry entry-wiki">
6
6
 
7
-
8
-
9
7
  <h1>
10
8
  {{ page.title }}
11
9
  </h1>
12
10
 
13
-
14
-
15
- {% if page.other_projects %}
16
-
17
- <section class="entry-other_projects">
18
- View in other collections:
19
- <ul>
20
- {% for item in page.other_projects %}
21
- <li>
22
- <a href="/{{ item }}{{ page.url | remove_first: "/wiki" }}">{{ item | capitalize }}</a>
23
- </li>
24
- {% endfor %}
25
- </ul>
11
+ {% if site.entry_tags_top %}
12
+ <section class="entry-tags entry-tags_top">
13
+ {% include entry_tags.html %}
26
14
  </section>
27
-
28
15
  {% endif %}
29
16
 
30
-
31
-
32
- <section class="entry-tags">
33
-
34
- <div class="entry-subhead_pair">
35
-
36
- <span class="entry-subhead_key">Portals:</span>
37
- <span>
38
- <a href="/wiki/portal:{{ page.portal }} class="entry-subhead_value"">
39
- {{ page.portal }}
40
- </a>
41
- </span>
42
-
43
- </div>
44
-
45
- <div class="entry-subhead_pair">
46
-
47
- <span class="entry-subhead_key">Categories:</span>
48
- <span>
49
- {% for item in page.categories %}
50
- <a href="/wiki/category:{{ item | slugify }}" class="entry-subhead_value">
51
- {{ item }}
52
- </a>
53
- {% endfor %}
54
- </span>
55
-
56
- </div>
57
-
58
- <div class="entry-subhead_pair">
59
-
60
- <span class="entry-subhead_key">Tags:</span>
61
- <span>
62
- {% for item in page.tags %}
63
- <a href="/wiki/tag:{{ item }}" class="entry-subhead_value">
64
- {{ item }}
65
- </a>
66
- {% endfor %}
67
- </span>
68
-
69
- </div>
70
-
71
- </section>
72
-
73
17
  {{ content }}
74
18
 
75
- </article>
76
-
77
-
78
-
79
- {% if page.quickstats %}
80
-
81
- <section class="entry-quickstats">
82
-
83
- {% if page.image %}
84
- <figure>
85
- <img src="{{ page.image }}" width=auto class="stats-image">
86
- <figcaption>{{ page.image_caption }}</figcaption>
87
- </figure>
88
- {% endif %}
89
-
90
- <section class="stats-facts">
91
-
92
- <table class="stats-table">
93
- {% if page.type == "person" %}
94
- <tr><td>Name</td><td>{{ page.fullname }}</td></tr>
95
- <tr><td>Birthday</td><td>{{ page.birthday }}</td></tr>
96
- <tr><td>Birthplace</td><td>{{ page.birthplace }}</td></tr>
97
- <tr><td>Known for</td><td>{{ page.known_for }}</td></tr>
98
- {% endif %}
99
- {% if page.type == "planet" %}
100
- <tr><td>Orbital period</td><td>{{ page.orbital_period }}</td></tr>
101
- <tr><td>Semimajor axis</td><td>{{ page.semimajor_axis }}</td></tr>
102
- <tr><td>Orbital eccentricity</td><td>{{ page.eccentricity }}</td></tr>
103
- <tr><td>Aphelion</td><td>{{ page.aphelion }}</td></tr>
104
- <tr><td>Perihelion</td><td>{{ page.perihelion }}</td></tr>
105
- <tr><td>Orbital speed</td><td>{{ page.orbital_speed }}</td></tr>
106
- <tr><td>Orbital period</td><td>{{ page.orbital_period }}</td></tr>
107
- <tr><td>Orbital inclination</td><td>{{ page.orbital_inclination }}</td></tr>
108
- <tr><td>Satellites</td><td>{{ page.satellites }}</td></tr>
109
- <tr><td>Radius (mean)</td><td>{{ page.radius }}</td></tr>
110
- <tr><td>Radius (equatorial)</td><td>{{ page.radius_equatorial }}</td></tr>
111
- <tr><td>Radius (polar)</td><td>{{ page.radius_polar }}</td></tr>
112
- <tr><td>Circumference</td><td>{{ page.circumference }}</td></tr>
113
- <tr><td>Surface area</td><td>{{ page.surface_area }}</td></tr>
114
- <tr><td>Sidereal day</td><td>{{ page.sidereal_day }}</td></tr>
115
- <tr><td>Synodic day</td><td>{{ page.synodic_day }}</td></tr>
116
- <tr><td>Axial tilt</td><td>{{ page.axial_tilt }}</td></tr>
117
- {% endif %}
118
- </table>
119
-
19
+ {% if site.entry_tags_top == false %}
20
+ <section class="entry-tags entry-tags_bottom">
21
+ {% include entry_tags.html %}
120
22
  </section>
23
+ {% endif %}
121
24
 
122
- </section>
25
+ </article>
123
26
 
124
- {% endif %}
27
+ {% include wiki_sidebar.html %}
@@ -0,0 +1,28 @@
1
+ # usage: {% blockquote text[0] text[1] text[2]%}
2
+ # usage: {% blockquote text[0] text[1] text[2]%}
3
+ # text[0]: the text of the blockquote
4
+ # text[1]: the author of the blockquote
5
+ # text[2]: the source of the blockquote
6
+
7
+ module Jekyll
8
+ module Tags
9
+ class RenderBlockquoteTag < Liquid::Tag
10
+
11
+ require "shellwords"
12
+
13
+ # initialize is called when we encounter the {% blockquote %} Liquid tag; 'blockquote' is the tag name and anything immediately after it is passed in via the second argument
14
+ def initialize(tag_name, text, tokens)
15
+ super
16
+ @text = text.shellsplit
17
+ end
18
+
19
+ def render(context)
20
+ "<figure><blockquote>#{@text[0]}<figcaption>#{@text[1]}, <cite>#{@text[2]}</cite></figcaption></blockquote></figure>"
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+
27
+ # The register_tag method takes two arguments: the user-facing name of the tag [blockquote], and the class that implements it [RenderBlockquoteTag].
28
+ Liquid::Template.register_tag("blockquote", Jekyll::Tags::RenderBlockquoteTag)
data/_plugins/gloss.rb CHANGED
@@ -3,14 +3,14 @@ module Jekyll
3
3
 
4
4
  def gloss(input) # will be available as the "gloss" filter
5
5
  @text = input
6
- # puts "<tr>"
6
+ puts "<table><tbody><tr>"
7
7
 
8
- # lexemes = @text.split(" ")
9
- # lexemes.each do |word|
10
- # puts "<td class=\"gloss_item\">#{word}</td>"
11
- # end
8
+ lexemes = @text.split(" ")
9
+ lexemes.each do |word|
10
+ puts "<td class=\"gloss_item\">#{word}</td>"
11
+ end
12
12
 
13
- # puts "</tr>"
13
+ puts "</tr></tbody><table>"
14
14
 
15
15
  # morphemic_analysis
16
16
  # morphemic_gloss
@@ -1,3 +1,11 @@
1
+ # usage:
2
+ # {% interlinear %}
3
+ # sentence in object lang
4
+ # sentence in object lang broken down into morphemes
5
+ # interlinear gloss of morphemes
6
+ # translation into target lang
7
+ # {% endinterlinear %}
8
+
1
9
  module Jekyll
2
10
  module Tags
3
11
  class InterlinearGlossTag < Liquid::Block
@@ -7,13 +15,18 @@ module Jekyll
7
15
  # initialize is called when we encounter the {% interlinear %} Liquid tag; 'interlinear' is the tag name and anything immediately after it is passed in via the second argument
8
16
  def initialize(tag_name, text, tokens)
9
17
  super
10
- # @text = text.shellsplit
11
- # @wordcount = @text[0].length
18
+ @text = text.shellsplit # splits the input string into individual words
19
+ # @wordcount = @text[0].length # counts the number of words in the string
20
+
12
21
  # object_lang, morphemic_analysis, morphemic_gloss, target_lang
13
22
  end
14
23
 
15
24
  def render(context)
16
- # "<table class=\"interlinear-gloss\"><tbody><tr><td colspan=\"7\">#{@text[0]}</td></tr>" + "<tr><td>#{@text[1]}</td></tr></tbody></table>"
25
+ "<table class=\"interlinear-gloss\">
26
+ <tbody>
27
+ <tr>
28
+ <td colspan=\"#{@wordcount}\">#{@text[0]}</td>
29
+ </tr>" + "<tr><td>#{@text[1]}</td></tr><tr><td>#{@text[2]}</td></tr><tr><td>#{@text[3]}</td></tr></tbody></table>"
17
30
  end
18
31
 
19
32
  end
@@ -21,4 +34,4 @@ module Jekyll
21
34
  end
22
35
 
23
36
  # The register_tag method takes two arguments: the user-facing name of the tag [interlinear], and the class that implements it [InterlinearGlossTag].
24
- Liquid::Template.register_tag('interlinear', Jekyll::Tags::InterlinearGlossTag)
37
+ Liquid::Template.register_tag("interlinear", Jekyll::Tags::InterlinearGlossTag)
data/_plugins/ipa.rb CHANGED
@@ -1,7 +1,11 @@
1
+ # usage: {% ipa /phonemic text/%}
2
+ # usage: {% ipa [phonetic text]%}
3
+
1
4
  module Jekyll
2
5
  module Tags
3
6
  class RenderPhoneticTag < Liquid::Tag
4
7
 
8
+ # initialize is called when we encounter the {% ipa %} Liquid tag; 'ipa' is the tag name and anything immediately after it is passed in via the second argument
5
9
  def initialize(tag_name, text, tokens)
6
10
  super
7
11
  @text = text
@@ -15,5 +19,5 @@ module Jekyll
15
19
  end
16
20
  end
17
21
 
18
- # The register_tag method takes two arguments: the user-facing name of the tag [lang], and the class that implements it [DefineLanguageTag].
22
+ # The register_tag method takes two arguments: the user-facing name of the tag [ipa], and the class that implements it [RenderPhoneticTag].
19
23
  Liquid::Template.register_tag("ipa", Jekyll::Tags::RenderPhoneticTag)
data/_plugins/lang.rb CHANGED
@@ -1,5 +1,5 @@
1
- # usage: {% lang text[0] text[1] text[2] %}
2
- # usage: {% lang ko 바이 괕 모 iced jelly dish %}
1
+ # usage: {% lang text[0] text[1] text[2]%}
2
+ # usage: {% lang ko 바이 괕 모 iced jelly dish%}
3
3
  # text[0] = language code
4
4
  # text[1] = the text, in latin script or not
5
5
  # text[2] = the translation into english
@@ -10,6 +10,7 @@ module Jekyll
10
10
 
11
11
  require "shellwords"
12
12
 
13
+ # initialize is called when we encounter the {% lang %} Liquid tag; 'lang' is the tag name and anything immediately after it is passed in via the second argument
13
14
  def initialize(tag_name, text, tokens)
14
15
  super
15
16
  @text = text.shellsplit
@@ -0,0 +1,24 @@
1
+ # usage: {% sidenote %}
2
+
3
+ module Jekyll
4
+ module Tags
5
+ class RenderSideNoteTag < Liquid::Tag
6
+
7
+ require "shellwords"
8
+
9
+ # initialize is called when we encounter the {% sidenote %} Liquid tag; 'sidenote' is the tag name and anything immediately after it is passed in via the second argument
10
+ def initialize(tag_name, text, tokens)
11
+ super
12
+ @text = text.shellsplit
13
+ end
14
+
15
+ def render(context)
16
+ "<label for='#{@text[0]}' class='margin-toggle sidenote-number'></label><input type='checkbox' id='#{@text[0]}' class='margin-toggle'/><span class='sidenote'>#{@text[1]} </span>"
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+
23
+ # The register_tag method takes two arguments: the user-facing name of the tag [sidenote], and the class that implements it [RenderSideNoteTag].
24
+ Liquid::Template.register_tag("sidenote", Jekyll::Tags::RenderSideNoteTag)