Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit a032d39

Browse files
author
Matt Gaunt
committed
Fixes a number of v 2 bugs
1 parent 147b33e commit a032d39

File tree

6 files changed

+82
-81
lines changed

6 files changed

+82
-81
lines changed

src/content/en/resources/jekyll/custom-jekyll-variables.markdown

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ from the current page down.
1414

1515
You can view the content of the object for a page with:
1616

17-
{% highlight text %}
18-
{% raw %}{{page.context}}{% endraw %}
19-
{% endhighlight %}
17+
<pre>
18+
&#123;&#123;page.context&#125;&#125;
19+
</pre>
2020

2121
## Structure of page.context
2222

@@ -42,18 +42,15 @@ The current pages context is:
4242

4343
To display all the pages title you can use liquid like so:
4444

45-
{% highlight text %}
46-
{% raw %}
47-
<ol>
48-
{% for page in page.context.pages %}
49-
<li>
50-
{{page.title}}
51-
</li>
52-
{% endfor %}
53-
</ol>
54-
{% endraw %}
55-
{% endhighlight %}
56-
45+
<pre>
46+
&lt;ol&gt;
47+
&#123;% for page in page.context.pages %&#125;
48+
&lt;li&gt;
49+
&#123;&#123;page.title&#125;&#125;
50+
&lt;/li&gt;
51+
&#123;% endfor %&#125;
52+
&lt;/ol&gt;
53+
</pre>
5754

5855
<ol>
5956
{% for page in page.context.pages %}
@@ -66,18 +63,15 @@ To display all the pages title you can use liquid like so:
6663
To display titles for all the subdirectories you could do something
6764
like the following:
6865

69-
70-
{% highlight text %}
71-
{% raw %}
72-
<ol>
73-
{% for subdirectory in page.context.subdirectories %}
74-
<li>
75-
{{subdirectory.index.title}}
76-
</li>
77-
{% endfor %}
78-
</ol>
79-
{% endraw %}
80-
{% endhighlight %}
66+
<pre>
67+
&lt;ol&gt;
68+
&#123;% for subdirectory in page.context.subdirectories %&#125;
69+
&lt;li&gt;
70+
&#123;&#123;subdirectory.index.title&#125;&#125;
71+
&lt;/li&gt;
72+
&#123;% endfor %&#125;
73+
&lt;/ol&gt;
74+
</pre>
8175

8276
# page.nextPage & page.previousPage
8377

@@ -87,17 +81,9 @@ do with the nextPage and previousPage variables.
8781

8882
This code:
8983

90-
{% highlight text %}
91-
{% raw %}
92-
{{page.nextPage}}
93-
{% endraw %}
94-
{% endhighlight %}
84+
&#123;&#123;page.nextPage&#125;&#125;
9585

96-
{% highlight text %}
97-
{% raw %}
98-
{{page.previousPage}}
99-
{% endraw %}
100-
{% endhighlight %}
86+
&#123;&#123;page.previousPage&#125;&#125;
10187

10288
Will output the following (Note: you may see 0, 1 or 2 snippets depending
10389
on whether or not this page has a next and / or previous page):
@@ -131,11 +117,9 @@ is that it will also account for language of the current page.
131117
Canonical URL has some filtering done on it to become a canonical url and
132118
will always be the full path.
133119

134-
{% highlight text %}
135-
{% raw %}
136-
{{page.canonical_url}}
137-
{% endraw %}
138-
{% endhighlight %}
120+
<pre>
121+
&#123;&#123;page.canonical_url&#125;&#125;
122+
</pre>
139123

140124
{% highlight text %}
141125
{{page.canonical_url}}
@@ -145,11 +129,9 @@ will always be the full path.
145129

146130
The relative url is the relative url for a page from the root of the domain
147131

148-
{% highlight text %}
149-
{% raw %}
150-
{{page.relative_url}}
151-
{% endraw %}
152-
{% endhighlight %}
132+
<pre>
133+
&#123;&#123;page.relative_url&#125;&#125;
134+
</pre>
153135

154136
{% highlight text %}
155137
{{page.relative_url}}
@@ -160,8 +142,6 @@ The relative url is the relative url for a page from the root of the domain
160142
This variable is defined for every page and will be true if a translation is
161143
no longer up to date with the primary language version, otherwise its false.
162144

163-
{% highlight text %}
164-
{% raw %}
165-
{{page.outOfDate}}
166-
{% endraw %}
167-
{% endhighlight %}
145+
<pre>
146+
&#123;&#123;page.outOfDate&#125;&#125;
147+
</pre>

src/content/en/resources/jekyll/custom-tags.markdown

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ We'll look at each of these in more detail below.
2121

2222
Includes the entire contents of a file
2323

24-
<pre>{% raw %}{% include_code src=_code/example.js %}{% endraw %}</pre>
24+
<pre>&#123;% include_code src=_code/example.js %&#125;</pre>
2525

