Skip to content

Critical important if fits the RC cicle before next RC subrelease: I fixed few rules with definitions.yaml and navigate.yaml, and implemented navigate.rs hungarian tests - #753

Open
hammera wants to merge 4 commits into
daisy:hufrom
hammera:hu

Conversation

@hammera

@hammera hammera commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Hi boys,

@NSoiffer, @MartheGjelstad, or @moritz-gross, I doed few smaller modifications into Rules/languages/hu/definitions.yaml file with navigation parts related, and doed few modifications the Rules/Languages/hu/navigate.yaml file.
Final I implemented tests/Languages/hu/navigate.rs test file, based with english tests.
I proofread the tests outputs, Most of the tests are completely fine, except for some of the zoom tests where I can't remove the "in" part for some reason.
Few examples in hungarian navigate.rs test file:

fn parts_prefix_logarithm_with_base() -> Result<()> {
    // Intent/general.yaml log-with-base → logarithm-with-base:prefix; parts "base"
    let expr = r#"
      <math>
        <msub id="log">
          <mi>log</mi>
          <mi id="b">b</mi>
        </msub>
      </math>
    "#;
    assert_zoom_in("ZoomIn", expr, "nagyítás; in alap; b")
}

#[test]
fn parts_infix_power() -> Result<()> {
    // power:infix; parts "base; exponent"
    let expr = r#"
      <math>
        <msup id="pow">
          <mi id="alap">x</mi>
          <mn id="kitevő">2</mn>
        </msup>
      </math>
    "#;
    assert_zoom_in("ZoomIn", expr, "nagyítás; in alap; x")
}

In the Hungarian navigate.yaml rule, I intentionally specified the string "in" as a translation string "" in one place, because in this case, the suffix "ban" is not necessary in Hungarian after the word "nagyítás" (zoom in), since it is not possible to know whether the next part begins with a vowel or a consonant, or whether an odd or even number comes after the navigation command. In Hungarian, we also use four types of "in" suffixes corresponding to the English language, the "ban", the "ben", the ból and the "ből" suffixes, depending on what these suffixes follow.
So simpler use the "" translate string this situation when the navigation command is zoom in.

Attila

Signed-off-by: Attila Hammer <hammera@pickup.hu>
Signed-off-by: Attila Hammer <hammera@pickup.hu>
Signed-off-by: Attila Hammer <hammera@pickup.hu>
@hammera

hammera commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Oh, again a Clippy problem, now I use rustc 1.98.1 (48a229cea 2026-09-01) version.
cargo clippy doed following three fixes with three files, I will be temporary committing this three fixes into my hu branch, because the upstream hu branch doesn't contains latest main branch state:

diff --git a/src/canonicalize.rs b/src/canonicalize.rs
index 380c4de0..d20374d4 100644
--- a/src/canonicalize.rs
+++ b/src/canonicalize.rs
@@ -2412,23 +2412,21 @@ impl CanonicalizeContext {
 			// This is not yet in canonical form, so the fences may be siblings or siblings of the parent 
 			let preceding_siblings = as_element(children[0]).preceding_siblings();
 			let following_siblings = as_element(children[end-1]).following_siblings();
-			let first_child;
-			let last_child;
-			if preceding_siblings.is_empty() && following_siblings.is_empty() {
+			
+			
+			let (first_child, last_child) = if preceding_siblings.is_empty() && following_siblings.is_empty() {
 				// number spans all children, look to parent for fences
 				let preceding_children = mrow.preceding_siblings();
 				let following_children = mrow.following_siblings();
 				if preceding_children.is_empty() || following_children.is_empty() {
 					return true;	// doesn't have left or right fence
 				}
-				first_child = preceding_children[preceding_children.len()-1];
-				last_child = following_children[0];
+				(preceding_children[preceding_children.len()-1], following_children[0])
 			} else if preceding_siblings.is_empty() || following_siblings.is_empty() {
 				return true; // can't be fences around it
 			} else {
-				first_child = preceding_siblings[preceding_siblings.len()-1];
-				last_child = following_siblings[0];
-			}
+				(preceding_siblings[preceding_siblings.len()-1], following_siblings[0])
+			};
 			let first_child = as_element(first_child);
 			let last_child = as_element(last_child);
 			return !(name(first_child) == "mo" && is_fence(first_child) &&
diff --git a/src/chemistry.rs b/src/chemistry.rs
index 1176d8d3..23de8668 100644
--- a/src/chemistry.rs
+++ b/src/chemistry.rs
@@ -1384,17 +1384,14 @@ pub fn likely_adorned_chem_formula(mathml: Element) -> i32 {
         // prescripts are normally positive integers, chem 2.5.1 allows for a superscript for a Lewis dot
         // postscript should be a charge
 
-        let prescripts;
-        let postscripts;
-        if children.len() == 4 && name(as_element(children[1]))=="mprescripts" { // just prescripts
-            prescripts = &children[2..4];
-            postscripts = &children[0..0]; // empty
+        
+        
+        let (prescripts, postscripts) = if children.len() == 4 && name(as_element(children[1]))=="mprescripts" { // just prescripts
+            (&children[2..4], &children[0..0]) // empty
         } else if children.len() == 6 && name(as_element(children[3]))=="mprescripts" {  // pre and postscripts
-            prescripts = &children[4..6];
-            postscripts = &children[1..3]; // empty
+            (&children[4..6], &children[1..3]) // empty
         } else if children.len() == 3 || children.len() == 5 {   // just postscripts (simultaneous or offset)
-            prescripts = &children[0..0]; // empty
-            postscripts = &children[1..];
+            (&children[0..0], &children[1..])
         } else {
             return NOT_CHEMISTRY;
         };
diff --git a/src/tts.rs b/src/tts.rs
index 91b05c0a..c2f951b3 100644
--- a/src/tts.rs
+++ b/src/tts.rs
@@ -669,18 +669,16 @@ impl TTS {
     /// There is a bias towards pausing more _after_ longer strings.
     pub fn compute_auto_pause(&self, prefs: &PreferenceManager, before: &str, after: &str) -> Result<String> {
         static REMOVE_XML: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"<.+?>").unwrap()); // punctuation ending with a '.'
-        let before_len;
-        let after_len;
-        match self {
+        
+        
+        let (before_len, after_len) = match self {
             TTS::SSML | TTS::SAPI5 => {
-                before_len = REMOVE_XML.replace_all(before, "").len();
-                after_len = REMOVE_XML.replace_all(after, "").len();
+                (REMOVE_XML.replace_all(before, "").len(), REMOVE_XML.replace_all(after, "").len())
             },
             _ => {
-                before_len = before.len();
-                after_len = after.len();
+                (before.len(), after.len())
             },
-        }
+        };
 
         // pause values are not cut in stone
         // the calculation bias to 'previous' is based on MathPlayer which used '30 * #-of-descendants-on-left

Attila

@hammera

hammera commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Ok, the Clippy fix is work correct in online workflows too.
If main branch is not applyed the quoted diff patch, need committing too this commit, othervise, need merge only the first three commits.
Neil, have possibility to do a merge to the main branch, and after this the hu branch to upstream hu branch contains latest RC version related changes too?
I not doed now interactive rebase command to the upstream main branch, to prevent lot of not relevant main branch commit to my feature branch with not have yet the upstream hu branch.

Attila

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant