glyph 0.5.2 → 0.5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS.textile +1 -0
  3. data/CHANGELOG.textile +104 -59
  4. data/Gemfile.lock +46 -0
  5. data/LICENSE.textile +1 -1
  6. data/README.textile +106 -120
  7. data/book/lib/layouts/bookindex.glyph +6 -106
  8. data/book/lib/layouts/bookpage.glyph +8 -108
  9. data/book/lib/layouts/project.glyph +0 -1
  10. data/book/text/acknowledgements.glyph +1 -0
  11. data/book/text/changelog.glyph +7 -1
  12. data/glyph.gemspec +10 -10
  13. data/lib/glyph.rb +1 -1
  14. data/spec/files/test.scss +1 -1
  15. data/spec/lib/analyzer_spec.rb +60 -61
  16. data/spec/lib/bookmark_spec.rb +21 -21
  17. data/spec/lib/commands_spec.rb +53 -54
  18. data/spec/lib/config_spec.rb +16 -16
  19. data/spec/lib/document_spec.rb +35 -35
  20. data/spec/lib/glyph_spec.rb +32 -32
  21. data/spec/lib/interpreter_spec.rb +8 -8
  22. data/spec/lib/macro_spec.rb +51 -49
  23. data/spec/lib/macro_validators_spec.rb +14 -14
  24. data/spec/lib/node_spec.rb +25 -25
  25. data/spec/lib/parser_spec.rb +26 -26
  26. data/spec/lib/reporter_spec.rb +32 -32
  27. data/spec/lib/syntax_node_spec.rb +33 -33
  28. data/spec/macros/core_spec.rb +95 -95
  29. data/spec/macros/filters_spec.rb +9 -8
  30. data/spec/macros/html5_spec.rb +17 -17
  31. data/spec/macros/macros_spec.rb +33 -33
  32. data/spec/macros/textile_spec.rb +15 -15
  33. data/spec/macros/web5_spec.rb +3 -3
  34. data/spec/macros/web_spec.rb +19 -19
  35. data/spec/macros/xml_spec.rb +15 -15
  36. data/spec/tasks/generate_spec.rb +34 -34
  37. data/spec/tasks/load_spec.rb +15 -15
  38. data/spec/tasks/project_spec.rb +15 -15
  39. data/styles/coderay.css +2 -0
  40. data/styles/coderay.css.map +7 -0
  41. data/styles/default.css +9 -7
  42. data/styles/default.css.map +7 -0
  43. data/styles/pagination.css +18 -23
  44. data/styles/pagination.css.map +7 -0
  45. data/tasks/generate.rake +12 -5
  46. metadata +47 -68
  47. data/glyph-0.5.1.gem +0 -0
@@ -16,73 +16,73 @@ describe "Macro:" do
16
16
  it "snippet" do
17
17
  define_em_macro
18
18
  interpret "&:[test|This is a \nTest snippet]Testing a snippet: &[test]."
19
- @p.document.output.should == "Testing a snippet: This is a \nTest snippet."
19
+ expect(@p.document.output).to eq("Testing a snippet: This is a \nTest snippet.")
20
20
  interpret("Testing &[wrong].")
21
- @p.document.output.should == "Testing [SNIPPET 'wrong' NOT PROCESSED]."
21
+ expect(@p.document.output).to eq("Testing [SNIPPET 'wrong' NOT PROCESSED].")
22
22
  text = "&:[b|and another em[test]]&:[a|this is a em[test] &[b]]TEST: &[a]"
23
23
  interpret text
24
- @p.document.output.should == "TEST: this is a <em>test</em> and another <em>test</em>"
24
+ expect(@p.document.output).to eq("TEST: this is a <em>test</em> and another <em>test</em>")
25
25
  # Check snippets with links
26
26
  text = "&:[c|This is a link to something afterwards: =>[#other]]Test. &[c]. #[other|Test]."
27
- output_for(text).should == %{Test. This is a link to something afterwards: <a href="#other">Test</a>. <a id="other">Test</a>.}
27
+ expect(output_for(text)).to eq(%{Test. This is a link to something afterwards: <a href="#other">Test</a>. <a id="other">Test</a>.})
28
28
  end
29
29
 
30
30
  it "snippet:" do
31
31
  interpret("&[t1] - &:[t1|Test #1] - &[t1]")
32
- @p.document.output.should == "[SNIPPET 't1' NOT PROCESSED] - - Test #1"
33
- @p.document.snippet?(:t1).should == "Test #1"
32
+ expect(@p.document.output).to eq("[SNIPPET 't1' NOT PROCESSED] - - Test #1")
33
+ expect(@p.document.snippet?(:t1)).to eq("Test #1")
34
34
  end
35
35
 
36
36
  it "condition" do
37
37
  define_em_macro
38
38
  interpret("?[$[document.invalid]|em[test]]")
39
- @p.document.output.should == ""
39
+ expect(@p.document.output).to eq("")
40
40
  interpret("?[$[document.output]|em[test]]")
41
- @p.document.output.should == "<em>test</em>"
41
+ expect(@p.document.output).to eq("<em>test</em>")
42
42
  interpret("?[not[eq[$[document.output]|]]|em[test]]")
43
- @p.document.output.should == "<em>test</em>"
43
+ expect(@p.document.output).to eq("<em>test</em>")
44
44
  interpret %{?[
45
45
  or[
46
46
  eq[$[document.target]|htmls]|
47
47
  not[eq[$[document.author]|x]]
48
48
  ]|em[test]]}
49
- @p.document.output.should == "<em>test</em>"
49
+ expect(@p.document.output).to eq("<em>test</em>")
50
50
  # "false" should be regarded as false
51
51
  interpret(%{?[%["test".blank?]|---]})
52
- @p.document.output.should == ""
52
+ expect(@p.document.output).to eq("")
53
53
  interpret("?[not[match[$[document.source]|/^docu/]]|em[test]]")
54
- @p.document.output.should == ""
54
+ expect(@p.document.output).to eq("")
55
55
  interpret "?[%[lite?]|test]"
56
- @p.document.output.should == ""
56
+ expect(@p.document.output).to eq("")
57
57
  interpret "?[%[!lite?]|test]"
58
- @p.document.output.should == "test"
58
+ expect(@p.document.output).to eq("test")
59
59
  interpret "?[%[lite?]|%[\"test\"]]"
60
- @p.document.output.should == ""
60
+ expect(@p.document.output).to eq("")
61
61
  # Condition not satisfied...
62
62
  interpret "?[%[lite?]|%[ Glyph\\['test_config'\\] = true ]]"
63
- @p.document.output.should == ""
64
- Glyph['test_config'].should_not == true
63
+ expect(@p.document.output).to eq("")
64
+ expect(Glyph['test_config']).not_to eq(true)
65
65
  # Condition satisfied...
66
66
  interpret "?[%[!lite?]|%[ Glyph\\['test_config'\\] = true ]]"
67
- @p.document.output.should == "true"
68
- Glyph['test_config'].should == true
67
+ expect(@p.document.output).to eq("true")
68
+ expect(Glyph['test_config']).to eq(true)
69
69
  end
70
70
 
71
71
  it "condition (else)" do
72
- output_for("?[true|OK|NOT OK]").should == "OK"
73
- output_for("?[false|OK|NOT OK]").should == "NOT OK"
72
+ expect(output_for("?[true|OK|NOT OK]")).to eq("OK")
73
+ expect(output_for("?[false|OK|NOT OK]")).to eq("NOT OK")
74
74
  end
75
75
 
76
76
  it "comment" do
77
- output_for("--[config:[some_random_setting|test]]").should == ""
78
- Glyph[:some_random_setting].should == nil
77
+ expect(output_for("--[config:[some_random_setting|test]]")).to eq("")
78
+ expect(Glyph[:some_random_setting]).to eq(nil)
79
79
  end
80
80
 
81
81
  it "include" do
82
82
  Glyph["filters.by_extension"] = true
83
83
  text = file_load(Glyph::PROJECT/'text/container.textile')
84
84
  interpret text
85
- @p.document.output.gsub(/\n|\t/, '').should == %{
85
+ expect(@p.document.output.gsub(/\n|\t/, '')).to eq(%{
86
86
  <div class="section">
87
87
  <h2 id="h_1" class="toc">Container section</h2>
88
88
  This is a test.
@@ -91,7 +91,7 @@ describe "Macro:" do
91
91
  <p>&#8230;</p>
92
92
  </div>
93
93
  </div>
94
- }.gsub(/\n|\t/, '')
94
+ }.gsub(/\n|\t/, ''))
95
95
  end
96
96
 
97
97
  it "include should work in Lite mode" do
@@ -107,17 +107,17 @@ This is a test.
107
107
  </div>}.gsub(/\n|\t/, '')
108
108
  Dir.chdir Glyph::SPEC_DIR/"files"
109
109
  text = file_load(Glyph::SPEC_DIR/"files/container.textile").gsub("a/b/c/", '')
110
- Glyph.filter(text).gsub(/\n|\t/, '').should == result
110
+ expect(Glyph.filter(text).gsub(/\n|\t/, '')).to eq(result)
111
111
  Dir.chdir Glyph::PROJECT
112
112
  Glyph.lite_mode = false
113
113
  end
114
114
 
115
115
  it "include should assume .glyph as the default extension" do
116
116
  file_copy Glyph::SPEC_DIR/'files/article.glyph', Glyph::PROJECT/'text/article.glyph'
117
- output_for("include[article]").gsub(/\n|\t/, '').should == %{<div class="section">
117
+ expect(output_for("include[article]").gsub(/\n|\t/, '')).to eq(%{<div class="section">
118
118
  改善 Test -- Test Snippet
119
119
 
120
- </div>}.gsub(/\n|\t/, '')
120
+ </div>}.gsub(/\n|\t/, ''))
121
121
  end
122
122
 
123
123
  it "include should evaluate .rb file in the context of Glyph" do
@@ -127,7 +127,7 @@ This is a test.
127
127
  end
128
128
  }
129
129
  file_write Glyph::PROJECT/"lib/test.rb", text
130
- output_for("include[test.rb]day[]").should == Time.now.day.to_s
130
+ expect(output_for("include[test.rb]day[]")).to eq(Time.now.day.to_s)
131
131
  end
132
132
 
133
133
  it "load" do
@@ -135,9 +135,9 @@ This is a test.
135
135
  text2 = %{Time.now.day}
136
136
  file_write Glyph::PROJECT/"test1.glyph", text1
137
137
  file_write Glyph::PROJECT/"test2.rb", text2
138
- output_for("load[test/test1.glyph]").should == "[FILE 'test/test1.glyph' NOT FOUND]"
139
- output_for("load[test1.glyph]").should == text1
140
- output_for("load[test2.rb]").should == text2
138
+ expect(output_for("load[test/test1.glyph]")).to eq("[FILE 'test/test1.glyph' NOT FOUND]")
139
+ expect(output_for("load[test1.glyph]")).to eq(text1)
140
+ expect(output_for("load[test2.rb]")).to eq(text2)
141
141
  end
142
142
 
143
143
 
@@ -145,53 +145,53 @@ This is a test.
145
145
  define_em_macro
146
146
  text = %{This is a test em[This can .[=contain test[macros em[test]]=]]}
147
147
  interpret text
148
- @p.document.output.should == %{This is a test <em>This can contain test[macros em[test]]</em>}
148
+ expect(@p.document.output).to eq(%{This is a test <em>This can contain test[macros em[test]]</em>})
149
149
  end
150
150
 
151
151
  it "ruby" do
152
152
  interpret "2 + 2 = %[2+2]"
153
- @p.document.output.should == %{2 + 2 = 4}
153
+ expect(@p.document.output).to eq(%{2 + 2 = 4})
154
154
  interpret "%[lite?]"
155
- @p.document.output.should == %{false}
155
+ expect(@p.document.output).to eq(%{false})
156
156
  interpret "%[def test; end]"
157
157
  end
158
158
 
159
159
  it "config" do
160
160
  Glyph["test.setting"] = "TEST"
161
161
  interpret "test.setting = $[test.setting]"
162
- @p.document.output.should == %{test.setting = TEST}
162
+ expect(@p.document.output).to eq(%{test.setting = TEST})
163
163
  end
