diff --git a/docs/changelog.rst b/docs/changelog.rst index 304f481f..2fc68e9a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -8,6 +8,9 @@ Changelog The buffer lead-time calculation could push a caption's start before its predecessor; now clamped to preserve chronological order. + - Fix DFXPReader producing None entries in CaptionList when + empty

elements yield zero parsed nodes, causing + AttributeError in merge_concurrent_captions() and SRTWriter. 2.2.22 ^^^^^^ diff --git a/docs/conf.py b/docs/conf.py index 8cafb6bd..ecefdce4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,9 +53,9 @@ # built documents. # # The short X.Y version. -version = "2.2.22" +version = "2.2.23.dev1" # The full version, including alpha/beta/rc tags. -release = "2.2.22" +release = "2.2.23.dev1" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pycaption/dfxp/base.py b/pycaption/dfxp/base.py index b6facc97..f4376e3a 100644 --- a/pycaption/dfxp/base.py +++ b/pycaption/dfxp/base.py @@ -147,9 +147,13 @@ def _get_dfxp_parser_class(): def _convert_div_to_caption_list(self, div): return CaptionList( [ - self._convert_p_tag_to_caption(p_tag) - for p_tag in div.find_all("p") - if p_tag.get_text().strip() + caption + for caption in ( + self._convert_p_tag_to_caption(p_tag) + for p_tag in div.find_all("p") + if p_tag.get_text().strip() + ) + if caption is not None ], div.layout_info, ) diff --git a/setup.py b/setup.py index 1ff04f07..fe23fc45 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( name="pycaption", - version="2.2.22", + version="2.2.23.dev1", description="Closed caption converter", long_description=open(README_PATH).read(), author="Joe Norton", diff --git a/tests/conftest.py b/tests/conftest.py index 6f4a007a..39bf9cd6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,6 +45,7 @@ sample_dfxp_with_relativized_positioning, sample_dfxp_with_templated_style, sample_dfxp_without_region_and_style, + sample_dfxp_concurrent_with_empty_p, ) from tests.fixtures.microdvd import missing_fps_sample_microdvd # noqa: F401 from tests.fixtures.microdvd import ( diff --git a/tests/fixtures/dfxp.py b/tests/fixtures/dfxp.py index a02a054b..3cc4bcb0 100644 --- a/tests/fixtures/dfxp.py +++ b/tests/fixtures/dfxp.py @@ -1521,3 +1521,31 @@ def sample_dfxp_default_styling_p_tags(): """ + + +@pytest.fixture(scope="session") +def sample_dfxp_concurrent_with_empty_p(): + return """\ + + + + +