From e83a870d32c06104621f912df8ce729dbbc05778 Mon Sep 17 00:00:00 2001 From: OlteanuRares Date: Mon, 16 Sep 2024 17:31:57 +0300 Subject: [PATCH] OCTO-11088-fix-text-positioning --- docs/changelog.rst | 4 ++++ pycaption/webvtt.py | 11 ++--------- setup.py | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7e751ec2..b49f0b07 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,5 +1,9 @@ Changelog --------- +2.2.14 +^^^^^^ +- Fix an issue with WebVTT writer text positioning on break inside a cue. + 2.2.13 ^^^^^^ - Mid-row codes only add spaces only if there isn't one before. diff --git a/pycaption/webvtt.py b/pycaption/webvtt.py index 805663f8..c3573b29 100644 --- a/pycaption/webvtt.py +++ b/pycaption/webvtt.py @@ -394,7 +394,6 @@ def _group_cues_by_layout(self, nodes, caption_set): return [] current_layout = None - current_node = None # A list with layout groups. Since WebVTT only support positioning # for different cues, each layout group has to be represented in a @@ -408,18 +407,12 @@ def _group_cues_by_layout(self, nodes, caption_set): if s and current_layout and node.layout_info != current_layout: # If the positioning changes from one text node to # another, a new WebVTT cue has to be created. - row, column = node.position if node.position else (0, 0) - prev_row, prev_column = ( - current_node.position if current_node.position else (0, 0) - ) - if row != prev_row + 1: - layout_groups.append((s, current_layout)) - s = "" + layout_groups.append((s, current_layout)) + s = "" # ATTENTION: This is where the plain unicode node content is # finally encoded as WebVTT. s += self._encode_illegal_characters(node.content) or " " current_layout = node.layout_info - current_node = node elif node.type_ == CaptionNode.STYLE: resulting_style = self._calculate_resulting_style( node.content, caption_set diff --git a/setup.py b/setup.py index 54aeeb68..5d23d39c 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( name="pycaption", - version="2.2.13", + version="2.2.14.dev1", description="Closed caption converter", long_description=open(README_PATH).read(), author="Joe Norton",