@@ -386,6 +386,7 @@ class _KatexParser {
386
386
final spanClasses = element.className != ''
387
387
? List <String >.unmodifiable (element.className.split (' ' ))
388
388
: const < String > [];
389
+ double ? widthEm;
389
390
String ? fontFamily;
390
391
double ? fontSizeEm;
391
392
KatexSpanFontWeight ? fontWeight;
@@ -576,7 +577,11 @@ class _KatexParser {
576
577
_ => throw _KatexHtmlParseError (),
577
578
};
578
579
579
- // TODO handle .nulldelimiter and .delimcenter .
580
+ case 'nulldelimiter' :
581
+ // .nulldelimiter { display: inline-block; width: 0.12em; }
582
+ widthEm = 0.12 ;
583
+
584
+ // TODO .delimcenter .
580
585
581
586
case 'op-symbol' :
582
587
// .op-symbol { ... }
@@ -621,6 +626,7 @@ class _KatexParser {
621
626
622
627
final inlineStyles = _parseInlineStyles (element);
623
628
final styles = KatexSpanStyles (
629
+ widthEm: widthEm,
624
630
fontFamily: fontFamily,
625
631
fontSizeEm: fontSizeEm,
626
632
fontWeight: fontWeight,
@@ -810,6 +816,8 @@ class KatexSpanColor {
810
816
811
817
@immutable
812
818
class KatexSpanStyles {
819
+ final double ? widthEm;
820
+
813
821
// TODO(#1674) does height actually appear on generic spans?
814
822
// In a corpus, the only occurrences that we don't already handle separately
815
823
// (i.e. occurrences other than on struts, vlists, etc) seem to be within
@@ -834,6 +842,7 @@ class KatexSpanStyles {
834
842
final KatexSpanColor ? color;
835
843
836
844
const KatexSpanStyles ({
845
+ this .widthEm,
837
846
this .heightEm,
838
847
this .topEm,
839
848
this .marginRightEm,
@@ -849,6 +858,7 @@ class KatexSpanStyles {
849
858
@override
850
859
int get hashCode => Object .hash (
851
860
'KatexSpanStyles' ,
861
+ widthEm,
852
862
heightEm,
853
863
topEm,
854
864
marginRightEm,
@@ -864,6 +874,7 @@ class KatexSpanStyles {
864
874
@override
865
875
bool operator == (Object other) {
866
876
return other is KatexSpanStyles &&
877
+ other.widthEm == widthEm &&
867
878
other.heightEm == heightEm &&
868
879
other.topEm == topEm &&
869
880
other.marginRightEm == marginRightEm &&
@@ -879,6 +890,7 @@ class KatexSpanStyles {
879
890
@override
880
891
String toString () {
881
892
final args = < String > [];
893
+ if (widthEm != null ) args.add ('widthEm: $widthEm ' );
882
894
if (heightEm != null ) args.add ('heightEm: $heightEm ' );
883
895
if (topEm != null ) args.add ('topEm: $topEm ' );
884
896
if (marginRightEm != null ) args.add ('marginRightEm: $marginRightEm ' );
@@ -893,6 +905,7 @@ class KatexSpanStyles {
893
905
}
894
906
895
907
KatexSpanStyles filter ({
908
+ bool widthEm = true ,
896
909
bool heightEm = true ,
897
910
bool verticalAlignEm = true ,
898
911
bool topEm = true ,
@@ -906,6 +919,7 @@ class KatexSpanStyles {
906
919
bool color = true ,
907
920
}) {
908
921
return KatexSpanStyles (
922
+ widthEm: widthEm ? this .widthEm : null ,
909
923
heightEm: heightEm ? this .heightEm : null ,
910
924
topEm: topEm ? this .topEm : null ,
911
925
marginRightEm: marginRightEm ? this .marginRightEm : null ,
0 commit comments