serbea 0.10.5 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0aa3994d0779dc0bada9d35a6125dafd4501070f780bd353384a1f72bd1be54
4
- data.tar.gz: 455373e852ca5f680adf28d7efe3198e34b97f84d1fb93d58ab32eac84bde61b
3
+ metadata.gz: 9de1d1227d672565dd3f5c7e1eaccd6b521aef986761905c32a5291f0ec07884
4
+ data.tar.gz: d1d30224f4c014bb7c142ace9c1780318e5a7e15ff299dc3d0d8a5913e419077
5
5
  SHA512:
6
- metadata.gz: 9b37ea92fed79e50c3e67ee81e06dfd9daf8c969ee6b6901312b8a74295d73f7a82e7b1fa34555feccd9c877e4e6322cb27e22acd3a3fab30a0b145318bbf221
7
- data.tar.gz: 37a8dbcf0799f9cdf352bbe633d959ea6f5ec1ba082ba918d223794b0e00b5a2377f5d960f57d7d47dc5db756cb5a12636062359bfe3922878593cbf286b6299
6
+ metadata.gz: ef72a8fd812225972e01f5a658c673266c72a0afa925595178f2f8f39e00a444c566b9f01c24880a2a063aa8dd29dbabd04114c792544f8d78e05e6f3c6fe321
7
+ data.tar.gz: bf6962a1de782dd73e8aad76a20d6c830b62906053c7d33a5f6e0783ecd5ef46f086e365d7c37d24d6437a80b94fcde7f1258dc318a5c7905ebbc4bca2b78859
data/.gitignore CHANGED
@@ -16,3 +16,6 @@ mkmf.log
16
16
  Gemfile.lock
17
17
  .bundle
18
18
  .ruby-version
19
+
20
+ # Mac files
21
+ .DS_Store
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-present Jared White
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,109 +1,24 @@
1
1
  # 👑 Serbea: Similar to ERB, Except Awesomer
2
2
 
