mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Command-line: Fix curid argument not working 2
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
public class Hiero_html_mgr_fxt {
|
||||
private Hiero_xtn_mgr xtn_mgr;
|
||||
public Hiero_html_mgr_fxt(Xop_fxt fxt) {this.fxt = fxt;}
|
||||
public Xop_fxt Fxt() {return fxt;} private Xop_fxt fxt;
|
||||
public void Reset() {
|
||||
fxt.Reset();
|
||||
xtn_mgr = new Hiero_xtn_mgr();
|
||||
xtn_mgr.Xtn_init_by_app(fxt.App());
|
||||
xtn_mgr.Clear();
|
||||
}
|
||||
public Hiero_html_mgr_fxt Init_hiero_A1_B1() {
|
||||
this.Init_file("A1", 29, 38);
|
||||
this.Init_file("B1", 23, 38);
|
||||
return this;
|
||||
}
|
||||
public Hiero_html_mgr_fxt Init_hiero_cartouche() {
|
||||
this.Init_phoneme("<", "Ca1");
|
||||
this.Init_phoneme(">", "Ca2");
|
||||
return this;
|
||||
}
|
||||
public Hiero_html_mgr_fxt Init_hiero_p_t() {
|
||||
this.Init_phoneme("p", "Q3");
|
||||
this.Init_phoneme("t", "X1");
|
||||
this.Init_file("Q3", 12, 15);
|
||||
this.Init_file("X1", 20, 11);
|
||||
return this;
|
||||
}
|
||||
public Hiero_html_mgr_fxt Init_hiero_a_A1() {
|
||||
this.Init_prefab("a&A1");
|
||||
this.Init_file("a&A1", 37, 38);
|
||||
return this;
|
||||
}
|
||||
public Hiero_html_mgr_fxt Init_prefab(String prefab) {xtn_mgr.Prefab_mgr().Add(Bry_.new_u8(prefab)); return this;}
|
||||
public Hiero_html_mgr_fxt Init_file(String s, int w, int h) {xtn_mgr.File_mgr().Add(Bry_.new_u8(s), w, h); return this;}
|
||||
public Hiero_html_mgr_fxt Init_phoneme(String phoneme, String code) {xtn_mgr.Phoneme_mgr().Add(Bry_.new_u8(phoneme), Bry_.new_u8(code)); return this;}
|
||||
public void Test_html_full_str(String raw, String expd) {fxt.Test_html_full_str(raw, expd);}
|
||||
public void Test_html_full_frag(String raw, String expd) {fxt.Test_html_full_frag(raw, expd);}
|
||||
}
|
||||
@@ -1,387 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Hiero_html_mgr_tst {
|
||||
@Before public void init() {fxt.Reset();} private Hiero_html_mgr_fxt fxt = new Hiero_html_mgr_fxt(new Xop_fxt());
|
||||
@Test public void Empty() {
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero></hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, ""
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Glyph_1() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>A1</hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Mirrored() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>A1\\</hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img class=\"mw-mirrored\" style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Glyph_2() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str("<hiero>A1-B1</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Void_half() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>A1 . B1</hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\" style=\"width: 22px;\">"
|
||||
, " <tr>"
|
||||
, " <td> "
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Void_full() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>A1 .. B1</hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\" style=\"width: 44px;\">"
|
||||
, " <tr>"
|
||||
, " <td> "
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void New_line() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>A1 ! B1</hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Cartouche() {
|
||||
fxt.Init_hiero_A1_B1().Init_hiero_cartouche();
|
||||
fxt.Test_html_full_str
|
||||
( "<hiero>< A1 ></hiero>"
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_Ca1.png' height='44' title='<' alt='<' />"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td class='mw-hiero-box' style='height: 2px;'>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " <tr>"
|
||||
, " <td class='mw-hiero-box' style='height: 2px;'>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " <td>"
|
||||
, " <img src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_Ca2.png' height='44' title='>' alt='>' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Superposition_regular() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str("<hiero>A1:B1</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 20px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' />"
|
||||
, " <br/>"
|
||||
, " <img style='margin: 1px; height: 20px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Superposition_phoneme() {
|
||||
fxt.Init_hiero_p_t();
|
||||
fxt.Test_html_full_str("<hiero>t:p</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 11px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_X1.png' title='X1 [t]' alt='t' />"
|
||||
, " <br/>"
|
||||
, " <img style='margin: 1px; height: 15px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_Q3.png' title='Q3 [p]' alt='p' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Superposition_prefab() {
|
||||
fxt.Init_hiero_a_A1();
|
||||
fxt.Test_html_full_str("<hiero>a:A1</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_a&A1.png' title='a&A1' alt='a&A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Juxtaposition_regular() {
|
||||
fxt.Init_hiero_A1_B1();
|
||||
fxt.Test_html_full_str("<hiero>A1*B1</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_A1.png' title='A1' alt='A1' /> "
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_B1.png' title='B1' alt='B1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Juxtaposition_phoneme() {
|
||||
fxt.Init_hiero_p_t();
|
||||
fxt.Test_html_full_str("<hiero>t*p</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 11px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_X1.png' title='X1 [t]' alt='t' /> "
|
||||
, " <img style='margin: 1px; height: 15px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_Q3.png' title='Q3 [p]' alt='p' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Juxtaposition_prefab() {
|
||||
fxt.Init_hiero_a_A1();
|
||||
fxt.Test_html_full_str("<hiero>a*A1</hiero>", String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, " <img style='margin: 1px; height: 38px;' src='file:///mem/xowa/bin/any/xowa/xtns/Wikihiero/img/hiero_a&A1.png' title='a&A1' alt='a&A1' />"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, " </table>"
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
));
|
||||
}
|
||||
@Test public void Para_if_text() {// PURPOSE: check that paras are handled correctly; EX: w:Hieroglyphics; DATE:2014-04-23
|
||||
fxt.Fxt().Init_para_y_();
|
||||
fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
|
||||
( "a" // should always be in <p>
|
||||
, ""
|
||||
, "<hiero></hiero> b" // <hiero> should not be in <p> but "b" should be;
|
||||
), String_.Concat_lines_nl_skip_last
|
||||
( "<p>a"
|
||||
, "</p>"
|
||||
, "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, ""
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
, ""
|
||||
, "<p> b" // NOTE: space seems wrong, but is "harmless"
|
||||
, "</p>"
|
||||
));
|
||||
fxt.Fxt().Init_para_n_();
|
||||
}
|
||||
@Test public void Para_skip_if_list() {// PURPOSE: do not add para if in list; EX:de.d:Damascus; DATE:2014-06-06
|
||||
fxt.Fxt().Init_para_y_();
|
||||
fxt.Test_html_full_str(String_.Concat_lines_nl_skip_last
|
||||
( ":<hiero></hiero> a" // a should not be in para
|
||||
, ":b"
|
||||
), String_.Concat_lines_nl_skip_last
|
||||
( "<dl>"
|
||||
, " <dd><table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
, " <td>"
|
||||
, ""
|
||||
, " </td>"
|
||||
, " </tr>"
|
||||
, "</table>"
|
||||
, " a"
|
||||
, " </dd>"
|
||||
, " <dd>b"
|
||||
, " </dd>"
|
||||
, "</dl>"
|
||||
));
|
||||
fxt.Fxt().Init_para_n_();
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
import gplx.core.intls.*;
|
||||
public class Hiero_mw_tables_parser_tst {
|
||||
@Before public void init() {fxt.Reset();} private Hiero_mw_tables_parser_fxt fxt = new Hiero_mw_tables_parser_fxt();
|
||||
@Test public void Basic() {// DATE:2014-04-19
|
||||
fxt.Test_bld_all
|
||||
( String_.Concat_lines_nl_skip_last
|
||||
( "$wh_prefabs = array("
|
||||
, " \"a&A1\","
|
||||
, " \"Z6&A1\","
|
||||
, ");"
|
||||
, ""
|
||||
, "$wh_files = array("
|
||||
, " \"a&A1\" => array( 37, 38 ),"
|
||||
, " \"Z98A\" => array( 5, 15 ),"
|
||||
, ");"
|
||||
, ""
|
||||
, "$wh_phonemes = array("
|
||||
, " \"mSa\" => \"A12\","
|
||||
, " \"\\\"]\" => \"\","
|
||||
, ");"
|
||||
)
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "prefabs.srl.load_by_str('"
|
||||
, "a&A1"
|
||||
, "Z6&A1"
|
||||
, "');"
|
||||
, ""
|
||||
, "files.srl.load_by_str('"
|
||||
, "a&A1|37|38"
|
||||
, "Z98A|5|15"
|
||||
, "');"
|
||||
, ""
|
||||
, "phonemes.srl.load_by_str("
|
||||
, "<:['"
|
||||
, "mSa|A12"
|
||||
, "\"]|"
|
||||
, "']:>"
|
||||
, ");"
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
class Hiero_mw_tables_parser_fxt {
|
||||
private Hiero_mw_tables_parser parser = new Hiero_mw_tables_parser();
|
||||
public void Reset() {}
|
||||
public void Test_bld_all(String raw, String expd) {
|
||||
Io_url load_url = Io_url_.mem_fil_("mem/hiero/load.php");
|
||||
Io_url save_url = Io_url_.mem_fil_("mem/hiero/save.php");
|
||||
Io_mgr.Instance.SaveFilStr(load_url, raw);
|
||||
parser.Bld_all(load_url, save_url);
|
||||
Tfds.Eq_str_lines(expd, Io_mgr.Instance.LoadFilStr(save_url));
|
||||
}
|
||||
public void Exec_bld_all(String load, String save) {
|
||||
parser.Bld_all(Io_url_.new_fil_(load), Io_url_.new_fil_(save));
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Hiero_parser_tst {
|
||||
@Before public void init() {fxt.Reset();} private Hiero_parser_fxt fxt = new Hiero_parser_fxt();
|
||||
@Test public void Separator() {
|
||||
String[][] expd = new String[][] {fxt.block_("A1"), fxt.block_("B1")};
|
||||
fxt.Test_parse("A1 B1" , expd); // space
|
||||
fxt.Test_parse("A1-B1" , expd); // dash
|
||||
fxt.Test_parse("A1\tB1" , expd); // tab
|
||||
fxt.Test_parse("A1\nB1" , expd); // nl
|
||||
fxt.Test_parse("A1\rB1" , expd); // cr
|
||||
fxt.Test_parse("A1 B1" , expd); // many: space
|
||||
fxt.Test_parse("A1 \t\nB1" , expd); // many: mixed
|
||||
}
|
||||
}
|
||||
class Hiero_parser_fxt {
|
||||
private Hiero_parser parser;
|
||||
public void Reset() {
|
||||
parser = new Hiero_parser();
|
||||
parser.Init();
|
||||
}
|
||||
public String[] block_(String... v) {return v;}
|
||||
public void Test_parse(String raw, String[]... expd) {
|
||||
byte[] raw_bry = Bry_.new_a7(raw);
|
||||
Hiero_block[] actl = parser.Parse(raw_bry, 0, raw_bry.length);
|
||||
Tfds.Eq_ary(String_.Ary_flatten(expd), String_.Ary_flatten(Xto_str(actl)));
|
||||
}
|
||||
private String[][] Xto_str(Hiero_block[] ary) {
|
||||
int len = ary.length;
|
||||
String[][] rv = new String[len][];
|
||||
for (int i = 0; i < len; i++) {
|
||||
Hiero_block itm = ary[i];
|
||||
int itm_len = itm.Len();
|
||||
String[] rv_sub = new String[itm_len];
|
||||
rv[i] = rv_sub;
|
||||
for (int j = 0; j < itm_len; j++) {
|
||||
rv_sub[j] = String_.new_u8(itm.Get_at(j));
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user