nesta-contentfocus-extensions 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +53 -0
- data/Rakefile +1 -2
- data/assets/stylesheets/bitters/_base.scss +24 -0
- data/assets/stylesheets/bitters/_buttons.scss +10 -0
- data/assets/stylesheets/bitters/_forms.scss +78 -0
- data/assets/stylesheets/bitters/_grid-settings.scss +14 -0
- data/assets/stylesheets/bitters/_lists.scss +31 -0
- data/assets/stylesheets/bitters/_tables.scss +24 -0
- data/assets/stylesheets/bitters/_typography.scss +93 -0
- data/assets/stylesheets/bitters/_variables.scss +65 -0
- data/assets/stylesheets/bitters/extends/_button.scss +22 -0
- data/assets/stylesheets/bitters/extends/_clearfix.scss +3 -0
- data/assets/stylesheets/bitters/extends/_errors.scss +11 -0
- data/assets/stylesheets/bitters/extends/_flashes.scss +38 -0
- data/assets/stylesheets/bitters/extends/_hide-text.scss +3 -0
- data/assets/stylesheets/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/assets/stylesheets/bourbon/_bourbon.scss +87 -0
- data/assets/stylesheets/bourbon/addons/_border-color.scss +26 -0
- data/assets/stylesheets/bourbon/addons/_border-radius.scss +48 -0
- data/assets/stylesheets/bourbon/addons/_border-style.scss +25 -0
- data/assets/stylesheets/bourbon/addons/_border-width.scss +25 -0
- data/assets/stylesheets/bourbon/addons/_buttons.scss +64 -0
- data/assets/stylesheets/bourbon/addons/_clearfix.scss +25 -0
- data/assets/stylesheets/bourbon/addons/_ellipsis.scss +30 -0
- data/assets/stylesheets/bourbon/addons/_font-stacks.scss +31 -0
- data/assets/stylesheets/bourbon/addons/_hide-text.scss +27 -0
- data/assets/stylesheets/bourbon/addons/_margin.scss +26 -0
- data/assets/stylesheets/bourbon/addons/_padding.scss +26 -0
- data/assets/stylesheets/bourbon/addons/_position.scss +48 -0
- data/assets/stylesheets/bourbon/addons/_prefixer.scss +66 -0
- data/assets/stylesheets/bourbon/addons/_retina-image.scss +25 -0
- data/assets/stylesheets/bourbon/addons/_size.scss +51 -0
- data/assets/stylesheets/bourbon/addons/_text-inputs.scss +112 -0
- data/assets/stylesheets/bourbon/addons/_timing-functions.scss +34 -0
- data/assets/stylesheets/bourbon/addons/_triangle.scss +63 -0
- data/assets/stylesheets/bourbon/addons/_word-wrap.scss +29 -0
- data/assets/stylesheets/bourbon/css3/_animation.scss +43 -0
- data/assets/stylesheets/bourbon/css3/_appearance.scss +3 -0
- data/assets/stylesheets/bourbon/css3/_backface-visibility.scss +3 -0
- data/assets/stylesheets/bourbon/css3/_background-image.scss +42 -0
- data/assets/stylesheets/bourbon/css3/_background.scss +55 -0
- data/assets/stylesheets/bourbon/css3/_border-image.scss +59 -0
- data/assets/stylesheets/bourbon/css3/_calc.scss +4 -0
- data/assets/stylesheets/bourbon/css3/_columns.scss +47 -0
- data/assets/stylesheets/bourbon/css3/_filter.scss +4 -0
- data/assets/stylesheets/bourbon/css3/_flex-box.scss +287 -0
- data/assets/stylesheets/bourbon/css3/_font-face.scss +24 -0
- data/assets/stylesheets/bourbon/css3/_font-feature-settings.scss +4 -0
- data/assets/stylesheets/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/assets/stylesheets/bourbon/css3/_hyphens.scss +4 -0
- data/assets/stylesheets/bourbon/css3/_image-rendering.scss +14 -0
- data/assets/stylesheets/bourbon/css3/_keyframes.scss +36 -0
- data/assets/stylesheets/bourbon/css3/_linear-gradient.scss +38 -0
- data/assets/stylesheets/bourbon/css3/_perspective.scss +8 -0
- data/assets/stylesheets/bourbon/css3/_placeholder.scss +8 -0
- data/assets/stylesheets/bourbon/css3/_radial-gradient.scss +39 -0
- data/assets/stylesheets/bourbon/css3/_selection.scss +42 -0
- data/assets/stylesheets/bourbon/css3/_text-decoration.scss +19 -0
- data/assets/stylesheets/bourbon/css3/_transform.scss +15 -0
- data/assets/stylesheets/bourbon/css3/_transition.scss +71 -0
- data/assets/stylesheets/bourbon/css3/_user-select.scss +3 -0
- data/assets/stylesheets/bourbon/functions/_assign-inputs.scss +11 -0
- data/assets/stylesheets/bourbon/functions/_contains-falsy.scss +20 -0
- data/assets/stylesheets/bourbon/functions/_contains.scss +26 -0
- data/assets/stylesheets/bourbon/functions/_is-length.scss +11 -0
- data/assets/stylesheets/bourbon/functions/_is-light.scss +21 -0
- data/assets/stylesheets/bourbon/functions/_is-number.scss +11 -0
- data/assets/stylesheets/bourbon/functions/_is-size.scss +13 -0
- data/assets/stylesheets/bourbon/functions/_modular-scale.scss +69 -0
- data/assets/stylesheets/bourbon/functions/_px-to-em.scss +13 -0
- data/assets/stylesheets/bourbon/functions/_px-to-rem.scss +15 -0
- data/assets/stylesheets/bourbon/functions/_shade.scss +24 -0
- data/assets/stylesheets/bourbon/functions/_strip-units.scss +17 -0
- data/assets/stylesheets/bourbon/functions/_tint.scss +24 -0
- data/assets/stylesheets/bourbon/functions/_transition-property-name.scss +22 -0
- data/assets/stylesheets/bourbon/functions/_unpack.scss +27 -0
- data/assets/stylesheets/bourbon/helpers/_convert-units.scss +21 -0
- data/assets/stylesheets/bourbon/helpers/_directional-values.scss +96 -0
- data/assets/stylesheets/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/assets/stylesheets/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/assets/stylesheets/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/assets/stylesheets/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/assets/stylesheets/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/assets/stylesheets/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/assets/stylesheets/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/assets/stylesheets/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/assets/stylesheets/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/assets/stylesheets/bourbon/helpers/_render-gradients.scss +26 -0
- data/assets/stylesheets/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/assets/stylesheets/bourbon/helpers/_str-to-num.scss +50 -0
- data/assets/stylesheets/bourbon/settings/_asset-pipeline.scss +7 -0
- data/assets/stylesheets/bourbon/settings/_prefixer.scss +9 -0
- data/assets/stylesheets/bourbon/settings/_px-to-em.scss +1 -0
- data/assets/stylesheets/contentfocus/_animations.scss +9 -0
- data/assets/stylesheets/contentfocus/_breadcrumb.scss +83 -0
- data/assets/stylesheets/contentfocus/_browser.scss +146 -0
- data/assets/stylesheets/contentfocus/_bullets.scss +63 -0
- data/assets/stylesheets/contentfocus/_comments.scss +59 -0
- data/assets/stylesheets/contentfocus/_device.scss +84 -0
- data/assets/stylesheets/contentfocus/_flashes.scss +30 -0
- data/assets/stylesheets/contentfocus/_footer.scss +78 -0
- data/assets/stylesheets/contentfocus/_forms.scss +110 -0
- data/assets/stylesheets/contentfocus/_geometric_typography.scss +104 -0
- data/assets/stylesheets/contentfocus/_hero.scss +108 -0
- data/assets/stylesheets/contentfocus/_hover_tile.scss +51 -0
- data/assets/stylesheets/contentfocus/_nav.scss +396 -0
- data/assets/stylesheets/contentfocus/_progress_bar.scss +92 -0
- data/assets/stylesheets/contentfocus/_variables.scss +84 -0
- data/assets/stylesheets/neat/_neat-helpers.scss +8 -0
- data/assets/stylesheets/neat/_neat.scss +23 -0
- data/assets/stylesheets/neat/functions/_new-breakpoint.scss +49 -0
- data/assets/stylesheets/neat/functions/_private.scss +114 -0
- data/assets/stylesheets/neat/grid/_box-sizing.scss +15 -0
- data/assets/stylesheets/neat/grid/_direction-context.scss +33 -0
- data/assets/stylesheets/neat/grid/_display-context.scss +28 -0
- data/assets/stylesheets/neat/grid/_fill-parent.scss +22 -0
- data/assets/stylesheets/neat/grid/_media.scss +92 -0
- data/assets/stylesheets/neat/grid/_omega.scss +87 -0
- data/assets/stylesheets/neat/grid/_outer-container.scss +38 -0
- data/assets/stylesheets/neat/grid/_pad.scss +25 -0
- data/assets/stylesheets/neat/grid/_private.scss +35 -0
- data/assets/stylesheets/neat/grid/_row.scss +52 -0
- data/assets/stylesheets/neat/grid/_shift.scss +50 -0
- data/assets/stylesheets/neat/grid/_span-columns.scss +94 -0
- data/assets/stylesheets/neat/grid/_to-deprecate.scss +97 -0
- data/assets/stylesheets/neat/grid/_visual-grid.scss +42 -0
- data/assets/stylesheets/neat/settings/_disable-warnings.scss +13 -0
- data/assets/stylesheets/neat/settings/_grid.scss +51 -0
- data/assets/stylesheets/neat/settings/_visual-grid.scss +27 -0
- data/lib/nesta-contentfocus-extensions.rb +14 -4
- data/lib/nesta-contentfocus-extensions/app.rb +8 -0
- data/lib/nesta-contentfocus-extensions/helpers.rb +21 -0
- data/lib/nesta-contentfocus-extensions/kramdown.rb +91 -0
- data/lib/nesta-contentfocus-extensions/menu.rb +4 -1
- data/lib/nesta-contentfocus-extensions/overrides.rb +17 -0
- data/lib/nesta-contentfocus-extensions/page.rb +29 -54
- data/lib/nesta-contentfocus-extensions/path.rb +13 -7
- data/lib/nesta-contentfocus-extensions/paths.rb +52 -0
- data/lib/nesta-contentfocus-extensions/renderer.rb +46 -0
- data/lib/nesta-contentfocus-extensions/routes.rb +15 -0
- data/lib/nesta-contentfocus-extensions/theme.rb +36 -0
- data/lib/nesta-contentfocus-extensions/version.rb +1 -1
- data/nesta-contentfocus-extensions.gemspec +14 -11
- metadata +184 -6
@@ -0,0 +1,97 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
@mixin breakpoint($query:$feature $value $columns, $total-columns: $grid-columns) {
|
4
|
+
@include -neat-warn("The breakpoint() mixin was renamed to media() in Neat 1.0. Please update your project with the new syntax before the next version bump.");
|
5
|
+
|
6
|
+
@if length($query) == 1 {
|
7
|
+
@media screen and ($default-feature: nth($query, 1)) {
|
8
|
+
$default-grid-columns: $grid-columns;
|
9
|
+
$grid-columns: $total-columns;
|
10
|
+
@content;
|
11
|
+
$grid-columns: $default-grid-columns;
|
12
|
+
}
|
13
|
+
} @else if length($query) == 2 {
|
14
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
15
|
+
$default-grid-columns: $grid-columns;
|
16
|
+
$grid-columns: $total-columns;
|
17
|
+
@content;
|
18
|
+
$grid-columns: $default-grid-columns;
|
19
|
+
}
|
20
|
+
} @else if length($query) == 3 {
|
21
|
+
@media screen and (nth($query, 1): nth($query, 2)) {
|
22
|
+
$default-grid-columns: $grid-columns;
|
23
|
+
$grid-columns: nth($query, 3);
|
24
|
+
@content;
|
25
|
+
$grid-columns: $default-grid-columns;
|
26
|
+
}
|
27
|
+
} @else if length($query) == 4 {
|
28
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
29
|
+
$default-grid-columns: $grid-columns;
|
30
|
+
$grid-columns: $total-columns;
|
31
|
+
@content;
|
32
|
+
$grid-columns: $default-grid-columns;
|
33
|
+
}
|
34
|
+
} @else if length($query) == 5 {
|
35
|
+
@media screen and (nth($query, 1): nth($query, 2)) and (nth($query, 3): nth($query, 4)) {
|
36
|
+
$default-grid-columns: $grid-columns;
|
37
|
+
$grid-columns: nth($query, 5);
|
38
|
+
@content;
|
39
|
+
$grid-columns: $default-grid-columns;
|
40
|
+
}
|
41
|
+
} @else {
|
42
|
+
@include -neat-warn("Wrong number of arguments for breakpoint(). Read the documentation for more details.");
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
@mixin nth-omega($nth, $display: block, $direction: default) {
|
47
|
+
@include -neat-warn("The nth-omega() mixin is deprecated. Please use omega() instead.");
|
48
|
+
@include omega($nth $display, $direction);
|
49
|
+
}
|
50
|
+
|
51
|
+
/// Resets the active display property to `block`. Particularly useful when changing the display property in a single row.
|
52
|
+
///
|
53
|
+
/// @example scss - Usage
|
54
|
+
/// .element {
|
55
|
+
/// @include row(table);
|
56
|
+
/// // Context changed to table display
|
57
|
+
/// }
|
58
|
+
///
|
59
|
+
/// @include reset-display;
|
60
|
+
/// // Context is reset to block display
|
61
|
+
|
62
|
+
@mixin reset-display {
|
63
|
+
$container-display-table: false !global;
|
64
|
+
@include -neat-warn("Resetting $display will be deprecated in future versions in favor of the display(){...} mixin.");
|
65
|
+
}
|
66
|
+
|
67
|
+
/// Resets the active layout direction to the default value set in `$default-layout-direction`. Particularly useful when changing the layout direction in a single row.
|
68
|
+
///
|
69
|
+
/// @example scss - Usage
|
70
|
+
/// .element {
|
71
|
+
/// @include row($direction: RTL);
|
72
|
+
/// // Context changed to right-to-left
|
73
|
+
/// }
|
74
|
+
///
|
75
|
+
/// @include reset-layout-direction;
|
76
|
+
/// // Context is reset to left-to-right
|
77
|
+
|
78
|
+
@mixin reset-layout-direction {
|
79
|
+
$layout-direction: $default-layout-direction !global;
|
80
|
+
@include -neat-warn("Resetting $direction will be deprecated in future versions in favor of the direction(){...} mixin.");
|
81
|
+
}
|
82
|
+
|
83
|
+
/// Resets both the active layout direction and the active display property.
|
84
|
+
///
|
85
|
+
/// @example scss - Usage
|
86
|
+
/// .element {
|
87
|
+
/// @include row(table, RTL);
|
88
|
+
/// // Context changed to table table and right-to-left
|
89
|
+
/// }
|
90
|
+
///
|
91
|
+
/// @include reset-all;
|
92
|
+
/// // Context is reset to block display and left-to-right
|
93
|
+
|
94
|
+
@mixin reset-all {
|
95
|
+
@include reset-display;
|
96
|
+
@include reset-layout-direction;
|
97
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
@mixin grid-column-gradient($values...) {
|
4
|
+
background-image: -webkit-linear-gradient(left, $values);
|
5
|
+
background-image: -moz-linear-gradient(left, $values);
|
6
|
+
background-image: -ms-linear-gradient(left, $values);
|
7
|
+
background-image: -o-linear-gradient(left, $values);
|
8
|
+
background-image: unquote("linear-gradient(to left, #{$values})");
|
9
|
+
}
|
10
|
+
|
11
|
+
@if $visual-grid == true or $visual-grid == yes {
|
12
|
+
body:before {
|
13
|
+
@include grid-column-gradient(gradient-stops($grid-columns));
|
14
|
+
content: "";
|
15
|
+
display: inline-block;
|
16
|
+
height: 100%;
|
17
|
+
left: 0;
|
18
|
+
margin: 0 auto;
|
19
|
+
max-width: $max-width;
|
20
|
+
opacity: $visual-grid-opacity;
|
21
|
+
pointer-events: none;
|
22
|
+
position: fixed;
|
23
|
+
right: 0;
|
24
|
+
width: 100%;
|
25
|
+
|
26
|
+
@if $visual-grid-index == back {
|
27
|
+
z-index: -1;
|
28
|
+
}
|
29
|
+
|
30
|
+
@else if $visual-grid-index == front {
|
31
|
+
z-index: 9999;
|
32
|
+
}
|
33
|
+
|
34
|
+
@each $breakpoint in $visual-grid-breakpoints {
|
35
|
+
@if $breakpoint {
|
36
|
+
@include media($breakpoint) {
|
37
|
+
@include grid-column-gradient(gradient-stops($grid-columns));
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
/// Disable all deprecation warnings. Defaults to `false`. Set with a `!global` flag.
|
4
|
+
///
|
5
|
+
/// @type Bool
|
6
|
+
|
7
|
+
$disable-warnings: false !default;
|
8
|
+
|
9
|
+
@mixin -neat-warn($message) {
|
10
|
+
@if $disable-warnings == false {
|
11
|
+
@warn "#{$message}";
|
12
|
+
}
|
13
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
/// Sets the relative width of a single grid column. The unit used should be the same one used to define `$gutter`. To learn more about modular-scale() see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with a `!global` flag.
|
4
|
+
///
|
5
|
+
/// @type Number (Unit)
|
6
|
+
|
7
|
+
$column: modular-scale(3, 1em, $golden) !default;
|
8
|
+
|
9
|
+
/// Sets the relative width of a single grid gutter. The unit used should be the same one used to define `$column`. To learn more about modular-scale() see [Bourbon docs](http://bourbon.io/docs/#modular-scale). Set with the `!global` flag.
|
10
|
+
///
|
11
|
+
/// @type Number (Unit)
|
12
|
+
|
13
|
+
$gutter: modular-scale(1, 1em, $golden) !default;
|
14
|
+
|
15
|
+
/// Sets the total number of columns in the grid. Its value can be overridden inside a media query using the `media()` mixin. Set with the `!global` flag.
|
16
|
+
///
|
17
|
+
/// @type Number (Unitless)
|
18
|
+
|
19
|
+
$grid-columns: 12 !default;
|
20
|
+
|
21
|
+
/// Sets the max-width property of the element that includes `outer-container()`. To learn more about `em()` see [Bourbon docs](http://bourbon.io/docs/#px-to-em). Set with the `!global` flag.
|
22
|
+
///
|
23
|
+
/// @type Number (Unit)
|
24
|
+
///
|
25
|
+
$max-width: em(1088) !default;
|
26
|
+
|
27
|
+
/// When set to true, it sets the box-sizing property of all elements to `border-box`. Set with a `!global` flag.
|
28
|
+
///
|
29
|
+
/// @type Bool
|
30
|
+
///
|
31
|
+
/// @example css - CSS Output
|
32
|
+
/// html {
|
33
|
+
/// box-sizing: border-box; }
|
34
|
+
///
|
35
|
+
/// *, *::after, *::before {
|
36
|
+
/// box-sizing: inherit;
|
37
|
+
/// }
|
38
|
+
|
39
|
+
$border-box-sizing: true !default;
|
40
|
+
|
41
|
+
/// Sets the default [media feature](http://www.w3.org/TR/css3-mediaqueries/#media) that `media()` and `new-breakpoint()` revert to when only a breakpoint value is passed. Set with a `!global` flag.
|
42
|
+
///
|
43
|
+
/// @type String
|
44
|
+
|
45
|
+
$default-feature: min-width; // Default @media feature for the breakpoint() mixin
|
46
|
+
|
47
|
+
///Sets the default layout direction of the grid. Can be `LTR` or `RTL`. Set with a `!global` flag.
|
48
|
+
///
|
49
|
+
///@type String
|
50
|
+
|
51
|
+
$default-layout-direction: LTR !default;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
/// Displays the visual grid when set to true. The overlaid grid may be few pixels off depending on the browser's rendering engine and pixel rounding algorithm. Set with the `!global` flag.
|
4
|
+
///
|
5
|
+
/// @type Bool
|
6
|
+
|
7
|
+
$visual-grid: false !default;
|
8
|
+
|
9
|
+
/// Sets the visual grid color. Set with `!global` flag.
|
10
|
+
///
|
11
|
+
/// @type Color
|
12
|
+
|
13
|
+
$visual-grid-color: #eee !default;
|
14
|
+
|
15
|
+
/// Sets the `z-index` property of the visual grid. Can be `back` (behind content) or `front` (in front of content). Set with `!global` flag.
|
16
|
+
///
|
17
|
+
/// @type String
|
18
|
+
|
19
|
+
$visual-grid-index: back !default;
|
20
|
+
|
21
|
+
/// Sets the opacity property of the visual grid. Set with `!global` flag.
|
22
|
+
///
|
23
|
+
/// @type Number (unitless)
|
24
|
+
|
25
|
+
$visual-grid-opacity: 0.4 !default;
|
26
|
+
|
27
|
+
$visual-grid-breakpoints: () !default;
|
@@ -1,4 +1,14 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'tilt'
|
2
|
+
require 'nesta-contentfocus-extensions/version'
|
3
|
+
require 'nesta-contentfocus-extensions/app'
|
4
|
+
require 'nesta-contentfocus-extensions/helpers'
|
5
|
+
require 'nesta-contentfocus-extensions/kramdown'
|
6
|
+
require 'nesta-contentfocus-extensions/menu'
|
7
|
+
require 'nesta-contentfocus-extensions/overrides'
|
8
|
+
require 'nesta-contentfocus-extensions/page'
|
9
|
+
require 'nesta-contentfocus-extensions/path'
|
10
|
+
require 'nesta-contentfocus-extensions/paths'
|
11
|
+
require 'nesta-contentfocus-extensions/renderer'
|
12
|
+
require 'nesta-contentfocus-extensions/routes'
|
13
|
+
require 'nesta-contentfocus-extensions/theme'
|
14
|
+
Nesta::ContentFocus::Paths.setup_base_app
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'nesta-contentfocus-extensions/paths'
|
2
|
+
module Nesta
|
3
|
+
class App < Sinatra::Base
|
4
|
+
helpers do
|
5
|
+
def find_template(view_path, name, engine, &block)
|
6
|
+
views = [view_path]
|
7
|
+
views += Nesta::ContentFocus::Paths.view_paths
|
8
|
+
views.each { |v| super(v, name, engine, &block) }
|
9
|
+
end
|
10
|
+
|
11
|
+
def body_class
|
12
|
+
classes = [@body_class]
|
13
|
+
if @page
|
14
|
+
classes << 'landing-page' if @page.flagged_as? 'landing-page'
|
15
|
+
classes << 'bare' if @page.flagged_as? 'sign-up'
|
16
|
+
end
|
17
|
+
classes.compact.sort.uniq.join(' ')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'rouge'
|
2
|
+
require 'kramdown'
|
3
|
+
require 'kramdown/converter'
|
4
|
+
require 'tilt'
|
5
|
+
|
6
|
+
Tilt.register Tilt::KramdownTemplate, 'markdown', 'mkd', 'md'
|
7
|
+
Tilt.prefer Tilt::KramdownTemplate
|
8
|
+
|
9
|
+
module Kramdown
|
10
|
+
module SyntaxHighlighter
|
11
|
+
module Rouge
|
12
|
+
def self.call(converter, text, lang, type, _unused_opts)
|
13
|
+
opts = converter.options[:syntax_highlighter_opts].dup
|
14
|
+
lexer = ::Rouge::Lexer.find_fancy(lang || opts[:default_lang], text)
|
15
|
+
return nil unless lexer
|
16
|
+
if type == :span
|
17
|
+
opts[:wrap] = false
|
18
|
+
opts[:line_numbers] = false
|
19
|
+
end
|
20
|
+
formatter = (opts.delete(:formatter) || ::Rouge::Formatters::HTML).new(opts)
|
21
|
+
formatter.format(lexer.lex(text))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module Converter
|
27
|
+
add_syntax_highlighter :rouge do |converter, text, lang, type, opts|
|
28
|
+
add_syntax_highlighter :rouge, ::Kramdown::SyntaxHighlighter::Rouge
|
29
|
+
syntax_highlighter(:rouge).call(converter, text, lang, type, opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
class Html < Base
|
33
|
+
alias_method :pre_headstartup_convert_ul, :convert_ul
|
34
|
+
alias_method :pre_headstartup_convert_blockquote, :convert_blockquote
|
35
|
+
alias_method :pre_headstartup_convert_header, :convert_header
|
36
|
+
|
37
|
+
def convert_ul(el, indent)
|
38
|
+
if ['benefits', 'how', 'features'].include? el.attr['class']
|
39
|
+
el.children.each do |li|
|
40
|
+
p = li.children.detect{ |c| c.type == :p }
|
41
|
+
if p
|
42
|
+
img = p.children.detect{ |c| c.type == :img}
|
43
|
+
if img
|
44
|
+
description = Element.new(:html_element, 'div', :class => 'description')
|
45
|
+
example = Element.new(:html_element, 'div', :class => 'example')
|
46
|
+
p.children.delete(img)
|
47
|
+
example.children = [img]
|
48
|
+
description.children = li.children
|
49
|
+
li.children = [example, description]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
output = pre_headstartup_convert_ul(el, indent)
|
55
|
+
output
|
56
|
+
end
|
57
|
+
|
58
|
+
def convert_blockquote(el, indent)
|
59
|
+
if el.attr['class'] == 'testimonial'
|
60
|
+
p = el.children.detect{ |c| c.type == :p }
|
61
|
+
if p
|
62
|
+
mdash_idx = p.children.index{ |c| c.type == :typographic_sym && c.value == :mdash }
|
63
|
+
if mdash_idx
|
64
|
+
next_el = p.children[mdash_idx + 1]
|
65
|
+
if (next_el.type == :text) && (next_el.value.strip.empty?) && (p.children[mdash_idx + 2].type == :a)
|
66
|
+
p.children.delete_at(mdash_idx)
|
67
|
+
cite = Element.new(:html_element, 'cite')
|
68
|
+
cite.children = p.children.pop(p.children.size - mdash_idx)
|
69
|
+
p.children.push cite
|
70
|
+
elsif next_el.type == :a
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
output = pre_headstartup_convert_blockquote(el, indent)
|
76
|
+
end
|
77
|
+
|
78
|
+
def convert_header(el, indent)
|
79
|
+
output = pre_headstartup_convert_header(el, indent)
|
80
|
+
matched, open, content, close = *output.match(%r{(.*<h[1-6][^>]*>)(.*)(</h[1-6]>)})
|
81
|
+
split_content = content.split(' ')
|
82
|
+
if split_content.size > 3
|
83
|
+
split_content[-1] = [split_content[-2], ' ', split_content.pop].join
|
84
|
+
content = split_content.join(' ')
|
85
|
+
end
|
86
|
+
[open, content, close].join
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'tempfile'
|
2
|
+
require 'tilt'
|
2
3
|
require 'nesta/models'
|
3
4
|
|
4
5
|
module Nesta
|
@@ -12,7 +13,9 @@ module Nesta
|
|
12
13
|
@full_menu = pre_contentfocus_full_menu
|
13
14
|
if @full_menu.empty?
|
14
15
|
menu_file = Tempfile.new('menu')
|
15
|
-
Page.find_all.map(&:categories).flatten.compact.uniq
|
16
|
+
categories = Page.find_all.map(&:categories).flatten.compact.uniq
|
17
|
+
categories.sort_by!(&:abspath)
|
18
|
+
categories.each do |category|
|
16
19
|
menu_file.write(category.abspath + "\n")
|
17
20
|
category.pages.each do |sub_category|
|
18
21
|
menu_file.write(Nesta::Menu::INDENT + sub_category.abspath + "\n")
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'nesta/overrides'
|
2
|
+
module Nesta
|
3
|
+
module Overrides
|
4
|
+
private
|
5
|
+
|
6
|
+
def self.render_options(template, *engines)
|
7
|
+
Nesta::ContentFocus::Paths.view_paths.each do |path|
|
8
|
+
engines.each do |engine|
|
9
|
+
if template_exists?(engine, path, template)
|
10
|
+
return { views: path }, engine
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
[{}, :sass]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,60 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
require 'nesta/models'
|
3
|
-
|
4
|
-
module Nesta
|
5
|
-
module ContentFocus
|
6
|
-
class HTMLRenderer < Redcarpet::Render::HTML
|
7
|
-
def preprocess(document)
|
8
|
-
@document = document
|
9
|
-
end
|
10
|
-
|
11
|
-
def paragraph(content)
|
12
|
-
if ['[TOC]'].include?(content)
|
13
|
-
toc_render = Redcarpet::Render::HTML_TOC.new(nesting_level: 2)
|
14
|
-
parser = Redcarpet::Markdown.new(toc_render)
|
15
|
-
rendered = parser.render(@document)
|
16
|
-
rendered.sub!(/\A<ul>/, '<ul class="toc">')
|
17
|
-
return rendered
|
18
|
-
else
|
19
|
-
["<p>",content,"</p>"].join
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def block_quote(content)
|
24
|
-
if content.match(/\A<p>\.([a-z]+) /)
|
25
|
-
cssclass = $1
|
26
|
-
content.sub!(/\A\<p>.([a-z]+) /, "")
|
27
|
-
content.sub!(/<\/p>\z/, "")
|
28
|
-
[%Q{<div class="#{cssclass}"><p>}, content, "</p></div>"].join
|
29
|
-
else
|
30
|
-
["<blockquote>", content, "</blockquote>"].join
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
1
|
+
require 'nesta-contentfocus-extensions/renderer'
|
37
2
|
module Nesta
|
38
3
|
class Page < FileModel
|
39
4
|
def convert_to_html(format, scope, text)
|
40
|
-
render_options = {
|
41
|
-
prettify: true,
|
42
|
-
safe_links_only: true,
|
43
|
-
with_toc_data: true
|
44
|
-
}
|
45
|
-
markdown_options = {
|
46
|
-
renderer: Nesta::ContentFocus::HTMLRenderer.new(render_options),
|
47
|
-
autolink: true,
|
48
|
-
disable_indented_code_blocks: true,
|
49
|
-
fenced_code_blocks: true,
|
50
|
-
footnotes: true,
|
51
|
-
highlight: true,
|
52
|
-
no_intra_emphasis: true,
|
53
|
-
quote: true,
|
54
|
-
strikethrough: true,
|
55
|
-
superscript: true,
|
56
|
-
tables: true
|
57
|
-
}
|
58
5
|
text = add_p_tags_to_haml(text) if @format == :haml
|
59
6
|
template = Tilt[format].new(nil, 1, markdown_options) { text }
|
60
7
|
template.render(scope)
|
@@ -63,5 +10,33 @@ module Nesta
|
|
63
10
|
def intro_image
|
64
11
|
return metadata('Intro Image') if metadata('Intro Image')
|
65
12
|
end
|
13
|
+
|
14
|
+
def markdown_options
|
15
|
+
{
|
16
|
+
auto_id_stripping: true,
|
17
|
+
auto_ids: true,
|
18
|
+
syntax_highlighter: :rouge,
|
19
|
+
syntax_highlighter_opts: syntax_highlight_options
|
20
|
+
}
|
21
|
+
#{
|
22
|
+
# autolink: true,
|
23
|
+
# disable_indented_code_blocks: true,
|
24
|
+
# fenced_code_blocks: true,
|
25
|
+
# footnotes: true,
|
26
|
+
# highlight: true,
|
27
|
+
# no_intra_emphasis: true,
|
28
|
+
# quote: true,
|
29
|
+
# strikethrough: true,
|
30
|
+
# syntax_highlighter: :rouge,
|
31
|
+
# superscript: true,
|
32
|
+
# tables: true }
|
33
|
+
end
|
34
|
+
|
35
|
+
def syntax_highlight_options
|
36
|
+
{
|
37
|
+
line_numbers: true,
|
38
|
+
css_class: 'hll'
|
39
|
+
}
|
40
|
+
end
|
66
41
|
end
|
67
42
|
end
|