2626
{% include_code src=_code/example.js %}
2727

@@ -43,7 +43,7 @@ The snippet is defined in example.html like so:
4343

4444
You can then add it to a page with:
4545

46-
<pre>{% raw %}{% include_code src=_code/example.html snippet=examplesnippet %}{% endraw %}</pre>
46+
<pre>&#123;% include_code src=_code/example.html snippet=examplesnippet %&#125;</pre>
4747

4848
The result is:
4949

@@ -53,7 +53,7 @@ The special snippet comments are removed from the code in the final docs.
5353

5454
### Defining the Language of Code
5555

56-
<pre>{% raw %}{% include_code src=_code/example.js snippet=classdefinition lang=javascript %}{% endraw %}</pre>
56+
<pre>&#123;% include_code src=_code/example.js snippet=classdefinition lang=javascript %&#125;</pre>
5757

5858
{% include_code src=_code/example.js snippet=classdefinition lang=javascript %}
5959

@@ -66,9 +66,9 @@ appropriate link to the sample based on the current environment (development,
6666
This is the same as the link sample button except it's styled as a normal
6767
link rather than a button.
6868

69-
<pre>{% raw %}{% link_sample _code/mse-gap.html %}
69+
<pre>&#123;% link_sample _code/mse-gap.html %&#125;
7070
Demo
71-
{% endlink_sample %}{% endraw %}</pre>
71+
&#123;% endlink_sample %&#125;</pre>
7272

7373
{% link_sample _code/mse-gap.html %}Demo{% endlink_sample %}
7474

@@ -82,9 +82,9 @@ appropriate link to the sample based on the current environment (development,
8282
This is the same as the link sample except it's styled as a button rather than
8383
a link.
8484

85-
<pre>{% raw %}{% link_sample_button _code/mse-gap.html %}
85+
<pre>&#123;% link_sample_button _code/mse-gap.html %&#125;
8686
Demo
87-
{% endlink_sample_button %}{% endraw %}</pre>
87+
&#123;% endlink_sample_button %&#125;</pre>
8888

8989
{% link_sample_button _code/mse-gap.html %}
9090
Demo
@@ -100,13 +100,13 @@ embeds.
100100

101101
### Tag usage
102102

103-
<pre>{% raw %}{% ytvideo 2eu23_if6Lw %}{% endraw %}</pre>
103+
<pre>&#123;% ytvideo 2eu23_if6Lw %&#125;</pre>
104104

105105
{% ytvideo 2eu23_if6Lw %}
106106

107107
You can add additional arguments to the end of the youtube embed by adding
108108
them to the end of the tag.
109109

110-
<pre>{% raw %}{% ytvideo 2eu23_if6Lw start=41 %}{% endraw %}</pre>
110+
<pre>&#123;% ytvideo 2eu23_if6Lw start=41 %&#125;</pre>
111111

112112
{% ytvideo 2eu23_if6Lw start=41 %}

src/content/en/resources/jekyll/useful-and-common-tags.markdown

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ related-guides:
4141

4242
This publishes a table of contents for the current page
4343

44-
<pre>{% raw %}{% include shared/toc.liquid %}{% endraw %}</pre>
44+
<pre>&#123;% include shared/toc.liquid %&#125;</pre>
4545

4646
{% include shared/toc.liquid %}
4747

4848
## Takeaways
4949

5050
The takeaway include is used to highlight important parts of a doc
5151

52-
<pre>{% raw %}{% include shared/takeaway.liquid list=page.key-takeaways.example %}{% endraw %}</pre>
52+
<pre>&#123;% include shared/takeaway.liquid list=page.key-takeaways.example %&#125;</pre>
5353

5454
{% include shared/takeaway.liquid list=page.key-takeaways.example %}
5555

@@ -66,13 +66,13 @@ key-takeaways:
6666

6767
## Notes and Remembers
6868

69-
<pre>{% raw %}{% include shared/remember.liquid list=page.notes.example %}{% endraw %}</pre>
69+
<pre>&#123;% include shared/remember.liquid list=page.notes.example %&#125;</pre>
7070

7171
{% include shared/remember.liquid list=page.notes.example %}
7272

7373
or
7474

75-
<pre>{% raw %}{% include shared/note.liquid list=page.notes.example %}{% endraw %}</pre>
75+
<pre>&#123;% include shared/note.liquid list=page.notes.example %&#125;</pre>
7676

7777
{% include shared/note.liquid list=page.notes.example %}
7878

@@ -90,15 +90,15 @@ notes:
9090

9191
## Related Guides
9292

93-
<pre>{% raw %}{% include shared/related_guides.liquid list=page.related-guides.example %}{% endraw %}</pre>
93+
<pre>&#123;% include shared/related_guides.liquid list=page.related-guides.example %&#125;</pre>
9494

9595
{% include shared/related_guides.liquid list=page.related-guides.example %}
9696

9797
{% comment %}
9898
// This should be enabled but needs a different css file that contains these styles
9999
## Subscribe List
100100

101-
<pre>{% raw %}{% include shows/subscribe.liquid %}{% endraw %}</pre>
101+
<pre>&#123;% include shows/subscribe.liquid %&#125;</pre>
102102

103103
{% include shows/subscribe.liquid %}
104104
{% endcomment %}
@@ -110,15 +110,13 @@ code highlighter.
110110

111111
### Example
112112

113-
<pre>{% raw %}
114-
{% highlight javascript %}
113+
<pre>&#123;% highlight javascript %&#125;
115114
if (navigator.onLine) {
116115
console.log('ONLINE!');
117116
} else {
118117
console.log('Connection flaky');
119118
}
120-
{% endhighlight %}
121-
{% endraw %}</pre>
119+
&#123;% endhighlight %&#125;</pre>
122120

123121
{% highlight javascript %}
124122
if (navigator.onLine) {

src/content/en/resources/styleguide/index.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ consectetur nisl.
193193

194194
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut et libero eget
195195
nibh porttitor maximus ac ut urna. `console.log('Inline Code')` Lorem ipsum dolor
196-
sit amet, consectetur adipiscing elit.
196+
sit amet, consectetur adipiscing elit.
197197

198198
### Code Block
199199

200-
To add code highlighting you need to the `{% raw %}{% highlight javascript %}{% endraw %}` and
201-
`{% raw %}{% endhighlight %}{% endraw %}` liquid tags.
200+
To add code highlighting you need to the {{"&#123;% highlight javascript %&#125;"}} and
201+
{{"&#123;% endhighlight %&#125;"}} liquid tags.
202202

203203
{% highlight javascript%}
204204
function() {

src/jekyll/_plugins/build-end-generator.rb

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,22 @@ def generate(site)
2727

2828
generateFeeds(site)
2929

30+
# Initialise the pageGroups mapping
31+
site.data['pageGroups'] = {}
3032

31-
32-
# This should run as the end of all generators and will give pages a
33-
# chance to do any final work needed
3433
site.pages.each { |page|
34+
# Add pages to site.pageGroups
35+
if not page.data['pageGroups'].nil?
36+
page.data['pageGroups'].each { |pageGroup|
37+
pageGroup = pageGroup.downcase.strip
38+
39+
site.data['pageGroups'][pageGroup] ||= []
40+
site.data['pageGroups'][pageGroup] << page
41+
}
42+
end
43+
44+
# This should run as the end of all generators and will give pages a
45+
# chance to do any final work needed
3546
page.onBuildComplete()
3647

3748
page.data['translations'].each { |langCode, translationPage|
@@ -45,6 +56,17 @@ def generate(site)
4556
}
4657
}
4758

59+
60+
site.data['pageGroups'].each { |key, group|
61+
group = group.sort do |a, b|
62+
a_order = a.data['order'] || a.data['published_on'] || 0
63+
b_order = b.data['order'] || b.data['published_on'] || 0
64+
a_order <=> b_order
65+
end
66+
67+
site.data['pageGroups'][key] = group
68+
}
69+
4870
generateSamples(site)
4971
end
5072

@@ -192,8 +214,8 @@ def getPages(subdirectory)
192214
array << page
193215
}
194216

195-
subdirectory['subdirectories'].each { |subdirectory|
196-
array = array + getPages(subdirectory)
217+
subdirectory['subdirectories'].each { |innerSubdirectory|
218+
array = array + getPages(innerSubdirectory)
197219
}
198220

199221
return array

src/jekyll/_plugins/pages/WFPage.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def initialize(site, relativeDir, filename, addtionalYamlKeys=[])
4646
'layout', 'title', 'description', 'order', 'translation_priority',
4747
'authors', 'translators', 'comments', 'published_on', 'updated_on',
4848
'published', 'rss', 'comments', 'key-takeaways', 'notes',
49-
'related-guides', 'html_head_social_img', 'feedName', 'feedURL'
49+
'related-guides', 'html_head_social_img', 'feedName', 'feedURL',
50+
'pageGroups'
5051
]
5152

5253
# This is a Jekyll::Page method (See: http://www.rubydoc.info/github/mojombo/jekyll/Jekyll/Page#process-instance_method)
@@ -153,7 +154,7 @@ def validateYamlData()
153154
puts ''
154155
puts '---------------------------------------------------------------'
155156
puts ''
156-
Jekyll.logger.error "Error: Invalid Author '" + authorKey + "' found in " + @langcode + '/' + self.relative_path
157+
Jekyll.logger.error "Error: Invalid Author '" + authorKey + "' found in " + @langcode + '/' + self.relative_path + ". Please ensure this author is added to src/content/_contributors.yaml."
157158
puts ''
158159
puts '---------------------------------------------------------------'
159160
puts ''

0 commit comments

Comments
 (0)