middleman-asciidoc 1.0.0.rc.2 → 1.0.0.rc.3

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.
@@ -23,12 +23,12 @@ Feature: AsciiDoc Support
23
23
  </div>
24
24
  """
25
25
 
26
- Scenario: Rendering html with default layout
26
+ Scenario: Rendering html with layout defined in extension config
27
27
  Given a fixture app "asciidoc-app"
28
28
  And a file named "config.rb" with:
29
29
  """
30
- activate :asciidoc
31
- set :layout, :default
30
+ activate :asciidoc, layout: :default
31
+ set :layout, :global
32
32
  """
33
33
  Given the Server is running at "asciidoc-app"
34
34
  When I go to "/hello.html"
@@ -48,9 +48,49 @@ Feature: AsciiDoc Support
48
48
  </html>
49
49
  """
50
50
 
51
- Scenario: Rendering html with explicit layout
51
+ Scenario: Rendering html with no layout specified
52
+ Given a fixture app "asciidoc-app"
53
+ And a file named "config.rb" with:
54
+ """
55
+ activate :asciidoc
56
+ set :layout, :default
57
+ """
58
+ And a file named "source/no-layout.adoc" with:
59
+ """
60
+ Hello, AsciiDoc!
61
+ """
62
+ Given the Server is running at "asciidoc-app"
63
+ When I go to "/no-layout.html"
64
+ Then I should see:
65
+ """
66
+ <!DOCTYPE html>
67
+ <html>
68
+ <head>
69
+ <title>Fallback</title>
70
+ </head>
71
+ <body>
72
+ <div class="paragraph">
73
+ <p>Hello, AsciiDoc!</p>
74
+ </div>
75
+ </body>
76
+ </html>
77
+ """
78
+
79
+ Scenario: Rendering html with auto layout specified
80
+ Given a fixture app "asciidoc-app"
81
+ And a file named "config.rb" with:
82
+ """
83
+ activate :asciidoc
84
+ set :layout, :default
85
+ """
86
+ And a file named "source/auto-layout.adoc" with:
87
+ """
88
+ :page-layout: _auto_layout
89
+
90
+ Hello, AsciiDoc!
91
+ """
52
92
  Given the Server is running at "asciidoc-app"
53
- When I go to "/hello-with-layout.html"
93
+ When I go to "/auto-layout.html"
54
94
  Then I should see:
55
95
  """
56
96
  <!DOCTYPE html>
@@ -66,17 +106,129 @@ Feature: AsciiDoc Support
66
106
  </html>
67
107
  """
68
108
 
69
- Scenario: Rendering html with no layout
109
+ Scenario: Rendering html with blank layout specified
110
+ Given a fixture app "asciidoc-app"
111
+ And a file named "config.rb" with:
112
+ """
113
+ activate :asciidoc
114
+ set :layout, :default
115
+ """
116
+ And a file named "source/blank-layout.adoc" with:
117
+ """
118
+ :page-layout:
119
+
120
+ Hello, AsciiDoc!
121
+ """
70
122
  Given the Server is running at "asciidoc-app"
71
- When I go to "/hello-no-layout.html"
123
+ When I go to "/blank-layout.html"
72
124
  Then I should see:
73
125
  """
126
+ <!DOCTYPE html>
127
+ <html>
128
+ <head>
129
+ <title>Fallback</title>
130
+ </head>
131
+ <body>
74
132
  <div class="paragraph">
75
133
  <p>Hello, AsciiDoc!</p>
76
134
  </div>
135
+ </body>
136
+ </html>
77
137
  """
78
138
 
79
- Scenario: Rendering html using title from document
139
+ Scenario: Rendering html with explicit layout specified
140
+ Given a fixture app "asciidoc-app"
141
+ And a file named "source/explicit-layout.adoc" with:
142
+ """
143
+ :page-layout: default
144
+
145
+ Hello, AsciiDoc!
146
+ """
147
+ Given the Server is running at "asciidoc-app"
148
+ When I go to "/explicit-layout.html"
149
+ Then I should see:
150
+ """
151
+ <!DOCTYPE html>
152
+ <html>
153
+ <head>
154
+ <title>Fallback</title>
155
+ </head>
156
+ <body>
157
+ <div class="paragraph">
158
+ <p>Hello, AsciiDoc!</p>
159
+ </div>
160
+ </body>
161
+ </html>
162
+ """
163
+
164
+ Scenario: Rendering html with layout unset
165
+ Given a fixture app "asciidoc-app"
166
+ And a file named "source/unset-layout.adoc" with:
167
+ """
168
+ :!page-layout:
169
+
170
+ Hello, AsciiDoc!
171
+ """
172
+ Given the Server is running at "asciidoc-app"
173
+ When I go to "/unset-layout.html"
174
+ Then I should see:
175
+ """
176
+ <meta name="generator" content="Asciidoctor
177
+ """
178
+ Then I should see:
179
+ """
180
+ <div class="paragraph">
181
+ <p>Hello, AsciiDoc!</p>
182
+ </div>
183
+ """
184
+
185
+ Scenario: Rendering html with false layout specified
186
+ Given a fixture app "asciidoc-app"
187
+ And a file named "source/false-layout.adoc" with:
188
+ """
189
+ :page-layout: false
190
+
191
+ Hello, AsciiDoc!
192
+ """
193
+ Given the Server is running at "asciidoc-app"
194
+ When I go to "/false-layout.html"
195
+ Then I should see:
196
+ """
197
+ <meta name="generator" content="Asciidoctor
198
+ """
199
+ Then I should see:
200
+ """
201
+ <div class="paragraph">
202
+ <p>Hello, AsciiDoc!</p>
203
+ </div>
204
+ """
205
+
206
+ Scenario: Rendering html with ~ layout specified
207
+ Given a fixture app "asciidoc-app"
208
+ And a file named "source/minus-layout.adoc" with:
209
+ """
210
+ :page-layout: -
211
+
212
+ Hello, AsciiDoc!
213
+ """
214
+ Given the Server is running at "asciidoc-app"
215
+ When I go to "/minus-layout.html"
216
+ Then I should not see:
217
+ """
218
+ <!DOCTYPE html>
219
+ """
220
+ Then I should not see:
221
+ """
222
+ <meta name="generator" content="Asciidoctor
223
+ """
224
+ Then I should see:
225
+ """
226
+ <div class="paragraph">
227
+ <p>Hello, AsciiDoc!</p>
228
+ </div>
229
+ """
230
+
231
+ Scenario: Rendering html using title and tags from document
80
232
  Given the Server is running at "asciidoc-app"
81
233
  When I go to "/hello-with-title.html"
82
234
  Then I should see:
@@ -96,6 +248,54 @@ Feature: AsciiDoc Support
96
248
  </html>
97
249
  """
98
250
 
251
+ Scenario: Default safe mode for AsciiDoc processor
252
+ Given a fixture app "asciidoc-app"
253
+ And a file named "config.rb" with:
254
+ """
255
+ activate :asciidoc
256
+ set :layout, :default
257
+ """
258
+ Given the Server is running at "asciidoc-app"
259
+ When I go to "/safe-mode.html"
260
+ Then I should see:
261
+ """
262
+ <!DOCTYPE html>
263
+ <html>
264
+ <head>
265
+ <title>Safe Mode</title>
266
+ </head>
267
+ <body>
268
+ <div class="paragraph">
269
+ <p>safe</p>
270
+ </div>
271
+ </body>
272
+ </html>
273
+ """
274
+
275
+ Scenario: Setting safe mode on AsciiDoc processor
276
+ Given a fixture app "asciidoc-app"
277
+ And a file named "config.rb" with:
278
+ """
279
+ activate :asciidoc, safe: :unsafe
280
+ set :layout, :default
281
+ """
282
+ Given the Server is running at "asciidoc-app"
283
+ When I go to "/safe-mode.html"
284
+ Then I should see:
285
+ """
286
+ <!DOCTYPE html>
287
+ <html>
288
+ <head>
289
+ <title>Safe Mode</title>
290
+ </head>
291
+ <body>
292
+ <div class="paragraph">
293
+ <p>unsafe</p>
294
+ </div>
295
+ </body>
296
+ </html>
297
+ """
298
+
99
299
  Scenario: Rendering html with title and layout from front matter
100
300
  Given the Server is running at "asciidoc-app"
101
301
  When I go to "/hello-with-front-matter.html"
@@ -114,7 +314,23 @@ Feature: AsciiDoc Support
114
314
  </html>
115
315
  """