3
- The Ruby template language you've always dreamed of is finally here. _Le roi est mort, vive le roi!_
3
+ [![Gem Version](https://badge.fury.io/rb/serbea.svg)](https://badge.fury.io/rb/serbea)
4
4
 
5
- Serbea combines the best ideas from "brace-style" template languages such as Liquid, Nunjucks, Twig, Jinja, Mustache, etc.—and applies them to the world of ERB. You can use Serbea in Rails applications, Bridgetown static sites, or pretty much any Ruby scenario you could imagine.
5
+ **Serbea is the Ruby template engine you didn’t realize you needed. Until now.**
6
6
 
7
- ## Features
7
+ Serbea combines the best ideas from “brace-style” template languages such as Liquid, Nunjucks, Twig, Jinja, Mustache, etc.—and applies them to the world of ERB. You can use Serbea in Rails applications, Bridgetown static sites, or pretty much any Ruby scenario you could imagine.
8
8
 
9
- * Real Ruby. Like, for real.
10
- * Filters!!! Pipeline operators!!!
11
- * Autoescaped variables by default within the pipeline (`{{ }}`) tags. Use the `safe`/`raw` or `escape`/`h` filters to control escaping on output.
12
- * Render directive `{%@ %}` as shortcut for rendering either string-named partials (`render "tmpl"`) or object instances (`render MyComponent.new`).
13
- * Supports every convention of ERB and builds upon it with new features (which is why it's "awesomer!").
14
- * Builtin frontmatter support so you can access the variables written into the top YAML within your templates. In any Rails view, including layouts, you'll have access to the `@frontmatter` ivar which is a merged `HashWithDotAccess::Hash` with data from any part of the view tree (partials, pages, layout).
15
- * The filters accessible within Serbea templates are either helpers (where the variable gets passed as the first argument) or instance methods of the variable itself, so you can build extremely expressive pipelines that take advantage of the code you already know and love. (For example, in Rails you could write `{{ "My Link" | link_to: route_path }}`).
16
- * The `Serbea::Pipeline.exec` method lets you pass a pipeline template in, along with an optional input value or included helpers module, and you'll get the output as a object of any type (not converted to a string like in traditional templates). For example: `Serbea::Pipeline.exec("arr |> map: ->(i) { i * 10 }", arr: [1,2,3])` will return `[10, 20, 30]`.
9
+ **Documentation and examples are on our website:**
17
10
 
18
- ## What It Looks Like
11
+ [www.serbea.dev](https://www.serbea.dev)
19
12
 
20
- ```hbs
21
- # example.serb
22
13
 
23
- {% wow = capture do %}
24
- This is {{ "amazing" + "!" | upcase }}
25
- {% end.each_char.reduce("") do |newstr, c|
26
- newstr += " #{c}"
27
- end.strip %}
14
+ ## Contributing
28
15
 
29
- {{ wow | prepend: "OMG! " }}
30
- ```
16
+ 1. Fork it (https://github.com/bridgetownrb/serbea/fork)
17
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
18
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
19
+ 4. Push to the branch (`git push origin my-new-feature`)
20
+ 5. Create a new Pull Request
31
21
 
32
- ```hbs
33
- <p>
34
- {%
35
- helper :multiply_array do |input, multiply_by = 2|
36
- input.map do |i|
37
- i.to_i * multiply_by
38
- end
39
- end
40
- %}
22
+ ## License
41
23
 
42
- Multiply! {{ [1,3,6, "9"] | multiply_array: 10 }}
43
- </p>
44
- ```
45
-
46
- ```hbs
47
- {%= form classname: "checkout" do |f| %}
48
- {{ f.input :first_name, required: true | errors: error_messages }}
49
- {% end %}
50
- ```
51
-
52
- ```hbs
53
- {%= render "box" do %}
54
- This is **dope!**
55
- {%= render "card", title: "Nifty!" do %}
56
- So great.
57
- {% end %}
58
- {% end %}
59
-
60
- # Let's simplify that using the new render directive!
61
-
62
- {%@ "box" do %}
63
- This is **dope!**
64
- {%@ "card", title: "Nifty!" do %}
65
- So great.
66
- {% end %}
67
- {% end %}
68
- ```
69
-
70
- ```hbs
71
- # Works with ViewComponent!
72
-
73
- {%= render(Theme::DropdownComponent.new(name: "banner", label: "Banners")) do |dropdown| %}
74
- {% RegistryTheme::BANNERS.each do |banner| %}
75
- {% dropdown.slot(:item, value: banner) do %}
76
- <img src="{{ banner | parameterize: separator: "_" | prepend: "/themes/" | append: ".jpg" }}">
77
- <strong>{{ banner }}</strong>
78
- {% end %}
79
- {% end %}
80
- {% end %}
81
-
82
- # Even better, use the new render directive!
83
-
84
- {%@ Theme::DropdownComponent name: "banner", label: "Banners" do |dropdown| %}
85
- {% RegistryTheme::BANNERS.each do |banner| %}
86
- {% dropdown.slot(:item, value: banner) do %}
87
- <img src="{{ banner | parameterize: separator: "_" | prepend: "/themes/" | append: ".jpg" }}">
88
- <strong>{{ banner }}</strong>
89
- {% end %}
90
- {% end %}
91
- {% end %}
92
- ```
93
-
94
- ```hbs
95
- # The | and |> pipeline operators are equivalent, so you can write like this if you want!
96
-
97
- {{
98
- [1,2,3] |>
99
- map: -> i {
100
- i * 10
101
- } |>
102
- filter: -> i do
103
- i > 15
104
- end |>
105
- assign_to: :array_length
106
- }}
107
-
108
- Array length: {{ @array_length.length }}
109
- ```
24
+ MIT
data/docs/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ # Bridgetown
2
+ output
3
+ .bridgetown-cache
4
+ .bridgetown-metadata
5
+ .bridgetown-webpack
6
+
7
+ # Dependency folders
8
+ node_modules
9
+ bower_components
10
+ vendor
11
+
12
+ # Caches
13
+ .sass-cache
14
+ .npm
15
+ .node_repl_history
16
+
17
+ # Ignore bundler config.
18
+ /.bundle
19
+
20
+ # Ignore Byebug command history file.
21
+ .byebug_history
22
+
23
+ # dotenv environment variables file
24
+ .env
25
+
26
+ # Mac files
27
+ .DS_Store
28
+
29
+ # Yarn
30
+ yarn-error.log
31
+ yarn-debug.log*
32
+ .pnp/
33
+ .pnp.js
34
+ # Yarn Integrity file
35
+ .yarn-integrity
36
+
37
+ .ruby-version
data/docs/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ gem "bridgetown", "~> 0.19"
5
+ gem "serbea", "~> 0.10", :group => :bridgetown_plugins
@@ -0,0 +1,6 @@
1
+ url: "https://www.serbea.dev"
2
+ permalink: pretty
3
+
4
+ timezone: America/Los_Angeles
5
+
6
+ template_engine: serbea
@@ -0,0 +1,3 @@
1
+ import "../styles/index.scss"
2
+
3
+ console.info("Bridgetown is loaded!")
@@ -0,0 +1,169 @@
1
+ $body-background: #f2f2f2;
2
+ $body-color: #5a5a5a;
3
+ $heading-color: #222222;
4
+
5
+ html {
6
+ box-sizing: border-box;
7
+ }
8
+ *, *:before, *:after {
9
+ box-sizing: inherit;
10
+ }
11
+
12
+ body {
13
+ background: $body-background;
14
+ color: $body-color;
15
+ font-family: BlinkMacSystemFont,-apple-system,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue","Helvetica","Arial",sans-serif;
16
+ margin: 0 8px;
17
+ font-size: 19px;
18
+ line-height: 1.5;
19
+ }
20
+
21
+ a {
22
+ color: #204a87;
23
+ text-decoration: underline;
24
+ text-decoration-color: #90add3;
25
+ }
26
+
27
+ h1 {
28
+ font-weight: 900;
29
+ font-size: 2.5rem;
30
+ color: $heading-color;
31
+ text-align: center;
32
+ }
33
+
34
+ footer {
35
+ text-align: center;
36
+ margin-bottom: 4rem;
37
+ font-size: 1em;
38
+ }
39
+
40
+ main {
41
+ margin: 2rem auto 4rem;
42
+ max-width: 68rem;
43
+ padding: 25px 35px 50px;
44
+ background: white;
45
+ box-shadow: 2px 3px 3px #ddd;
46
+ border-radius: 3px;
47
+
48
+ @media (max-width: 500px) {
49
+ padding: 16px 16px 50px;
50
+ }
51
+ }
52
+
53
+ h2 {
54
+ font-weight: 700;
55
+ color: $heading-color;
56
+ text-align: center;
57
+ }
58
+
59
+ h3 {
60
+ margin-top: 3rem;
61
+ margin-bottom: 2rem;
62
+ font-weight: 700;
63
+ color: $heading-color;
64
+ font-size: 1.75rem;
65
+ text-align: center;
66
+ }
67
+
68
+ p, ul li, ol li {
69
+ margin-top: 0;
70
+ margin-bottom: 1.5rem;
71
+ }
72
+
73
+ div.highlighter-rouge {
74
+ margin: 1.5rem 0;
75
+ width: 100%;
76
+ overflow: auto;
77
+ }
78
+
79
+ $grey: #888;
80
+ $base-code-text-color: #222;
81
+
82
+ code {
83
+ font-size: 1.1rem;
84
+ font-family: ui-monospace, monospace;
85
+ color: #8f5902;
86
+ }
87
+
88
+ pre code {
89
+ color: $base-code-text-color;
90
+ }
91
+
92
+ .highlight .hll { background-color: #ffffcc }
93
+ .highlight .c { color: $grey } /* Comment */
94
+ .highlight .err { color: #a40000 } /* Error */
95
+ .highlight .g { color: $base-code-text-color } /* Generic */
96
+ .highlight .k { color: #204a87; font-weight: 500 } /* Keyword */
97
+ .highlight .l { color: $base-code-text-color } /* Literal */
98
+ .highlight .n { color: $base-code-text-color } /* Name */
99
+ .highlight .o { color: #ce5c00; font-weight: 500 } /* Operator */
100
+ .highlight .x { color: $base-code-text-color } /* Other */
101
+ .highlight .p { color: $base-code-text-color; font-weight: 500 } /* Punctuation */
102
+ .highlight .cm { color: #8f5902 } /* Comment.Multiline */
103
+ .highlight .cp { color: #8f5902 } /* Comment.Preproc */
104
+ .highlight .c1 { color: #8f5902 } /* Comment.Single */
105
+ .highlight .cs { color: #8f5902 } /* Comment.Special */
106
+ .highlight .gd { color: #a40000 } /* Generic.Deleted */
107
+ .highlight .ge { color: $base-code-text-color } /* Generic.Emph */
108
+ .highlight .gr { color: #ef2929 } /* Generic.Error */
109
+ .highlight .gh { color: #000080; font-weight: 500 } /* Generic.Heading */
110
+ .highlight .gi { color: #00A000 } /* Generic.Inserted */
111
+ .highlight .go { color: $base-code-text-color } /* Generic.Output */
112
+ .highlight .gp { color: #8f5902 } /* Generic.Prompt */
113
+ .highlight .gs { color: $base-code-text-color; font-weight: 500 } /* Generic.Strong */
114
+ .highlight .gu { color: #800080; font-weight: 500 } /* Generic.Subheading */
115
+ .highlight .gt { color: #a40000; font-weight: 500 } /* Generic.Traceback */
116
+ .highlight .kc { color: #204a87; font-weight: 500 } /* Keyword.Constant */
117
+ .highlight .kd { color: #204a87; font-weight: 500 } /* Keyword.Declaration */
118
+ .highlight .kn { color: #204a87; font-weight: 500 } /* Keyword.Namespace */
119
+ .highlight .kp { color: #204a87; font-weight: 500 } /* Keyword.Pseudo */
120
+ .highlight .kr { color: #204a87; font-weight: 500 } /* Keyword.Reserved */
121
+ .highlight .kt { color: #204a87; font-weight: 500 } /* Keyword.Type */
122
+ .highlight .ld { color: $base-code-text-color } /* Literal.Date */
123
+ .highlight .m { color: #0000cf; font-weight: 500 } /* Literal.Number */
124
+ .highlight .s { color: #4e9a06 } /* Literal.String */
125
+ .highlight .na { color: #8d8400 } /* Name.Attribute */
126
+ .highlight .nb { color: #204a87 } /* Name.Builtin */
127
+ .highlight .nc { color: $base-code-text-color } /* Name.Class */
128
+ .highlight .no { color: $base-code-text-color } /* Name.Constant */
129
+ .highlight .nd { color: #5c35cc; font-weight: 500 } /* Name.Decorator */
130
+ .highlight .ni { color: #ce5c00 } /* Name.Entity */
131
+ .highlight .ne { color: #cc0000; font-weight: 500 } /* Name.Exception */
132
+ .highlight .nf { color: $base-code-text-color } /* Name.Function */
133
+ .highlight .nl { color: #f57900 } /* Name.Label */
134
+ .highlight .nn { color: $base-code-text-color } /* Name.Namespace */
135
+ .highlight .nx { color: $base-code-text-color } /* Name.Other */
136
+ .highlight .py { color: $base-code-text-color } /* Name.Property */
137
+ .highlight .nt { color: #204a87; font-weight: 500 } /* Name.Tag */
138
+ .highlight .nv { color: $base-code-text-color } /* Name.Variable */
139
+ .highlight .ow { color: #204a87; font-weight: 500 } /* Operator.Word */
140
+ .highlight .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
141
+ .highlight .mf { color: #0000cf; font-weight: 500 } /* Literal.Number.Float */
142
+ .highlight .mh { color: #0000cf; font-weight: 500 } /* Literal.Number.Hex */
143
+ .highlight .mi { color: #0000cf; font-weight: 500 } /* Literal.Number.Integer */
144
+ .highlight .mo { color: #0000cf; font-weight: 500 } /* Literal.Number.Oct */
145
+ .highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */
146
+ .highlight .sc { color: #4e9a06 } /* Literal.String.Char */
147
+ .highlight .sd { color: #8f5902 } /* Literal.String.Doc */
148
+ .highlight .s2 { color: #4e9a06 } /* Literal.String.Double */
149
+ .highlight .se { color: #4e9a06 } /* Literal.String.Escape */
150
+ .highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */
151
+ .highlight .si { color: #4e9a06 } /* Literal.String.Interpol */
152
+ .highlight .sx { color: #4e9a06 } /* Literal.String.Other */
153
+ .highlight .sr { color: #4e9a06 } /* Literal.String.Regex */
154
+ .highlight .s1 { color: #4e9a06 } /* Literal.String.Single */
155
+ .highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */
156
+ .highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
157
+ .highlight .vc { color: $base-code-text-color } /* Name.Variable.Class */
158
+ .highlight .vg { color: $base-code-text-color } /* Name.Variable.Global */
159
+ .highlight .vi { color: $base-code-text-color } /* Name.Variable.Instance */
160
+ .highlight .il { color: #0000cf; font-weight: 500 } /* Literal.Number.Integer.Long */
161
+
162
+ .language-liquid {
163
+ .highlight .p {
164
+ color: #8d8400;
165
+ }
166
+ .highlight .nv {
167
+ color: #204a87;
168
+ }
169
+ }
data/docs/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "bridgetown-primer-demo",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "build": "bundle exec bridgetown build",
7
+ "serve": "bundle exec bridgetown serve",
8
+ "clean": "bundle exec bridgetown clean",
9
+ "webpack-build": "webpack --mode production",
10
+ "webpack-dev": "webpack --mode development -w",
11
+ "deploy": "yarn clean && yarn webpack-build && yarn build",
12
+ "sync": "node sync.js",
13
+ "start": "node start.js"
14
+ },
15
+ "devDependencies": {
16
+ "@babel/core": "^7.9.0",
17
+ "@babel/plugin-proposal-class-properties": "^7.8.3",
18
+ "@babel/plugin-proposal-decorators": "^7.10.1",
19
+ "@babel/plugin-transform-runtime": "^7.9.0",
20
+ "@babel/preset-env": "^7.9.0",
21
+ "babel-loader": "^8.1.0",
22
+ "browser-sync": "^2.26.7",
23
+ "concurrently": "^5.2.0",
24
+ "css-loader": "^3.4.2",
25
+ "file-loader": "^6.0.0",
26
+ "mini-css-extract-plugin": "^0.9.0",
27
+ "node-sass": "^4.13.1",
28
+ "sass-loader": "^8.0.2",
29
+ "style-loader": "^1.1.3",
30
+ "webpack": "^4.42.1",
31
+ "webpack-cli": "^3.3.11",
32
+ "webpack-manifest-plugin": "^2.2.0"
33
+ }
34
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ class SiteBuilder < Bridgetown::Builder
2
+ # write builders which subclass SiteBuilder in plugins/builder
3
+ end
data/docs/src/404.html ADDED
@@ -0,0 +1,9 @@
1
+ ---
2
+ permalink: /404.html
3
+ layout: default
4
+ ---
5
+
6
+ <h1>404</h1>
7
+
8
+ <p><strong>Page not found :(</strong></p>
9
+ <p>The requested page could not be found.</p>