fix: add changelog support for github/gitlab format
This commit is contained in:
parent
9bbb60c460
commit
ce96cad54d
2 changed files with 28 additions and 21 deletions
|
|
@ -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"<ins>{msg}</ins>"
|
||||
|
||||
def stripped(
|
||||
self,
|
||||
text: str,
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue