mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.9.3.1
This commit is contained in:
@@ -54,10 +54,10 @@ public class Xof_math_html_wtr {
|
||||
for (int i = bgn; i < end; i++) {
|
||||
byte b = bry[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Lt: if (mathjax) escaped = gplx.html.Html_entity_.Lt_bry; break;
|
||||
case Byte_ascii.Gt: if (mathjax) escaped = gplx.html.Html_entity_.Gt_bry; break;
|
||||
case Byte_ascii.Lt: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Lt_bry; break;
|
||||
case Byte_ascii.Gt: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Gt_bry; break;
|
||||
// case Byte_ascii.Amp: escaped = Const_amp; break; // TOMBSTONE:never escape ampersand; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
|
||||
// case Byte_ascii.Quote: if (mathjax) escaped = gplx.html.Html_entity_.Quote_bry; break; // TOMBSTONE:do not escape quote; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
|
||||
// case Byte_ascii.Quote: if (mathjax) escaped = gplx.langs.htmls.Html_entity_.Quote_bry; break; // TOMBSTONE:do not escape quote; PAGE:s.w:Matrix_(mathematics); DATE:2014-07-19
|
||||
default:
|
||||
if (dirty || write_to_bfr)
|
||||
bfr.Add_byte(b);
|
||||
|
||||
@@ -47,9 +47,9 @@ class Texvc_checker {
|
||||
Texvc_tkn arg_tkn = root.Subs__get_at(root_idx);
|
||||
// skip ws, dlm, lit
|
||||
int arg_tid = arg_tkn.Tid();
|
||||
switch (arg_tid) {
|
||||
case Texvc_tkn_.Tid__func:
|
||||
case Texvc_tkn_.Tid__curly:
|
||||
// switch (arg_tid) {
|
||||
// case Texvc_tkn_.Tid__func:
|
||||
// case Texvc_tkn_.Tid__curly:
|
||||
root.Regy__move(arg_tkn.Uid(), func_tkn.Uid());
|
||||
--root_len;
|
||||
--root_idx;
|
||||
@@ -57,8 +57,8 @@ class Texvc_checker {
|
||||
if (arg_tid == Texvc_tkn_.Tid__func) {
|
||||
Check_func(arg_tkn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
List_adp_.Pop_last(func_stack);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ public class Texvc_checker_tst {
|
||||
);
|
||||
}
|
||||
@Test public void Mathrm() {
|
||||
// fxt.Test_check("\\mathrm\\frac{a}{b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
// fxt.Test_check("\\mathrm\\frac a b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
// fxt.Test_check("\\mathrm{\\frac{a}{b}}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\mathrm\\frac{a}{b}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\mathrm{\\frac{a}{b}}" , "\\mathrm{\\frac{a}{b}}");
|
||||
fxt.Test_check("\\frac a b" , "\\frac a b");
|
||||
}
|
||||
}
|
||||
class Texvc_checker_fxt extends Texvc_parser_fxt { private final Texvc_checker checker = new Texvc_checker();
|
||||
|
||||
@@ -28,7 +28,7 @@ class Texvc_lxr__curly_bgn implements Texvc_lxr {
|
||||
class Texvc_lxr__curly_end implements Texvc_lxr {
|
||||
public int Tid() {return Texvc_lxr_.Tid__curly_end;}
|
||||
public int Make_tkn(Texvc_ctx ctx, Texvc_root root, byte[] src, int src_len, int bgn_pos, int cur_pos) {
|
||||
int bgn_uid = ctx.Stack().Pop_or(-1);
|
||||
int bgn_uid = ctx.Stack().Pop_or_fail();
|
||||
root.Regy__take_from_root_end(bgn_uid);
|
||||
root.Regy__update_end(bgn_uid, cur_pos);
|
||||
return cur_pos;
|
||||
|
||||
@@ -37,12 +37,25 @@ public class Texvc_tkn__func implements Texvc_tkn {
|
||||
public int Subs__len() {return root.Regy__get_subs_len(uid);}
|
||||
public Texvc_tkn Subs__get_at(int i) {return root.Regy__get_subs_tkn(uid, i);}
|
||||
public void Print_tex_bry(Bry_bfr bfr, byte[] src, int indent) {
|
||||
if (tid != Texvc_func_itm_.Id__xowa_arg) // do not add func name if arg; EX: "{a}" vs "\alpha{a}"
|
||||
bfr.Add_byte_backslash().Add(func_itm.Key()); // funcs have pattern of "\key"; EX: "\alpha"
|
||||
if (func_itm.Id() != Texvc_func_itm_.Id__xowa_arg) // do not add func name if arg; EX: "{a}" vs "\alpha{a}"
|
||||
bfr.Add_byte_backslash().Add(func_itm.Key()); // funcs have pattern of "\key"; EX: "\alpha"
|
||||
int subs_len = Subs__len();
|
||||
for (int i = 0; i < subs_len; ++i) {
|
||||
Texvc_tkn sub_tkn = Subs__get_at(i);
|
||||
sub_tkn.Print_tex_bry(bfr, src, indent + 1);
|
||||
if (subs_len > 0) {
|
||||
boolean curly_added = false;
|
||||
for (int i = 0; i < subs_len; ++i) {
|
||||
Texvc_tkn sub_tkn = Subs__get_at(i);
|
||||
if (i == 0 && (sub_tkn.Tid() == Texvc_tkn_.Tid__func) && tid != Texvc_tkn_.Tid__curly) {
|
||||
bfr.Add_byte(Byte_ascii.Curly_bgn);
|
||||
curly_added = true;
|
||||
}
|
||||
if (sub_tkn.Tid() == Texvc_tkn_.Tid__curly)
|
||||
bfr.Add_byte(Byte_ascii.Curly_bgn);
|
||||
sub_tkn.Print_tex_bry(bfr, src, indent + 1);
|
||||
if (sub_tkn.Tid() == Texvc_tkn_.Tid__curly)
|
||||
bfr.Add_byte(Byte_ascii.Curly_end);
|
||||
}
|
||||
if (curly_added)
|
||||
bfr.Add_byte(Byte_ascii.Curly_end);
|
||||
}
|
||||
}
|
||||
public void Print_dbg_bry(Bry_bfr bfr, int indent) {
|
||||
|
||||
Reference in New Issue
Block a user