litchi 0.0.1

High-performance parser for Microsoft Office, OpenDocument, and Apple iWork file formats with unified API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
use crate::formula::omml::elements::ElementProperties;
use crate::formula::omml::attributes::*;

/// Parse run properties (m:rPr)
#[allow(dead_code)] // Used indirectly through property parsing
pub fn parse_run_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "scr" | "m:scr" => {
                        // Script/style type (normal, bold, italic, etc.)
                        properties.math_variant = Some(value.to_string());
                        properties.style = Some(value.to_string());
                    }
                    "sty" | "m:sty" => {
                        // Math style (display/text)
                        properties.display_style = Some(matches!(value, "d" | "display" | "1" | "true"));
                        properties.run_math_style = Some(value.to_string());
                    }
                    "nor" | "m:nor" => {
                        // Normal text font
                        properties.font = Some(value.to_string());
                        properties.run_normal_text = Some(value.to_string());
                    }
                    "lit" | "m:lit" => {
                        // Literal text flag
                        properties.run_literal = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse fraction properties (m:fPr)
pub fn parse_fraction_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "type" | "m:type" => {
                        // Fraction type (bar, noBar, skewed)
                        properties.fraction_type = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse delimiter properties (m:dPr)
pub fn parse_delimiter_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "begChr" | "m:begChr" => {
                        // Beginning character
                        properties.delimiter_open_char = Some(value.to_string());
                    }
                    "endChr" | "m:endChr" => {
                        // Ending character
                        properties.delimiter_close_char = Some(value.to_string());
                    }
                    "sepChr" | "m:sepChr" => {
                        // Separator character
                        properties.delimiter_separator_char = Some(value.to_string());
                    }
                    "grow" | "m:grow" => {
                        // Grow to fit content
                        properties.delimiter_grow = Some(matches!(value, "1" | "true"));
                    }
                    "shp" | "m:shp" => {
                        // Shape (centered, match)
                        properties.delimiter_shape = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse n-ary operator properties (m:naryPr)
pub fn parse_nary_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "chr" | "m:chr" => {
                        // Operator character
                        properties.chr = Some(value.to_string());
                    }
                    "grow" | "m:grow" => {
                        // Grow to fit content
                        properties.nary_operator_grow = Some(matches!(value, "1" | "true"));
                    }
                    "subHide" | "m:subHide" => {
                        // Hide subscript
                        properties.nary_hide_sub = Some(matches!(value, "1" | "true"));
                    }
                    "supHide" | "m:supHide" => {
                        // Hide superscript
                        properties.nary_hide_sup = Some(matches!(value, "1" | "true"));
                    }
                    "limLoc" | "m:limLoc" => {
                        // Limit location (undOvr, subSup)
                        properties.style = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse accent properties (m:accPr)
pub fn parse_accent_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "chr" | "m:chr" => {
                        // Accent character
                        properties.chr = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse matrix properties (m:mPr)
pub fn parse_matrix_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "baseJc" | "m:baseJc" => {
                        // Baseline justification
                        properties.matrix_alignment = Some(value.to_string());
                    }
                    "plcHide" | "m:plcHide" => {
                        // Hide placeholder
                        properties.hide = Some(matches!(value, "1" | "true"));
                    }
                    "rSp" | "m:rSp" => {
                        // Row spacing
                        properties.matrix_row_spacing = Some(value.to_string());
                    }
                    "cSp" | "m:cSp" => {
                        // Column spacing
                        properties.matrix_column_spacing = Some(value.to_string());
                    }
                    "cGp" | "m:cGp" => {
                        // Column gap
                        properties.spacing = Some(value.to_string());
                    }
                    "mcs" | "m:mcs" => {
                        // Matrix column spacing (complex structure)
                        properties.spacing = Some(value.to_string());
                    }
                    "mcsJc" | "m:mcsJc" => {
                        // Matrix column spacing justification
                        properties.alignment = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse group character properties (m:groupChrPr)
pub fn parse_group_char_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "chr" | "m:chr" => {
                        // Group character
                        properties.chr = Some(value.to_string());
                    }
                    "pos" | "m:pos" => {
                        // Position (top/bot)
                        properties.accent_position = Some(value.to_string());
                    }
                    "vertJc" | "m:vertJc" => {
                        // Vertical justification
                        properties.vertical_alignment = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse equation array properties (m:eqArrPr)
pub fn parse_eq_arr_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "baseJc" | "m:baseJc" => {
                        // Baseline justification
                        properties.eq_arr_base_alignment = Some(value.to_string());
                    }
                    "maxDist" | "m:maxDist" => {
                        // Maximum distance
                        properties.eq_arr_max_distance = Some(value.to_string());
                    }
                    "objDist" | "m:objDist" => {
                        // Object distance
                        properties.eq_arr_object_distance = Some(value.to_string());
                    }
                    "rSp" | "m:rSp" => {
                        // Row spacing
                        properties.eq_arr_row_spacing = Some(value.to_string());
                    }
                    "rSpRule" | "m:rSpRule" => {
                        // Row spacing rule
                        properties.eq_arr_row_spacing_rule = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse limit properties (m:lim)
pub fn parse_limit_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "type" | "m:type" => {
                        // Limit type (undOvr, subSup)
                        properties.style = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse bar properties (m:barPr)
pub fn parse_bar_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "pos" | "m:pos" => {
                        // Position (top/bot)
                        properties.accent_position = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse box properties (m:boxPr)
pub fn parse_box_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "opEmu" | "m:opEmu" => {
                        // Operator emulation
                        properties.box_operator_emulation = Some(matches!(value, "1" | "true"));
                    }
                    "noBreak" | "m:noBreak" => {
                        // No break
                        properties.box_no_break = Some(matches!(value, "1" | "true"));
                    }
                    "diff" | "m:diff" => {
                        // Differential
                        properties.box_differential = Some(matches!(value, "1" | "true"));
                    }
                    "brk" | "m:brk" => {
                        // Break
                        properties.box_break = Some(matches!(value, "1" | "true"));
                    }
                    "aln" | "m:aln" => {
                        // Alignment
                        properties.box_alignment = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse border box properties (m:borderBoxPr)
pub fn parse_border_box_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "hideTop" | "m:hideTop" => {
                        properties.border_hide_top = Some(matches!(value, "1" | "true"));
                    }
                    "hideBot" | "m:hideBot" => {
                        properties.border_hide_bottom = Some(matches!(value, "1" | "true"));
                    }
                    "hideLeft" | "m:hideLeft" => {
                        properties.border_hide_left = Some(matches!(value, "1" | "true"));
                    }
                    "hideRight" | "m:hideRight" => {
                        properties.border_hide_right = Some(matches!(value, "1" | "true"));
                    }
                    "strikeH" | "m:strikeH" => {
                        properties.border_strike_horizontal = Some(matches!(value, "1" | "true"));
                    }
                    "strikeV" | "m:strikeV" => {
                        properties.border_strike_vertical = Some(matches!(value, "1" | "true"));
                    }
                    "strikeBLTR" | "m:strikeBLTR" => {
                        // Strike bottom-left to top-right
                        properties.border_strike_bltr = Some(matches!(value, "1" | "true"));
                    }
                    "strikeTLBR" | "m:strikeTLBR" => {
                        // Strike top-left to bottom-right
                        properties.border_strike_tlbr = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse phantom properties (m:phantPr)
pub fn parse_phantom_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "show" | "m:show" => {
                        // Show phantom content
                        properties.phantom_show = Some(matches!(value, "1" | "true"));
                    }
                    "zeroWid" | "m:zeroWid" => {
                        // Zero width
                        properties.phantom_zero_width = Some(matches!(value, "1" | "true"));
                    }
                    "zeroAsc" | "m:zeroAsc" => {
                        // Zero ascent
                        properties.phantom_zero_ascent = Some(matches!(value, "1" | "true"));
                    }
                    "zeroDesc" | "m:zeroDesc" => {
                        // Zero descent
                        properties.phantom_zero_descent = Some(matches!(value, "1" | "true"));
                    }
                    "transp" | "m:transp" => {
                        // Transparent
                        properties.phantom_transparent = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse radical properties (m:radPr)
pub fn parse_radical_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "degHide" | "m:degHide" => {
                        // Hide degree
                        properties.radical_hide_degree = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse spacing properties (m:sPre, m:sPost, etc.)
pub fn parse_spacing_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "val" | "m:val" => {
                        properties.spacing = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse subscript properties (m:sSubPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_subscript_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "degHide" | "m:degHide" => {
                        // Hide degree/subscript
                        properties.hide = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse superscript properties (m:sSupPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_superscript_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "degHide" | "m:degHide" => {
                        // Hide degree/superscript
                        properties.hide = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse sub-sup properties (m:sSubSupPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_subsup_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "subHide" | "m:subHide" => {
                        // Hide subscript
                        properties.nary_hide_sub = Some(matches!(value, "1" | "true"));
                    }
                    "supHide" | "m:supHide" => {
                        // Hide superscript
                        properties.nary_hide_sup = Some(matches!(value, "1" | "true"));
                    }
                    "aln" | "m:aln" => {
                        // Alignment
                        properties.alignment = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse prescript properties (m:sPrePr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_prescript_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "subHide" | "m:subHide" => {
                        // Hide prescript subscript
                        properties.nary_hide_sub = Some(matches!(value, "1" | "true"));
                    }
                    "supHide" | "m:supHide" => {
                        // Hide prescript superscript
                        properties.nary_hide_sup = Some(matches!(value, "1" | "true"));
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse function properties (m:funcPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_function_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "type" | "m:type" => {
                        // Function type
                        properties.style = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse upper limit properties (m:limUppPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_upper_limit_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "limLoc" | "m:limLoc" => {
                        // Limit location (undOvr, subSup)
                        properties.style = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse lower limit properties (m:limLowPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_lower_limit_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "limLoc" | "m:limLoc" => {
                        // Limit location (undOvr, subSup)
                        properties.style = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse control properties (m:ctrlPr)
#[allow(dead_code)] // Part of the property parsing API, used in element-specific property handling
pub fn parse_control_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    "ascii" | "m:ascii" => {
                        // ASCII font
                        properties.font = Some(value.to_string());
                    }
                    "hAnsi" | "m:hAnsi" => {
                        // High ANSI font
                        properties.font = Some(value.to_string());
                    }
                    "cs" | "m:cs" => {
                        // Complex script font
                        properties.font = Some(value.to_string());
                    }
                    "eastAsia" | "m:eastAsia" => {
                        // East Asia font
                        properties.font = Some(value.to_string());
                    }
                    _ => {}
                }
            }
    }

    properties
}

/// Parse general element properties from attributes
pub fn parse_general_properties(attrs: &[quick_xml::events::attributes::Attribute]) -> ElementProperties {
    let mut properties = ElementProperties::default();

    for attr in attrs {
        if let Ok(key) = std::str::from_utf8(attr.key.as_ref())
            && let Ok(value) = std::str::from_utf8(&attr.value) {
                match key {
                    // Style and formatting
                    "scr" | "m:scr" => properties.math_variant = Some(value.to_string()),
                    "sty" | "m:sty" => properties.display_style = Some(matches!(value, "d" | "display" | "1" | "true")),

                    // Size and scaling
                    "sz" | "m:sz" => properties.size = Some(value.to_string()),
                    "minSz" | "m:minSz" => properties.min_size = Some(value.to_string()),
                    "maxSz" | "m:maxSz" => properties.max_size = Some(value.to_string()),
                    "scrLvl" | "m:scrLvl" => {
                        if let Some(lvl) = parse_int_simd(value) {
                            properties.script_level = Some(lvl);
                        }
                    }

                    // Color and font
                    "color" | "m:color" => properties.color = Some(value.to_string()),
                    "font" | "m:font" => properties.font = Some(value.to_string()),
                    "nor" | "m:nor" => properties.font = Some(value.to_string()),

                    // Layout and positioning
                    "aln" | "m:aln" => properties.alignment = Some(value.to_string()),
                    "alnScr" | "m:alnScr" => properties.alignment = Some(value.to_string()),
                    "vertJc" | "m:vertJc" => properties.vertical_alignment = Some(value.to_string()),
                    "baseJc" | "m:baseJc" => properties.alignment = Some(value.to_string()),

                    // Characters and symbols
                    "chr" | "m:chr" => properties.chr = Some(value.to_string()),

                    // Spacing
                    "val" | "m:val" => properties.spacing = Some(value.to_string()),

                    // Fraction properties
                    "type" | "m:type" => properties.fraction_type = Some(value.to_string()),
                    "lnThick" | "m:lnThick" => properties.fraction_line_thickness = Some(value.to_string()),

                    // Matrix properties
                    "rSp" | "m:rSp" => properties.matrix_row_spacing = Some(value.to_string()),
                    "cSp" | "m:cSp" => properties.matrix_column_spacing = Some(value.to_string()),

                    // Accent properties
                    "pos" | "m:pos" => properties.accent_position = Some(value.to_string()),

                    // Box properties
                    "diff" | "m:diff" => properties.box_differential = Some(matches!(value, "1" | "true")),
                    "opEmu" | "m:opEmu" => properties.box_operator_emulation = Some(matches!(value, "1" | "true")),
                    "brk" | "m:brk" => properties.box_break = Some(matches!(value, "1" | "true")),
                    "noBreak" | "m:noBreak" => properties.box_no_break = Some(matches!(value, "1" | "true")),

                    // Phantom properties
                    "show" | "m:show" => properties.phantom_show = Some(matches!(value, "1" | "true")),
                    "zeroWid" | "m:zeroWid" => properties.phantom_zero_width = Some(matches!(value, "1" | "true")),
                    "zeroAsc" | "m:zeroAsc" => properties.phantom_zero_ascent = Some(matches!(value, "1" | "true")),
                    "zeroDesc" | "m:zeroDesc" => properties.phantom_zero_descent = Some(matches!(value, "1" | "true")),
                    "transp" | "m:transp" => properties.phantom_transparent = Some(matches!(value, "1" | "true")),

                    // Border box properties
                    "hideTop" | "m:hideTop" => properties.border_hide_top = Some(matches!(value, "1" | "true")),
                    "hideBot" | "m:hideBot" => properties.border_hide_bottom = Some(matches!(value, "1" | "true")),
                    "hideLeft" | "m:hideLeft" => properties.border_hide_left = Some(matches!(value, "1" | "true")),
                    "hideRight" | "m:hideRight" => properties.border_hide_right = Some(matches!(value, "1" | "true")),
                    "strikeH" | "m:strikeH" => properties.border_strike_horizontal = Some(matches!(value, "1" | "true")),
                    "strikeV" | "m:strikeV" => properties.border_strike_vertical = Some(matches!(value, "1" | "true")),
                    "strikeBLTR" | "m:strikeBLTR" => properties.border_strike_bltr = Some(matches!(value, "1" | "true")),
                    "strikeTLBR" | "m:strikeTLBR" => properties.border_strike_tlbr = Some(matches!(value, "1" | "true")),

                    // Equation array properties
                    "maxDist" | "m:maxDist" => properties.eq_arr_max_distance = Some(value.to_string()),
                    "objDist" | "m:objDist" => properties.eq_arr_object_distance = Some(value.to_string()),
                    "rSpRule" | "m:rSpRule" => properties.eq_arr_row_spacing_rule = Some(value.to_string()),

                    // N-ary operator properties
                    "subHide" | "m:subHide" => properties.nary_hide_sub = Some(matches!(value, "1" | "true")),
                    "supHide" | "m:supHide" => properties.nary_hide_sup = Some(matches!(value, "1" | "true")),
                    "grow" | "m:grow" => properties.nary_operator_grow = Some(matches!(value, "1" | "true")),

                    // Delimiter properties
                    "sepChr" | "m:sepChr" => properties.delimiter_separator_char = Some(value.to_string()),
                    "begChr" | "m:begChr" => properties.delimiter_open_char = Some(value.to_string()),
                    "endChr" | "m:endChr" => properties.delimiter_close_char = Some(value.to_string()),
                    "shp" | "m:shp" => properties.delimiter_shape = Some(value.to_string()),

                    // Radical properties
                    "degHide" | "m:degHide" => properties.radical_hide_degree = Some(matches!(value, "1" | "true")),

                    // Run properties
                    "lit" | "m:lit" => properties.run_literal = Some(matches!(value, "1" | "true")),

                    // Visibility and rendering
                    "hide" | "m:hide" => properties.hide = Some(matches!(value, "1" | "true")),
                    "strike" | "m:strike" => properties.strike_through = Some(matches!(value, "1" | "true")),
                    "dstrike" | "m:dstrike" => properties.double_strike_through = Some(matches!(value, "1" | "true")),

                    // Line styles
                    "u" | "m:u" => properties.underline = Some(value.to_string()),
                    "o" | "m:o" => properties.overline = Some(value.to_string()),

                    // Special positioning attributes
                    "den" | "m:den" => properties.alignment = Some("denominator".to_string()),
                    "num" | "m:num" => properties.alignment = Some("numerator".to_string()),

                    _ => {} // Ignore unknown attributes
                }
            }
    }

    properties
}