File tree Expand file tree Collapse file tree 7 files changed +28
-59
lines changed
project_styleguide/templates/patterns Expand file tree Collapse file tree 7 files changed +28
-59
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,15 @@ def has_gist_block(value):
97
97
return False
98
98
99
99
for block in value ._raw_data :
100
+ # special case for work page section block as the streamfields are nested within sections
101
+ if block ["type" ] == "section" :
102
+ for sub_block in block ["value" ]["content" ]:
103
+ if (
104
+ sub_block ["type" ] == "raw_html"
105
+ and "https://gist.github.com" in sub_block ["value" ]
106
+ ):
107
+ return True
108
+
100
109
if block ["type" ] == "raw_html" and "https://gist.github.com" in block ["value" ]:
101
110
return True
102
111
return False
@@ -108,5 +117,10 @@ def has_markdown_block(value):
108
117
return False
109
118
110
119
for block in value ._raw_data :
120
+ # special case for work page section block as the streamfields are nested within sections
121
+ if block ["type" ] == "section" :
122
+ for sub_block in block ["value" ]["content" ]:
123
+ if sub_block ["type" ] == "markdown" :
124
+ return True
111
125
if block ["type" ] == "markdown" :
112
126
return True
Original file line number Diff line number Diff line change 31
31
32
32
< link rel ="stylesheet " type ="text/css " href ="{% static 'css/main.css' %} ">
33
33
34
+ {# Add syntax highlighting for gists if a gist exists within a raw html streamfield #}
35
+ {% if page.body|has_gist_block %}
36
+ < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
37
+ {% endif %}
38
+
39
+ {# Add syntax highlighting for code snippets within a code block streamfield (aka markdown block) #}
40
+ {% if page.body|has_markdown_block %}
41
+ < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
42
+ {% endif %}
43
+
34
44
{% block extra_css %}{% endblock %}
35
45
</ head >
36
46
Original file line number Diff line number Diff line change 1
1
{% extends "patterns/base_page.html" %}
2
2
{% load wagtailcore_tags wagtailimages_tags util_tags static %}
3
3
4
- {% block extra_css %}
5
- {{ block.super }}
6
- {% if page.body|has_gist_block %}
7
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
8
- {% endif %}
9
-
10
- {% if page.body|has_markdown_block %}
11
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
12
- {% endif %}
13
- {% endblock %}
14
-
15
4
{% block meta_tags %}
16
5
< script >
17
6
window . dataLayer = window . dataLayer || [ ] ;
Original file line number Diff line number Diff line change 1
1
{% extends "patterns/base_page.html" %}
2
- {% load wagtailcore_tags wagtailimages_tags util_tags static %}
3
-
4
- {% block extra_css %}
5
- {{ block.super }}
6
- {% if page.body|has_gist_block %}
7
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
8
- {% endif %}
9
-
10
- {% if page.body|has_markdown_block %}
11
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
12
- {% endif %}
13
- {% endblock %}
2
+ {% load wagtailcore_tags wagtailimages_tags %}
14
3
15
4
{% block content %}
16
5
< div class ="grid mt-spacerMedium lg:mt-spacerLarge ">
Original file line number Diff line number Diff line change 1
1
{% extends "patterns/base_page.html" %}
2
- {% load wagtailcore_tags wagtailimages_tags util_tags static %}
3
-
4
- {% block extra_css %}
5
- {{ block.super }}
6
- {% if page.body|has_gist_block %}
7
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
8
- {% endif %}
9
-
10
- {% if page.body|has_markdown_block %}
11
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
12
- {% endif %}
13
- {% endblock %}
2
+ {% load wagtailcore_tags wagtailimages_tags %}
14
3
15
4
{% block content %}
16
5
< div class ="grid grid--spacer-large streamfield ">
Original file line number Diff line number Diff line change 1
1
{% extends "patterns/base_page.html" %}
2
- {% load wagtailcore_tags wagtailimages_tags util_tags static %}
3
-
4
- {% block extra_css %}
5
- {{ block.super }}
6
- {% if page.body|has_gist_block %}
7
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
8
- {% endif %}
9
-
10
- {% if page.body|has_markdown_block %}
11
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
12
- {% endif %}
13
- {% endblock %}
2
+ {% load wagtailcore_tags wagtailimages_tags %}
14
3
15
4
{% block content %}
16
5
< div class ="grid grid--spacer-large streamfield ">
Original file line number Diff line number Diff line change 1
1
{% extends "patterns/pages/work/work_page_base.html" %}
2
- {% load wagtailcore_tags wagtailimages_tags util_tags static %}
3
-
4
- {% block extra_css %}
5
- {{ block.super }}
6
- {% if page.body|has_gist_block %}
7
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/gist.css' %} ">
8
- {% endif %}
9
-
10
- {% if page.body|has_markdown_block %}
11
- < link rel ="stylesheet " type ="text/css " href ="{% static 'css/codehilite.css' %} ">
12
- {% endif %}
13
- {% endblock %}
2
+ {% load wagtailcore_tags wagtailimages_tags %}
14
3
15
4
{# The historical work pages did not have a separate intro - so we just loop over the body streamfield to find the intro block(s) #}
16
5
{% block intro %}
You can’t perform that action at this time.
0 commit comments