govuk_tech_docs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +29 -0
  3. data/.gitignore +34 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +5 -0
  6. data/CHANGELOG.md +36 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE +21 -0
  9. data/README.md +47 -0
  10. data/Rakefile +9 -0
  11. data/example/.ruby-version +1 -0
  12. data/example/Gemfile +3 -0
  13. data/example/config.rb +3 -0
  14. data/example/config/tech-docs.yml +23 -0
  15. data/example/source/index.html.md.erb +17 -0
  16. data/example/source/javascripts/application.js +1 -0
  17. data/example/source/stylesheets/print.css.scss +3 -0
  18. data/example/source/stylesheets/screen-old-ie.css.scss +4 -0
  19. data/example/source/stylesheets/screen.css.scss +1 -0
  20. data/govuk_tech_docs.gemspec +38 -0
  21. data/lib/assets/javascripts/_analytics.js +31 -0
  22. data/lib/assets/javascripts/_govuk/modules.js +57 -0
  23. data/lib/assets/javascripts/_modules/anchored-headings.js +18 -0
  24. data/lib/assets/javascripts/_modules/in-page-navigation.js +124 -0
  25. data/lib/assets/javascripts/_modules/navigation.js +34 -0
  26. data/lib/assets/javascripts/_modules/table-of-contents.js +103 -0
  27. data/lib/assets/javascripts/_start-modules.js +9 -0
  28. data/lib/assets/javascripts/_vendor/fixedsticky.js +194 -0
  29. data/lib/assets/javascripts/_vendor/jquery.js +5 -0
  30. data/lib/assets/javascripts/_vendor/lodash.js +613 -0
  31. data/lib/assets/javascripts/_vendor/modernizr.js +3 -0
  32. data/lib/assets/javascripts/govuk_tech_docs.js +10 -0
  33. data/lib/assets/stylesheets/_accessibility.scss +9 -0
  34. data/lib/assets/stylesheets/_core.scss +62 -0
  35. data/lib/assets/stylesheets/_fonts.scss +29 -0
  36. data/lib/assets/stylesheets/_govuk_tech_docs.scss +2 -0
  37. data/lib/assets/stylesheets/_syntax-highlighting.scss +196 -0
  38. data/lib/assets/stylesheets/govuk_frontend_toolkit/_colours.scss +2 -0
  39. data/lib/assets/stylesheets/govuk_frontend_toolkit/_conditionals.scss +81 -0
  40. data/lib/assets/stylesheets/govuk_frontend_toolkit/_css3.scss +90 -0
  41. data/lib/assets/stylesheets/govuk_frontend_toolkit/_device-pixels.scss +10 -0
  42. data/lib/assets/stylesheets/govuk_frontend_toolkit/_font_stack.scss +19 -0
  43. data/lib/assets/stylesheets/govuk_frontend_toolkit/_grid_layout.scss +136 -0
  44. data/lib/assets/stylesheets/govuk_frontend_toolkit/_helpers.scss +16 -0
  45. data/lib/assets/stylesheets/govuk_frontend_toolkit/_measurements.scss +14 -0
  46. data/lib/assets/stylesheets/govuk_frontend_toolkit/_shims.scss +55 -0
  47. data/lib/assets/stylesheets/govuk_frontend_toolkit/_typography.scss +249 -0
  48. data/lib/assets/stylesheets/govuk_frontend_toolkit/_url-helpers.scss +16 -0
  49. data/lib/assets/stylesheets/govuk_frontend_toolkit/colours/_organisation.scss +103 -0
  50. data/lib/assets/stylesheets/govuk_frontend_toolkit/colours/_palette.scss +77 -0
  51. data/lib/assets/stylesheets/govuk_frontend_toolkit/design-patterns/_alpha-beta.scss +66 -0
  52. data/lib/assets/stylesheets/govuk_frontend_toolkit/design-patterns/_breadcrumbs.scss +53 -0
  53. data/lib/assets/stylesheets/govuk_frontend_toolkit/design-patterns/_buttons.scss +141 -0
  54. data/lib/assets/stylesheets/govuk_frontend_toolkit/design-patterns/_media-player.scss +242 -0
  55. data/lib/assets/stylesheets/modules/_anchored-heading.scss +54 -0
  56. data/lib/assets/stylesheets/modules/_app-pane.scss +64 -0
  57. data/lib/assets/stylesheets/modules/_footer.scss +130 -0
  58. data/lib/assets/stylesheets/modules/_govuk-logo.scss +47 -0
  59. data/lib/assets/stylesheets/modules/_header.scss +289 -0
  60. data/lib/assets/stylesheets/modules/_phase-banner.scss +22 -0
  61. data/lib/assets/stylesheets/modules/_skip-link.scss +31 -0
  62. data/lib/assets/stylesheets/modules/_technical-documentation.scss +236 -0
  63. data/lib/assets/stylesheets/modules/_toc.scss +221 -0
  64. data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +23 -0
  65. data/lib/assets/stylesheets/utilities/_fonts.scss +29 -0
  66. data/lib/assets/stylesheets/utilities/_printable.scss +13 -0
  67. data/lib/assets/stylesheets/vendor/_fixedsticky.scss +22 -0
  68. data/lib/govuk_tech_docs.rb +54 -0
  69. data/lib/govuk_tech_docs/table_of_contents/heading.rb +29 -0
  70. data/lib/govuk_tech_docs/table_of_contents/heading_tree.rb +27 -0
  71. data/lib/govuk_tech_docs/table_of_contents/heading_tree_builder.rb +41 -0
  72. data/lib/govuk_tech_docs/table_of_contents/heading_tree_renderer.rb +46 -0
  73. data/lib/govuk_tech_docs/table_of_contents/headings_builder.rb +37 -0
  74. data/lib/govuk_tech_docs/table_of_contents/helpers.rb +20 -0
  75. data/lib/govuk_tech_docs/tech_docs_html_renderer.rb +24 -0
  76. data/lib/govuk_tech_docs/unique_identifier_extension.rb +13 -0
  77. data/lib/govuk_tech_docs/unique_identifier_generator.rb +72 -0
  78. data/lib/govuk_tech_docs/version.rb +3 -0
  79. data/lib/source/favicon.ico +0 -0
  80. data/lib/source/images/anchored-heading-icon-2x.png +0 -0
  81. data/lib/source/images/anchored-heading-icon.png +0 -0
  82. data/lib/source/images/gov.uk_logotype_crown-2x.png +0 -0
  83. data/lib/source/images/gov.uk_logotype_crown.png +0 -0
  84. data/lib/source/images/gov.uk_logotype_crown_invert_trans.png +0 -0
  85. data/lib/source/images/govuk-crest-2x.png +0 -0
  86. data/lib/source/images/govuk-crest.png +0 -0
  87. data/lib/source/images/govuk-icn-close.png +0 -0
  88. data/lib/source/images/govuk-icn-close@2x.png +0 -0
  89. data/lib/source/images/govuk-icn-numbered-list.png +0 -0
  90. data/lib/source/images/govuk-icn-numbered-list@2x.png +0 -0
  91. data/lib/source/images/open-government-licence.png +0 -0
  92. data/lib/source/images/open-government-licence_2x.png +0 -0
  93. data/lib/source/layouts/_analytics.erb +14 -0
  94. data/lib/source/layouts/_footer.erb +10 -0
  95. data/lib/source/layouts/_header.erb +46 -0
  96. data/lib/source/layouts/core.erb +59 -0
  97. data/lib/source/layouts/layout.erb +16 -0
  98. metadata +323 -0
