Skip to content

Commit

Permalink
Support shortTitle in mod headers
Browse files Browse the repository at this point in the history
Added for ASA currently but should be useful in future.
  • Loading branch information
coldino committed Nov 6, 2023
1 parent e6098ca commit 8657624
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions automate/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
from utils.log import get_logger

MANIFEST_FILENAME = '_manifest.json'
SHRINK_MOD_REGEX = r"{\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*)\n\s+}"
SHRINK_MOD_REGEX3 = r"{\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*)\n\s+}"
SHRINK_MOD_REGEX4 = r"{\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*)\n\s+}"
SHRINK_MOD_REGEX5 = r"{\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*),\n\s+(.+: .*)\n\s+}"

__all__ = [
'update_manifest',
Expand Down Expand Up @@ -39,7 +41,9 @@ def _write_manifest(filename: Path, data: Dict[str, Any]):
filename.parent.mkdir(parents=True, exist_ok=True)
with open(filename, 'wt', encoding='utf-8', newline='\n') as f:
content = json.dumps(data, indent='\t')
content = re.sub(SHRINK_MOD_REGEX, r'{ \1, \2, \3 }', content)
content = re.sub(SHRINK_MOD_REGEX3, r'{ \1, \2, \3 }', content)
content = re.sub(SHRINK_MOD_REGEX4, r'{ \1, \2, \3, \4 }', content)
content = re.sub(SHRINK_MOD_REGEX5, r'{ \1, \2, \3, \4, \5 }', content)
f.write(content)


Expand Down

0 comments on commit 8657624

Please sign in to comment.