164
164
 
165
165
  it "config:" do
166
166
  Glyph["test.setting"] = "TEST"
167
167
  interpret "test.setting = $[test.setting]"
168
- @p.document.output.should == %{test.setting = TEST}
168
+ expect(@p.document.output).to eq(%{test.setting = TEST})
169
169
  interpret "test.setting = $:[test.setting|TEST2]$[test.setting]"
170
- @p.document.output.should == %{test.setting = TEST2}
170
+ expect(@p.document.output).to eq(%{test.setting = TEST2})
171
171
  interpret("$:[test.setting]").process
172
- Glyph['test.setting'].should == nil
172
+ expect(Glyph['test.setting']).to eq(nil)
173
173
  Glyph['system.test'] = 1
174
174
  interpret("$:[system.test|2]").process
175
- Glyph['system.test'].should == 1
175
+ expect(Glyph['system.test']).to eq(1)
176
176
  end
177
177
 
178
178
  it "macro:" do
179
179
  interpret '%:[e_macro|
180
180
  "Test: #{value}"]e_macro[OK!]'
181
- @p.document.output.should == "Test: OK!"
181
+ expect(@p.document.output).to eq("Test: OK!")
182
182
  end
183
183
 
184
184
  it "alias:" do
185
185
  define_em_macro
186
186
  interpret("alias:[test|em]").process
187
- Glyph::MACROS[:test].should == Glyph::MACROS[:em]
187
+ expect(Glyph::MACROS[:test]).to eq(Glyph::MACROS[:em])
188
188
  end
189
189
 
190
190
  it "define:" do
191
191
  define_em_macro
192
192
  interpret("def:[def_test|em[{{0}}\\/em[{{a}}]]]").process
193
- output_for("def_test[test @a[em[A!]]]").should == "<em>test<em><em>A!</em></em></em>"
194
- output_for("def_test[]").should == "<em><em></em></em>"
193
+ expect(output_for("def_test[test @a[em[A!]]]")).to eq("<em>test<em><em>A!</em></em></em>")
194
+ expect(output_for("def_test[]")).to eq("<em><em></em></em>")
195
195
  end
196
196
 
197
197
  it "define should support recursion" do
@@ -206,17 +206,17 @@ This is a test.
206
206
  ]
207
207
  fact[5]
208
208
  }
209
- output_for(fact).strip.should == "120"
209
+ expect(output_for(fact).strip).to eq("120")
210
210
  end
211
211
 
212
212
  it "output?" do
213
213
  out = Glyph['document.output']
214
214
  Glyph['document.output'] = "html"
215
- output_for("?[output?[html|web]|YES!]").should == "YES!"
215
+ expect(output_for("?[output?[html|web]|YES!]")).to eq("YES!")
216
216
  Glyph['document.output'] = "web"
217
- output_for("?[output?[html|web]|YES!]").should == "YES!"
217
+ expect(output_for("?[output?[html|web]|YES!]")).to eq("YES!")
218
218
  Glyph['document.output'] = "web5"
219
- output_for("?[output?[html|web]|YES!|NO...]").should == "NO..."
219
+ expect(output_for("?[output?[html|web]|YES!|NO...]")).to eq("NO...")
220
220
  end
221
221
 
222
222
  it "let, attribute, attribute:" do
@@ -247,12 +247,12 @@ This is a test.
247
247
  }
248
248
  invalid_set = %{@:[test|1]}
249
249
  invalid_macro = %{=>@[test]}
250
- output_for(test).should match("-- 11 --")
251
- output_for(nested_test).should match("-- test --")
252
- output_for(set_test).should match("-- testchanged! --")
253
- output_for(set_test).should match("-- changed again! --")
254
- lambda { output_for(invalid_set)}.should raise_error(Glyph::MacroError, "Undeclared attribute 'test'")
255
- lambda { output_for(invalid_macro) }.should raise_error
250
+ expect(output_for(test)).to match("-- 11 --")
251
+ expect(output_for(nested_test)).to match("-- test --")
252
+ expect(output_for(set_test)).to match("-- testchanged! --")
253
+ expect(output_for(set_test)).to match("-- changed again! --")
254
+ expect { output_for(invalid_set)}.to raise_error(Glyph::MacroError, "Undeclared attribute 'test'")
255
+ expect { output_for(invalid_macro) }.to raise_error
256
256
  # Set same attribute
