diff options
author | Philipp A | 2023-12-28 15:37:38 +0100 |
---|---|---|
committer | GitHub | 2023-12-28 14:37:38 +0000 |
commit | 774dd4798aedc40b38c6480e9c47f34c482f12d0 (patch) | |
tree | 48411fb82c50de0ba07282bc5d6f333305f48f4e /rst/src | |
parent | 2a76f2dde6533c09f8e93b44d1f214a105d9c5c2 (diff) | |
download | rust-rst-774dd4798aedc40b38c6480e9c47f34c482f12d0.tar.bz2 |
Trailing newlines (#31)
Diffstat (limited to 'rst/src')
-rw-r--r-- | rst/src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rst/src/main.rs b/rst/src/main.rs index 0339ce1..8b616f9 100644 --- a/rst/src/main.rs +++ b/rst/src/main.rs @@ -32,7 +32,11 @@ fn main() -> CliResult { args.verbosity.setup_env_logger("rst")?; // TODO: somehow make it work without replacing tabs - let content = read_file(args.file)?.replace('\t', " ".repeat(8).as_ref()); + let mut content = read_file(args.file)?.replace('\t', " ".repeat(8).as_ref()); + // Allows for less complex grammar + if !content.ends_with('\n') { + content.push('\n'); + } let document = parse(&content)?; let stdout = std::io::stdout(); match args.format { |