diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2017-05-18 23:54:16 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-18 23:54:16 -0600 |
| commit | 3114709d3ea712bf26b1209211e5644a4cf5c295 (patch) | |
| tree | e622157bc5d3a5876c42676efd0fc3b46f1969d5 /test/fixtures | |
| parent | 9b68c2ed15fb340c7c5f320b5bc761c6ef9a7d9f (diff) | |
resolves #1516 add option to exclude tags when including file (PR #2196)
- in addition to including tags, add option to exclude tags using !name syntax
- introduce wildcard for including all (*) or excluding all (!*) tags
- introduce wildcard for selecting non-tagged lines (**)
- don't select nested tags with wildcard if ancestor tag is excluded
- warn if a mismatched or unexpected end tag is found
- improve efficiency of detecting and processing tag directives
- maintain a tag stack for handling nested tags
- skip call to push_include if selected lines array is empty
- ignore tag and tags attribute if empty (previously caused an infinite loop)
- add tests for excluding tags
Diffstat (limited to 'test/fixtures')
| -rw-r--r-- | test/fixtures/mismatched-end-tag.adoc | 7 | ||||
| -rw-r--r-- | test/fixtures/tagged-class-enclosed.rb | 26 | ||||
| -rw-r--r-- | test/fixtures/tagged-class.rb | 23 |
3 files changed, 56 insertions, 0 deletions
diff --git a/test/fixtures/mismatched-end-tag.adoc b/test/fixtures/mismatched-end-tag.adoc new file mode 100644 index 00000000..a9510c7d --- /dev/null +++ b/test/fixtures/mismatched-end-tag.adoc @@ -0,0 +1,7 @@ +//tag::a[] +a +//tag::b[] +b +//end::a[] +//end::b[] +c diff --git a/test/fixtures/tagged-class-enclosed.rb b/test/fixtures/tagged-class-enclosed.rb new file mode 100644 index 00000000..5ebfd373 --- /dev/null +++ b/test/fixtures/tagged-class-enclosed.rb @@ -0,0 +1,26 @@ +#tag::all[] +class Dog + #tag::init[] + def initialize breed + @breed = breed + end + #end::init[] + #tag::bark[] + + def bark + #tag::bark-beagle[] + if @breed == 'beagle' + 'woof woof woof woof woof' + #end::bark-beagle[] + #tag::bark-other[] + else + 'woof woof' + #end::bark-other[] + #tag::bark-all[] + #tag::bark-all[] + end + #end::bark-all[] + end + #end::bark[] +end +#end::all[] diff --git a/test/fixtures/tagged-class.rb b/test/fixtures/tagged-class.rb new file mode 100644 index 00000000..66b4c9f5 --- /dev/null +++ b/test/fixtures/tagged-class.rb @@ -0,0 +1,23 @@ +class Dog + #tag::init[] + def initialize breed + @breed = breed + end + #end::init[] + #tag::bark[] + + def bark + #tag::bark-beagle[] + if @breed == 'beagle' + 'woof woof woof woof woof' + #end::bark-beagle[] + #tag::bark-other[] + else + 'woof woof' + #end::bark-other[] + #tag::bark-all[] + end + #end::bark-all[] + end + #end::bark[] +end |