116
316
 
117
- Scenario: Merges page data in front matter and AsciiDoc header
317
+ Scenario: Ignoring files marked as ignored
318
+ Given the Server is running at "asciidoc-app"
319
+ When I go to "/ignored.html"
320
+ Then I should see:
321
+ """
322
+ <h1>File Not Found</h1>
323
+ """
324
+
325
+ Scenario: Publishing site information as AsciiDoc attributes
326
+ Given the Server is running at "asciidoc-app"
327
+ When I go to "/site-information.html"
328
+ Then I should see content matching %r{<p>site-root=.+/tmp/aruba/asciidoc-app</p>}
329
+ Then I should see content matching %r{<p>site-source=.+/tmp/aruba/asciidoc-app/source</p>}
330
+ Then I should see content matching %r{<p>site-destination=.+/tmp/aruba/asciidoc-app/build</p>}
331
+ Then I should see content matching %r{<p>site-environment=development</p>}
332
+
333
+ Scenario: Merging page data in front matter and AsciiDoc header
118
334
  Given the Server is running at "asciidoc-app"
119
335
  When I go to "/hello-with-mixed-page-data.html"
120
336
  Then I should see:
@@ -133,6 +349,41 @@ Feature: AsciiDoc Support
133
349
  </html>
134
350
  """
135
351
 
352
+ Scenario: Promoting standard AsciiDoc attributes to page data
353
+ Given the Server is running at "asciidoc-app"
354
+ When I go to "/inspect-standard-page-data.html"
355
+ Then I should see:
356
+ """
357
+ <p>Page Title</p>
358
+ <p>Doc Writer</p>
359
+ <p>Doc Writer | Junior Writer</p>
360
+ <p>doc.writer@example.com</p>
361
+ <p>This is a sample page.</p>
362
+ <p>meta, AsciiDoc, Middleman</p>
363
+ """
364
+
365
+ Scenario: Honor time zone specified in revdate
366
+ Given the Server is running at "asciidoc-app"
367
+ When I go to "/page-with-date-at-zone.html"
368
+ Then I should see:
369
+ """
370
+ <html data-date="2017-01-01T16:00:00Z">
371
+ """
372
+
373
+ Scenario: Add application time zone to revdate when none specified
374
+ Given a fixture app "asciidoc-app"
375
+ And a file named "config.rb" with:
376
+ """
377
+ set :time_zone, 'MST'
378
+ activate :asciidoc
379
+ """
380
+ Given the Server is running at "asciidoc-app"
381
+ When I go to "/page-with-date.html"
382
+ Then I should see:
383
+ """
384
+ <html data-date="2017-01-01T16:00:00Z">
385
+ """
386
+
136
387
  Scenario: Including a file relative to source root
137
388
  Given the Server is running at "asciidoc-app"
138
389
  When I go to "/master.html"
@@ -160,11 +411,24 @@ Feature: AsciiDoc Support
160
411
  </div>
161
412
  """
162
413
 
