mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Xtn.Math: Swap out math tags with UNIQ
This commit is contained in:
@@ -30,4 +30,18 @@ public class Xoh_page_wtr_mgr_tst {
|
||||
page_wtr_mgr.Gen(wiki.Parser_mgr().Ctx().Page(), Xopg_page_.Tid_read);
|
||||
Tfds.Eq(String_.new_a7(portal_mgr.Div_logo_bry()), "/site/en.wikipedia.org/wiki/");
|
||||
}
|
||||
@Test public void Skip__math__basic() {
|
||||
Xop_fxt fxt = Xop_fxt.New_app_html();
|
||||
fxt.Init_lang_vnts("zh-hans", "zh-hant");
|
||||
|
||||
fxt.Test__parse_to_html_mgr(String_.Concat_lines_nl_skip_last
|
||||
( "<math>x_{1}-1</math>"
|
||||
, "<math>x-{1+2}-1</math>"
|
||||
, "-{zh-hans:A;zh-hant:B;}-"
|
||||
), String_.Concat_lines_nl_skip_last
|
||||
( "<span id='xowa_math_txt_0'>x_{1}-1</span>" // not converted
|
||||
, "<span id='xowa_math_txt_0'>x-{1+2}-1</span>" // not converted
|
||||
, "A" // converted
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +207,9 @@ public class Xoh_page_wtr_wkr {
|
||||
// translate if variants are enabled
|
||||
Xol_vnt_mgr vnt_mgr = wiki.Lang().Vnt_mgr();
|
||||
if (vnt_mgr.Enabled()) bfr.Add(vnt_mgr.Convert_lang().Parse_page(vnt_mgr.Cur_itm(), page.Db().Page().Id(), bfr.To_bry_and_clear()));
|
||||
|
||||
// handle uniqs
|
||||
wiki.Parser_mgr().Uniq_mgr().Parse(bfr);
|
||||
}
|
||||
private void Write_body_pre(Bry_bfr bfr, Xoae_app app, Xowe_wiki wiki, Xoh_wtr_ctx hctx, byte[] data_raw, Bry_bfr tmp_bfr) {
|
||||
Xoh_html_wtr_escaper.Escape(app.Parser_amp_mgr(), tmp_bfr, data_raw, 0, data_raw.length, false, false);
|
||||
|
||||
@@ -320,13 +320,6 @@ public class Xoh_html_wtr_tst {
|
||||
fxt.Test_parse_page_wiki_str("<div id='a*'></div>", "<div id='a.2A'></div>");
|
||||
fxt.Test_parse_page_wiki_str("<div id='a b'></div>", "<div id='a_b'></div>");
|
||||
}
|
||||
@Test public void Math() {
|
||||
fxt.App().File_mgr().Math_mgr().Renderer_is_mathjax_(false);
|
||||
fxt.Test_parse_page_all_str("<math>x + y</math>", "<img id='xowa_math_img_0' src='' width='' height=''/><span id='xowa_math_txt_0'>x + y</span>"); // latex has img
|
||||
fxt.App().File_mgr().Math_mgr().Renderer_is_mathjax_(true);
|
||||
fxt.Test_parse_page_all_str("<math>x + y</math>", "<span id='xowa_math_txt_0'>x + y</span>"); // mathjax has no img
|
||||
fxt.App().File_mgr().Math_mgr().Renderer_is_mathjax_(false);
|
||||
}
|
||||
@Test public void Timeline() {// PURPOSE: embed timeline contents in pre; DATE:2014-05-22
|
||||
fxt.Test_parse_page_wiki_str("<timeline>a</timeline>", "<pre class='xowa-timeline'>a</pre>");
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class Xow_popup_parser {
|
||||
parser.Parse_to_src_end(wtxt_root, wtxt_ctx, tkn_mkr, wrdx_bry, wtxt_trie, Xop_parser_.Doc_bgn_bos, wrdx_bry.length);
|
||||
wtxt_ctx.Parser__page_term(wtxt_root, wrdx_bry, wrdx_bry.length);
|
||||
wiki.Html_mgr().Html_wtr().Write_doc(wrdx_bfr, wtxt_ctx, hctx, wrdx_bry, wtxt_root);
|
||||
wiki.Parser_mgr().Uniq_mgr().Parse(wrdx_bfr);
|
||||
}
|
||||
private void Adjust_wrdx_end(Xow_popup_itm popup_itm, Bry_bfr wrdx_bfr) {
|
||||
popup_itm.Words_found_(data.Words_found());
|
||||
|
||||
Reference in New Issue
Block a user