Capture carriage returns from Word
See Powell01.
There is a poem at the very end of this chapter, and many of the different lines are being combined into one paragraph, losing the returns that separate the lines. This is because the xml carriage return tag <w:cr/>
comes through as an empty span in the extraction step. Can you please add the xml carriage return tag to the list of elements XSweet pays attention to?
Compare the two examples below.
- Here are two lines in Word that get combined into one p in the html. In the xml, they are separated by a carriage return tag
<w:cr/>
, and many lines like this are enclosed in one single<w:p>
. This get extracted as a series of spans inside one<p>
.
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:tab/>
<w:t>no flood will carry you away.</w:t>
</w:r>
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:cr/></w:r>
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:tab/>
<w:t>You will not taste the river’s evils,</w:t>
</w:r>
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:cr/></w:r>
- This is the xml for two lines that DO come through properly, as separate
<p>
s in the html. These use a close paragraph tag</w:p>
for each line, instead of a<w:cr>
:
<w:p w14:paraId="0E41693A" w14:textId="77777777" w:rsidR="00CE3D10" w:rsidRPr="008B5A47" w:rsidRDefault="00CE3D10" w:rsidP="00CE3D10">
<w:pPr><w:spacing w:line="480" w:lineRule="auto"/>
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr>
</w:pPr>
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:tab/>
<w:t>nor will your boat be idle.</w:t>
</w:r>
</w:p>
<w:p w14:paraId="7E6E92D5" w14:textId="77777777" w:rsidR="00CE3D10" w:rsidRPr="008B5A47" w:rsidRDefault="00CE3D10" w:rsidP="00CE3D10">
<w:pPr><w:spacing w:line="480" w:lineRule="auto"/>
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr>
</w:pPr>
<w:r w:rsidRPr="008B5A47">
<w:rPr><w:rFonts w:ascii="Times New Roman" w:hAnsi="Times New Roman" w:cs="Times New Roman"/></w:rPr><w:tab/>
<w:t>No accident will affect your mast,</w:t>
</w:r>
</w:p>