mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
show what's wrong when bad formatting found in ftl
This commit is contained in:
parent
5634c8fe7a
commit
ffd59a03c0
1 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import os
|
||||||
import json
|
import json
|
||||||
import glob
|
import glob
|
||||||
import sys
|
import sys
|
||||||
|
import difflib
|
||||||
from typing import List
|
from typing import List
|
||||||
from fluent.syntax import parse, serialize
|
from fluent.syntax import parse, serialize
|
||||||
from fluent.syntax.ast import Junk
|
from fluent.syntax.ast import Junk
|
||||||
|
|
@ -64,6 +65,17 @@ def check_file(path: str, fix: bool) -> bool:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print(f"Bad formatting in {path}")
|
print(f"Bad formatting in {path}")
|
||||||
|
print(
|
||||||
|
"\n".join(
|
||||||
|
difflib.unified_diff(
|
||||||
|
orig_text.splitlines(),
|
||||||
|
new_text.splitlines(),
|
||||||
|
fromfile="bad",
|
||||||
|
tofile="good",
|
||||||
|
lineterm="",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue