@@ -70,8 +70,7 @@ export function smart_quotes(
70
70
if ( html && char === '&' ) {
71
71
if ( str . slice ( index , index + 5 ) === ''' ) {
72
72
const left : boolean =
73
- ( ( first && before === '' ) || stack . at ( - 1 ) !== "'" || ( index > 1 && before === '=' ) ) &&
74
- ! opening_squo_chars . test ( before ) ;
73
+ stack . at ( - 1 ) !== "'" && ( opening_squo_chars . test ( before ) || ( first && before === '' ) ) ;
75
74
res += `&${ left ? 'l' : 'r' } squo;` ;
76
75
index += 4 ;
77
76
if ( ! left ) {
@@ -80,10 +79,7 @@ export function smart_quotes(
80
79
stack . push ( "'" ) ;
81
80
}
82
81
} else if ( str . slice ( index , index + 6 ) === '"' ) {
83
- const left : boolean =
84
- ( first && before === '' ) ||
85
- stack . at ( - 1 ) !== '"' ||
86
- ( index > 1 && str . charAt ( index - 1 ) === '=' ) ;
82
+ const left : boolean = stack . at ( - 1 ) !== '"' ;
87
83
res += `&${ left ? 'l' : 'r' } dquo` ;
88
84
index += 5 ;
89
85
if ( ! left ) {
@@ -95,10 +91,10 @@ export function smart_quotes(
95
91
res += '&' ;
96
92
}
97
93
} else if ( ! html && ( char === '"' || char === "'" ) ) {
98
- let left : boolean =
99
- ( ( first && before === '' ) || stack . at ( - 1 ) !== char || ( index > 1 && before === '=' ) ) &&
100
- ! ( char === "'" && ! opening_squo_chars . test ( before ) ) ;
101
- let double = char === '"' ;
94
+ const left : boolean =
95
+ stack . at ( - 1 ) !== char &&
96
+ ( opening_squo_chars . test ( char ) || ( first && before === '' ) || char === '"' ) ;
97
+ const double = char === '"' ;
102
98
res += double ? ( left ? '“' : '”' ) : left ? '‘' : '’' ;
103
99
if ( ! left ) {
104
100
stack . pop ( ) ;
0 commit comments