163
- Scenario: Including a file relative to document in subdirectory when base_dir is set
414
+ Scenario: Including a file relative to document in subdirectory when base_dir is set to :source
415
+ Given a fixture app "asciidoc-app"
416
+ And a file named "config.rb" with:
417
+ """
418
+ activate :asciidoc, base_dir: :source
419
+ """
420
+ Given the Server is running at "asciidoc-app"
421
+ When I go to "/manual/index.html"
422
+ Then I should see:
423
+ """
424
+ <p>Unresolved directive in &lt;stdin&gt; - include::_chapters/ch01.adoc[]</p>
425
+ """
426
+
427
+ Scenario: Including a file relative to document in subdirectory when base_dir is set to app.source_dir
164
428
  Given a fixture app "asciidoc-app"
165
429
  And a file named "config.rb" with:
166
430
  """
167
- activate :asciidoc, base_dir: app.source_dir.expand_path
431
+ activate :asciidoc, base_dir: app.source_dir
168
432
  """
169
433
  Given the Server is running at "asciidoc-app"
170
434
  When I go to "/manual/index.html"
@@ -173,6 +437,50 @@ Feature: AsciiDoc Support
173
437
  <p>Unresolved directive in &lt;stdin&gt; - include::_chapters/ch01.adoc[]</p>
174
438
  """
175
439
 
440
+ Scenario: Linking to a sibling page with directory indexes activated
441
+ Given a fixture app "asciidoc-app"
442
+ And a file named "config.rb" with:
443
+ """
444
+ activate :asciidoc
445
+ activate :directory_indexes
446
+ """
447
+ Given the Server is running at "asciidoc-app"
448
+ When I go to "/link-to-page/"
449
+ Then I should see:
450
+ """
451
+ <p>See <a href="../code/">code</a> run.</p>
452
+ """
453
+
454
+ Scenario: Linking to a sibling page with directory indexes activated and trailing slash disabled
455
+ Given a fixture app "asciidoc-app"
456
+ And a file named "config.rb" with:
457
+ """
458
+ activate :asciidoc
459
+ activate :directory_indexes
460
+ set :trailing_slash, false
461
+ """
462
+ Given the Server is running at "asciidoc-app"
463
+ When I go to "/link-to-page/"
464
+ Then I should see:
465
+ """
466
+ <p>See <a href="../code">code</a> run.</p>
467
+ """
468
+
469
+ Scenario: Linking to a sibling page with directory indexes activated and strip index file disabled
470
+ Given a fixture app "asciidoc-app"
471
+ And a file named "config.rb" with:
472
+ """
473
+ activate :asciidoc
474
+ activate :directory_indexes
475
+ set :strip_index_file, false
476
+ """
477
+ Given the Server is running at "asciidoc-app"
478
+ When I go to "/link-to-page/"
479
+ Then I should see:
480
+ """
481
+ <p>See <a href="../code/index.html">code</a> run.</p>
482
+ """
483
+
176
484
  Scenario: Linking to an image
177
485
  Given the Server is running at "asciidoc-app"
178
486
  When I go to "/gallery.html"
@@ -195,7 +503,39 @@ Feature: AsciiDoc Support
195
503
  </div>
196
504
  """
197
505
 
198
- Scenario: imagesdir configuration should override imagesdir defined in page
506
+ Scenario: Restoring imagesdir to value defined in page
507
+ Given a fixture app "asciidoc-app"
508
+ And a file named "config.rb" with:
509
+ """
510
+ activate :asciidoc, attributes: %w(imagesdir=@)
511
+ """
512
+ Given the Server is running at "asciidoc-app"
513
+ When I go to "/custom-imagesdir.html"
514
+ Then I should see:
515
+ """
516
+ <div class="imageblock">
517
+ <div class="content">
518
+ <img src="img/tiger.gif" alt="tiger">
519
+ </div>
520
+ """
521
+
522
+ Scenario: Restoring imagesdir to default value
523
+ Given a fixture app "asciidoc-app"
524
+ And a file named "config.rb" with:
525
+ """
526
+ activate :asciidoc, attributes: %w(imagesdir!)
527
+ """
528
+ Given the Server is running at "asciidoc-app"
529
+ When I go to "/custom-imagesdir.html"
530
+ Then I should see:
531
+ """
532
+ <div class="imageblock">
533
+ <div class="content">
534
+ <img src="tiger.gif" alt="tiger">
535
+ </div>
536
+ """
537
+
538
+ Scenario: Overriding imagesdir attribute in page with imagesdir configuration
199
539
  Given a fixture app "asciidoc-app"