257
257
  text = %{
258
258
  let[
@@ -263,50 +263,50 @@ This is a test.
263
263
  ]
264
264
  ]
265
265
  }
266
- output_for(text).strip.should match("---")
266
+ expect(output_for(text).strip).to match("---")
267
267
  end
268
268
 
269
269
  it "add, multiply, subtract" do
270
- output_for("add[2|2]").should == "4"
271
- output_for("add[1|2|3|4]").should == "10"
272
- output_for("add[1|2|-3]").should == "0"
273
- output_for("add[a|1|2]").should == "3"
274
- output_for("add[a|test]").should == "0"
275
- lambda { output_for("add[1]").should == "1"}.should raise_error
276
- lambda { output_for("add[]").should == "1"}.should raise_error
277
- output_for("subtract[2|2]").should == "0"
278
- output_for("subtract[1|2|3|4]").should == "-8"
279
- output_for("subtract[1|2|-3]").should == "2"
280
- output_for("subtract[a|1|2]").should == "-3"
281
- output_for("subtract[a|test]").should == "0"
282
- lambda { output_for("subtract[1]").should == "1"}.should raise_error
283
- lambda { output_for("subtract[]").should == "1"}.should raise_error
284
- output_for("multiply[2|2]").should == "4"
285
- output_for("multiply[1|2|3|4]").should == "24"
286
- output_for("multiply[1|2|-3]").should == "-6"
287
- output_for("multiply[a|1|2]").should == "0"
288
- output_for("multiply[a|test]").should == "0"
289
- lambda { output_for("multiply[1]").should == "1"}.should raise_error
290
- lambda { output_for("multiply[]").should == "1"}.should raise_error
270
+ expect(output_for("add[2|2]")).to eq("4")
271
+ expect(output_for("add[1|2|3|4]")).to eq("10")
272
+ expect(output_for("add[1|2|-3]")).to eq("0")
273
+ expect(output_for("add[a|1|2]")).to eq("3")
274
+ expect(output_for("add[a|test]")).to eq("0")
275
+ expect { expect(output_for("add[1]")).to eq("1")}.to raise_error
276
+ expect { expect(output_for("add[]")).to eq("1")}.to raise_error
277
+ expect(output_for("subtract[2|2]")).to eq("0")
278
+ expect(output_for("subtract[1|2|3|4]")).to eq("-8")
279
+ expect(output_for("subtract[1|2|-3]")).to eq("2")
280
+ expect(output_for("subtract[a|1|2]")).to eq("-3")
281
+ expect(output_for("subtract[a|test]")).to eq("0")
282
+ expect { expect(output_for("subtract[1]")).to eq("1")}.to raise_error
283
+ expect { expect(output_for("subtract[]")).to eq("1")}.to raise_error
284
+ expect(output_for("multiply[2|2]")).to eq("4")
285
+ expect(output_for("multiply[1|2|3|4]")).to eq("24")
286
+ expect(output_for("multiply[1|2|-3]")).to eq("-6")
287
+ expect(output_for("multiply[a|1|2]")).to eq("0")
288
+ expect(output_for("multiply[a|test]")).to eq("0")
289
+ expect { expect(output_for("multiply[1]")).to eq("1")}.to raise_error
290
+ expect { expect(output_for("multiply[]")).to eq("1")}.to raise_error
291
291
  end
292
292
 
293
293
  it "s" do
