From e4204729c23e9f31199888e30288516fdd17bbf9 Mon Sep 17 00:00:00 2001 From: PoiScript Date: Tue, 5 Nov 2019 17:02:20 +0800 Subject: [PATCH] fix: ignore trailing newline in table parsing (#4) --- src/parsers.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/parsers.rs b/src/parsers.rs index 462aed3..5f9d1fe 100644 --- a/src/parsers.rs +++ b/src/parsers.rs @@ -1,5 +1,3 @@ -// parser related functions - use std::borrow::Cow; use std::iter::once; use std::marker::PhantomData; @@ -722,7 +720,8 @@ pub fn parse_org_table<'a, T: ElementArena<'a>>( let line = contents[last_end..start].trim_start(); if line.starts_with("|-") { arena.append(TableRow::Rule, parent); - } else { + } else if !line.is_empty() { + // ignores trailing newline let parent = arena.append(TableRow::Standard, parent); for content in line.split_terminator('|').skip(1) { let node = arena.append(Element::TableCell, parent);