200
540
  And a file named "config.rb" with:
201
541
  """
@@ -215,21 +555,21 @@ Feature: AsciiDoc Support
215
555
  Given a fixture app "asciidoc-app"
216
556
  And a file named "config.rb" with:
217
557
  """
218
- activate :asciidoc, attributes: %w(foo=bar)
558
+ activate :asciidoc, attributes: %w(bar=bar@ foo={bar}{baz})
219
559
  """
220
560
  Given the Server is running at "asciidoc-app"
221
561
  When I go to "/custom-attribute.html"
222
- Then I should see "bar"
562
+ Then I should see "bar{baz}"
223
563
 
224
564
  Scenario: Configuring custom AsciiDoc attributes as Hash
225
565
  Given a fixture app "asciidoc-app"
226
566
  And a file named "config.rb" with:
227
567
  """
228
- activate :asciidoc, attributes: { 'foo' => 'bar' }
568
+ activate :asciidoc, attributes: { 'bar' => 'bar@', 'foo' => '{bar}{baz}' }
229
569
  """
230
570
  Given the Server is running at "asciidoc-app"
231
571
  When I go to "/custom-attribute.html"
232
- Then I should see "bar"
572
+ Then I should see "bar{baz}"
233
573
 
234
574
  Scenario: Highlighting source code
235
575
  Given a fixture app "asciidoc-app"
@@ -0,0 +1,4 @@
1
+ = Ignored
2
+ :page-ignored:
3
+
4
+ This page is not included in the generated site.
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: false
3
+ ---
4
+ <% page_data = ((sitemap.find_resource_by_page_id 'standard-page-data') || (sitemap.find_resource_by_page_id 'standard-page-data.html')).data %>
5
+ <p><%= page_data.title %></p>
6
+ <p><%= page_data.author %></p>
7
+ <p><%= (page_data.authors || []) * ' | ' %></p>
8
+ <p><%= page_data.email %></p>
9
+ <p><%= page_data.description %></p>
10
+ <p><%= page_data.keywords %></p>
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html data-date="<%= current_resource.data.date.getutc.iso8601 %>">
3
+ <head>
4
+ <title><%= current_resource.data.title || 'Fallback' %></title>
5
+ </head>
6
+ <body>
7
+ <%= yield %>
8
+ </body>
9
+ </html>
@@ -0,0 +1,5 @@
1
+ = Code
2
+
3
+ ifdef::relfilesuffix[:outfilesuffix: {relfilesuffix}]
4
+
5
+ See <<code.adoc#,code>> run.
@@ -0,0 +1,5 @@
1
+ = Time Zone Sensitive
2
+ :revdate: 2017-01-01 09:00 MST
3
+ :page-layout: showdate
4
+
5
+ content
@@ -0,0 +1,5 @@
1
+ = Time Sensitive
2
+ :revdate: 2017-01-01 09:00
3
+ :page-layout: showdate
4
+
5
+ content
@@ -0,0 +1,3 @@
1
+ = Safe Mode
2
+
3
+ {safe-mode-name}
@@ -0,0 +1,6 @@
1
+ = Site Information
2
+
3
+ * site-root={site-root}
4
+ * site-source={site-source}
5
+ * site-destination={site-destination}
6
+ * site-environment={site-environment}
@@ -0,0 +1,5 @@
1
+ = Page Title
2
+ Doc Writer <doc.writer@example.com>; Junior Writer
3
+ :showtitle:
4
+ :description: This is a sample page.
5
+ :keywords: meta, AsciiDoc, Middleman