Markdown Writer writes out front matter part with Linux EOL even on Windows

Issue #816 new
Kuro Kurosaka created an issue

Markdown Writer seems to write all lines of Markdown's Front Matter (the YAML block at the beginning of a Markdown file) with the Linux/Unix end-of-line, i.e. NL only, even on the Windows platform and the input file has DOS/Windows CR/LF new lines.

To reproduce, copy the following files from Okapi source file tree to where tikal.bat exists: okapi/filters/markdown/src/test/resources/net/sf/okapi/filters/markdown/complex_frontmatter.md okapi/filters/markdown//src/test/resources/net/sf/okapi/filters/markdown/okf_markdown@custom_markdown.fprm okapi/filters/markdown//src/test/resources/net/sf/okapi/filters/markdown/okf_yaml@custom_markdown.fprm

Convert the end of line to CR/LF, if they are not. (git should convert them automatically...)

Run:

       tikal.bat -x complex_frontmatter.md -fc kf_markdown@custom_markdown

       tikal.bat -m  complex_frontmatter.m.xlf -fc kf_markdown@custom_markdown

Open the out.md file with Notepad. You'll see a long second line because Notepad doesn't recognizes NL alone as a new line character.

The reporter was working on MarkdownWriterTest to remove Util.normalizeNewlines call from the private method getFileContents(String) because he wanted to have a unit test case to verify that DOS-convention file can be handled properly on Linux machine and vice versa. After removing normalizeNewlines, MarkdownWriterTest.testComplexFrontMatterIncludedDefaultFilter() failed. Further investigation revealed this bug. The test case will be marked with the \@Ignored annotation.

Note: this was verified with M37.

Comments (4)

  1. Log in to comment