jekyll-theme-basically-basic 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +150 -42
  4. data/_includes/author +30 -30
  5. data/_includes/contact-list.html +27 -27
  6. data/_includes/cv/awards.html +23 -23
  7. data/_includes/cv/basics.html +68 -68
  8. data/_includes/cv/education.html +36 -36
  9. data/_includes/cv/interests.html +19 -19
  10. data/_includes/cv/intro.html +18 -18
  11. data/_includes/cv/languages.html +19 -19
  12. data/_includes/cv/publications.html +29 -29
  13. data/_includes/cv/references.html +23 -23
  14. data/_includes/cv/volunteer.html +46 -46
  15. data/_includes/cv/work.html +46 -46
  16. data/_includes/disqus_comments.html +16 -16
  17. data/_includes/documents-collection.html +19 -0
  18. data/_includes/entry.html +37 -29
  19. data/_includes/footer.html +11 -9
  20. data/_includes/google-analytics.html +8 -8
  21. data/_includes/head.html +35 -35
  22. data/_includes/icon-bitbucket.html +4 -4
  23. data/_includes/icon-codepen.html +4 -4
  24. data/_includes/icon-dribbble.html +4 -4
  25. data/_includes/icon-facebook.html +4 -4
  26. data/_includes/icon-flickr.html +4 -4
  27. data/_includes/icon-github.html +4 -4
  28. data/_includes/icon-gitlab.html +4 -4
  29. data/_includes/icon-googleplus.html +4 -4
  30. data/_includes/icon-instagram.html +4 -4
  31. data/_includes/icon-lastfm.html +4 -4
  32. data/_includes/icon-linkedin.html +4 -4
  33. data/_includes/icon-pinterest.html +4 -4
  34. data/_includes/icon-soundcloud.html +4 -4
  35. data/_includes/icon-stackoverflow.html +4 -4
  36. data/_includes/icon-tumblr.html +4 -4
  37. data/_includes/icon-twitter.html +4 -4
  38. data/_includes/icon-xing.html +4 -4
  39. data/_includes/icon-youtube.html +4 -4
  40. data/_includes/masthead.html +27 -27
  41. data/_includes/navigation.html +25 -25
  42. data/_includes/page-intro.html +42 -42
  43. data/_includes/page-tags.html +14 -0
  44. data/_includes/posts-all.html +2 -2
  45. data/_includes/posts-category.html +3 -0
  46. data/_includes/posts-paginated.html +15 -15
  47. data/_includes/posts-tag.html +3 -0
  48. data/_includes/read-time.html +13 -13
  49. data/_includes/search-form.html +14 -13
  50. data/_includes/search/algolia-search-scripts.html +52 -52
  51. data/_includes/search/lunr-search-scripts.html +1 -1
  52. data/_includes/skip-links.html +8 -8
  53. data/_layouts/about.html +0 -2
  54. data/_layouts/categories.html +48 -0
  55. data/_layouts/category.html +9 -0
  56. data/_layouts/collection.html +9 -0
  57. data/_layouts/cv.html +28 -28
  58. data/_layouts/default.html +2 -1
  59. data/_layouts/home.html +28 -30
  60. data/_layouts/page.html +15 -17
  61. data/_layouts/post.html +18 -20
  62. data/_layouts/posts.html +29 -0
  63. data/_layouts/tag.html +9 -0
  64. data/_layouts/tags.html +48 -0
  65. data/_sass/basically-basic.scss +1 -1
  66. data/_sass/basically-basic/_base.scss +116 -118
  67. data/_sass/basically-basic/_contact-lists.scss +11 -11
  68. data/_sass/basically-basic/_entries.scss +230 -152
  69. data/_sass/basically-basic/_footer.scss +37 -13
  70. data/_sass/basically-basic/_functions.scss +2 -2
  71. data/_sass/basically-basic/_global.scss +116 -42
  72. data/_sass/basically-basic/_icons.scss +43 -43
  73. data/_sass/basically-basic/_intro.scss +3 -1
  74. data/_sass/basically-basic/_layout.scss +188 -188
  75. data/_sass/basically-basic/_mixins.scss +5 -5
  76. data/_sass/basically-basic/_navicons.scss +148 -148
  77. data/_sass/basically-basic/_navigation.scss +66 -66
  78. data/_sass/basically-basic/_print.scss +252 -252
  79. data/_sass/basically-basic/_reset.scss +522 -522
  80. data/_sass/basically-basic/_responsive-embed.scss +70 -70
  81. data/_sass/basically-basic/_search.scss +101 -101
  82. data/_sass/basically-basic/_sidebar.scss +166 -166
  83. data/_sass/basically-basic/_tables.scss +34 -34
  84. data/_sass/basically-basic/_utilities.scss +6 -6
  85. data/_sass/basically-basic/_variables.scss +3 -0
  86. data/_sass/basically-basic/functions/_color.scss +21 -21
  87. data/_sass/basically-basic/functions/_fluid-type.scss +33 -33
  88. data/_sass/basically-basic/mixins/_clearfix.scss +11 -11
  89. data/_sass/basically-basic/mixins/_float.scss +15 -15
  90. data/_sass/basically-basic/mixins/_image.scss +38 -38
  91. data/_sass/basically-basic/mixins/_lists.scss +9 -9
  92. data/_sass/basically-basic/mixins/_text-truncate.scss +10 -10
  93. data/_sass/basically-basic/themes/_default.scss +5 -5
  94. data/_sass/basically-basic/themes/_night.scss +12 -12
  95. data/_sass/basically-basic/themes/_plum.scss +12 -12
  96. data/_sass/basically-basic/themes/_sea.scss +12 -12
  97. data/_sass/basically-basic/utilities/_accessibility.scss +43 -43
  98. data/_sass/basically-basic/utilities/_align.scss +62 -62
  99. data/_sass/basically-basic/utilities/_clearfix.scss +7 -7
  100. data/_sass/basically-basic/utilities/_float.scss +7 -7
  101. data/_sass/basically-basic/utilities/_text.scss +28 -28
  102. data/_sass/basically-basic/utilities/_visibility.scss +32 -32
  103. data/_sass/basically-basic/vendor/breakpoint/_breakpoint.scss +114 -114
  104. data/_sass/basically-basic/vendor/breakpoint/_context.scss +94 -94
  105. data/_sass/basically-basic/vendor/breakpoint/_helpers.scss +151 -151
  106. data/_sass/basically-basic/vendor/breakpoint/_legacy-settings.scss +49 -49
  107. data/_sass/basically-basic/vendor/breakpoint/_no-query.scss +15 -15
  108. data/_sass/basically-basic/vendor/breakpoint/_parsers.scss +215 -215
  109. data/_sass/basically-basic/vendor/breakpoint/_respond-to.scss +82 -82
  110. data/_sass/basically-basic/vendor/breakpoint/_settings.scss +70 -70
  111. data/_sass/basically-basic/vendor/breakpoint/parsers/_double.scss +33 -33
  112. data/_sass/basically-basic/vendor/breakpoint/parsers/_query.scss +82 -82
  113. data/_sass/basically-basic/vendor/breakpoint/parsers/_resolution.scss +31 -31
  114. data/_sass/basically-basic/vendor/breakpoint/parsers/_single.scss +26 -26
  115. data/_sass/basically-basic/vendor/breakpoint/parsers/_triple.scss +36 -36
  116. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_default-pair.scss +21 -21
  117. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_default.scss +22 -22
  118. data/_sass/basically-basic/vendor/breakpoint/parsers/double/_double-string.scss +21 -21
  119. data/_sass/basically-basic/vendor/breakpoint/parsers/resolution/_resolution.scss +60 -60
  120. data/_sass/basically-basic/vendor/breakpoint/parsers/single/_default.scss +13 -13
  121. data/_sass/basically-basic/vendor/breakpoint/parsers/triple/_default.scss +18 -18
  122. data/_sass/basically-basic/vendor/susy/_su.scss +4 -4
  123. data/_sass/basically-basic/vendor/susy/_susy-prefix.scss +13 -13
  124. data/_sass/basically-basic/vendor/susy/_susy.scss +5 -5
  125. data/_sass/basically-basic/vendor/susy/plugins/_svg-grid.scss +5 -5
  126. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_prefix.scss +7 -7
  127. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-api.scss +114 -114
  128. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-grid-math.scss +67 -67
  129. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-settings.scss +14 -14
  130. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-unprefix.scss +18 -18
  131. data/_sass/basically-basic/vendor/susy/plugins/svg-grid/_svg-utilities.scss +133 -133
  132. data/_sass/basically-basic/vendor/susy/susy/_api.scss +318 -318
  133. data/_sass/basically-basic/vendor/susy/susy/_normalize.scss +261 -261
  134. data/_sass/basically-basic/vendor/susy/susy/_parse.scss +163 -163
  135. data/_sass/basically-basic/vendor/susy/susy/_settings.scss +329 -329
  136. data/_sass/basically-basic/vendor/susy/susy/_su-math.scss +441 -441
  137. data/_sass/basically-basic/vendor/susy/susy/_su-validate.scss +213 -213
  138. data/_sass/basically-basic/vendor/susy/susy/_syntax-helpers.scss +191 -191
  139. data/_sass/basically-basic/vendor/susy/susy/_unprefix.scss +56 -56
  140. data/_sass/basically-basic/vendor/susy/susy/_utilities.scss +167 -167
  141. data/assets/javascripts/lunr/lunr.da.min.js +17 -17
  142. data/assets/javascripts/lunr/lunr.de.min.js +17 -17
  143. data/assets/javascripts/lunr/lunr.du.min.js +17 -17
  144. data/assets/javascripts/lunr/lunr.es.min.js +17 -17
  145. data/assets/javascripts/lunr/lunr.fi.min.js +17 -17
  146. data/assets/javascripts/lunr/lunr.fr.min.js +17 -17
  147. data/assets/javascripts/lunr/lunr.hu.min.js +17 -17
  148. data/assets/javascripts/lunr/lunr.it.min.js +17 -17
  149. data/assets/javascripts/lunr/lunr.jp.min.js +1 -1
  150. data/assets/javascripts/lunr/lunr.min.js +6 -6
  151. data/assets/javascripts/lunr/lunr.no.min.js +17 -17
  152. data/assets/javascripts/lunr/lunr.pt.min.js +17 -17
  153. data/assets/javascripts/lunr/lunr.ro.min.js +17 -17
  154. data/assets/javascripts/lunr/lunr.ru.min.js +17 -17
  155. data/assets/javascripts/lunr/lunr.sv.min.js +17 -17
  156. data/assets/javascripts/lunr/lunr.tr.min.js +17 -17
  157. data/assets/javascripts/main.js +12 -12
  158. data/assets/javascripts/search-data.json +43 -27
  159. data/assets/stylesheets/main.scss +9 -9
  160. metadata +21 -5
