asciidoctor 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of asciidoctor might be problematic. Click here for more details.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -0
  3. data/Guardfile +18 -0
  4. data/LICENSE +1 -1
  5. data/README.adoc +65 -21
  6. data/Rakefile +10 -0
  7. data/asciidoctor.gemspec +17 -35
  8. data/compat/asciidoc.conf +130 -13
  9. data/lib/asciidoctor.rb +107 -87
  10. data/lib/asciidoctor/abstract_block.rb +6 -2
  11. data/lib/asciidoctor/abstract_node.rb +21 -13
  12. data/lib/asciidoctor/attribute_list.rb +2 -5
  13. data/{stylesheets/asciidoctor.css → lib/asciidoctor/backends/_stylesheets.rb} +96 -46
  14. data/lib/asciidoctor/backends/base_template.rb +9 -4
  15. data/lib/asciidoctor/backends/docbook45.rb +246 -138
  16. data/lib/asciidoctor/backends/html5.rb +580 -381
  17. data/lib/asciidoctor/block.rb +2 -50
  18. data/lib/asciidoctor/cli/options.rb +9 -8
  19. data/lib/asciidoctor/document.rb +35 -45
  20. data/lib/asciidoctor/helpers.rb +10 -0
  21. data/lib/asciidoctor/lexer.rb +456 -148
  22. data/lib/asciidoctor/list_item.rb +0 -21
  23. data/lib/asciidoctor/path_resolver.rb +18 -12
  24. data/lib/asciidoctor/reader.rb +71 -26
  25. data/lib/asciidoctor/renderer.rb +2 -19
  26. data/lib/asciidoctor/section.rb +0 -1
  27. data/lib/asciidoctor/substituters.rb +150 -36
  28. data/lib/asciidoctor/table.rb +30 -24
  29. data/lib/asciidoctor/version.rb +1 -1
  30. data/man/asciidoctor.1 +22 -16
  31. data/man/asciidoctor.ad +24 -16
  32. data/test/attributes_test.rb +50 -0
  33. data/test/blocks_test.rb +660 -9
  34. data/test/document_test.rb +191 -14
  35. data/test/fixtures/encoding.asciidoc +8 -0
  36. data/test/invoker_test.rb +47 -0
  37. data/test/lexer_test.rb +172 -0
  38. data/test/links_test.rb +28 -0
  39. data/test/lists_test.rb +172 -13
  40. data/test/options_test.rb +29 -2
  41. data/test/paragraphs_test.rb +105 -47
  42. data/test/paths_test.rb +3 -3
  43. data/test/reader_test.rb +46 -0
  44. data/test/sections_test.rb +365 -12
  45. data/test/substitutions_test.rb +127 -11
  46. data/test/tables_test.rb +81 -14
  47. data/test/test_helper.rb +18 -7
  48. data/test/text_test.rb +17 -5
  49. metadata +9 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8a3cff3d36fc7c331d8fa58ec52d3de55c82a01
4
- data.tar.gz: 4096f0425da556b1c4fb0c808fcf09f2c3848131
3
+ metadata.gz: 83e440b38375e7aaf9706436000410fd3d80a205
4
+ data.tar.gz: 3a6e68864dbce5fe5e845305972a49cca714b4ab
5
5
  SHA512:
6
- metadata.gz: 57e7391640b1677fb9d19ecde95af02a6cd53111613d0335e0618901a55dff080aa1bab1290a2f0d591de7ec5db7a8c9e198ba78b386d7c1a3f3b0a3ba5953f6
7
- data.tar.gz: 6f6f8002274a90e950327b5ecd69d3a05d760f842acc9b70fdce6c17a55e039dcd1c293d06b565047b7c7557c128f375e6ba7d8f37c4e28318207fe6bc002a03
6
+ metadata.gz: ebd29c43ea544f14375e7c8f49c43bda1cfb99057cf819c2919679e32d3fd9c27c42459ac115decbd846e6e4349b2c094693e11e549dbb300c7815ab8500053a
7
+ data.tar.gz: 19b9420012417f358e1433e3c38511a12b5bdbaf9c99f5487ea5829493d7271c2a9156afc78e377e36ff0678e000b49d6dc22e4d74a63919033bb4b4253d24e6
data/Gemfile CHANGED
@@ -1,2 +1,12 @@
1
1
  source 'https://rubygems.org'
2
+
2
3
  gemspec
4
+
5
+ # enable this group to use Guard for continuous testing
6
+ # after removing comments, run `bundle install` then `guard`
7
+ #group :guardtest do
8
+ # gem 'guard'
9
+ # gem 'guard-test'
10
+ # gem 'libnotify'
11
+ # gem 'listen', :github => 'guard/listen'
12
+ #end
data/Guardfile ADDED
@@ -0,0 +1,18 @@
1
+ # use `guard start -n f` to disable notifications
2
+ # or set the environment variable GUARD_NOTIFY=false
3
+ notification :libnotify,
4
+ :display_message => true,
5
+ :timeout => 5, # in seconds
6
+ :append => false,
7
+ :transient => true,
8
+ :urgency => :critical
9
+
10
+ guard :test do
11
+ watch(%r{^lib/(.+)\.rb$}) do |m|
12
+ "test/#{m[1]}_test.rb"
13
+ end
14
+ watch(%r{^test.+_test\.rb$})
15
+ watch('test/test_helper.rb') do
16
+ "test"
17
+ end
18
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) Ryan Waldron and Dan Allen
3
+ Copyright (C) 2012-2013 Dan Allen and Ryan Waldron
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.adoc CHANGED
@@ -1,20 +1,21 @@
1
1
  = Asciidoctor
2
+ :awestruct-layout: base
2
3
  :homepage: http://asciidoctor.org
3
4
  :asciidoc: http://asciidoc.org
4
- :sources: http://github.com/asciidoctor/asciidoctor
5
+ :sources: https://github.com/asciidoctor/asciidoctor
5
6
  :issues: https://github.com/asciidoctor/asciidoctor/issues
6
7
  :forum: http://discuss.asciidoctor.org
7
- :org: http://github.com/asciidoctor
8
+ :org: https://github.com/asciidoctor
8
9
  :contributors: https://github.com/asciidoctor/asciidoctor/graphs/contributors
9
10
  :templates: https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/backends
10
11
  :gitscm-next: https://github.com/github/gitscm-next
11
12
  :seed-contribution: https://github.com/github/gitscm-next/commits/master/lib/asciidoc.rb
12
13
  :tilt: https://github.com/rtomayko/tilt
13
- :freesoftware: http://www.fsf.org/licensing/essays/free-sw.html
14
+ :freesoftware: http://www.gnu.org/philosophy/free-sw.html
14
15
  :gist: https://gist.github.com
15
- :fork: http://help.github.com/fork-a-repo/
16
+ :fork: https://help.github.com/articles/fork-a-repo
16
17
  :branch: http://learn.github.com/p/branching.html
17
- :pr: http://help.github.com/send-pull-requests/
18
+ :pr: https://help.github.com/articles/using-pull-requests
18
19
  :license: https://github.com/asciidoctor/asciidoctor/blob/master/LICENSE
19
20
  :idprefix:
20
21
  :idseparator: -
@@ -24,23 +25,26 @@
24
25
  and other formats. It's http://rubygems.org/gems/asciidoctor[published
25
26
  as a RubyGem] and is available under the MIT open source license.
26
27
 
28
+ ifndef::awestruct[]
27
29
  image::https://travis-ci.org/asciidoctor/asciidoctor.png?branch=master[Build Status, link="https://travis-ci.org/asciidoctor/asciidoctor"]
30
+ endif::awestruct[]
28
31
 
29
32
  Asciidoctor uses a set of built-in ERB templates to render the document
30
33
  to HTML 5 or DocBook 4.5. We've matched the rendered output as close as
31
34
  possible to the default output of the native Python processor. You can
32
35
  override this behavior by providing {tilt}[Tilt]-compatible templates.
33
- See <<usage,Usage>> for more details.
36
+ See the <<usage>> section for more details.
34
37
 
35
38
  Asciidoctor currently works (read as 'tested') with Ruby 1.8.7, Ruby
