Klafyvel/Norg.jl

BUG: `example` scope parse result does not contain newlines

pysan3 opened this issue · 1 comments

pysan3 commented

Hi, thanks a lot for the amazing work.

As I was writing a pandoc json -> norg converter, I noticed a bug with example scopes that newlines are not included into c.text.

Example

@document.meta
title: tmp_example
description:
authors: takuto
categories:
created: 2023-10-30T18:22:27+0900
updated: 2023-10-30T18:22:28+0900
version: 1.1.1
@end

* Example Is Not Parsed Correctly

  |example
  I am a paragraph segment.
  I am another paragraph segment.
  Together we form a paragraph.
  |end

Result

{
  "pandoc-api-version": [
    1,
    23
  ],
  "meta": {},
  "blocks": [
    {
      "t": "Div",
      "c": [
        [
          "section-h1-example-is-not-parsed-correctly",
          [],
          []
        ],
        [
          {
            "t": "Header",
            "c": [
              1,
              [
                "h1-example-is-not-parsed-correctly",
                [],
                []
              ],
              [
                {
                  "t": "Str",
                  "c": "Example"
                },
                {
                  "t": "Space"
                },
                {
                  "t": "Str",
                  "c": "Is"
                },
                {
                  "t": "Space"
                },
                {
                  "t": "Str",
                  "c": "Not"
                },
                {
                  "t": "Space"
                },
                {
                  "t": "Str",
                  "c": "Parsed"
                },
                {
                  "t": "Space"
                },
                {
                  "t": "Str",
                  "c": "Correctly"
                }
              ]
            ]
          }
        ]
      ]
    },
    {
      "t": "CodeBlock",
      "c": [
        [
          "",
          [
            "norg"
          ],
          []
        ],
        "  I am a paragraph segment.  I am another paragraph segment.  Together we form a paragraph."
      ]
    }
  ]
}

Expected

Newline \n not being ignored.

...
    {
      "t": "CodeBlock",
      "c": [
        [
          "",
          [
            "norg"
          ],
          []
        ],
        "  I am a paragraph segment.\n  I am another paragraph segment.\n  Together we form a paragraph.\n"
      ]
    }
...