Skip to content

Commit a829129

Browse files
committed
Merge branch 'main' into fix-line-numbers
# Conflicts: # PythonScripts/audit_translations/tests/golden/rich/cli_calculus_verbose.golden
2 parents 87cf5b3 + ffe4e4b commit a829129

File tree

189 files changed

+20948
-11474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+20948
-11474
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Python
22

3-
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
3+
on: [push, pull_request]
84

95
jobs:
106
test:

.github/workflows/rust.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Rust
22

3-
on:
4-
push:
5-
branches: [ "main" ]
6-
pull_request:
7-
branches: [ "main" ]
3+
on: [push, pull_request] # note: pre-release job still only on 'refs/heads/main'
84

95
env:
106
CARGO_TERM_COLOR: always

PythonScripts/audit_translations/auditor.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,16 @@ def write(self, issue: dict) -> None:
452452
self.stream.write(json.dumps(issue, ensure_ascii=False) + "\n")
453453

454454

455-
def print_warnings(result: ComparisonResult, file_name: str, verbose: bool = False) -> int:
455+
def print_warnings(
456+
result: ComparisonResult,
457+
file_name: str,
458+
verbose: bool = False,
459+
target_language: str = "tr",
460+
) -> int:
456461
"""Print warnings to console. Returns count of issues found."""
457462
issues = 0
458463
display_name = Path(file_name).as_posix()
464+
target_label = normalize_language(target_language)
459465

460466
has_issues = result.missing_rules or result.untranslated_text or result.extra_rules or result.rule_differences
461467
if not has_issues:
@@ -547,24 +553,24 @@ def add_issue(rule: RuleInfo, issue_type: str, payload: Dict[str, Any]) -> None:
547553
issues += 1
548554
elif issue_type == "extra_rule":
549555
console.print(
550-
f" [dim]•[/] [dim](line {entry['line_tr']} in translation)[/]"
556+
f" [dim]•[/] [dim](line {entry['line_tr']} in {target_label})[/]"
551557
)
552558
issues += 1
553559
elif issue_type == "untranslated_text":
554560
console.print(
555-
f" [dim]•[/] [dim](line {entry['line_tr']} tr)[/] "
561+
f" [dim]•[/] [dim](line {entry['line_tr']} {target_label})[/] "
556562
f"[yellow]\"{escape(entry['text'])}\"[/]"
557563
)
558564
issues += 1
559565
else:
560566
diff: RuleDifference = entry["diff"]
561567
console.print(
562-
f" [dim]•[/] [dim](line {entry['line_en']} en, {entry['line_tr']} tr)[/]"
568+
f" [dim]•[/] [dim](line {entry['line_en']} en, {entry['line_tr']} {target_label})[/]"
563569
)
564570
console.print(f" [dim]{diff.description}[/]")
565571
if verbose:
566572
console.print(f" [green]en:[/] {escape(diff.english_snippet)}")
567-
console.print(f" [red]tr:[/] {escape(diff.translated_snippet)}")
573+
console.print(f" [red]{target_label}:[/] {escape(diff.translated_snippet)}")
568574
issues += 1
569575