@@ -0,0 +1,242 @@
1
+ @import '../colours';
2
+ @import '../url-helpers';
3
+
4
+ // Player overrides
5
+
6
+ @mixin media-player {
7
+ display: block;
8
+ overflow: hidden;
9
+ margin: 30px 0;
10
+
11
+ &.player-wide {
12
+ min-width: 580px;
13
+ }
14
+
15
+ span {
16
+ display: block;
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+
21
+ .video {
22
+ position: relative;
23
+ z-index: 3000;
24
+
25
+ iframe {
26
+ display: block;
27
+ }
28
+ }
29
+
30
+ .logo {
31
+ display: none;
32
+ }
33
+
34
+ .control-bar {
35
+ position: relative;
36
+ width: 100%;
37
+ height: 60px;
38
+ border-bottom: 1px solid $border-colour;
39
+
40
+ button {
41
+ background: transparent;
42
+ border: none;
43
+ padding: 0;
44
+ cursor: pointer;
45
+ }
46
+
47
+ a,
48
+ button {
49
+ &:focus {
50
+ background-color: $focus-colour;
51
+ outline: none;
52
+ }
53
+ }
54
+
55
+ .player-controls {
56
+ .play,
57
+ .pause {
58
+ position: absolute;
59
+ bottom: 0;
60
+ left: 0;
61
+ width: 40px;
62
+ height: 40px;
63
+ overflow: hidden;
64
+ text-indent: -5000%;
65
+ background-repeat: no-repeat;
66
+ background-position: center left;
67
+ }
68
+
69
+ .play {
70
+ background-image: file-url('player-icon-play.png');
71
+ }
72
+
73
+ .pause {
74
+ background-image: file-url('player-icon-pause.png');
75
+ }
76
+
77
+ .rewind,
78
+ .forward {
79
+ position: absolute;
80
+ top: 0;
81
+ z-index: 30;
82
+ height: 20px;
83
+ width: 40px;
84
+ overflow: hidden;
85
+ text-indent: -5000%;
86
+ background-repeat: no-repeat;
87
+ background-position: center left;
88
+ }
89
+
90
+ .rewind {
91
+ left: 0;
92
+ background-image: file-url('player-icon-rewind.png');
93
+ }
94
+
95
+ .forward {
96
+ left: 100%;
97
+ margin-left: -40px;
98
+ background-image: file-url('player-icon-forward.png');
99
+ }
100
+ }
101
+
102
+ .volume-controls {
103
+ position: absolute;
104
+ bottom: 0;
105
+ right: 0;
106
+ height: 40px;
107
+ width: 180px;
108
+ overflow: visible;
109
+
110
+ .mute {
111
+ position: absolute;
112
+ bottom: 0;
113
+ left: 120px;
114
+ height: 40px;
115
+ width: 50px;
116
+ padding-top: 1px;
117
+ font-size: 14px;
118
+ line-height: 40px;
119
+ text-align: center;
120
+ }
121
+
122
+ .muted {
123
+ color: $light-blue;
124
+
125
+ ~ * {
126
+ opacity: 0.333;
127
+ }
128
+
129
+ ~ .vol-display {
130
+ text-decoration: line-through;
131
+ }
132
+ }
133
+
134
+ .muted::after {
135
+ content: "d";
136
+ }
137
+
138
+ .vol-down,
139
+ .vol-up {
140
+ position: absolute;
141
+ bottom: 0;
142
+ height: 40px;
143
+ width: 60px;
144
+ padding-top: 2px;
145
+ font-size: 24px;
146
+ line-height: 40px;
147
+ text-align: center;
148
+ z-index: 10;
149
+
150
+ &:hover,
151
+ &:focus {
152
+ color: $light-blue;
153
+ }
154
+ }
155
+
156
+ .vol-down {
157
+ text-align: left;
158
+ padding-left: 10px;
159
+ left: 0;
160
+ }
161
+
162
+ .vol-up {
163
+ text-align: right;
164
+ padding-right: 10px;
165
+ left: 60px;
166
+ }
167
+
168
+ .vol-display {
169
+ position: absolute;
170
+ bottom: 0;
171
+ left: 20px;
172
+ height: 40px;
173
+ width: 0;
174
+ padding-left: 35px;
175
+ overflow: visible;
176
+ font-size: 14px;
177
+ font-weight: bold;
178
+ line-height: 40px;
179
+ background-repeat: no-repeat;
180
+ background-position: center left;
181
+ background-image: file-url('player-icon-volume.png');
182
+ }
183
+ }
184
+
185
+ .current-time {
186
+ position: absolute;
187
+ bottom: 0;
188
+ left: 50px;
189
+ height: 40px;
190
+ font-size: 14px;
191
+ line-height: 40px;
192
+ font-weight: bold;
193
+ }
194
+
195
+ .duration-time {
196
+ display: none;
197
+ position: absolute;
198
+ bottom: 0;
199
+ right: 10px;
200
+ height: 40px;
201
+ line-height: 40px;
202
+ font-size: 16px;
203
+ font-weight: bold;
204
+ }
205
+
206
+ .ui-slider {
207
+ position: absolute;
208
+ top: 0;
209
+ right: 0;
210
+ width: 100%;
211
+ height: 20px;
212
+ overflow: hidden;
213
+ background: $border-colour;
214
+
215
+ .progress-bar {
216
+ position: absolute;
217
+ top: 0;
218
+ left: 0;
219
+ height: 100%;
220
+ padding-bottom: 1px;
221
+ background: $light-blue;
222
+ }
223
+
224
+ .ui-slider-handle {
225
+ position: absolute;
226
+ top: 0;
227
+ height: 100%;
228
+ padding-bottom: 1px;
229
+ width: 20px;
230
+ // Allow RGBA here, it is the only colour value with alpha transparency
231
+ // scss-lint:disable ColorVariable
232
+ color: rgba(0, 0, 0, 0.5);
233
+ z-index: 10;
234
+ }
235
+ }
236
+ }
237
+
238
+ .ui-helper-hidden-accessible {
239
+ position: absolute;
240
+ left: -5000%;
241
+ }
242
+ }
@@ -0,0 +1,54 @@
1
+ .anchored-heading {
2
+ $icon-width: 23px;
3
+ $icon-height: 14px;
4
+ $icon-spacing: 3px;
5
+
6
+ position: relative;
7
+
8
+ &__icon {
9
+ position: absolute;
10
+ width: $icon-width;
11
+ left: -($icon-width + ($icon-spacing * 2));
12
+ padding: 0 $icon-spacing;
13
+ margin-top: -1px;
14
+
15
+ opacity: 0;
16
+ display: none;
17
+
18
+ text-decoration: none;
19
+ text-indent: -9999em;
20
+
21
+ background-image: file-url('anchored-heading-icon.png');
22
+ background-repeat: no-repeat;
23
+ background-position: center center;
24
+
25
+ @include device-pixel-ratio {
26
+ background-image: file-url('anchored-heading-icon-2x.png');
27
+ background-size: $icon-width $icon-height;
28
+ }
29
+
30
+ @include media(tablet) {
31
+ display: block;
32
+ }
33
+
34
+ &:before {
35
+ // zero width space character so that the link behaves like it has text,
36
+ // has height, sits on the baseline, etc.
37
+ content: "\200b";
38
+ }
39
+ }
40
+
41
+ &:hover &__icon {
42
+ @include media(tablet) {
43
+ opacity: 1;
44
+ }
45
+ }
46
+
47
+ &__icon:focus {
48
+ @include media(tablet) {
49
+ opacity: 1;
50
+ outline-width: 1px;
51
+ padding: 0 ($icon-spacing - 1);
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,64 @@
1
+ @include screen {
2
+ @include media(tablet) {
3
+ $toc-width: 330px;
4
+
5
+ .flexbox, .flexboxtweener {
6
+
7
+ body {
8
+ overflow: hidden;
9
+ }
10
+
11
+ .app-pane {
12
+ display: flex;
13
+ flex-direction: column;
14
+ overflow: hidden;
15
+ height: 100vh;
16
+ }
17
+
18
+ .app-pane__header {
19
+ display: flex;
20
+ flex-direction: column;
21
+ flex: 1 0 auto;
22
+
23
+ > * {
24
+ flex: 1 0 auto;
25
+ }
26
+ }
27
+
28
+ .app-pane__body {
29
+ display: flex;
30
+ flex: 1 1 100%;
31
+ min-height: 0;
32
+ position: relative;
33
+
34
+ > * {
35
+ overflow-x: scroll;
36
+ -webkit-overflow-scrolling: touch;
37
+ -ms-overflow-style: none;
38
+ }
39
+ }
40
+
41
+ .app-pane__toc {
42
+ flex: 0 0 auto;
43
+ width: $toc-width;
44
+ border-right: 1px solid $grey-2;
45
+ }
46
+
47
+ .app-pane__content {
48
+ flex: 1 1 auto;
49
+ }
50
+ }
51
+
52
+ .no-flexbox.no-flexboxtweener,
53
+ .no-js {
54
+ .app-pane__toc {
55
+ float: left;
56
+ width: $toc-width;
57
+ }
58
+
59
+ .app-pane__content {
60
+ margin-left: $toc-width;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Footer Component
3
+ *
4
+ * Based on the existing GOV.UK footer in GOV.UK Template, built with flexbox
5
+ * and with tweaked behaviour for the OGL logo for the smaller viewport (when
6
+ * allowing for the table of contents)
7
+ *
8
+ * Example Usage:
9
+ *
10
+ * <footer class="footer">
11
+ * <div class="footer__licence">
12
+ * <a class="footer__licence-logo" href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence</a>
13
+ * <p class="footer__licence-description">All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" rel="license">Open Government Licence v3.0</a>, except where otherwise stated</p>
14
+ * </div>
15
+ *
16
+ * <div class="footer__copyright">
17
+ * <a class="footer__copyright-logo" href="http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/copyright-and-re-use/crown-copyright/">© Crown copyright</a>
18
+ * </div>
19
+ * </footer>
20
+ */
21
+
22
+ // Copied from govuk_template
23
+ $footer-background: $grey-3;
24
+ $footer-border-top: #a1acb2;
25
+ $footer-link: #454a4c;
26
+ $footer-link-hover: #171819;
27
+ $footer-text: $footer-link;
28
+
29
+ .footer {
30
+ display: block;
31
+ margin-top: $gutter * 2;
32
+ padding: $gutter $gutter-half ($gutter * 2);
33
+ border-top: 1px solid $footer-border-top;
34
+ background: $footer-background;
35
+ color: $footer-text;
36
+
37
+ @include media(tablet) {
38
+ padding: $gutter;
39
+ display: flex;
40
+ flex-shrink: 0;
41
+ align-items: flex-end;
42
+ justify-content: space-between;
43
+ }
44
+
45
+ a:link, a:visited {
46
+ color: $footer-link;
47
+ }
48
+
49
+ a:hover, a:active {
50
+ color: $footer-link-hover;
51
+ }
52
+ }
53
+
54
+ .footer__licence {
55
+ line-height: 1;
56
+ margin-bottom: -1em;
57
+ }
58
+
59
+ .footer__licence-logo {
60
+ margin-top: -2px; // Align baseline with paragraph
61
+ margin-bottom: 1em;
62
+ display: block;
63
+ width: 41px;
64
+ height: 17px;
65
+ overflow: hidden;
66
+ text-indent: -999em;
67
+
68
+ background-image: file-url("/images/open-government-licence.png");
69
+ background-repeat: no-repeat;
70
+ background-size: 41px 17px;
71
+
72
+ @include device-pixel-ratio() {
73
+ background-image: file-url("/images/open-government-licence_2x.png");
74
+ }
75
+
76
+ @include media(tablet) {
77
+ float: left;
78
+ margin-right: 12px;
79
+ }
80
+ }
81
+
82
+ .footer__licence-description {
83
+ @include core-16;
84
+ margin: 0 0 1em;
85
+ display: inline-block;
86
+ }
87
+
88
+ .footer__copyright {
89
+ @include core-16;
90
+ margin-top: 30px;
91
+ }
92
+
93
+ .footer__copyright-logo {
94
+ display: block;
95
+ white-space: nowrap;
96
+
97
+ padding: 115px 0 0 0;
98
+ min-width: 125px;
99
+
100
+ background-image: file-url("/images/govuk-crest.png");
101
+ background-size: 125px 102px;
102
+ background-repeat: no-repeat;
103
+ background-position: 50% 0%;
104
+
105
+ text-align: center;
106
+ text-decoration: none;
107
+
108
+ @include device-pixel-ratio() {
109
+ background-image: file-url("/images/govuk-crest-2x.png");
110
+ }
111
+ }
112
+
113
+ .flexbox, .flexboxtweener {
114
+ @include media(tablet) {
115
+
116
+ .footer__license {
117
+ flex-shrink: 1;
118
+ }
119
+
120
+ .footer__copyright {
121
+ margin-top: 0;
122
+ display: inline-block;
123
+ margin-left: $gutter;
124
+ }
125
+
126
+ .footer__copyright-logo {
127
+ text-align: right;
128
+ }
129
+ }
130
+ }