Skip to content

Commit

Permalink
feat(parser): support attribute name in 'endif' directive (#900)
Browse files Browse the repository at this point in the history
name is parsed but no check is done with regards to current ifdef/ifnded
directive.

fixes #898

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Dec 31, 2021
1 parent cb1b357 commit d26aa45
Show file tree
Hide file tree
Showing 3 changed files with 15,951 additions and 15,867 deletions.
32 changes: 32 additions & 0 deletions pkg/parser/document_preprocessing_conditionals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ ifdef::cookie[* conditional content]
Expect(PreparseDocument(source)).To(Equal(expected))
})
})

})

Context("ifndef", func() {
Expand Down Expand Up @@ -333,5 +334,36 @@ closing content`
Expect(PreparseDocument(source, configuration.WithAttribute("sectnumlevels", "2"))).To(Equal(expected))
})
})

Context("endif with attribute name", func() {

It("should support attribute name in endif directive", func() {
source := `:cookie:
intro content
ifdef::cookie[]
cookie content (1)
ifdef::chocolate[]
chocolate content
endif::chocolate[]
cookie content (2)
endif::cookie[]
closing content`
expected := `:cookie:
intro content
cookie content (1)
cookie content (2)
closing content`
Expect(PreparseDocument(source)).To(Equal(expected))
})
})
})
})
Loading

0 comments on commit d26aa45

Please sign in to comment.