570576
return issues
@@ -645,7 +651,7 @@ def audit_language(
645651
has_issues = result.missing_rules or result.untranslated_text or result.extra_rules or result.rule_differences
646652
if output_format == "rich":
647653
if has_issues:
648-
issues = print_warnings(result, file_name, verbose)
654+
issues = print_warnings(result, file_name, verbose, language)
649655
if issues > 0:
650656
files_with_issues += 1
651657
total_issues += issues

PythonScripts/audit_translations/tests/golden/rich/cli_calculus_verbose.golden

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,46 @@
1616
• (line 4 in English)
1717
• divergence (divergence)
1818
Untranslated Text [3]
19-
• (line 10 tr) "divergence"
20-
• (line 11 tr) "div"
21-
• (line 12 tr) "of"
19+
• (line 10 es) "divergence"
20+
• (line 11 es) "div"
21+
• (line 12 es) "of"
2222
Match Pattern Differences [1]
23-
• (line 22 en, 6 tr)
23+
• (line 22 en, 6 es)
2424
Match pattern differs
2525
en: count(*) = 1
26-
tr: .
26+
es: .
2727
Condition Differences [1]
28-
• (line 25 en, 9 tr)
28+
• (line 25 en, 9 es)
2929
Conditions differ
3030
en: $Verbosity='Terse', not(IsNode(*[1], 'leaf'))
31-
tr: $Verbosity='Verbose', not(IsNode(*[1], 'leaf'))
31+
es: $Verbosity='Verbose', not(IsNode(*[1], 'leaf'))
3232
• curl (curl)
3333
Untranslated Text [1]
34-
• (line 22 tr) "curl of"
34+
• (line 22 es) "curl of"
3535
Match Pattern Differences [1]
36-
• (line 35 en, 20 tr)
36+
• (line 35 en, 20 es)
3737
Match pattern differs
3838
en: count(*) = 1
39-
tr: .
39+
es: .
4040
Condition Differences [1]
41-
• (line 39 en, 24 tr)
41+
• (line 39 en, 24 es)
4242
Conditions differ
4343
en: $Verbosity!='Terse', not(IsNode(*[1], 'leaf'))
44-
tr: not(IsNode(*[1], 'leaf'))
44+
es: not(IsNode(*[1], 'leaf'))
4545
Structure Differences [1]
46-
• (line 40 en, 25 tr)
46+
• (line 40 en, 25 es)
4747
Rule structure differs (test/if/then/else blocks)
4848
en: replace: test: if: then: test: if: then:
49-
tr: replace: test: if: then:
49+
es: replace: test: if: then:
5050
• gradient (gradient)
5151
Untranslated Text [2]
52-
• (line 34 tr) "gradient of"
53-
• (line 35 tr) "del"
52+
• (line 34 es) "gradient of"
53+
• (line 35 es) "del"
5454
Match Pattern Differences [1]
55-
• (line 48 en, 30 tr)
55+
• (line 48 en, 30 es)
5656
Match pattern differs
5757
en: count(*) = 1
58-
tr: .
58+
es: .
5959
╭──────────────────────────────────────────────────────────────────────────────╮
6060
│ SUMMARY │
6161
│ Files checked 1 │

Rules/Braille/Nemeth/Nemeth_Rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
match:
270270
- "(( (.='?' and name(EdgeNode(., 'right', 'math'))!='math') or
271271
.='-?-') and parent::*[1][self::m:mrow]) or
272-
.='\u00A0'"
272+
(.='\u00A0' and @data-width > 0)"
273273
variables:
274274
# guess whether this needs spacing or not
275275
- IsComparisonOp: "not(

Rules/Braille/UEB/UEB_Rules.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@
226226
# normally(?) this is an omission, but the case 6'2" causes problems due to WIRIS
227227
# in that case, it doesn't put the ft/in in a superscript and thinks the space is an operator
228228
# canonicalization moves them into <msup> with base <mn>, so this shouldn't be an omission for that case
229-
match: ".='\u00A0' and @width > 1.1 and
229+
match: ".='\u00A0' and @data-width > 1.1 and
230230
not( preceding-sibling::*[1][self::m:msup and *[2][self::m:mo]] and
231231
following-sibling::*[1][self::m:msup and *[2][self::m:mo]] )"
232232
replace:

src/braille.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,7 +2307,7 @@ impl Function for NemethNestingChars {
23072307
} else if name == "msqrt" || name == "mroot" {
23082308
return Ok( Value::String( NemethNestingChars::nemeth_root_value(el, &repeat_char)? ) );
23092309
} else {
2310-
panic!("NestingChars chars should be used only on 'mfrac'. '{}' was passed in", name);
2310+
return Err(XPathError::Other(format!("NestingChars chars should be used only on 'mfrac'. '{}' was passed in", name)));
23112311
}
23122312
} else {
23132313
// not an element, so nothing to do

0 commit comments

Comments
 (0)