diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-07-15 00:42:43 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-07-15 00:42:43 -0600 |
| commit | 2088cc3508d0fd365cd0856d8fc0bfae0ab1b915 (patch) | |
| tree | 28299eff5568bceed20b36e3a05b2e87ffb83fd0 | |
| parent | 3b10db4ebea27310b3d3bf646f11cb1dafac3251 (diff) | |
| parent | 20f20301a3cd70af162a23aa532baea86f4b72c8 (diff) | |
Merge pull request #1010 from mojavelinux/issue-789
resolves #789 add compliance setting for shorthand property syntax
| -rw-r--r-- | lib/asciidoctor.rb | 4 | ||||
| -rw-r--r-- | lib/asciidoctor/parser.rb | 8 | ||||
| -rw-r--r-- | lib/asciidoctor/substitutors.rb | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb index 540354af..2cf45fc1 100644 --- a/lib/asciidoctor.rb +++ b/lib/asciidoctor.rb @@ -154,6 +154,10 @@ module Asciidoctor # Compliance value: 'drop-line' define :attribute_undefined, 'drop-line' + # Asciidoctor will allow the id, role and options to be set + # on blocks using a shorthand syntax (e.g., #idname.rolename%optionname) + define :shorthand_property_syntax, true + # Asciidoctor will recognize commonly-used Markdown syntax # to the degree it does not interfere with existing # AsciiDoc syntax and behavior. diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb index 75234c79..3ed7481b 100644 --- a/lib/asciidoctor/parser.rb +++ b/lib/asciidoctor/parser.rb @@ -2491,10 +2491,7 @@ class Parser original_style = attributes['style'] raw_style = attributes[1] # NOTE spaces are not allowed in shorthand, so if we find one, this ain't shorthand - if !raw_style || raw_style.include?(' ') - attributes['style'] = raw_style - [raw_style, original_style] - else + if raw_style && !raw_style.include?(' ') && Compliance.shorthand_property_syntax type = :style collector = [] parsed = {} @@ -2570,6 +2567,9 @@ class Parser end [parsed_style, original_style] + else + attributes['style'] = raw_style + [raw_style, original_style] end end diff --git a/lib/asciidoctor/substitutors.rb b/lib/asciidoctor/substitutors.rb index ae6fb8a5..e21af764 100644 --- a/lib/asciidoctor/substitutors.rb +++ b/lib/asciidoctor/substitutors.rb @@ -1070,7 +1070,7 @@ module Substitutors if str.empty? {} - elsif str.start_with?('.') || str.start_with?('#') + elsif (str.start_with?('.') || str.start_with?('#')) && Compliance.shorthand_property_syntax segments = str.split('#', 2) if segments.length > 1 |
