On Windows, there were problems with lines not being split correctly

On Windows, the below comparison (if line == "---") did not trigger, because there were some line endings left in the string. I trimmed These remaining trailing whitespaces away. 
to avoid the risk of any use of the `line` field below, could you move the `replace` to the condition on line 12?