diff --git a/src/rougail/output_doc/output/github.py b/src/rougail/output_doc/output/github.py index 314b222bc..c08ea6e03 100644 --- a/src/rougail/output_doc/output/github.py +++ b/src/rougail/output_doc/output/github.py @@ -65,6 +65,20 @@ class Formater(CommonFormater): """Set a text to italic""" return f"*{msg}*" + def delete( + self, + msg: str, + ) -> str: + """Set a text to deleted""" + return f"~~{msg}~~" + + def underline( + self, + msg: str, + ) -> str: + """Set a text to underline""" + return f"{msg}" + def stripped( self, text: str, diff --git a/tests/test_changelog.py b/tests/test_changelog.py index 11c777875..12a6c8568 100644 --- a/tests/test_changelog.py +++ b/tests/test_changelog.py @@ -9,6 +9,8 @@ os.environ['COLUMNS'] = '80' test_ok = sorted(list((Path(__file__).parent / 'changelog').iterdir())) # test_ok = [Path(__file__).parent / 'changelog' / '40_dynamic_mod_default1'] +EXT = {'github': 'md', 'asciidoc': 'adoc', 'json': 'json', 'console': 'sh', 'gitlab': 'gitlab.md', "html": "html"} + def idfn(fixture_value): return fixture_value.name @@ -34,30 +36,21 @@ def test_changelog(test_dir): rougailconfig['main_namespace'] = None rougailconfig["step.output"] = "doc" rougailconfig['main_structural_directories'] = [str(test_dir / "after" / "rougail" / "00-base.yml")] - rougailconfig["doc.output_format"] = "asciidoc" rougailconfig["doc.contents"] = ["changelog"] rougailconfig["doc.previous_json_file"] = str(destfile) eolobj = Rougail(rougailconfig=rougailconfig) config = eolobj.run() - result = RougailOutputDoc(config, rougailconfig=rougailconfig).run()[1] - output_file = test_dir / 'result.adoc' - if not output_file.is_file(): - with output_file.open('w') as outfh: - outfh.write(result) - with output_file.open() as outfh: - attented_output = outfh.read() - assert result == attented_output, f'filename {output_file}' - # - rougailconfig["doc.output_format"] = "console" -# eolobj = Rougail(rougailconfig=rougailconfig) -# config = eolobj.run() - result = RougailOutputDoc(config, rougailconfig=rougailconfig).run()[1] - output_file = test_dir / 'result.sh' - if not output_file.is_file(): - with output_file.open('w') as outfh: - outfh.write(result) - with output_file.open() as outfh: - attented_output = outfh.read() - assert result == attented_output, f'filename {output_file}' + for output_format, ext in EXT.items(): + if output_format == 'json': + continue + rougailconfig["doc.output_format"] = output_format + result = RougailOutputDoc(config, rougailconfig=rougailconfig).run()[1] + output_file = test_dir / f'result.{ext}' + if not output_file.is_file(): + with output_file.open('w') as outfh: + outfh.write(result) + with output_file.open() as outfh: + attented_output = outfh.read() + assert result == attented_output, f'filename {output_file}' # destfile.unlink()