294
- lambda { output_for("s/each[test]") }.should raise_error
295
- lambda { output_for("s/gsub[]") }.should raise_error
296
- output_for("s/gsub[string|/ri/|i]").should == "sting"
297
- output_for("s/match[test|/EST/i]").should == "est"
298
- output_for("s/upcase[test]").should == "TEST"
299
- output_for("s/insert[hell|4|o]").should == "hello"
300
- output_for("s/slice[test]").should == ""
294
+ expect { output_for("s/each[test]") }.to raise_error
295
+ expect { output_for("s/gsub[]") }.to raise_error
296
+ expect(output_for("s/gsub[string|/ri/|i]")).to eq("sting")
297
+ expect(output_for("s/match[test|/EST/i]")).to eq("est")
298
+ expect(output_for("s/upcase[test]")).to eq("TEST")
299
+ expect(output_for("s/insert[hell|4|o]")).to eq("hello")
300
+ expect(output_for("s/slice[test]")).to eq("")
301
301
  end
302
302
 
303
303
  it "lt, lte, gt, gte" do
304
- lambda { output_for("lt[1|2|3]")}.should raise_error
305
- output_for("lt[2|7]").should == "true"
306
- output_for("gt[2|7]").should == ""
307
- output_for("gte[2|2]").should == "true"
308
- output_for("lte[2|2]").should == "true"
309
- output_for("gt[aaa|2]").should == "true"
304
+ expect { output_for("lt[1|2|3]")}.to raise_error
305
+ expect(output_for("lt[2|7]")).to eq("true")
306
+ expect(output_for("gt[2|7]")).to eq("")
307
+ expect(output_for("gte[2|2]")).to eq("true")
308
+ expect(output_for("lte[2|2]")).to eq("true")
309
+ expect(output_for("gt[aaa|2]")).to eq("true")
310
310
  end
311
311
 
312
312
  it "while" do
@@ -321,21 +321,21 @@ This is a test.
321
321
  @[text]
322
322
  ]
323
323
  }
324
- output_for(text).strip.should == "-test-test-test-test-test-"
324
+ expect(output_for(text).strip).to eq("-test-test-test-test-test-")
325
325
  end
326
326
 
327
327
  it "fragment" do
328
328
  text = "... ##[id1|test fragment #1] ... ##[id2|test fragment #2]"
329
329
  interpret text
330
- @p.document.fragments.should == {:id1 => "test fragment #1", :id2 => "test fragment #2"}
331
- @p.document.output.should == "... test fragment #1 ... test fragment #2"
332
- lambda { output_for "##[id1|test] -- fragment[id1|test]" }.should raise_error
333
- lambda { output_for "##[id1]" }.should raise_error
330
+ expect(@p.document.fragments).to eq({:id1 => "test fragment #1", :id2 => "test fragment #2"})
331
+ expect(@p.document.output).to eq("... test fragment #1 ... test fragment #2")
332
+ expect { output_for "##[id1|test] -- fragment[id1|test]" }.to raise_error
333
+ expect { output_for "##[id1]" }.to raise_error
334
334
  end
335
335
 
336
336
  it "embed" do
337
337
  text = "... <=[id2] ##[id1|test fragment #1] ... ##[id2|test fragment #2] <=[id1]"
338
- output_for(text).should == "... test fragment #2 test fragment #1 ... test fragment #2 test fragment #1"
338
+ expect(output_for(text)).to eq("... test fragment #2 test fragment #1 ... test fragment #2 test fragment #1")
339
339
  end
340
340
 
341
341
 
@@ -16,14 +16,14 @@ describe "Filter Macros" do
16
16
  it "should filter textile input" do
17
17
  text = "textile[This is a _TEST_(TM).]"
18
18
  interpret text
19
- @p.document.output.should == "<p>This is a <em><span class=\"caps\">TEST</span></em>&#8482;.</p>"
19
+ expect(@p.document.output).to eq("<p>This is a <em><span class=\"caps\">TEST</span></em>&#8482;.</p>")
20
20
  Glyph["output.#{Glyph['document.output']}.filter_target"] = :latex
21
21
  interpret text
22
- @p.document.output.should == "This is a \\emph{TEST}\\texttrademark{}.\n\n"
22
+ expect(@p.document.output).to eq("This is a \\emph{TEST}\\texttrademark{}.\n\n")
23
23
  Glyph["output.#{Glyph['document.output']}.filter_target"] = :html
24
24
  Glyph['filters.redcloth.restrictions'] = [:no_span_caps]
25
25
  interpret text
