Skip to content

Commit 5a006ef

Browse files
committed
ensure markdown export is using only LF as end of line
Web browsers send multiline textarea value with CRLF as end of line. As the markdown export uses the raw value from database, we need to replace the CRLF by LF end of lines. Otherwise the file will have both type of end of lines. See suivi request: https://linuxfr.org/suivi/export-markdown
1 parent 1d72a29 commit 5a006ef

6 files changed

Lines changed: 7 additions & 7 deletions

File tree

app/views/diaries/show.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= render "nodes/front_matter", :content => @diary %>
22

3-
<%= raw @diary.wiki_body %>
3+
<%= raw @diary.wiki_body.encode(universal_newline: true) %>

app/views/news/show.md.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%= render "nodes/front_matter", :content => @news %>
22

3-
<%= raw @news.wiki_body %>
3+
<%= raw @news.wiki_body.encode(universal_newline: true) %>
44

55
----
66

@@ -10,4 +10,4 @@
1010

1111
----
1212

13-
<%= raw @news.wiki_second_part %>
13+
<%= raw @news.wiki_second_part.encode(universal_newline: true) %>

app/views/polls/show.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<%= render "nodes/front_matter", :content => @poll %>
22

3-
<%= raw @poll.wiki_explanations %>
3+
<%= raw @poll.wiki_explanations.encode(universal_newline: true) %>
44

55
<%- @poll.answers.each do |answer| -%>
66
* <%= raw answer.answer %>

app/views/posts/show.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= render "nodes/front_matter", :content => @post %>
22

3-
<%= raw @post.wiki_body %>
3+
<%= raw @post.wiki_body.encode(universal_newline: true) %>

app/views/trackers/show.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= render "nodes/front_matter", :content => @tracker %>
22

3-
<%= raw @tracker.wiki_body %>
3+
<%= raw @tracker.wiki_body.encode(universal_newline: true) %>

app/views/wiki_pages/show.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= render "nodes/front_matter", :content => @wiki_page %>
22

3-
<%= raw @wiki_page.versions.first.body %>
3+
<%= raw @wiki_page.versions.first.body.encode(universal_newline: true) %>

0 commit comments

Comments
 (0)