git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: better handling of line breaks in simple tables.

Now we also handle the case where they're embedded in other elements, e.g. spans. Closes #7272.

commit2bd5d0cafbe67fa723f49fd2d35d913594fdb935 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 11 May 2021, 07:52 (5 years ago) parentff7176d
2 files changed+25−3
src/Text/Pandoc/Writers/LaTeX/Table.hs+1−3 test/command/7272.md+24
src/Text/Pandoc/Writers/LaTeX/Table.hs+1−3
@@ -219,9 +219,7 @@ footRows (Ann.TableFoot _attr rows) = map headerRowCells rows
219219-- we need to go to some lengths to get line breaks working:
220220-- as LineBreak bs = \vtop{\hbox{\strut as}\hbox{\strut bs}}.
221221fixLineBreaks :: Block -> Block
222−fixLineBreaks (Para ils) = Para $ fixLineBreaks' ils
223−fixLineBreaks (Plain ils) = Plain $ fixLineBreaks' ils
224−fixLineBreaks x = x
222+fixLineBreaks = walk fixLineBreaks'
225223
226224fixLineBreaks' :: [Inline] -> [Inline]
227225fixLineBreaks' ils = case splitBy (== LineBreak) ils of
test/command/7272.mdnew file+24
@@ -0,0 +1,24 @@
1+```
2+% pandoc -t latex -f html
3+<table>
4+ <tbody>
5+ <tr>
6+ <td>
7+ <span>
8+ text
9+ <br />
10+ text2
11+ </span>
12+ </td>
13+ </tr>
14+ </tbody>
15+</table>
16+^D
17+\begin{longtable}[]{@{}
18+ >{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{1.00}}@{}}
19+\toprule
20+\endhead
21+{\vtop{\hbox{\strut text}\hbox{\strut text2 }}} \\
22+\bottomrule
23+\end{longtable}
24+```