26
- @p.document.output.should == "<p>This is a <em>TEST</em>&#8482;.</p>"
26
+ expect(@p.document.output).to eq("<p>This is a <em>TEST</em>&#8482;.</p>")
27
27
  end
28
28
 
29
29
  it "should filter markdown input" do
@@ -35,8 +35,9 @@ describe "Filter Macros" do
35
35
 
36
36
  etc.]"
37
37
  interpret text
38
- @p.document.output.gsub(/\n|\t|\s{2}/, '').should ==
38
+ expect(@p.document.output.gsub(/\n|\t|\s{2}/, '')).to eq(
39
39
  "<p>This is a test:</p><ul><li>item 1</li><li>item 2</li><li>item 3</li></ul><p>etc.</p>"
40
+ )
40
41
  end
41
42
 
42
43
  it "highlight" do
@@ -64,7 +65,7 @@ interpret text
64
65
  Glyph["filters.highlighter"] = hl.to_sym
65
66
  Glyph.debug_mode = true
66
67
  interpret("highlight[=ruby|\n#{code}=]")
67
- @p.document.output.gsub(/\s+/, ' ').strip.should == result.gsub(/\s+/, ' ').strip
68
+ expect(@p.document.output.gsub(/\s+/, ' ').strip).to eq(result.gsub(/\s+/, ' ').strip)
68
69
  end
69
70
  Glyph['filters.ultraviolet.line_numbers'] = false
70
71
  check.call 'ultraviolet', uv_result if uv
@@ -72,9 +73,9 @@ interpret text
72
73
  end
73
74
 
74
75
  it "textile_section, markdown_section" do
75
- output_for("§txt[*test*]").should == "<div class=\"section\">\n<p><strong>test</strong></p>\n\n</div>"
76
- output_for("§md[*test*]").should == "<div class=\"section\">\n<p><em>test</em></p>\n\n</div>"
77
- output_for("textile_section[@title[test]...]").should == "<div class=\"section\">\n<h2 id=\"h_1\" class=\"toc\">test</h2>\n<p>&#8230;</p>\n\n</div>"
76
+ expect(output_for("§txt[*test*]")).to eq("<div class=\"section\">\n<p><strong>test</strong></p>\n\n</div>")
77
+ expect(output_for("§md[*test*]")).to eq("<div class=\"section\">\n<p><em>test</em></p>\n\n</div>")
78
+ expect(output_for("textile_section[@title[test]...]")).to eq("<div class=\"section\">\n<h2 id=\"h_1\" class=\"toc\">test</h2>\n<p>&#8230;</p>\n\n</div>")
78
79
  end
79
80
 
80
81
 
@@ -20,7 +20,7 @@ describe "Macro:" do
20
20
  text = "chapter[@title[Chapter X] ... section[@title[Section Y]@id[sec-y] ... section[@title[Another section] ...]]]"
21
21
  interpret text
22
22
  doc = @p.document
23
- doc.output.gsub(/\n|\t/, '').should == %{<section class="chapter">
23
+ expect(doc.output.gsub(/\n|\t/, '')).to eq(%{<section class="chapter">
24
24
  <header><h1 id="h_1" class="toc">Chapter X</h1></header>...
25
25
  <section class="section">
26
26
  <header><h1 id="sec-y" class="toc">Section Y</h1></header>...
@@ -29,13 +29,13 @@ describe "Macro:" do
29
29
  </section>
30
30
  </section>
31
31
  </section>
32
- }.gsub(/\n|\t/, '')
33
- doc.bookmark?(:"sec-y").should == Glyph::Bookmark.new({:id => :"sec-y", :title => "Section Y", :file => nil})
32
+ }.gsub(/\n|\t/, ''))
33
+ expect(doc.bookmark?(:"sec-y")).to eq(Glyph::Bookmark.new({:id => :"sec-y", :title => "Section Y", :file => nil}))
34
34
  end
35
35
 
36
36
  it "document, head, style (html5)" do
37
37
  interpret "document[head[style[test.sass]]]"