36
- 1.9.3, Ruby 2.0.0, JRuby 1.7.2 and Rubinius 1.2.4 (on Linux, Mac and
39
+ 1.9.3, Ruby 2.0.0, JRuby 1.7.4 and Rubinius nightly (on Linux, Mac and
37
40
  Windows). We expect it will work with other versions of Ruby as well and
38
41
  would welcome help in testing it out.
39
42
 
40
- The initial code from which Asciidoctor started emerged from the
41
- {gitscm-next}[Git SCM site repo]. Refer to commit history of
43
+ The initial code from which Asciidoctor emerged was written by
44
+ http://github.com/nickh[Nick Hengeveld] to process the git man pages for
45
+ the {gitscm-next}[Git project site]. Refer to commit history of
42
46
  {seed-contribution}[asciidoc.rb] to view the initial contributions and
43
- individual contributors.
47
+ contributors.
44
48
 
45
49
  The source code can now be found in the {sources}[Asciidoctor source
46
50
  repository] on GitHub.
@@ -74,7 +78,7 @@ Ruby if it's not already on your machine.
74
78
  == Usage
75
79
 
76
80
  Asciidoctor has both a command line interface (CLI) and an API. The CLI
77
- is a drop-in replacement for the +asciidoc.py+ command from the python
81
+ is a drop-in replacement for the +asciidoc.py+ command from the Python
78
82
  implementation. The API is intended for integration with other software
79
83
  projects and is suitable for server-side applications, such as Rails,
80
84
  Sinatra and GitHub.
@@ -233,6 +237,9 @@ Here are the known cases where Asciidoctor differs from AsciiDoc:
233
237
  quotes are rarely needed, though you may want to keep them for
234
238
  compatibility)
235
239
 
240
+ * Asciidoctor adds the type attribute on ordered lists to provide hint
241
+ for numbering style when stylesheet is absent (such as in embedded mode)
242
+
236
243
  * Asciidoctor recognizes +opts+ as an alias for the +options+ attribute.
237
244
 
238
245
  * Asciidoctor creates xref labels using the text from the linked section
@@ -247,6 +254,9 @@ Here are the known cases where Asciidoctor differs from AsciiDoc:
247
254
  NOTE: In general, Asciidoctor handles whitespace much more intelligently
248
255
  +
249
256
 
257
+ * Asciidoctor does not output an empty +<dd>+ for labeled list items
258
+ that don't have a definition
259
+
250
260
  * In Asciidoctor, a horizontal ruler can have attributes
251
261
 
252
262
  * Asciidoctor wraps +<col>+ elements in +<colgroup>+ in tables
@@ -279,7 +289,7 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
279
289
  * Asciidoctor honors the id, title, role and levels attributes set on
280
290
  the toc macro.
281
291
 
282
- * Asciidoctor does not output two tocs with the same id.
292
+ * Asciidoctor does not output two TOCs with the same id.
283
293
 
284
294
  * Asciidoctor is nice about using a section title syntax inside a
285
295
  delimited block by simply ignoring it (AsciiDoc issues warnings)
@@ -287,7 +297,9 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
287
297
  * Asciidoctor honors the alternate style name "discrete" for a floating
288
298
  title (i.e., +[discrete]+)
289
299
 
290
- * Asciidoctor supports syntax highlighting of listing or literal blocks
300
+ * Asciidoctor supports the +pass+ style on open blocks and paragraphs
301
+
302
+ * Asciidoctor supports syntax highlighting of listing, literal or open blocks
291
303
  that have the "source" style out of the box
292
304
 
293
305
  ** Asciidoctor honors the source-highlighter values +coderay+ and
@@ -296,6 +308,9 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
296
308
  ** Asciidoctor does not currently support Pygments for source
297
309
  highlighting
298
310
 
311
+ ** Asciidoctor gracefully falls back to listing block if no source language
312
+ is specified
313
+
299
314
  * Asciidoctor sets these additional intrinsic attributes
300
315
 
301
316
  +asciidoctor+::
@@ -311,7 +326,7 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
311
326
  * Use can set the extension for icons using the +icontype+ attribute
312
327
  (AsciiDoc defaults to .png)
313
328
 
314
- * AsciiDoc uses the +<blockquote>+ for the content and +<cite>+ tag for
329
+ * Asciidoctor uses the +<blockquote>+ for the content and +<cite>+ tag for
315
330
  attribution title in the HTML output for quote blocks, requiring some
316
331
  additional styling to match AsciiDoc
317
332
  +
@@ -319,11 +334,22 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
319
334
  cite { color: navy; }
320
335
  +
321
336
 
337
+ * Asciidoctor supports markdown-style blockquotes as well as a shorthand
338
+ for a blockquote paragraph.
339
+
340
+ * Asciidoctor supports markdown-style headings (section titles)
341
+
322
342
  * Asciidoctor does not support the deprecated index term syntax (`++`
323
343
  and `+++`)
324
344
 
325
- * Asciidoctor does not yet ship w/ a stylesheet, must provide your own
326
- using the +stylesheet+ attribute
345
+ * Asciidoctor includes a modern default stylesheet based on Foundation.
346
+
347
+ * Asciidoctor links to, rather than embeds, the default stylesheet into
348
+ the document by default (e.g., +linkcss+). To include the default
349
+ stylesheet, you can either use the +copycss+ attribute to tell
350
+ Asciidoctor to copy it to the output directory, or you can embed it
351
+ into the document using the +linkcss!+ attribute. You can also provide
352
+ your own stylesheet using the +stylesheet+ attribute.
327
353
 
