fortitude 0.9.1-java → 0.9.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +28 -22
- data/CHANGES.md +50 -0
- data/CONTRIBUTORS.md +1 -0
- data/doc/.gitignore +18 -0
- data/doc/Gemfile +21 -0
- data/doc/config.rb +92 -0
- data/doc/source/images/background.png +0 -0
- data/doc/source/images/middleman.png +0 -0
- data/doc/source/images/why/icon_button.png +0 -0
- data/doc/source/images/why/icon_button@2x.png +0 -0
- data/doc/source/images/why/modal_dialog@2x.png +0 -0
- data/doc/source/index.html.pcss +96 -0
- data/doc/source/index.html.rb +66 -0
- data/doc/source/javascripts/all.js +1 -0
- data/doc/source/javascripts/highlight.pack.js +1 -0
- data/doc/source/layouts/layout.rb +55 -0
- data/doc/source/portable/fortitude-bootstrap.rb +53 -0
- data/doc/source/shared/base.pcss +62 -0
- data/doc/source/shared/base.rb +30 -0
- data/doc/source/shared/common.rb +55 -0
- data/doc/source/shared/standard_page.rb +40 -0
- data/doc/source/stylesheets/_shared_prefix.scss +25 -0
- data/doc/source/stylesheets/all.css.scss +7 -0
- data/doc/source/stylesheets/basics.css.scss +20 -0
- data/doc/source/stylesheets/bootstrap_importer.css.scss +1 -0
- data/doc/source/stylesheets/highlight/arta.css +140 -0
- data/doc/source/stylesheets/highlight/ascetic.css +52 -0
- data/doc/source/stylesheets/highlight/atelier-dune.dark.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-dune.light.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-forest.dark.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-forest.light.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-heath.dark.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-heath.light.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-lakeside.dark.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-lakeside.light.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-seaside.dark.css +95 -0
- data/doc/source/stylesheets/highlight/atelier-seaside.light.css +95 -0
- data/doc/source/stylesheets/highlight/brown_paper.css +104 -0
- data/doc/source/stylesheets/highlight/brown_papersq.png +0 -0
- data/doc/source/stylesheets/highlight/codepen-embed.css +108 -0
- data/doc/source/stylesheets/highlight/color-brewer.css +168 -0
- data/doc/source/stylesheets/highlight/dark.css +104 -0
- data/doc/source/stylesheets/highlight/default.css +152 -0
- data/doc/source/stylesheets/highlight/docco.css +135 -0
- data/doc/source/stylesheets/highlight/far.css +111 -0
- data/doc/source/stylesheets/highlight/foundation.css +136 -0
- data/doc/source/stylesheets/highlight/github.css +124 -0
- data/doc/source/stylesheets/highlight/googlecode.css +147 -0
- data/doc/source/stylesheets/highlight/hybrid.css +170 -0
- data/doc/source/stylesheets/highlight/idea.css +125 -0
- data/doc/source/stylesheets/highlight/ir_black.css +109 -0
- data/doc/source/stylesheets/highlight/kimbie.dark.css +96 -0
- data/doc/source/stylesheets/highlight/kimbie.light.css +96 -0
- data/doc/source/stylesheets/highlight/magula.css +121 -0
- data/doc/source/stylesheets/highlight/mono-blue.css +69 -0
- data/doc/source/stylesheets/highlight/monokai.css +127 -0
- data/doc/source/stylesheets/highlight/monokai_sublime.css +154 -0
- data/doc/source/stylesheets/highlight/obsidian.css +153 -0
- data/doc/source/stylesheets/highlight/paraiso.dark.css +95 -0
- data/doc/source/stylesheets/highlight/paraiso.light.css +95 -0
- data/doc/source/stylesheets/highlight/pojoaque.css +107 -0
- data/doc/source/stylesheets/highlight/pojoaque.jpg +0 -0
- data/doc/source/stylesheets/highlight/railscasts.css +187 -0
- data/doc/source/stylesheets/highlight/rainbow.css +108 -0
- data/doc/source/stylesheets/highlight/school_book.css +112 -0
- data/doc/source/stylesheets/highlight/school_book.png +0 -0
- data/doc/source/stylesheets/highlight/solarized_dark.css +108 -0
- data/doc/source/stylesheets/highlight/solarized_light.css +108 -0
- data/doc/source/stylesheets/highlight/sunburst.css +164 -0
- data/doc/source/stylesheets/highlight/tomorrow-night-blue.css +95 -0
- data/doc/source/stylesheets/highlight/tomorrow-night-bright.css +94 -0
- data/doc/source/stylesheets/highlight/tomorrow-night-eighties.css +94 -0
- data/doc/source/stylesheets/highlight/tomorrow-night.css +95 -0
- data/doc/source/stylesheets/highlight/tomorrow.css +92 -0
- data/doc/source/stylesheets/highlight/vs.css +93 -0
- data/doc/source/stylesheets/highlight/xcode.css +158 -0
- data/doc/source/stylesheets/highlight/zenburn.css +118 -0
- data/doc/source/why/a_larger_view.html.rb +774 -0
- data/doc/source/why/a_simple_helper.html.rb +332 -0
- data/doc/source/why/building_a_rich_modal_dialog.html.rb +156 -0
- data/doc/source/why/commonality_and_inheritance.html.rb +564 -0
- data/doc/source/why/example_list.rb +60 -0
- data/doc/source/why/example_page.rb +116 -0
- data/doc/source/why/index.html.rb +86 -0
- data/doc/source/why/other_benefits.html.rb +110 -0
- data/fortitude.gemspec +6 -1
- data/lib/fortitude/doctypes/html4_tags_strict.rb +1 -0
- data/lib/fortitude/doctypes/html5.rb +1 -0
- data/lib/fortitude/method_templates/tag_method_template.rb.smpl +27 -14
- data/lib/fortitude/rails/helpers.rb +2 -2
- data/lib/fortitude/rendering_context.rb +10 -1
- data/lib/fortitude/tags/tag.rb +3 -2
- data/lib/fortitude/tags/tag_support.rb +8 -3
- data/lib/fortitude/tilt/fortitude_template.rb +6 -2
- data/lib/fortitude/version.rb +1 -1
- data/lib/fortitude/widget.rb +2 -0
- data/lib/fortitude/widget/convenience.rb +30 -0
- data/lib/fortitude/widget/files.rb +22 -11
- data/lib/fortitude/widget/needs.rb +5 -3
- data/spec/helpers/system_helpers.rb +1 -0
- data/spec/rails/development_mode_system_spec.rb +0 -1
- data/spec/rails/rendering_system_spec.rb +20 -1
- data/spec/rails/templates/rendering_system_spec/app/controllers/rendering_system_spec_controller.rb +13 -0
- data/spec/rails/templates/rendering_system_spec/app/views/rendering_system_spec/render_hash_subclass.rb +18 -0
- data/spec/rails/templates/rendering_system_spec/lib/my_hash.rb +5 -0
- data/spec/system/convenience_methods_system_spec.rb +166 -0
- data/spec/system/formatting_system_spec.rb +25 -1
- data/spec/system/tag_rendering_system_spec.rb +73 -0
- data/spec/system/tilt_system_spec.rb +31 -0
- data/spec/system/widget_class_from_spec.rb +20 -4
- metadata +91 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Views
|
|
2
|
+
module Why
|
|
3
|
+
module ExampleList
|
|
4
|
+
EXAMPLES = begin
|
|
5
|
+
out = [
|
|
6
|
+
{ :subpath => 'a_simple_helper', :title => 'A Simple Helper' },
|
|
7
|
+
{ :subpath => 'a_larger_view', :title => 'A Larger View' },
|
|
8
|
+
{ :subpath => 'commonality_and_inheritance', :title => 'Commonality and Inheritance' },
|
|
9
|
+
{ :subpath => 'building_a_rich_modal_dialog', :title => 'Building a Rich Modal Dialog' }
|
|
10
|
+
]
|
|
11
|
+
out.each_with_index do |hash, index|
|
|
12
|
+
hash[:number] = (index + 1)
|
|
13
|
+
hash[:path] = "/why/#{hash[:subpath]}.html"
|
|
14
|
+
end
|
|
15
|
+
out
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def first_example
|
|
19
|
+
EXAMPLES[0]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def number_of_examples
|
|
23
|
+
EXAMPLES.length
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def this_example_number
|
|
27
|
+
this_example[:number] if this_example
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def example_by_number(number)
|
|
31
|
+
EXAMPLES.detect { |e| e[:number] == number }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def this_example
|
|
35
|
+
@this_example ||= begin
|
|
36
|
+
request_path = request[:path]
|
|
37
|
+
request_path = "/#{request_path}" unless request_path.start_with?("/")
|
|
38
|
+
|
|
39
|
+
out = EXAMPLES.detect { |e| e[:path] == request_path }
|
|
40
|
+
out || :none
|
|
41
|
+
end
|
|
42
|
+
@this_example unless @this_example == :none
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def example_title(example)
|
|
46
|
+
"Example #{example[:number]}. #{example[:title]}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def next_example
|
|
50
|
+
@next_example ||= begin
|
|
51
|
+
if this_example_number
|
|
52
|
+
example_by_number(this_example_number + 1)
|
|
53
|
+
else
|
|
54
|
+
first_example
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
require 'source/shared/standard_page'
|
|
2
|
+
require 'source/why/example_list'
|
|
3
|
+
|
|
4
|
+
module Views
|
|
5
|
+
module Why
|
|
6
|
+
class ExamplePage < Views::Shared::StandardPage
|
|
7
|
+
include Views::Why::ExampleList
|
|
8
|
+
|
|
9
|
+
css %{
|
|
10
|
+
.example_link {
|
|
11
|
+
font-family: $heading-font;
|
|
12
|
+
|
|
13
|
+
.next {
|
|
14
|
+
font-weight: $heading-font-light-weight;
|
|
15
|
+
font-size: 18px;
|
|
16
|
+
margin-right: 10px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
a {
|
|
20
|
+
font-weight: $heading-font-heavy-weight;
|
|
21
|
+
font-size: 20px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
padding: 20px;
|
|
25
|
+
margin-left: auto;
|
|
26
|
+
margin-right: 0;
|
|
27
|
+
margin-top: 40px;
|
|
28
|
+
margin-bottom: 40px;
|
|
29
|
+
|
|
30
|
+
background-color: $bold-translucent;
|
|
31
|
+
|
|
32
|
+
text-align: right;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h4 { margin-top: 25px; }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
def page_content
|
|
39
|
+
big_title "Why use Fortitude?"
|
|
40
|
+
example_body
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def example_body
|
|
44
|
+
standard_text_row {
|
|
45
|
+
show_example_title
|
|
46
|
+
example_intro
|
|
47
|
+
|
|
48
|
+
section {
|
|
49
|
+
h4 "What We’re Trying To Do"
|
|
50
|
+
example_description
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
section {
|
|
54
|
+
h4 "Using Standard Templating Engines"
|
|
55
|
+
using_standard_engines
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
section {
|
|
59
|
+
h4 "Issues with Standard Templating Engines"
|
|
60
|
+
standard_engine_issues
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
section {
|
|
64
|
+
h4 "Using Fortitude"
|
|
65
|
+
using_fortitude
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
section {
|
|
69
|
+
h4 "The Benefits"
|
|
70
|
+
fortitude_benefits
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
link_to_next_example if next_example
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def show_example_title
|
|
78
|
+
h3 example_title(this_example)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def example_intro
|
|
82
|
+
raise "Must override in #{self.class.name}"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def example_description
|
|
86
|
+
raise "Must override in #{self.class.name}"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def using_standard_engines
|
|
90
|
+
raise "Must override in #{self.class.name}"
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def standard_engine_issues
|
|
94
|
+
raise "Must override in #{self.class.name}"
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def using_fortitude
|
|
98
|
+
raise "Must override in #{self.class.name}"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def fortitude_benefits
|
|
102
|
+
raise "Must override in #{self.class.name}"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def link_to_next_example
|
|
106
|
+
e = next_example
|
|
107
|
+
div(:class => 'example_link') {
|
|
108
|
+
span "next", :class => 'next'
|
|
109
|
+
a(:href => e[:path]) {
|
|
110
|
+
text example_title(e)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'source/why/example_page'
|
|
2
|
+
|
|
3
|
+
module Views
|
|
4
|
+
module Why
|
|
5
|
+
class Index < Views::Why::ExamplePage
|
|
6
|
+
def example_body
|
|
7
|
+
standard_text_row {
|
|
8
|
+
bang_intro
|
|
9
|
+
examples_setup
|
|
10
|
+
|
|
11
|
+
link_to_next_example
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def bang_intro
|
|
16
|
+
p %{There is exactly one overwhelming reason to use Fortitude:}
|
|
17
|
+
|
|
18
|
+
emphatic_pullquote %{It allows you to write vastly better-factored views.}
|
|
19
|
+
|
|
20
|
+
p %{With Fortitude, you can turn this:}
|
|
21
|
+
|
|
22
|
+
erb <<-EOS
|
|
23
|
+
<div class="container main outermost" id="main-container">
|
|
24
|
+
<div class="row primary">
|
|
25
|
+
<div class="col-sm-7">
|
|
26
|
+
<figure class="source">
|
|
27
|
+
<figcaption>example_code_1.rb</figcaption>
|
|
28
|
+
<pre class="ruby">
|
|
29
|
+
[ 1, 2, 3 ].map { |x| x * 2 } # => [ 2, 4, 6 ]
|
|
30
|
+
</pre>
|
|
31
|
+
</figure>
|
|
32
|
+
|
|
33
|
+
<%= render :partial => '/shared/buttons/icon_button', :locals => {
|
|
34
|
+
:target => conditional_refresh_url(:user => @user),
|
|
35
|
+
:icon_name => 'refresh',
|
|
36
|
+
:tooltip_html => "<p>Refresh this page</p>"
|
|
37
|
+
} %>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
EOS
|
|
42
|
+
|
|
43
|
+
p %{Into this:}
|
|
44
|
+
|
|
45
|
+
fortitude <<-EOS
|
|
46
|
+
simple_page {
|
|
47
|
+
ruby "example_code_1.rb", "[ 1, 2, 3 ].map { |x| x * 2 } # => [ 2, 4, 6 ]"
|
|
48
|
+
|
|
49
|
+
icon_button(:refresh, conditional_refresh_url(:user => @user)) {
|
|
50
|
+
p "Refresh this page"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
EOS
|
|
54
|
+
|
|
55
|
+
p {
|
|
56
|
+
text %{…and that’s just the beginning. With Fortitude, you can }
|
|
57
|
+
strong "refactor your views into the methods that are right for your application"
|
|
58
|
+
text ". This means:"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ul {
|
|
62
|
+
li "You’ll be able to enhance, modify, and debug views much faster."
|
|
63
|
+
li %{You’ll build new views faster — and this pace will accelerate as
|
|
64
|
+
your codebase grows, not decelerate.}
|
|
65
|
+
li "You’ll have fewer bugs in your views, and spend less time debugging them."
|
|
66
|
+
li {
|
|
67
|
+
text "You’ll "
|
|
68
|
+
em "enjoy"
|
|
69
|
+
text " building views much more."
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def examples_setup
|
|
75
|
+
p %{Fortitude expresses your views using a Ruby DSL that models HTML;
|
|
76
|
+
this allows you to bring all the power of Ruby to bear on your views.
|
|
77
|
+
The difference this makes in the long run is enormous.}
|
|
78
|
+
|
|
79
|
+
p %{It’s easiest to explain by example.
|
|
80
|
+
Follow the link below, and you’ll see #{number_of_examples.humanize}
|
|
81
|
+
examples of using Fortitude to refactor common view problems into clear, concise,
|
|
82
|
+
powerful code.}
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
module Views
|
|
2
|
+
module Why
|
|
3
|
+
class OtherBenefits < Views::Shared::Base
|
|
4
|
+
def content
|
|
5
|
+
container {
|
|
6
|
+
jumbotron {
|
|
7
|
+
h2 "Other Benefits of Fortitude"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
row {
|
|
11
|
+
columns(:small => 3) { }
|
|
12
|
+
columns(:small => 7) {
|
|
13
|
+
p {
|
|
14
|
+
text %{Next to }
|
|
15
|
+
a("the power Fortitude gives you to factor your views", :href => '/why')
|
|
16
|
+
text %{, its other
|
|
17
|
+
benefits pale by comparison. It’s not that these advantages are even all that small,
|
|
18
|
+
it’s that being able to factor your views well is so important that it’s by far the biggest
|
|
19
|
+
reason to use Fortitude. Even so, it’s worth listing these other benefits of Fortitude:}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
ul {
|
|
23
|
+
li {
|
|
24
|
+
strong "Speed"
|
|
25
|
+
text %{: Fortitude is currently the fastest general-purpose templating engine
|
|
26
|
+
for Ruby — 20-40% faster than ERb, 4-5x faster than HAML, and 30-40x faster than Erector.}
|
|
27
|
+
}
|
|
28
|
+
li {
|
|
29
|
+
strong "Syntax"
|
|
30
|
+
text %{: Fortitude makes it impossible to make an HTML syntax error, like
|
|
31
|
+
forgetting to close a tag or mismatching tags. If your view parses as Ruby, you’re guaranteed
|
|
32
|
+
to produce syntactically-valid HTML.}
|
|
33
|
+
}
|
|
34
|
+
li {
|
|
35
|
+
strong "Semantics"
|
|
36
|
+
text %{: Fortitude can automatically enforce many of the rules
|
|
37
|
+
of HTML, like which elements can nest within which others (}
|
|
38
|
+
em "e.g."
|
|
39
|
+
text %{, you can’t put a }
|
|
40
|
+
code "<div>"
|
|
41
|
+
text " inside a "
|
|
42
|
+
code "<p>"
|
|
43
|
+
text "), which attributes an element can have (for example, "
|
|
44
|
+
code "<video>"
|
|
45
|
+
text " can have "
|
|
46
|
+
code "width"
|
|
47
|
+
text " and "
|
|
48
|
+
code "height"
|
|
49
|
+
text " attributes, but "
|
|
50
|
+
code "<audio>"
|
|
51
|
+
text " cannot), and — perhaps most usefully — that no two elements on a page can "
|
|
52
|
+
text "have the same "
|
|
53
|
+
code "id"
|
|
54
|
+
text %{. And when you make a mistake, you get an extremely clear error message, even
|
|
55
|
+
referring you to the proper part of the HTML specification to check what went wrong.}
|
|
56
|
+
}
|
|
57
|
+
li {
|
|
58
|
+
strong "Formatting"
|
|
59
|
+
text %{: Fortitude can produce beautifully-formatted, perfectly-indented HTML — even across
|
|
60
|
+
view boundaries. Conversely, in production, it automatically produces highly-compressed HTML
|
|
61
|
+
to minimize page weight.}
|
|
62
|
+
}
|
|
63
|
+
li {
|
|
64
|
+
strong "Traceability"
|
|
65
|
+
text %{: When working with a large codebase, it can be very frustrating trying to track
|
|
66
|
+
down which partial is responsible for generating a particular piece of content. In development,
|
|
67
|
+
Fortitude emits HTML comments above and below every partial, telling you exactly what's
|
|
68
|
+
being rendered and with what variable assignments — making it a piece of cake to figure
|
|
69
|
+
out which file you need to edit to change something.}
|
|
70
|
+
}
|
|
71
|
+
li {
|
|
72
|
+
strong "Interoperability"
|
|
73
|
+
text %{: Fortitude interoperates perfectly with your existing templating engine(s)
|
|
74
|
+
(like ERb or HAML) and views. You can start using it on new views, or convert existing views
|
|
75
|
+
at any pace you like. There’s even a tool, }
|
|
76
|
+
a(:href => "https://github.com/ageweke/html2fortitude") {
|
|
77
|
+
code "html2fortitude"
|
|
78
|
+
}
|
|
79
|
+
text ", that automatically converts ERb views to Fortitue."
|
|
80
|
+
}
|
|
81
|
+
li {
|
|
82
|
+
strong "Compatibility"
|
|
83
|
+
text %{: Fortitude is compatible with Ruby 1.8.7–2.2.}
|
|
84
|
+
em "x"
|
|
85
|
+
text %{, including JRuby, and all versions of Rails from 3.0.}
|
|
86
|
+
em "x"
|
|
87
|
+
text %{ through 4.2.}
|
|
88
|
+
em "x"
|
|
89
|
+
text %{. It also is fully compatible with the wonderful }
|
|
90
|
+
a("Tilt", :href => "https://github.com/rtomayko/tilt")
|
|
91
|
+
text %{ meta-templating framework, so any tool that uses Tilt can use Fortitude.
|
|
92
|
+
(For example, the documentation you’re reading right now was built using }
|
|
93
|
+
a("Middleman", :href => "http://middlemanapp.com/")
|
|
94
|
+
text ", using Fortitude as the templating engine.)"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
p {
|
|
99
|
+
text %{Still not convinced? }
|
|
100
|
+
a("Read more about how powerful it can be to factor your views well", :href => '/why')
|
|
101
|
+
text "."
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
columns(:small => 2) { }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
data/fortitude.gemspec
CHANGED
|
@@ -39,5 +39,10 @@ Gem::Specification.new do |s|
|
|
|
39
39
|
s.add_development_dependency "rake-compiler"
|
|
40
40
|
s.add_development_dependency "json"
|
|
41
41
|
s.add_development_dependency "tilt", "~> 2.0"
|
|
42
|
-
s.add_development_dependency "oop_rails_server", ">= 0.0.
|
|
42
|
+
s.add_development_dependency "oop_rails_server", ">= 0.0.7"
|
|
43
|
+
|
|
44
|
+
# This is because i18n >= 0.7 is incompatible with Ruby 1.8.x.
|
|
45
|
+
if RUBY_VERSION =~ /^1\.8\./
|
|
46
|
+
s.add_development_dependency "i18n", "~> 0.6.0", "< 0.7.0"
|
|
47
|
+
end
|
|
43
48
|
end
|
|
@@ -107,6 +107,7 @@ module Fortitude
|
|
|
107
107
|
:spec => 'http://www.w3.org/TR/html401/struct/text.html#h-9.3.2.1'
|
|
108
108
|
tag :pre, :newline_before => true, :valid_attributes => ATTRS_ATTRIBUTES,
|
|
109
109
|
:can_enclose => INLINE_CONTENT - %w{img object big small sub sup},
|
|
110
|
+
:suppress_formatting_inside => true,
|
|
110
111
|
:spec => 'http://www.w3.org/TR/html401/struct/text.html#h-9.3.4'
|
|
111
112
|
tag :ins, :valid_attributes => ATTRS_ATTRIBUTES + %w{cite datetime}, :can_enclose => FLOW_CONTENT,
|
|
112
113
|
:spec => 'http://www.w3.org/TR/html401/struct/text.html#h-9.4'
|
|
@@ -152,6 +152,7 @@ module Fortitude
|
|
|
152
152
|
html5_tag :hr, :newline_before => true, :content_allowed => false,
|
|
153
153
|
:spec => 'http://www.w3.org/TR/html5/grouping-content.html#the-hr-element'
|
|
154
154
|
html5_tag :pre, :newline_before => true, :can_enclose => PHRASING_CONTENT,
|
|
155
|
+
:suppress_formatting_inside => true,
|
|
155
156
|
:spec => 'http://www.w3.org/TR/html5/grouping-content.html#the-pre-element'
|
|
156
157
|
html5_tag :blockquote, :newline_before => true, :can_enclose => FLOW_CONTENT, :valid_attributes => %w{cite},
|
|
157
158
|
:spec => 'http://www.w3.org/TR/html5/grouping-content.html#the-blockquote-element'
|
|
@@ -17,9 +17,12 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
|
|
|
17
17
|
if block_given?
|
|
18
18
|
_fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
|
|
19
19
|
o.#{concat_method}(#{open_const})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
begin
|
|
21
|
+
#{yield_call}
|
|
22
|
+
o = @_fortitude_output_buffer_holder.output_buffer
|
|
23
|
+
ensure
|
|
24
|
+
o.#{concat_method}(#{close_const})
|
|
25
|
+
end
|
|
23
26
|
else
|
|
24
27
|
o.#{concat_method}(#{alone_const})
|
|
25
28
|
end
|
|
@@ -37,9 +40,12 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
|
|
|
37
40
|
if block_given?
|
|
38
41
|
_fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
|
|
39
42
|
o.#{concat_method}(#{partial_open_end_const})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
begin
|
|
44
|
+
#{yield_call}
|
|
45
|
+
ensure
|
|
46
|
+
o = @_fortitude_output_buffer_holder.output_buffer
|
|
47
|
+
o.#{concat_method}(#{close_const})
|
|
48
|
+
end
|
|
43
49
|
else
|
|
44
50
|
o.#{concat_method}(#{partial_open_alone_end_const})
|
|
45
51
|
end
|
|
@@ -49,12 +55,16 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
|
|
|
49
55
|
rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get('@html_safe') # :if record_emitting_tag
|
|
50
56
|
content_or_attributes.to_s.fortitude_append_escaped_string(o) # :if escape_direct_content
|
|
51
57
|
o.#{concat_method}(content_or_attributes.to_s) # :if ! escape_direct_content
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
|
|
59
|
+
begin
|
|
60
|
+
if block_given?
|
|
61
|
+
_fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
|
|
62
|
+
#{yield_call}
|
|
63
|
+
end
|
|
64
|
+
ensure
|
|
55
65
|
o = @_fortitude_output_buffer_holder.output_buffer
|
|
66
|
+
o.#{concat_method}(#{close_const})
|
|
56
67
|
end
|
|
57
|
-
o.#{concat_method}(#{close_const})
|
|
58
68
|
else
|
|
59
69
|
_fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
|
|
60
70
|
this_tag.validate_attributes(self, attributes) # :if needs_attribute_rules
|
|
@@ -66,12 +76,15 @@ def #{method_name}(content_or_attributes = nil, attributes = nil)
|
|
|
66
76
|
rc.emitting_tag!(self, FORTITUDE_TEXT_PSEUDOTAG, content_or_attributes, nil) { } unless content_or_attributes.instance_variable_get('@html_safe') # :if record_emitting_tag
|
|
67
77
|
content_or_attributes.to_s.fortitude_append_escaped_string(o) # :if escape_direct_content
|
|
68
78
|
o.#{concat_method}(content_or_attributes.to_s) # :if ! escape_direct_content
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
begin
|
|
80
|
+
if block_given?
|
|
81
|
+
_fortitude_raise_no_content_allowed_error(#{tag_object_const}) # :if ! content_allowed
|
|
82
|
+
#{yield_call}
|
|
83
|
+
end
|
|
84
|
+
ensure
|
|
72
85
|
o = @_fortitude_output_buffer_holder.output_buffer
|
|
86
|
+
o.#{concat_method}(#{close_const})
|
|
73
87
|
end
|
|
74
|
-
o.#{concat_method}(#{close_const})
|
|
75
88
|
end
|
|
76
89
|
rc.needs_newline! if format_output # :if needs_formatting && newline_before
|
|
77
90
|
end # :if record_emitting_tag
|