mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
Add @flow to unicodeRegexes and change to ES6 exports.
This commit is contained in:
committed by
Ashish Myles
parent
588f5a1ee6
commit
d46ca811c1
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Similar functions for working with MathML nodes exist in mathMLTree.js.
|
||||
*/
|
||||
import unicodeRegexes from "./unicodeRegexes";
|
||||
import {cjkRegex, hangulRegex} from "./unicodeRegexes";
|
||||
import utils from "./utils";
|
||||
|
||||
/**
|
||||
@@ -222,11 +222,11 @@ class symbolNode {
|
||||
// fonts to use. This allows us to render these characters with a serif
|
||||
// font in situations where the browser would either default to a sans serif
|
||||
// or render a placeholder character.
|
||||
if (unicodeRegexes.cjkRegex.test(value)) {
|
||||
if (cjkRegex.test(value)) {
|
||||
// I couldn't find any fonts that contained Hangul as well as all of
|
||||
// the other characters we wanted to test there for it gets its own
|
||||
// CSS class.
|
||||
if (unicodeRegexes.hangulRegex.test(value)) {
|
||||
if (hangulRegex.test(value)) {
|
||||
this.classes.push('hangul_fallback');
|
||||
} else {
|
||||
this.classes.push('cjk_fallback');
|
||||
|
@@ -1,4 +1,5 @@
|
||||
const hangulRegex = /[\uAC00-\uD7AF]/;
|
||||
// @flow
|
||||
export const hangulRegex = /[\uAC00-\uD7AF]/;
|
||||
|
||||
// This regex combines
|
||||
// - CJK symbols and punctuation: [\u3000-\u303F]
|
||||
@@ -8,10 +9,5 @@ const hangulRegex = /[\uAC00-\uD7AF]/;
|
||||
// - Hangul syllables: [\uAC00-\uD7AF]
|
||||
// - Fullwidth punctuation: [\uFF00-\uFF60]
|
||||
// Notably missing are halfwidth Katakana and Romanji glyphs.
|
||||
const cjkRegex =
|
||||
export const cjkRegex =
|
||||
/[\u3000-\u30FF\u4E00-\u9FAF\uAC00-\uD7AF\uFF00-\uFF60]/;
|
||||
|
||||
module.exports = {
|
||||
cjkRegex: cjkRegex,
|
||||
hangulRegex: hangulRegex,
|
||||
};
|
||||
|
Reference in New Issue
Block a user