junegunn / junegunn/vader.vim

Vader swallows Given lines

Open
#211 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
599
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Hi,

please have a look at the following vader file:

```
Given asciidoc (ATX headings);
= ATX title

== ATX heading level 1

=== ATX heading level 2

==== ATX heading level 3

===== ATX heading level 4

====== ATX heading level 5

[[someanchor1]]
=== ATX heading level 2 with preceding anchor line

.some label
== ATX heading level 1 with preceding label line

Execute (print all ATX headings):
echom 'START'
for l in getline(1, '$')
echom l
endfor
echom 'END'

Given asciidoc (Setext headings);
Setext title
============

Setext heading level 1
----------------------

Setext heading level 2
~~~~~~~~~~~~~~~~~~~~~~

Setext heading level 3
^^^^^^^^^^^^^^^^^^^^^^

Setext heading level 4
++++++++++++++++++++++

[[someanchor1]]
Setext heading level 2 with preceding anchor line
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.some label
Setext heading level 1 with preceding label line
------------------------------------------------

Execute (print all Setext headings):
echom 'START'
for l in getline(1, '$')
echom l
endfor
echom 'END'
```

When running `:Vader` this is the output:

```
START
= ATX title
== ATX heading level 1
=== ATX heading level 2
==== ATX heading level 3
===== ATX heading level 4
====== ATX heading level 5
[[someanchor1]]
=== ATX heading level 2 with preceding anchor line
.some label
END
START
Setext title
============
END
```

Vader obviously swallows some lines. At first it seemed to me that it does this when it encounters a line that:

- starts with `=` and
- the line before it is not empty

But if I add

```

== foo

== bar
```

to the end of the "ATX headings" Given block then only the `== bar` line is swallowed.

The behaviour is the same when I use a semicolon instead of a colon after the `Given` line and use indentation.

What is wrong here? It seems that Vader just always chokes on asciidoc syntax.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.