peposso / lua-tinyyaml

a tiny yaml (subset) parser for pure lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Several blank lines in multi-line scalar values collapsed to one

Witiko opened this issue · comments

The following two YAML documents will produce the same output when passed to tinyyaml.parse().

first_input = [[
abstract: |
  This is *the abstract*.
  It consists of two paragraphs.
]]

second_input = [[
abstract: |
  This is *the abstract*.

  It consists of two paragraphs.
]]

tinyyaml = require("tinyyaml")
for k, v in pairs(tinyyaml.parse(first_input)) do
  print(k, v)
end
for k, v in pairs(tinyyaml.parse(second_input)) do
  print(k, v)
end

Executing the above code in Lua 5.2.4 and in Lua 5.3 gives me the following results:

abstract        This is *the abstract*.
It consists of two paragraphs.

abstract        This is *the abstract*.
It consists of two paragraphs.

Here is the expected output:

abstract        This is *the abstract*.
It consists of two paragraphs.

abstract        This is *the abstract*.

It consists of two paragraphs.