Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
Signed-off-by: Miek Gieben <[email protected]>
  • Loading branch information
miekg committed Oct 10, 2018
1 parent c1f2c2e commit b737e8b
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 24 deletions.
4 changes: 1 addition & 3 deletions markdown/renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ func (r *Renderer) paragraph(w io.Writer, para *ast.Paragraph, entering bool) {
indented[plen+0] = '1'
indented[plen+1] = ' '
indented[plen+2] = '.'

case x&ast.ListTypeTerm != 0:
// nothing
indented = indented[plen+3:] // remove prefix.
case x&ast.ListTypeDefinition != 0:
indented[plen+0] = ':'
indented[plen+1] = ' '
Expand Down Expand Up @@ -551,7 +550,6 @@ func (r *Renderer) RenderHeader(_ io.Writer, _ ast.Node) {}
func (r *Renderer) writeDocumentHeader(_ io.Writer) {}

func (r *Renderer) RenderFooter(w io.Writer, _ ast.Node) {
return
buf, ok := w.(*bytes.Buffer)
if !ok {
return
Expand Down
22 changes: 22 additions & 0 deletions testdata/markdown/def-list.fmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module rule:

: controls access for definitions in a specific YANG module, identified by its
name.

protocol operation rule:

: controls access for a specific protocol operation, identified by its YANG
module and name.

data node rule:

: controls access for a specific data node and its descendants, identified by
its path location within the conceptual XML document for the data node.

notification rule:

: controls access for a specific notification event type, identified by its
YANG module and name.

More.

14 changes: 14 additions & 0 deletions testdata/markdown/def-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module rule:
: controls access for definitions in a specific YANG module, identified by its name.

protocol operation rule:
: controls access for a specific protocol operation, identified by its YANG module and name.

data node rule:
: controls access for a specific data node and its descendants, identified by its path location
within the conceptual XML document for the data node.

notification rule:
: controls access for a specific notification event type, identified by its YANG module and name.

More.
5 changes: 3 additions & 2 deletions testdata/markdown/list-in-aside.fmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
A> * this is a list more rehjsh dhsjd hsj dhsjds hdjs dhsjdshjd sdhsj dshjdsh
A> dsjd shjdshdsjdshd sdhsj
A>
A>
A> * more list
A>
A>
A> * even more list

5 changes: 3 additions & 2 deletions testdata/markdown/list-in-quote.fmt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
> * this is a list more rehjsh dhsjd hsj dhsjds hdjs dhsjdshjd sdhsj dshjdsh
> dsjd shjdshdsjdshd sdhsj
>
>
> * more list
>
>
> * even more list

5 changes: 3 additions & 2 deletions testdata/markdown/list-paragraph.fmt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
* item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1

* item2 item2

* item3 item3 item3 item3 item3 item3 item3 item3 item3 item3 item3 item3 item3
item3 item3 item3 item3 item3 item3 item3 item3 item3

More text.

7 changes: 4 additions & 3 deletions testdata/markdown/list.fmt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
* item1

* item2

* item3

* item4

10 changes: 5 additions & 5 deletions testdata/markdown/table-in-quote.fmt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
> Name | Age
> Name | Age
> ---------|-----
> Bob | 27
> Alice | 23
> Charlie | 1
> Bob | 27
> Alice | 23
> Charlie | 1
> =========|=====
> Total | 50
> Total | 50

5 changes: 3 additions & 2 deletions testdata/markdown/table-simple.fmt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Name | Age
Name | Age
------|-----
Bob | 27
Bob | 27
Alice | 23

11 changes: 6 additions & 5 deletions testdata/markdown/table.fmt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Name | Age
Name | Age
---------|-----
Bob | 27
Alice | 23
Charlie | 1
Bob | 27
Alice | 23
Charlie | 1
=========|=====
Total | 50
Total | 50

0 comments on commit b737e8b

Please sign in to comment.