@@ -1,213 +1,213 @@
1
- /// Validation
2
- /// ==========
3
- /// Each argument to Su has a single canonical syntax.
4
- /// These validation functions check to ensure
5
- /// that each argument is valid,
6
- /// in order to provide useful errors
7
- /// before attempting to calculate the results/
8
- ///
9
- /// @group x-validation
10
- ///
11
- /// @see su-valid-columns
12
- /// @see su-valid-gutters
13
- /// @see su-valid-spread
14
- /// @see su-valid-location
15
-
16
-
17
-
18
- // Valid Span
19
- // ----------
20
- /// Check that the `span` argument
21
- /// is a number, length, or column-list
22
- ///
23
- /// @group x-validation
24
- ///
25
- /// @param {number | list} $span -
26
- /// Number of columns, or length of span
27
- ///
28
- /// @return {number | list} -
29
- /// Validated `$span` number, length, or columns list
30
- ///
31
- /// @throw
32
- /// when span value is not a number, or valid column list
33
- @function su-valid-span(
34
- $span
35
- ) {
36
- $type: type-of($span);
37
- @if ($type == 'number') {
38
- @return $span;
39
- } @else if ($type == 'list') and su-valid-columns($span, 'silent-failure') {
40
- @return $span;
41
- }
42
-
43
- $actual: '[#{type-of($span)}] `#{inspect($span)}`';
44
- @return _susy-error(
45
- '#{$actual} is not a valid number, length, or column-list for $span.',
46
- 'su-valid-span');
47
- }
48
-
49
-
50
-
51
- // Valid Columns
52
- // -------------
53
- /// Check that the `columns` argument is a valid
54
- /// list of column-lengths
55
- ///
56
- /// @group x-validation
57
- ///
58
- /// @param {list} $columns -
59
- /// List of column-lengths
60
- /// @param {bool} $silent-failure [true] -
61
- /// Set false to return null on failure
62
- ///
63
- /// @return {list} -
64
- /// Validated `$columns` list
65
- ///
66
- /// @throw
67
- /// when column value is not a valid list of numbers
68
- @function su-valid-columns(
69
- $columns,
70
- $silent-failure: false
71
- ) {
72
- @if (type-of($columns) == 'list') {
73
- $fail: false;
74
-
75
- @each $col in $columns {
76
- @if (type-of($col) != 'number') {
77
- $fail: true;
78
- }
79
- }
80
-
81
- @if not $fail {
82
- @return $columns;
83
- }
84
- }
85
-
86
- // Silent Failure
87
- @if $silent-failure {
88
- @return null;
89
- }
90
-
91
- // Error Message
92
- $actual: '[#{type-of($columns)}] `#{inspect($columns)}`';
93
-
94
- @return _susy-error(
95
- '#{$actual} is not a valid list of numbers for $columns.',
96
- 'su-valid-columns');
97
- }
98
-
99
-
100
-
101
- // Valid Gutters
102
- // -------------
103
- /// Check that the `gutters` argument is a valid number
104
- ///
105
- /// @group x-validation
106
- ///
107
- /// @param {number} $gutters -
108
- /// Width of a gutter
109
- ///
110
- /// @return {number} -
111
- /// Validated `$gutters` number
112
- ///
113
- /// @throw
114
- /// when gutter value is not a number
115
- @function su-valid-gutters(
116
- $gutters
117
- ) {
118
- $type: type-of($gutters);
119
-
120
- @if ($type == 'number') {
121
- @return $gutters;
122
- }
123
-
124
- $actual: '[#{$type}] `#{inspect($gutters)}`';
125
- @return _susy-error(
126
- '#{$actual} is not a number or length for $gutters.',
127
- 'su-valid-gutters');
128
- }
129
-
130
-
131
-
132
- // Valid Spread
133
- // ------------
134
- /// Check that the `spread` argument is a valid
135
- /// intiger between `-1` and `1`
136
- ///
137
- /// @group x-validation
138
- ///
139
- /// @param {0 | 1 | -1} $spread -
140
- /// Number of gutters to include in a span,
141
- /// relative to the number columns
142
- ///
143
- /// @return {0 | 1 | -1} -
144
- /// Validated `$spread` number
145
- ///
146
- /// @throw
147
- /// when spread value is not a valid spread
148
- @function su-valid-spread(
149
- $spread
150
- ) {
151
- @if index(0 1 -1, $spread) {
152
- @return $spread;
153
- }
154
-
155
- $actual: '[#{type-of($spread)}] `#{inspect($spread)}`';
156
- @return _susy-error(
157
- '#{$actual} is not a normalized [0 | 1 | -1] value for `$spread`.',
158
- 'su-valid-spread');
159
- }
160
-
161
-
162
-
163
- // Valid Location
164
- // --------------
165
- /// Check that the `location` argument is a valid number,
166
- /// within the scope of available columns
167
- ///
168
- /// @group x-validation
169
- ///
170
- /// @param {number} $span -
171
- /// Number of grid-columns to be spanned
172
- /// @param {integer | string} $location -
173
- /// Starting (1-indexed) column-position of that span
174
- /// @param {list} $columns -
175
- /// List of available columns in the grid
176
- ///
177
- /// @return {integer} -
178
- /// Validated `$location` intiger
179
- ///
180
- /// @throw
181
- /// when location value is not a valid index,
182
- /// given the context and span.
183
- @function su-valid-location(
184
- $span,
185
- $location,
186
- $columns
187
- ) {
188
- $count: length($columns);
189
-
190
- @if $location {
191
- @if (type-of($location) != 'number') or (not unitless($location)) {
192
- $actual: '[#{type-of($location)}] `#{$location}`';
193
- @return _susy-error(
194
- '#{$actual} is not a unitless number for $location.',
195
- 'su-valid-location');
196
- } @else if (round($location) != $location) {
197
- @return _susy-error(
198
- 'Location (`#{$location}`) must be a 1-indexed intiger position.',
199
- 'su-valid-location');
200
- } @else if ($location > $count) or ($location < 1) {
201
- @return _susy-error(
202
- 'Position `#{$location}` does not exist in grid `#{$columns}`.',
203
- 'su-valid-location');
204
- } @else if ($location + $span - 1 > $count) {
205
- $details: 'grid `#{$columns}` for span `#{$span}` at `#{$location}`';
206
- @return _susy-error(
207
- 'There are not enough columns in #{$details}.',
208
- 'su-valid-location');
209
- }
210
- }
211
-
212
- @return $location;
213
- }
1
+ /// Validation
2
+ /// ==========
3
+ /// Each argument to Su has a single canonical syntax.
4
+ /// These validation functions check to ensure
5
+ /// that each argument is valid,
6
+ /// in order to provide useful errors
7
+ /// before attempting to calculate the results/
8
+ ///
9
+ /// @group x-validation
10
+ ///
11
+ /// @see su-valid-columns
12
+ /// @see su-valid-gutters
13
+ /// @see su-valid-spread
14
+ /// @see su-valid-location
15
+
16
+
17
+
18
+ // Valid Span
19
+ // ----------
20
+ /// Check that the `span` argument
21
+ /// is a number, length, or column-list
22
+ ///
23
+ /// @group x-validation
24
+ ///
25
+ /// @param {number | list} $span -
26
+ /// Number of columns, or length of span
27
+ ///
28
+ /// @return {number | list} -
29
+ /// Validated `$span` number, length, or columns list
30
+ ///
31
+ /// @throw
32
+ /// when span value is not a number, or valid column list
33
+ @function su-valid-span(
34
+ $span
35
+ ) {
36
+ $type: type-of($span);
37
+ @if ($type == 'number') {
38
+ @return $span;
39
+ } @else if ($type == 'list') and su-valid-columns($span, 'silent-failure') {
40
+ @return $span;
41
+ }
42
+
43
+ $actual: '[#{type-of($span)}] `#{inspect($span)}`';
44
+ @return _susy-error(
45
+ '#{$actual} is not a valid number, length, or column-list for $span.',
46
+ 'su-valid-span');
47
+ }
48
+
49
+
50
+
51
+ // Valid Columns
52
+ // -------------
53
+ /// Check that the `columns` argument is a valid
54
+ /// list of column-lengths
55
+ ///
56
+ /// @group x-validation
57
+ ///
58
+ /// @param {list} $columns -
59
+ /// List of column-lengths
60
+ /// @param {bool} $silent-failure [true] -
61
+ /// Set false to return null on failure
62
+ ///
63
+ /// @return {list} -
64
+ /// Validated `$columns` list
65
+ ///
66
+ /// @throw
67
+ /// when column value is not a valid list of numbers
68
+ @function su-valid-columns(
69
+ $columns,
70
+ $silent-failure: false
71
+ ) {
72
+ @if (type-of($columns) == 'list') {
73
+ $fail: false;
74
+
75
+ @each $col in $columns {
76
+ @if (type-of($col) != 'number') {
77
+ $fail: true;
78
+ }
79
+ }
80
+
81
+ @if not $fail {
82
+ @return $columns;
83
+ }
84
+ }
85
+
86
+ // Silent Failure
87
+ @if $silent-failure {
88
+ @return null;
89
+ }
90
+
91
+ // Error Message
92
+ $actual: '[#{type-of($columns)}] `#{inspect($columns)}`';
93
+
94
+ @return _susy-error(
95
+ '#{$actual} is not a valid list of numbers for $columns.',
96
+ 'su-valid-columns');
97
+ }
98
+
99
+
100
+
101
+ // Valid Gutters
102
+ // -------------
103
+ /// Check that the `gutters` argument is a valid number
104
+ ///
105
+ /// @group x-validation
106
+ ///
107
+ /// @param {number} $gutters -
108
+ /// Width of a gutter
109
+ ///
110
+ /// @return {number} -
111
+ /// Validated `$gutters` number
112
+ ///
113
+ /// @throw
114
+ /// when gutter value is not a number
115
+ @function su-valid-gutters(
116
+ $gutters
117
+ ) {
118
+ $type: type-of($gutters);
119
+
120
+ @if ($type == 'number') {
121
+ @return $gutters;
122
+ }
123
+
124
+ $actual: '[#{$type}] `#{inspect($gutters)}`';
125
+ @return _susy-error(
126
+ '#{$actual} is not a number or length for $gutters.',
127
+ 'su-valid-gutters');
128
+ }
129
+
130
+
131
+
132
+ // Valid Spread
133
+ // ------------
134
+ /// Check that the `spread` argument is a valid
135
+ /// intiger between `-1` and `1`
136
+ ///
137
+ /// @group x-validation
138
+ ///
139
+ /// @param {0 | 1 | -1} $spread -
140
+ /// Number of gutters to include in a span,
141
+ /// relative to the number columns
142
+ ///
143
+ /// @return {0 | 1 | -1} -
144
+ /// Validated `$spread` number
145
+ ///
146
+ /// @throw
147
+ /// when spread value is not a valid spread
148
+ @function su-valid-spread(
149
+ $spread
150
+ ) {
151
+ @if index(0 1 -1, $spread) {
152
+ @return $spread;
153
+ }
154
+
155
+ $actual: '[#{type-of($spread)}] `#{inspect($spread)}`';
156
+ @return _susy-error(
157
+ '#{$actual} is not a normalized [0 | 1 | -1] value for `$spread`.',
158
+ 'su-valid-spread');
159
+ }
160
+
161
+
162
+
163
+ // Valid Location
164
+ // --------------
165
+ /// Check that the `location` argument is a valid number,
166
+ /// within the scope of available columns
167
+ ///
168
+ /// @group x-validation
169
+ ///
170
+ /// @param {number} $span -
171
+ /// Number of grid-columns to be spanned
172
+ /// @param {integer | string} $location -
173
+ /// Starting (1-indexed) column-position of that span
174
+ /// @param {list} $columns -
175
+ /// List of available columns in the grid
176
+ ///
177
+ /// @return {integer} -
178
+ /// Validated `$location` intiger
179
+ ///
180
+ /// @throw
181
+ /// when location value is not a valid index,
182
+ /// given the context and span.
183
+ @function su-valid-location(
184
+ $span,
185
+ $location,
186
+ $columns
187
+ ) {
188
+ $count: length($columns);
189
+
190
+ @if $location {
191
+ @if (type-of($location) != 'number') or (not unitless($location)) {
192
+ $actual: '[#{type-of($location)}] `#{$location}`';
193
+ @return _susy-error(
194
+ '#{$actual} is not a unitless number for $location.',
195
+ 'su-valid-location');
196
+ } @else if (round($location) != $location) {
197
+ @return _susy-error(
198
+ 'Location (`#{$location}`) must be a 1-indexed intiger position.',
199
+ 'su-valid-location');
200
+ } @else if ($location > $count) or ($location < 1) {
201
+ @return _susy-error(
202
+ 'Position `#{$location}` does not exist in grid `#{$columns}`.',
203
+ 'su-valid-location');
204
+ } @else if ($location + $span - 1 > $count) {
205
+ $details: 'grid `#{$columns}` for span `#{$span}` at `#{$location}`';
206
+ @return _susy-error(
207
+ 'There are not enough columns in #{$details}.',
208
+ 'su-valid-location');
209
+ }
210
+ }
211
+
212
+ @return $location;
213
+ }
@@ -1,191 +1,191 @@
1
- /// Syntax Utilities for Extending Susy
2
- /// ===================================
3
- /// There are many steps involved
4
- /// when translating between the Susy syntax layer,
5
- /// and the Su core math.
6
- /// That entire process can be condensed with these two functions.
7
- /// For anyone that wants to access the full power of Susy,
8
- /// and build their own plugins, functions, or mixins –
9
- /// this is the primary API for compiling user input,
10
- /// and accessing the core math.
11
- ///
12
- /// This is the same technique we use internally,
13
- /// to keep our API layer simple and light-weight.
14
- /// Every function accepts two arguments,
15
- /// a "shorthand" description of the span or context,
16
- /// and an optional settings-map to override global defaults.
17
- ///
18
- /// - Use `susy-compile()` to parse, merge, and normalize
19
- /// all the user settings into a single map.
20
- /// - Then use `su-call()` to call one of the core math functions,
21
- /// with whatever data is needed for that function.
22
- ///
23
- /// @group plugin-utils
24
- /// @see susy-compile
25
- /// @see su-call
26
- ///
27
- /// @example scss - Susy API `gutter` function
28
- /// @function susy-gutter(
29
- /// $context: susy-get('columns'),
30
- /// $config: ()
31
- /// ) {
32
- /// // compile and normalize all user arguments and global settings
33
- /// $context: susy-compile($context, $config, 'context-only');
34
- /// // call `su-gutter` with the appropriate data
35
- /// @return su-call('su-gutter', $context);
36
- /// }
37
- ///
38
- /// @example scss - Sample `span` mixin for floated grids
39
- /// @mixin span(
40
- /// $span,
41
- /// $config: ()
42
- /// ) {
43
- /// $context: susy-compile($span, $config);
44
- /// width: su-call('su-span', $context);
45
- ///
46
- /// @if index($span, 'last') {
47
- /// float: right;
48
- /// } @else {
49
- /// float: left;
50
- /// margin-right: su-call('su-gutter', $context);
51
- /// }
52
- /// }
53
-
54
-
55
-
56
- // Compile
57
- // -------
58
- /// Susy's syntax layer has various moving parts,
59
- /// with syntax-parsing for the grid/span shorthand,
60
- /// and normalization for each of the resulting values.
61
- /// The compile function rolls this all together
62
- /// in a single call –
63
- /// for quick access from our internal API functions,
64
- /// or any additional functions and mixins you add to your project.
65
- /// Pass user input and configuration maps to the compiler,
66
- /// and it will hand back a map of values ready for Su.
67
- /// Combine this with the `su-call` function
68
- /// to quickly parse, normalize, and process grid calculations.
69
- ///
70
- /// @group plugin-utils
71
- /// @see su-call
72
- ///
73
- /// @param {list | map} $shorthand -
74
- /// Shorthand expression to define the width of the span,
75
- /// optionally containing:
76
- /// - a count, length, or column-list span;
77
- /// - `at $n`, `first`, or `last` location on asymmetrical grids;
78
- /// - `narrow`, `wide`, or `wider` for optionally spreading
79
- /// across adjacent gutters;
80
- /// - `of $n <spread>` for available grid columns
81
- /// and spread of the container
82
- /// (span counts like `of 6` are only valid
83
- /// in the context of symmetrical grids);
84
- /// - and `set-gutters $n` to override global gutter settings
85
- /// @param {map} $config [null] -
86
- /// Optional map of Susy grid configuration settings
87
- /// @param {bool} $context-only [false] -
88
- /// Allow the parser to ignore span and span-spread values,
89
- /// only parsing context and container-spread
90
- ///
91
- /// @return {map} -
92
- /// Parsed and normalized map of settings,
93
- /// based on global and local configuration,
94
- /// alongwith shorthad adjustments.
95
- ///
96
- /// @example scss -
97
- /// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
98
- /// $grid-data: susy-compile($user-input, $susy);
99
- ///
100
- /// @each $key, $value in $grid-data {
101
- /// /* #{$key}: #{$value}, */
102
- /// }
103
- @function susy-compile(
104
- $short,
105
- $config: null,
106
- $context-only: false
107
- ) {
108
- // Get and normalize config
109
- $config: if($config, susy-settings($config), susy-settings());
110
- $normal-config: susy-normalize($config);
111
-
112
- // Parse and normalize shorthand
113
- @if (type-of($short) != 'map') and (length($short) > 0) {
114
- $short: susy-parse($short, $context-only);
115
- }
116
-
117
- $normal-short: susy-normalize($short, $normal-config);
118
-
119
- // Merge and return
120
- @return map-merge($normal-config, $normal-short);
121
- }
122
-
123
-
124
-
125
- // Call
126
- // ----
127
- /// The Susy parsing and normalization process
128
- /// results in a map of configuration settings,
129
- /// much like the global `$susy` settings map.
130
- /// In order to pass that information along to Su math functions,
131
- /// the proper values have to be picked out,
132
- /// and converted to arguments.
133
- ///
134
- /// The `su-call` function streamlines that process,
135
- /// weeding out the unnecessary data,
136
- /// and passing the rest along to Su in the proper format.
137
- /// Combine this with `susy-compile` to quickly parse,
138
- /// normalize, and process grid calculations.
139
- ///
140
- /// @group plugin-utils
141
- ///
142
- /// @require su-span
143
- /// @require su-gutter
144
- /// @require su-slice
145
- /// @see susy-compile
146
- ///
147
- /// @param {'su-span' | 'su-gutter' | 'su-slice'} $name -
148
- /// Name of the Su math function to call.
149
- /// @param {map} $config -
150
- /// Parsed and normalized map of Susy configuration settings
151
- /// to use for math-function arguments.
152
- ///
153
- /// @return {*} -
154
- /// Results of the function being called.
155
- ///
156
- /// @example scss -
157
- /// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
158
- /// $grid-data: susy-compile($user-input, $susy);
159
- ///
160
- /// .su-span {
161
- /// width: su-call('su-span', $grid-data);
162
- /// }
163
- @function su-call(
164
- $name,
165
- $config
166
- ) {
167
- $grid-function-args: (
168
- 'su-span': ('span', 'columns', 'gutters', 'spread', 'container-spread', 'location'),
169
- 'su-gutter': ('columns', 'gutters', 'container-spread'),
170
- 'su-slice': ('span', 'columns', 'location'),
171
- );
172
-
173
- $args: map-get($grid-function-args, $name);
174
-
175
- @if not $args {
176
- $options: 'Try one of these: #{map-keys($grid-function-args)}';
177
- @return _susy-error(
178
- '#{$name} is not a public Su function. #{$options}',
179
- 'su-call');
180
- }
181
-
182
- $call: if(function-exists('get-function'), get-function($name), $name);
183
- $output: ();
184
-
185
- @each $arg in $args {
186
- $value: map-get($config, $arg);
187
- $output: if($value, map-merge($output, ($arg: $value)), $output);
188
- }
189
-
190
- @return call($call, $output...);
191
- }
1
+ /// Syntax Utilities for Extending Susy
2
+ /// ===================================
3
+ /// There are many steps involved
4
+ /// when translating between the Susy syntax layer,
5
+ /// and the Su core math.
6
+ /// That entire process can be condensed with these two functions.
7
+ /// For anyone that wants to access the full power of Susy,
8
+ /// and build their own plugins, functions, or mixins –
9
+ /// this is the primary API for compiling user input,
10
+ /// and accessing the core math.
11
+ ///
12
+ /// This is the same technique we use internally,
13
+ /// to keep our API layer simple and light-weight.
14
+ /// Every function accepts two arguments,
15
+ /// a "shorthand" description of the span or context,
16
+ /// and an optional settings-map to override global defaults.
17
+ ///
18
+ /// - Use `susy-compile()` to parse, merge, and normalize
19
+ /// all the user settings into a single map.
20
+ /// - Then use `su-call()` to call one of the core math functions,
21
+ /// with whatever data is needed for that function.
22
+ ///
23
+ /// @group plugin-utils
24
+ /// @see susy-compile
25
+ /// @see su-call
26
+ ///
27
+ /// @example scss - Susy API `gutter` function
28
+ /// @function susy-gutter(
29
+ /// $context: susy-get('columns'),
30
+ /// $config: ()
31
+ /// ) {
32
+ /// // compile and normalize all user arguments and global settings
33
+ /// $context: susy-compile($context, $config, 'context-only');
34
+ /// // call `su-gutter` with the appropriate data
35
+ /// @return su-call('su-gutter', $context);
36
+ /// }
37
+ ///
38
+ /// @example scss - Sample `span` mixin for floated grids
39
+ /// @mixin span(
40
+ /// $span,
41
+ /// $config: ()
42
+ /// ) {
43
+ /// $context: susy-compile($span, $config);
44
+ /// width: su-call('su-span', $context);
45
+ ///
46
+ /// @if index($span, 'last') {
47
+ /// float: right;
48
+ /// } @else {
49
+ /// float: left;
50
+ /// margin-right: su-call('su-gutter', $context);
51
+ /// }
52
+ /// }
53
+
54
+
55
+
56
+ // Compile
57
+ // -------
58
+ /// Susy's syntax layer has various moving parts,
59
+ /// with syntax-parsing for the grid/span shorthand,
60
+ /// and normalization for each of the resulting values.
61
+ /// The compile function rolls this all together
62
+ /// in a single call –
63
+ /// for quick access from our internal API functions,
64
+ /// or any additional functions and mixins you add to your project.
65
+ /// Pass user input and configuration maps to the compiler,
66
+ /// and it will hand back a map of values ready for Su.
67
+ /// Combine this with the `su-call` function
68
+ /// to quickly parse, normalize, and process grid calculations.
69
+ ///
70
+ /// @group plugin-utils
71
+ /// @see su-call
72
+ ///
73
+ /// @param {list | map} $shorthand -
74
+ /// Shorthand expression to define the width of the span,
75
+ /// optionally containing:
76
+ /// - a count, length, or column-list span;
77
+ /// - `at $n`, `first`, or `last` location on asymmetrical grids;
78
+ /// - `narrow`, `wide`, or `wider` for optionally spreading
79
+ /// across adjacent gutters;
80
+ /// - `of $n <spread>` for available grid columns
81
+ /// and spread of the container
82
+ /// (span counts like `of 6` are only valid
83
+ /// in the context of symmetrical grids);
84
+ /// - and `set-gutters $n` to override global gutter settings
85
+ /// @param {map} $config [null] -
86
+ /// Optional map of Susy grid configuration settings
87
+ /// @param {bool} $context-only [false] -
88
+ /// Allow the parser to ignore span and span-spread values,
89
+ /// only parsing context and container-spread
90
+ ///
91
+ /// @return {map} -
92
+ /// Parsed and normalized map of settings,
93
+ /// based on global and local configuration,
94
+ /// alongwith shorthad adjustments.
95
+ ///
96
+ /// @example scss -
97
+ /// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
98
+ /// $grid-data: susy-compile($user-input, $susy);
99
+ ///
100
+ /// @each $key, $value in $grid-data {
101
+ /// /* #{$key}: #{$value}, */
102
+ /// }
103
+ @function susy-compile(
104
+ $short,
105
+ $config: null,
106
+ $context-only: false
107
+ ) {
108
+ // Get and normalize config
109
+ $config: if($config, susy-settings($config), susy-settings());
110
+ $normal-config: susy-normalize($config);
111
+
112
+ // Parse and normalize shorthand
113
+ @if (type-of($short) != 'map') and (length($short) > 0) {
114
+ $short: susy-parse($short, $context-only);
115
+ }
116
+
117
+ $normal-short: susy-normalize($short, $normal-config);
118
+
119
+ // Merge and return
120
+ @return map-merge($normal-config, $normal-short);
121
+ }
122
+
123
+
124
+
125
+ // Call
126
+ // ----
127
+ /// The Susy parsing and normalization process
128
+ /// results in a map of configuration settings,
129
+ /// much like the global `$susy` settings map.
130
+ /// In order to pass that information along to Su math functions,
131
+ /// the proper values have to be picked out,
132
+ /// and converted to arguments.
133
+ ///
134
+ /// The `su-call` function streamlines that process,
135
+ /// weeding out the unnecessary data,
136
+ /// and passing the rest along to Su in the proper format.
137
+ /// Combine this with `susy-compile` to quickly parse,
138
+ /// normalize, and process grid calculations.
139
+ ///
140
+ /// @group plugin-utils
141
+ ///
142
+ /// @require su-span
143
+ /// @require su-gutter
144
+ /// @require su-slice
145
+ /// @see susy-compile
146
+ ///
147
+ /// @param {'su-span' | 'su-gutter' | 'su-slice'} $name -
148
+ /// Name of the Su math function to call.
149
+ /// @param {map} $config -
150
+ /// Parsed and normalized map of Susy configuration settings
151
+ /// to use for math-function arguments.
152
+ ///
153
+ /// @return {*} -
154
+ /// Results of the function being called.
155
+ ///
156
+ /// @example scss -
157
+ /// $user-input: 3 wide of susy-repeat(6, 120px) set-gutters 10px;
158
+ /// $grid-data: susy-compile($user-input, $susy);
159
+ ///
160
+ /// .su-span {
161
+ /// width: su-call('su-span', $grid-data);
162
+ /// }
163
+ @function su-call(
164
+ $name,
165
+ $config
166
+ ) {
167
+ $grid-function-args: (
168
+ 'su-span': ('span', 'columns', 'gutters', 'spread', 'container-spread', 'location'),
169
+ 'su-gutter': ('columns', 'gutters', 'container-spread'),
170
+ 'su-slice': ('span', 'columns', 'location'),
171
+ );
172
+
173
+ $args: map-get($grid-function-args, $name);
174
+
175
+ @if not $args {
176
+ $options: 'Try one of these: #{map-keys($grid-function-args)}';
177
+ @return _susy-error(
178
+ '#{$name} is not a public Su function. #{$options}',
179
+ 'su-call');
180
+ }
181
+
182
+ $call: if(function-exists('get-function'), get-function($name), $name);
183
+ $output: ();
184
+
185
+ @each $arg in $args {
186
+ $value: map-get($config, $arg);
187
+ $output: if($value, map-merge($output, ($arg: $value)), $output);
188
+ }
189
+
190
+ @return call($call, $output...);
191
+ }