38
- @p.document.output.gsub(/\n|\t/, '').should == %{
38
+ expect(@p.document.output.gsub(/\n|\t/, '')).to eq(%{
39
39
  <!DOCTYPE html>
40
40
  <html lang="en">
41
41
  <head>
@@ -44,10 +44,10 @@ describe "Macro:" do
44
44
  <meta name="copyright" content="#{Glyph["document.author"]}" />
45
45
  <meta name="generator" content="Glyph v#{Glyph::VERSION} (http://www.h3rald.com/glyph)" />
46
46
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
47
- <style type=\"text/css\">#main { background-color: blue; margin: 12px; }</style>
47
+ <style type=\"text/css\">#main { background-color: #0000ff; margin: 12px; }</style>
48
48
  </head>
49
49
  </html>
50
- }.gsub(/\n|\t/, '')
50
+ }.gsub(/\n|\t/, ''))
51
51
  end
52
52
 
53
53
  it "toc (html5)" do
@@ -55,7 +55,7 @@ describe "Macro:" do
55
55
  interpret file_load(Glyph::PROJECT/'document.glyph')
56
56
  doc = @p.document
57
57
  doc.output.gsub!(/\n|\t/, '')
58
- doc.output.slice(/(.+?<\/nav>)/, 1).should == %{
58
+ expect(doc.output.slice(/(.+?<\/nav>)/, 1)).to eq(%{
59
59
  <nav class="contents">
60
60
  <h1 class="toc-header" id="toc">Table of Contents</h1>
61
61
  <ol class="toc">
@@ -63,38 +63,38 @@ describe "Macro:" do
63
63
  <li class="section"><a href="#md">Markdown</a></li>
64
64
  </ol>
65
65
  </nav>
66
- }.gsub(/\n|\t/, '')
66
+ }.gsub(/\n|\t/, ''))
67
67
  end
68
68
 
69
69
  it "fmi (html5)" do
70
70
  interpret "fmi[this topic|#test] #[test|Test]"
71
- @p.document.output.should == %{<span class="fmi">
71
+ expect(@p.document.output).to eq(%{<span class="fmi">
72
72
  for more information on <mark>this topic</mark>,
73
- see <a href="#test">Test</a></span> <a id="test">Test</a>}.gsub(/\n|\t/, '')
73
+ see <a href="#test">Test</a></span> <a id="test">Test</a>}.gsub(/\n|\t/, ''))
74
74
  end
75
75
 
76
76
  it "figure (html5)" do
77
77
  interpret "figure[@alt[ligature]ligature.jpg|Ligature]"
78
- @p.document.output.gsub(/\t|\n/, '').should == %{
78
+ expect(@p.document.output.gsub(/\t|\n/, '')).to eq(%{
79
79
  <figure alt=\"ligature\">
80
80
  <img src=\"images/ligature.jpg\" />
81
81
  <figcaption>Ligature</figcaption>
82
- </figure>}.gsub(/\n|\t/, '')
82
+ </figure>}.gsub(/\n|\t/, ''))
83
83
  end
84
84
 
85
85
  it "draftcomment, todo (html5)" do
86
86
  text1 = "dc[comment!]"
87
87
  text2 = "![todo!]"
88
88
  interpret text1
89
- @p.document.output.should == ""
89
+ expect(@p.document.output).to eq("")
90
90
  interpret text2
91
- @p.document.output.should == ""
91
+ expect(@p.document.output).to eq("")
92
92
  Glyph['document.draft'] = true
93
93
  interpret text1
94
- @p.document.output.should == %{<aside class="comment"><span class="comment-pre"><strong>Comment:</strong> </span>comment!</aside>}
94
+ expect(@p.document.output).to eq(%{<aside class="comment"><span class="comment-pre"><strong>Comment:</strong> </span>comment!</aside>})
95
95
  interpret text2
96
- @p.document.output.should == %{<aside class="todo"><span class="todo-pre"><strong>TODO:</strong> </span>todo!</aside>}
97
- @p.document.todos.length.should == 1
96
+ expect(@p.document.output).to eq(%{<aside class="todo"><span class="todo-pre"><strong>TODO:</strong> </span>todo!</aside>})
97
+ expect(@p.document.todos.length).to eq(1)
98
98
  Glyph['document.draft'] = false
99
99
  end
100
100
  end