328
354
  * Asciidoctor introduces the +hardbreaks+ attribute, which inserts a
329
355
  line break character after each line of wrapped text
@@ -358,6 +384,19 @@ NOTE: In general, Asciidoctor handles whitespace much more intelligently
358
384
  when SafeMode is SECURE or greater (this makes for a friendly
359
385
  experience on GitHub)
360
386
 
387
+ * Asciidoctor supports up to 6 section levels (to cover all heading levels in
388
+ HTML) whereas AsciiDoc stops at 5; note the 6 section level is only available
389
+ using the single-line section title syntax
390
+
391
+ * Admonition block style is added to class of outer div in html5 backend
392
+ in Asciidoctor
393
+
394
+ * Admonition block caption can be overridden in Asciidoctor using the
395
+ +caption+ block attribute
396
+
397
+ * Asciidoctor will parse attributes in link macros if the +linkattrs+
398
+ attribute is set on the document.
399
+
361
400
  If there's a difference you don't see in this list, check the {issues}[issue
362
401
  tracker] to see if it's an outstanding feature, or file an issue to report the
363
402
  difference.
@@ -420,8 +459,8 @@ This library aims to support the following Ruby implementations:
420
459
  * Ruby 1.8.7
421
460
  * Ruby 1.9.3
422
461
  * Ruby 2.0.0
423
- * JRuby 1.7.2
424
- * Rubinius 1.2.4
462
+ * JRuby 1.7.4
463
+ * Rubinius nightly
425
464
 
426
465
  If something doesn't work on one of these interpreters, it should be
427
466
  considered a bug.
@@ -448,14 +487,19 @@ GitHub organization:: {org}
448
487
 
449
488
  == Authors
450
489
 
451
- *Asciidoctor* was written by Ryan Waldron, Dan Allen and
452
- {contributors}[other contributors].
490
+ *Asciidoctor* was written by https://github.com/mojavelinux[Dan Allen],
491
+ https://github.com/erebor[Ryan Waldron],
492
+ https://github.com/lightguard[Jason Porter], https://github.com/nickh[Nick
493
+ Hengeveld] and {contributors}[other contributors].
453
494
 
454
495
  *AsciiDoc* was written by Stuart Rackham and has received contributions
455
496
  from many other individuals.
456
497
 
457
498
  == Copyright
458
499
 
459
- Copyright (C) 2012-2013 Ryan Waldron and Dan Allen. See {license}[LICENSE] for details.
500
+ Copyright (C) 2012-2013 Dan Allen and Ryan Waldron. Free use of this
501
+ software is granted under the terms of the MIT License.
502
+
503
+ See the {license}[LICENSE] file for details.
460
504
 
461
505
  // vim: tw=72
data/Rakefile CHANGED
@@ -47,12 +47,22 @@ task :default => :test
47
47
 
48
48
  require 'rake/testtask'
49
49
  Rake::TestTask.new(:test) do |test|
50
+ puts "LANG: #{ENV['LANG']}"
50
51
  test.libs << 'lib' << 'test'
51
52
  test.pattern = 'test/**/*_test.rb'
52
53
  test.warning = true
53
54
  test.verbose = true
54
55
  end
55
56
 
57
+ # Run tests with Encoding::default_external set to US-ASCII
58
+ Rake::TestTask.new(:test_us_ascii) do |test|
59
+ test.libs << 'lib' << 'test'
60
+ test.pattern = 'test/**/*_test.rb'
61
+ test.warning = true
62
+ test.verbose = true
63
+ test.ruby_opts << '-EUS-ASCII' if RUBY_VERSION >= '1.9'
64
+ end
65
+
56
66
  desc "Generate RCov test coverage and open in your browser"
57
67
  task :coverage do
58
68
  require 'rcov'
data/asciidoctor.gemspec CHANGED
@@ -1,69 +1,52 @@
1
- ## This is the rakegem gemspec template. Make sure you read and understand
2
- ## all of the comments. Some sections require modification, and others can
3
- ## be deleted if you don't need them. Once you understand the contents of
4
- ## this file, feel free to delete any comments that begin with two hash marks.
5
- ## You can find comprehensive Gem::Specification documentation, at
6
- ## http://docs.rubygems.org/read/chapter/20
7
1
  Gem::Specification.new do |s|
8
2
  s.specification_version = 2 if s.respond_to? :specification_version=
9
3
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
10
4
  s.rubygems_version = '1.8.5'
11
5
 
12
- ## This group of properties is updated automatically by the Rake build when
13
- ## cutting a new release (see the validate task)
6
+ ## name, version, date and rubyforge_project are updated automatically by the
7
+ ## Rake build (see the validate task)
14
8
  s.name = 'asciidoctor'
15
- s.version = '0.1.2'
16
- s.date = '2013-04-25'
9
+ s.version = '0.1.3'
10
+ s.date = '2013-05-30'
17
11
  s.rubyforge_project = 'asciidoctor'
18
12
 
19
- ## Make sure your summary is short. The description may be as long
20
- ## as you like.
21
13
  s.summary = 'A native Ruby AsciiDoc syntax processor and publishing toolchain'
22
14
  s.description = <<-EOS
23
- An open source text processor and publishing toolchain, written entirely in Ruby, for converting AsciiDoc markup into HTML 5, DocBook 4.5 and other formats.
15
+ An open source text processor and publishing toolchain written in Ruby for converting AsciiDoc markup into HTML 5, DocBook 4.5 and custom formats.
24
16
  EOS
25
17
  s.license = 'MIT'
26
-
27
- ## List the primary authors. If there are a bunch of authors, it's probably
28
- ## better to set the email to an email list or something. If you don't have
29
- ## a custom homepage, consider using your GitHub URL or the like.
30
- s.authors = ['Ryan Waldron', 'Dan Allen', 'Jeremy McAnally', 'Jason Porter']
31
- s.email = ['rew@erebor.com', 'dan.j.allen@gmail.com']
18
+ s.authors = ['Dan Allen', 'Ryan Waldron', 'Jeremy McAnally', 'Jason Porter', 'Nick Hengeveld']
19
+ s.email = ['dan.j.allen@gmail.com', 'rew@erebor.com']
32
20
  s.homepage = 'http://asciidoctor.org'
33
21
 
34
- ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
35
- ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
36
22
  s.require_paths = %w[lib]
37
-
38
- ## If your gem includes any executables, list them here.
39
23
  s.executables = ['asciidoctor', 'asciidoctor-safe']
40
24
 
41
- ## Specify any RDoc options here. You'll want to add your README and
42
- ## LICENSE files to the extra_rdoc_files list.
25
+ s.has_rdoc = true
43
26
  s.rdoc_options = ['--charset=UTF-8']
44
27
  s.extra_rdoc_files = %w[LICENSE]
45
28
 
46
29
  ## List your runtime dependencies here. Runtime dependencies are those
47
30
  ## that are needed for an end user to actually USE your code.
31
+ #s.add_dependency 'foo', '~> 1.0.0'
48
32
 
49
- ## List your development dependencies here. Development dependencies are
50
- ## those that are only needed during development
33
+ ## Development dependencies are libraries only needed during development or
34
+ ## testing
51
35
  s.add_development_dependency('coderay')
52
36
  s.add_development_dependency('erubis')
53
- s.add_development_dependency('htmlentities')
54
- s.add_development_dependency('mocha')
55
37
  s.add_development_dependency('nokogiri')
56
38
  s.add_development_dependency('pending')
57
39
  s.add_development_dependency('rake')
58
40
  s.add_development_dependency('rdoc', '~> 3.12')
59
41
  s.add_development_dependency('tilt')
60
42
 
61
- ## Leave this section as-is. It will be automatically generated from the
62
- ## contents of your Git repository via the gemspec task. DO NOT REMOVE
63
- ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
43
+ ## The manifest section is automatically generated by the Rake build
44
+ ## based on the contents of the Git repository (see the gemspec task).
45
+ ## DO NOT REMOVE THE = MANIFEST = DELIMITERS!
64
46
  # = MANIFEST =
65
47
  s.files = %w[
66
48
  Gemfile
49
+ Guardfile
67
50
  LICENSE
68
51
  README.adoc
69
52
  Rakefile
@@ -75,6 +58,7 @@ EOS
75
58
  lib/asciidoctor/abstract_block.rb
76
59
  lib/asciidoctor/abstract_node.rb
77
60
  lib/asciidoctor/attribute_list.rb
61
+ lib/asciidoctor/backends/_stylesheets.rb
78
62
  lib/asciidoctor/backends/base_template.rb
79
63
  lib/asciidoctor/backends/docbook45.rb
80
64
  lib/asciidoctor/backends/html5.rb
@@ -97,7 +81,6 @@ EOS
97
81
  lib/asciidoctor/version.rb
98
82
  man/asciidoctor.1
99
83
  man/asciidoctor.ad
100
- stylesheets/asciidoctor.css
101
84
  test/attributes_test.rb
102
85
  test/blocks_test.rb
103
86
  test/document_test.rb
@@ -134,7 +117,6 @@ EOS
134
117
  ]
