ezml 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +149 -0
- data/LICENSE.txt +21 -0
- data/README.md +140 -0
- data/Rakefile +6 -0
- data/bin/ezml +9 -0
- data/examples/helloworld.ezml +44 -0
- data/examples/helloworld.html +61 -0
- data/examples/template.ezml +69 -0
- data/examples/template.html +102 -0
- data/ezml.gemspec +40 -0
- data/lib/ezml.rb +8 -0
- data/lib/ezml/attribute_builder.rb +141 -0
- data/lib/ezml/attribute_compiler.rb +172 -0
- data/lib/ezml/attribute_parser.rb +133 -0
- data/lib/ezml/buffer.rb +166 -0
- data/lib/ezml/compiler.rb +322 -0
- data/lib/ezml/engine.rb +107 -0
- data/lib/ezml/error.rb +59 -0
- data/lib/ezml/escapable.rb +46 -0
- data/lib/ezml/exec.rb +348 -0
- data/lib/ezml/filters.rb +249 -0
- data/lib/ezml/generator.rb +38 -0
- data/lib/ezml/helpers.rb +299 -0
- data/lib/ezml/options.rb +142 -0
- data/lib/ezml/parser.rb +826 -0
- data/lib/ezml/template_engine.rb +106 -0
- data/lib/ezml/temple_line_counter.rb +26 -0
- data/lib/ezml/util.rb +156 -0
- data/lib/ezml/version.rb +3 -0
- metadata +199 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c47f830a1717a3507e500f735e5d38fc6aaeb0d5ca13190297c1ceb1e743647
|
4
|
+
data.tar.gz: 8be6041c6a2fee36075b0d6057eeb1d7b693064ee65c418f176027b1ac86a074
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c9c3ce07de865c25b1c32d4224eb975571ae87e99cb14f72e000d89910b0047c7b7b3a32c9b547c7dcac6d7ba4b2be2724d6219ccf3106598969fddf987e620d
|
7
|
+
data.tar.gz: 55088204e9e2883a6ad1238927bf3c54d3d472b1af3cf966e65871ab8d67297f9303f3d5d22b41c11ea4fe9d12708fea1fb005ae40ce5587a5e5ba0c9061f974
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at stormburpee@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
EZML (0.1.0)
|
5
|
+
temple (>= 0.8.0)
|
6
|
+
tilt
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (5.2.0)
|
12
|
+
actionpack (= 5.2.0)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailer (5.2.0)
|
16
|
+
actionpack (= 5.2.0)
|
17
|
+
actionview (= 5.2.0)
|
18
|
+
activejob (= 5.2.0)
|
19
|
+
mail (~> 2.5, >= 2.5.4)
|
20
|
+
rails-dom-testing (~> 2.0)
|
21
|
+
actionpack (5.2.0)
|
22
|
+
actionview (= 5.2.0)
|
23
|
+
activesupport (= 5.2.0)
|
24
|
+
rack (~> 2.0)
|
25
|
+
rack-test (>= 0.6.3)
|
26
|
+
rails-dom-testing (~> 2.0)
|
27
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
+
actionview (5.2.0)
|
29
|
+
activesupport (= 5.2.0)
|
30
|
+
builder (~> 3.1)
|
31
|
+
erubi (~> 1.4)
|
32
|
+
rails-dom-testing (~> 2.0)
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
+
activejob (5.2.0)
|
35
|
+
activesupport (= 5.2.0)
|
36
|
+
globalid (>= 0.3.6)
|
37
|
+
activemodel (5.2.0)
|
38
|
+
activesupport (= 5.2.0)
|
39
|
+
activerecord (5.2.0)
|
40
|
+
activemodel (= 5.2.0)
|
41
|
+
activesupport (= 5.2.0)
|
42
|
+
arel (>= 9.0)
|
43
|
+
activestorage (5.2.0)
|
44
|
+
actionpack (= 5.2.0)
|
45
|
+
activerecord (= 5.2.0)
|
46
|
+
marcel (~> 0.3.1)
|
47
|
+
activesupport (5.2.0)
|
48
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
|
+
i18n (>= 0.7, < 2)
|
50
|
+
minitest (~> 5.1)
|
51
|
+
tzinfo (~> 1.1)
|
52
|
+
arel (9.0.0)
|
53
|
+
builder (3.2.3)
|
54
|
+
concurrent-ruby (1.0.5)
|
55
|
+
crass (1.0.4)
|
56
|
+
diff-lcs (1.3)
|
57
|
+
erubi (1.7.1)
|
58
|
+
globalid (0.4.1)
|
59
|
+
activesupport (>= 4.2.0)
|
60
|
+
i18n (1.0.1)
|
61
|
+
concurrent-ruby (~> 1.0)
|
62
|
+
loofah (2.2.2)
|
63
|
+
crass (~> 1.0.2)
|
64
|
+
nokogiri (>= 1.5.9)
|
65
|
+
mail (2.7.0)
|
66
|
+
mini_mime (>= 0.1.1)
|
67
|
+
marcel (0.3.2)
|
68
|
+
mimemagic (~> 0.3.2)
|
69
|
+
method_source (0.9.0)
|
70
|
+
mimemagic (0.3.2)
|
71
|
+
mini_mime (1.0.0)
|
72
|
+
mini_portile2 (2.3.0)
|
73
|
+
minitest (5.11.3)
|
74
|
+
nio4r (2.3.1)
|
75
|
+
nokogiri (1.8.4)
|
76
|
+
mini_portile2 (~> 2.3.0)
|
77
|
+
rack (2.0.5)
|
78
|
+
rack-test (1.1.0)
|
79
|
+
rack (>= 1.0, < 3)
|
80
|
+
rails (5.2.0)
|
81
|
+
actioncable (= 5.2.0)
|
82
|
+
actionmailer (= 5.2.0)
|
83
|
+
actionpack (= 5.2.0)
|
84
|
+
actionview (= 5.2.0)
|
85
|
+
activejob (= 5.2.0)
|
86
|
+
activemodel (= 5.2.0)
|
87
|
+
activerecord (= 5.2.0)
|
88
|
+
activestorage (= 5.2.0)
|
89
|
+
activesupport (= 5.2.0)
|
90
|
+
bundler (>= 1.3.0)
|
91
|
+
railties (= 5.2.0)
|
92
|
+
sprockets-rails (>= 2.0.0)
|
93
|
+
rails-dom-testing (2.0.3)
|
94
|
+
activesupport (>= 4.2.0)
|
95
|
+
nokogiri (>= 1.6)
|
96
|
+
rails-html-sanitizer (1.0.4)
|
97
|
+
loofah (~> 2.2, >= 2.2.2)
|
98
|
+
railties (5.2.0)
|
99
|
+
actionpack (= 5.2.0)
|
100
|
+
activesupport (= 5.2.0)
|
101
|
+
method_source
|
102
|
+
rake (>= 0.8.7)
|
103
|
+
thor (>= 0.18.1, < 2.0)
|
104
|
+
rake (10.5.0)
|
105
|
+
rbench (0.2.3)
|
106
|
+
rspec (3.7.0)
|
107
|
+
rspec-core (~> 3.7.0)
|
108
|
+
rspec-expectations (~> 3.7.0)
|
109
|
+
rspec-mocks (~> 3.7.0)
|
110
|
+
rspec-core (3.7.1)
|
111
|
+
rspec-support (~> 3.7.0)
|
112
|
+
rspec-expectations (3.7.0)
|
113
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
114
|
+
rspec-support (~> 3.7.0)
|
115
|
+
rspec-mocks (3.7.0)
|
116
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
117
|
+
rspec-support (~> 3.7.0)
|
118
|
+
rspec-support (3.7.1)
|
119
|
+
sprockets (3.7.2)
|
120
|
+
concurrent-ruby (~> 1.0)
|
121
|
+
rack (> 1, < 3)
|
122
|
+
sprockets-rails (3.2.1)
|
123
|
+
actionpack (>= 4.0)
|
124
|
+
activesupport (>= 4.0)
|
125
|
+
sprockets (>= 3.0.0)
|
126
|
+
temple (0.8.0)
|
127
|
+
thor (0.20.0)
|
128
|
+
thread_safe (0.3.6)
|
129
|
+
tilt (2.0.8)
|
130
|
+
tzinfo (1.2.5)
|
131
|
+
thread_safe (~> 0.1)
|
132
|
+
websocket-driver (0.7.0)
|
133
|
+
websocket-extensions (>= 0.1.0)
|
134
|
+
websocket-extensions (0.1.3)
|
135
|
+
|
136
|
+
PLATFORMS
|
137
|
+
ruby
|
138
|
+
|
139
|
+
DEPENDENCIES
|
140
|
+
EZML!
|
141
|
+
bundler (~> 1.16)
|
142
|
+
nokogiri
|
143
|
+
rails (>= 4.0.0)
|
144
|
+
rake (~> 10.0)
|
145
|
+
rbench
|
146
|
+
rspec (~> 3.0)
|
147
|
+
|
148
|
+
BUNDLED WITH
|
149
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Storm Burpee
|
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
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# EZML
|
2
|
+
|
3
|
+
EZML is a templating engine for HTML. It's designed to make it both easier and
|
4
|
+
more pleasant to write HTML documents, by eliminating redundancy, reflecting the
|
5
|
+
underlying structure that the document represents, and providing an elegant syntax
|
6
|
+
that's both powerful and easy to understand.
|
7
|
+
|
8
|
+
## Basic Usage
|
9
|
+
|
10
|
+
EZML is used from the command line to compile .ezml documents to .html
|
11
|
+
To install, ensure you have ruby installed and run
|
12
|
+
```sh
|
13
|
+
gem install ezml
|
14
|
+
```
|
15
|
+
|
16
|
+
After you write some EZML, you can run
|
17
|
+
```sh
|
18
|
+
ezml document.ezml
|
19
|
+
```
|
20
|
+
|
21
|
+
This will compile it to HTML, to specifiy an output do the following
|
22
|
+
```sh
|
23
|
+
ezml document.ezml document.html
|
24
|
+
```
|
25
|
+
|
26
|
+
For more information on the commands use the folowing
|
27
|
+
```sh
|
28
|
+
ezml --help
|
29
|
+
```
|
30
|
+
|
31
|
+
## Formatting
|
32
|
+
|
33
|
+
The most basic element of EZML is a shorthand for creating HTML:
|
34
|
+
|
35
|
+
~~~haml
|
36
|
+
%tagname{:attr1 => 'value1', :attr2 => 'value2'} Contents
|
37
|
+
~~~
|
38
|
+
|
39
|
+
No end-tag is needed; EZML handles that automatically. If you prefer HTML-style
|
40
|
+
attributes, you can also use:
|
41
|
+
|
42
|
+
~~~haml
|
43
|
+
%tagname(attr1='value1' attr2='value2') Contents
|
44
|
+
~~~
|
45
|
+
|
46
|
+
Adding `class` and `id` attributes is even easier. EZML uses the same syntax as
|
47
|
+
the CSS that styles the document:
|
48
|
+
|
49
|
+
~~~haml
|
50
|
+
%tagname#id.class
|
51
|
+
~~~
|
52
|
+
|
53
|
+
In fact, when you're using the `<div>` tag, it becomes _even easier_. Because
|
54
|
+
`<div>` is such a common element, a tag without a name defaults to a div. So
|
55
|
+
|
56
|
+
~~~haml
|
57
|
+
#foo Hello!
|
58
|
+
~~~
|
59
|
+
|
60
|
+
becomes
|
61
|
+
|
62
|
+
~~~html
|
63
|
+
<div id='foo'>Hello!</div>
|
64
|
+
~~~
|
65
|
+
|
66
|
+
EZML uses indentation to bring the individual elements to represent the HTML
|
67
|
+
structure. A tag's children are indented beneath than the parent tag. Again, a
|
68
|
+
closing tag is automatically added. For example:
|
69
|
+
|
70
|
+
~~~haml
|
71
|
+
%ul
|
72
|
+
%li Salt
|
73
|
+
%li Pepper
|
74
|
+
~~~
|
75
|
+
|
76
|
+
becomes:
|
77
|
+
|
78
|
+
~~~html
|
79
|
+
<ul>
|
80
|
+
<li>Salt</li>
|
81
|
+
<li>Pepper</li>
|
82
|
+
</ul>
|
83
|
+
~~~
|
84
|
+
|
85
|
+
You can also put plain text as a child of an element:
|
86
|
+
|
87
|
+
~~~haml
|
88
|
+
%p
|
89
|
+
Hello,
|
90
|
+
World!
|
91
|
+
~~~
|
92
|
+
|
93
|
+
It's also possible to embed Ruby code into EZML documents. An equals sign, `=`,
|
94
|
+
will output the result of the code. A hyphen, `-`, will run the code but not
|
95
|
+
output the result. You can even use control statements like `if` and `while`:
|
96
|
+
|
97
|
+
~~~haml
|
98
|
+
%p
|
99
|
+
Date/Time:
|
100
|
+
- now = DateTime.now
|
101
|
+
%strong= now
|
102
|
+
- if now > DateTime.parse("December 31, 2006")
|
103
|
+
= "Happy new " + "year!"
|
104
|
+
~~~
|
105
|
+
|
106
|
+
### Indentation
|
107
|
+
|
108
|
+
EZML's indentation can be made up of one or more tabs or spaces. However,
|
109
|
+
indentation must be consistent within a given document. Hard tabs and spaces
|
110
|
+
can't be mixed, and the same number of tabs or spaces must be used throughout.
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
# Initial README.md for reference
|
115
|
+
|
116
|
+
## Installation
|
117
|
+
|
118
|
+
Add this line to your application's Gemfile:
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
gem 'ezml'
|
122
|
+
```
|
123
|
+
|
124
|
+
And then execute:
|
125
|
+
|
126
|
+
$ bundle
|
127
|
+
|
128
|
+
Or install it yourself as:
|
129
|
+
|
130
|
+
$ gem install ezml
|
131
|
+
|
132
|
+
## Usage
|
133
|
+
|
134
|
+
TODO: Write usage instructions here
|
135
|
+
|
136
|
+
## Development
|
137
|
+
|
138
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
139
|
+
|
140
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Rakefile
ADDED