sandflow / ttconv

Subtitle conversion. Converts STL, SRT, TTML and SCC into TTML, WebVTT and SRT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SRT Writer: Handling of newlines when input content has @xml:space = "preserve"

xchange11 opened this issue · comments

The following IMSC document input:

<ttml:tt xmlns:ttml="http://www.w3.org/ns/ttml"
    xmlns:ttp="http://www.w3.org/ns/ttml#parameter"
    xmlns:tts="http://www.w3.org/ns/ttml#styling" xml:lang="de" ttp:cellResolution="44 29">
    <ttml:head>
        <ttml:layout>
            <ttml:region xml:id="r0" tts:displayAlign="after" tts:extent="90% 80%" tts:origin="5% 10%" />
        </ttml:layout>
    </ttml:head>
    <ttml:body>
        <ttml:div xml:space="preserve">
            <ttml:p region="r0" begin="00:00:01.160" end="00:00:03.160" tts:fontSize="160%" tts:lineHeight="125%" tts:textAlign="center" xml:space="preserve">
                
            Test whitespace handling
            
        </ttml:p>
        </ttml:div>
    </ttml:body>
</ttml:tt>

Results in the following (invalid) SRT output:

1
00:00:01,160 --> 00:00:03,160

            Test whitespace handling

The empty line between timing and subtitle content needs to be removed.