135
118
  # = MANIFEST =
136
119
 
137
- ## Test files will be grabbed from the file list. Make sure the path glob
138
- ## matches what you actually use.
120
+ ## Test files are selected from the file list using the path glob here
139
121
  s.test_files = s.files.select { |path| path =~ /^test\/.*_test\.rb/ }
140
122
  end
data/compat/asciidoc.conf CHANGED
@@ -20,30 +20,107 @@ plus=&#43;
20
20
  space=" "
21
21
  tilde=~
22
22
 
23
+ # enables markdown-style headings
24
+ [titles]
25
+ sect0=^(=|#) +(?P<title>[\S].*?)(?: +\1)?$
26
+ sect1=^(==|##) +(?P<title>[\S].*?)(?: +\1)?$
27
+ sect2=^(===|###) +(?P<title>[\S].*?)(?: +\1)?$
28
+ sect3=^(====|####) +(?P<title>[\S].*?)(?: +\1)?$
29
+ sect4=^(=====|#####) +(?P<title>[\S].*?)(?: +\1)?$
30
+
23
31
  # enables fenced code blocks
24
- # I haven't sorted out yet how to do syntax highlighting
32
+ # FIXME I haven't sorted out yet how to do syntax highlighting
25
33
  [blockdef-fenced-code]
26
34
  delimiter=^```\w*$
27
35
  template::[blockdef-listing]
28
36
 
37
+ # enables blockquotes to be defined using two double quotes
38
+ [blockdef-air-quote]
39
+ delimiter=^""$
40
+ template::[blockdef-quote]
41
+
42
+ # markdown-style blockquote (paragraph only)
43
+ # FIXME does not strip leading > on subsequent lines
44
+ [paradef-markdown-quote]
45
+ delimiter=(?s)>\s*(?P<text>\S.*)
46
+ style=quote
47
+ quote-style=template="quoteparagraph",posattrs=("style","attribution","citetitle")
48
+
49
+ # fix regex for callout list to require number; also makes markdown-style blockquote work
50
+ [listdef-callout]
51
+ posattrs=style
52
+ delimiter=^<?(?P<index>\d+>) +(?P<text>.+)$
53
+ type=callout
54
+ tags=callout
55
+ style=arabic
56
+
29
57
  # enables literal block to be used as code block
30
58
  [blockdef-literal]
31
59
  template::[source-filter-style]
32
60
 
61
+ [tabledef-csv]
62
+ template::[tabledef-default]
63
+ delimiter=^,={3,}$
64
+ format=csv
65
+
66
+ [tabledef-dsv]
67
+ template::[tabledef-default]
68
+ delimiter=^:={3,}$
69
+ format=dsv
70
+
71
+ [macros]
72
+ # btn:[Save]
73
+ (?su)(?<!\w)\\?btn:\[(?P<attrlist>(?:\\\]|[^\]])+?)\]=button
74
+
75
+ # kbd:[F11] or kbd:[Ctrl+T] or kbd:[Ctrl,T]
76
+ (?su)(?<!\w)\\?kbd:\[(?P<attrlist>(?:\\\]|[^\]])+?)\]=keyboard
77
+
78
+ # menu:Search[] or menu:File[New...] or menu:View[Page Style, No Style]
79
+ # TODO implement menu:View[Page Style > No Style] syntax
80
+ (?su)(?<!\w)[\\]?(?P<name>menu):(?P<target>\w|\w.*?\S)?\[(?P<attrlist>.*?)\]=
81
+
33
82
  ifdef::basebackend-html[]
34
83
 
84
+ [button-inlinemacro]
85
+ <b class="button">{1}</b>
86
+
87
+ [keyboard-inlinemacro]
88
+ {set2:keys:{eval:re.split(r'(?<!\+ |.\+)\+', '{1}')}}
89
+ {2%}{eval:len({keys}) == 1}<kbd>{1}</kbd>
90
+ {2%}{eval:len({keys}) == 2}<kbd class="combo"><kbd>{eval:{keys}[0].strip()}</kbd>+<kbd>{eval:{keys}[1].strip()}</kbd></kbd>
91
+ {2%}{eval:len({keys}) == 3}<kbd class="combo"><kbd>{eval:{keys}[0].strip()}</kbd>+<kbd>{eval:{keys}[1].strip()}</kbd>+<kbd>{eval:{keys}[2].strip()}</kbd></kbd>
92
+ {2#}{3%}<kbd class="combo"><kbd>{1}</kbd>+<kbd>{2}</kbd></kbd>
93
+ {3#}<kbd class="combo"><kbd>{1}</kbd>+<kbd>{2}</kbd>+<kbd>{3}</kbd></kbd>
94
+
95
+ [menu-inlinemacro]
96
+ {1%}<span class="menu">{target}</span>
97
+ {1#}{2%}<span class="menuseq"><span class="menu">{target}</span>&#160;&#9656; <span class="menuitem">{1}</span></span>
98
+ {2#}{3%}<span class="menuseq"><span class="menu">{target}</span>&#160;&#9656; <span class="submenu">{1}</span>&#160;&#9656; <span class="menuitem">{2}</span></span>
99
+ {3#}<span class="menuseq"><span class="menu">{target}</span>&#160;&#9656; <span class="submenu">{1}</span>&#160;&#9656; <span class="submenu">{2}</span>&#160;&#9656; <span class="menuitem">{3}</span></span>
100
+
35
101
  [literal-inlinemacro]
36
102
  <code>{passtext}</code>
37
103
 
38
104
  [tags]
105
+ emphasis=<em{1? class="{1}"}>|</em>
106
+ strong=<strong{1? class="{1}"}>|</strong>
39
107
  monospaced=<code{1? class="{1}"}>|</code>
108
+ superscript=<sup{1? class="{1}"}>|</sup>
109
+ subscript=<sub{1? class="{1}"}>|</sub>
40
110
 
41
111
  [monospacedwords]
42
112
  <code>{words}</code>
43
113
 
114
+ [listtags-numbered]
115
+ list=<div class="olist{style? {style}}{compact-option? compact}{role? {role}}"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol class="{style}"{style@loweralpha: type="a"}{style@lowerroman: type="i"}{style@upperalpha: type="A"}{style@upperroman: type="I"}{start? start="{start}"}>|</ol></div>
116
+
44
117
  [tabletags-monospaced]
45
118
  paragraph=<p class="tableblock"><code>|</code></p>
46
119
 
120
+ [sect0]
121
+ <h1{id? id="{id}"} class="sect0">{title}</h1>
122
+ |
123
+
47
124
  # support for document title in embedded documents
48
125
  ifeval::[not config.header_footer]
49
126
  [preamble]
@@ -52,6 +129,7 @@ ifeval::[not config.header_footer]
52
129
  <div class="sectionbody">
53
130
  |
54
131
  </div>
132
+ {toc,toc2#}{toc-placement$preamble:}{template:toc}
55
133
  </div>
56
134
 
57
135
  [sect1]
@@ -109,28 +187,67 @@ template::[attribution]
109
187
  template::[attribution]
110
188
  </div>
111
189
 
190
+ # override tabletags to support cellbgcolor
191
+ [tabletags-default]
192
+ headdata=<th class="tableblock halign-{halign=left} valign-{valign=top}"{colspan@1:: colspan="{colspan}"}{rowspan@1:: rowspan="{rowspan}"}{cellbgcolor? style="background-color:{cellbgcolor};"}>|</th>
193
+ bodydata=<td class="tableblock halign-{halign=left} valign-{valign=top}"{colspan@1:: colspan="{colspan}"}{rowspan@1:: rowspan="{rowspan}"}{cellbgcolor? style="background-color:{cellbgcolor};"}>|</td>
194
+
195
+ [toc]
196
+ <div id="toc">
197
+ <div id="toctitle">{toc-title}</div>
198
+ ifdef::toc2[]
199
+ <script type="text/javascript">
200
+ document.body.className += ' toc2';
201
+ document.getElementById('toc').className = 'toc2';
202
+ </script>
203
+ endif::toc2[]
204
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
205
+ </div>
206
+
112
207
  endif::basebackend-html[]
113
208
 
114
209
  # Override docinfo to support subtitle
115
210
  ifdef::basebackend-docbook[]
116
211
 
212
+ [button-inlinemacro]
213
+ <guibutton>{1}</guibutton>
214
+
215
+ [keyboard-inlinemacro]
216
+ {set2:keys:{eval:re.split(r'(?<!\+ |.\+)\+', '{1}')}}
217
+ {2%}{eval:len({keys}) == 1}<keycap>{1}</keycap>
218
+ {2%}{eval:len({keys}) == 2}<keycombo><keycap>{eval:{keys}[0].strip()}</keycap><keycap>{eval:{keys}[1].strip()}</keycap></keycombo>
219
+ {2%}{eval:len({keys}) == 3}<keycombo><keycap>{eval:{keys}[0].strip()}</keycap><keycap>{eval:{keys}[1].strip()}</keycap><keycap>{eval:{keys}[2].strip()}</keycap></keycombo>
220
+ {2#}{3%}<keycombo><keycap>{1}</keycap><keycap>{2}</keycap></keycombo>
221
+ {3#}<keycombo><keycap>{1}</keycap><keycap>{2}</keycap><keycap>{3}</keycap></keycombo>
222
+
223
+ [menu-inlinemacro]
224
+ {1%}<guimenu>{target}</guimenu>
225
+ {1#}{2%}<menuchoice><guimenu>{target}</guimenu> <guimenuitem>{1}</guimenuitem></menuchoice>
226
+ {2#}{3%}<menuchoice><guimenu>{target}</guimenu> <guisubmenu>{1}</guisubmenu> <guimenuitem>{2}</guimenuitem></menuchoice>
227
+ {3#}<menuchoice><guimenu>{target}</guimenu> <guisubmenu>{1}</guisubmenu> <guisubmenu>{2}</guisubmenu> <guimenuitem>{3}</guimenuitem></menuchoice>
228
+
229
+ # override tabletags to support cellbgcolor
230
+ [tabletags-default]
231
+ headdata=<entry align="{halign}" valign="{valign}"{colspan@1:: namest="col_{colstart}" nameend="col_{colend}"}{morerows@0:: morerows="{morerows}"}>{cellbgcolor?<?dbfo bgcolor="{cellbgcolor}"?>}|</entry>
232
+ bodydata=<entry align="{halign}" valign="{valign}"{colspan@1:: namest="col_{colstart}" nameend="col_{colend}"}{morerows@0:: morerows="{morerows}"}>{cellbgcolor?<?dbfo bgcolor="{cellbgcolor}"?>}|</entry>
233
+
117
234
  [docinfo]
118
235
  ifndef::notitle[]
119
236
  {set2:subtitle_offset:{eval:'{doctitle}'.rfind(': ')}}
120
- {eval:{subtitle_offset} != -1} <title>{eval:'{doctitle}'[0:{subtitle_offset}]}</title>
121
- {eval:{subtitle_offset} != -1} <subtitle>{eval:'{doctitle}'[{subtitle_offset} + 2:]}</subtitle>
122
- {eval:{subtitle_offset} < 0} <title>{doctitle}</title>
237
+ {eval:{subtitle_offset} != -1}<title>{eval:'{doctitle}'[0:{subtitle_offset}]}</title>
238
+ {eval:{subtitle_offset} != -1}<subtitle>{eval:'{doctitle}'[{subtitle_offset} + 2:]}</subtitle>
239
+ {eval:{subtitle_offset} < 0}<title>{doctitle}</title>
123
240
  endif::notitle[]
124
- <date>{revdate}</date>
241
+ <date>{revdate}</date>
125
242
  # To ensure valid articleinfo/bookinfo when there is no AsciiDoc header.
126
- {doctitle%}{revdate%}<date>{docdate}</date>
127
- {authored#}<author>
128
- <firstname>{firstname}</firstname>
129
- <othername>{middlename}</othername>
130
- <surname>{lastname}</surname>
131
- <email>{email}</email>
132
- {authored#}</author>
133
- <authorinitials>{authorinitials}</authorinitials>
243
+ {doctitle%}{revdate%}<date>{docdate}</date>
244
+ {authored#}<author>
245
+ <firstname>{firstname}</firstname>
246
+ <othername>{middlename}</othername>
247
+ <surname>{lastname}</surname>
248
+ <email>{email}</email>
249
+ {authored#}</author>
250
+ <authorinitials>{authorinitials}</authorinitials>
134
251
  <revhistory><revision>{revnumber?<revnumber>{revnumber}</revnumber>}<date>{revdate}</date>{authorinitials?<authorinitials>{authorinitials}</authorinitials>}{revremark?<revremark>{revremark}</revremark>}</revision></revhistory>
135
252
  {docinfo1,docinfo2#}{include:{docdir}/docinfo.xml}
136
253
  {docinfo,docinfo2#}{include:{docdir}/{docname}-docinfo.xml}