diff --git a/doc/utils/converters/lammpsdoc/txt2rst.py b/doc/utils/converters/lammpsdoc/txt2rst.py index 3914e5782eeec33f051bcec96c90147448229826..0997af80cda4b65a28f0e89a09503bddba14b2d1 100755 --- a/doc/utils/converters/lammpsdoc/txt2rst.py +++ b/doc/utils/converters/lammpsdoc/txt2rst.py @@ -169,7 +169,7 @@ class RSTFormatting(Formatting): def header(self, content, level): header_content = content.strip() - header_content = re.sub(r'[0-9]+(\.[0-9]*)*\s+', '', header_content) + header_content = re.sub(r'[0-9]+\.([0-9]*\.?)*\s+', '', header_content) header_underline = RSTFormatting.RST_HEADER_TYPES[level-1] * len(header_content) return header_content + "\n" + header_underline + "\n" diff --git a/doc/utils/converters/tests/test_txt2rst.py b/doc/utils/converters/tests/test_txt2rst.py index d6a5cb5a6521c21c2b3fcc43f58236b2d93f41ae..904eeb47494e491839748f3e9d89aa0147e80746 100644 --- a/doc/utils/converters/tests/test_txt2rst.py +++ b/doc/utils/converters/tests/test_txt2rst.py @@ -205,6 +205,11 @@ class TestFormatting(unittest.TestCase): self.assertEqual("Level\n" "#####\n\n", s) + def test_no_filter_date(self): + s = self.txt2rst.convert("9 Sept 2016 version :h1\n") + self.assertEqual("9 Sept 2016 version\n" + "###################\n\n", s) + def test_all_breaks(self): s = self.txt2rst.convert("one\n" "two\n"