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,100 +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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.vnts.converts.*;
|
||||
public class Vnt_convert_lang__html__tst { // REF: https://www.mediawiki.org/wiki/Writing_systems/Syntax
|
||||
private final Vnt_convert_lang_fxt fxt = new Vnt_convert_lang_fxt();
|
||||
private String rule;
|
||||
@Before public void init() {
|
||||
rule = "-{H|zh-cn:cn;zh-hk:hk;zh-tw:tw}-";
|
||||
fxt.Clear();
|
||||
}
|
||||
@Test public void Node() {
|
||||
fxt.Test_parse(rule + "hk<span>hk</span>hk", "cn<span>cn</span>cn");
|
||||
}
|
||||
@Test public void Attribs() {
|
||||
fxt.Test_parse(rule + "<span class='hk'>hk</span>", "<span class='hk'>cn</span>");
|
||||
}
|
||||
@Test public void Attribs__title() {
|
||||
fxt.Test_parse(rule + "<span title='hk'>hk</span>", "<span title='cn'>cn</span>");
|
||||
}
|
||||
@Test public void Attribs__alt() {
|
||||
fxt.Test_parse(rule + "<span alt='hk'>hk</span>", "<span alt='cn'>cn</span>");
|
||||
}
|
||||
@Test public void Attribs__alt_w_embedded_vnt() { // PURPOSE: handle embedded variants inside attribute tags; PAGE:sr.n:Проглашени_победници_„Вики_воли_Земљу" DATE:2015-10-13
|
||||
fxt.Test_parse(rule + "<img id='hk' alt='hk-{hk}-hk' src='hk'>", "<img id='hk' alt='cnhkcn' src='hk'>");
|
||||
}
|
||||
@Test public void Attribs__skip_url() {
|
||||
fxt.Test_parse(rule + "<span alt='http://hk.org'>hk</span>", "<span alt='http://hk.org'>cn</span>");
|
||||
}
|
||||
@Test public void Node__script() {
|
||||
fxt.Test_parse(rule + "hk<script>hk</script>hk", "cn<script>hk</script>cn");
|
||||
}
|
||||
@Test public void Node__code() {
|
||||
fxt.Test_parse(rule + "hk<code>hk</code>hk", "cn<code>hk</code>cn");
|
||||
}
|
||||
@Test public void Node__pre() {
|
||||
fxt.Test_parse(rule + "hk<pre>hk</pre>hk", "cn<pre>hk</pre>cn");
|
||||
}
|
||||
@Test public void Node__pre__nested() {
|
||||
fxt.Test_parse(rule + "hk<pre><span>hk</span></pre>hk", "cn<pre><span>hk</span></pre>cn");
|
||||
}
|
||||
@Test public void Recursive__deep() {
|
||||
fxt.Test_parse("a-{b-{c-{d}-e}-f}-g", "abcdefg");
|
||||
}
|
||||
@Test public void Recursive__many() {
|
||||
fxt.Test_parse("a-{b-{c}-d-{e}-f}-g", "abcdefg");
|
||||
}
|
||||
@Test public void Recursive__unclosed() {
|
||||
fxt.Test_parse("a-{b-{c", "a-{b-{c");
|
||||
}
|
||||
@Test public void Recursive__unclosed_2() {
|
||||
fxt.Test_parse("a-{b-{c}-", "a-{bc");
|
||||
}
|
||||
@Test public void Recursive__failed() { // PURPOSE: handle out of bounds exception; PAGE:zh.w:重庆市 ;DATE:2015-10-01
|
||||
fxt.Test_parse("-{zh-cn:a-{b}-c; zh-tw:d-{e}-f; }-", "abc");
|
||||
}
|
||||
@Test public void Unclosed() {
|
||||
fxt.Test_parse("a-{bc", "a-{bc");
|
||||
}
|
||||
@Test public void Entity__body() {
|
||||
fxt.Test_parse("-{H|zh-cn:nbsp-cn;zh-hk:nbsp;}-" + " nbsp", " nbsp-cn");
|
||||
}
|
||||
@Test public void Entity__atr() {
|
||||
fxt.Test_parse("-{H|zh-cn:nbsp-cn;zh-hk:nbsp;}-" + "<div title='nbsp nbsp'/>" , "<div title='nbsp-cn nbsp-cn'/>");
|
||||
}
|
||||
@Test public void Node__example() {
|
||||
fxt.Test_parse(rule + String_.Concat_lines_nl_skip_last
|
||||
( "{|"
|
||||
, "|-"
|
||||
, "|A<br />"
|
||||
, "|B<br/>"
|
||||
, "<span style=''>-{zh-hans:C;zh-hant:D;}-</span>"
|
||||
, "|}")
|
||||
, String_.Concat_lines_nl_skip_last
|
||||
( "{|"
|
||||
, "|-"
|
||||
, "|A<br />"
|
||||
, "|B<br/>"
|
||||
, "<span style=''>C</span>"
|
||||
, "|}"
|
||||
));
|
||||
}
|
||||
@Test public void Attribs__title__w_vnt() {
|
||||
fxt.Init_cur("zh-tw");
|
||||
fxt.Test_parse("<span title=\"-{zh-cn:cn;zh-hant:hk;}-cn\" style=\"color:red;\">cn</span>", "<span title=\"hkcn\" style=\"color:red;\">cn</span>"); // cn not converted to hk
|
||||
}
|
||||
}
|
||||
@@ -1,81 +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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*; import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.vnts.converts.*;
|
||||
public class Vnt_convert_lang__syntax__tst { // REF: https://www.mediawiki.org/wiki/Writing_systems/Syntax
|
||||
private final Vnt_convert_lang_fxt fxt = new Vnt_convert_lang_fxt();
|
||||
@Test public void Bidi() {
|
||||
String text = "-{zh-hans:a;zh-hant:b}-";
|
||||
fxt.Test_parse_many(text, "a", "zh-hans", "zh-cn", "zh-sg", "zh");
|
||||
fxt.Test_parse_many(text, "b", "zh-hant", "zh-hk", "zh-tw");
|
||||
}
|
||||
@Test public void Undi() {
|
||||
String text = "-{H|cn_k=>zh-cn:cn_v}-cn_k";
|
||||
fxt.Test_parse_many(text, "cn_k", "zh", "zh-hans", "zh-hant", "zh-hk", "zh-my", "zh-mo", "zh-sg", "zh-tw");
|
||||
fxt.Test_parse_many(text, "cn_v", "zh-cn");
|
||||
}
|
||||
@Test public void Raw() {
|
||||
fxt.Test_parse_many("-{a}-", "a", "zh-hans", "zh-cn", "zh-sg", "zh", "zh-hant", "zh-hk", "zh-tw");
|
||||
fxt.Test_parse_many("-{R|a}-", "a", "zh-hans", "zh-cn", "zh-sg", "zh", "zh-hant", "zh-hk", "zh-tw");
|
||||
}
|
||||
@Test public void Hide() {
|
||||
String text = "-{H|zh-cn:cn;zh-hk:hk;zh-tw:tw}-cn hk tw";
|
||||
fxt.Test_parse_many(text, "cn cn cn", "zh-cn", "zh-sg");
|
||||
fxt.Test_parse_many(text, "hk hk hk", "zh-hk");
|
||||
fxt.Test_parse_many(text, "tw tw tw", "zh-tw");
|
||||
fxt.Test_parse_many(text, "cn hk tw", "zh", "zh-hans", "zh-hant");
|
||||
}
|
||||
@Test public void Aout() {
|
||||
String text = "-{A|zh-cn:cn;zh-hk:hk;zh-tw:tw}- cn hk tw";
|
||||
fxt.Test_parse_many(text, "cn cn cn cn", "zh-cn", "zh-sg");
|
||||
fxt.Test_parse_many(text, "hk hk hk hk", "zh-hk");
|
||||
fxt.Test_parse_many(text, "tw tw tw tw", "zh-tw");
|
||||
fxt.Test_parse_many(text, "cn cn hk tw", "zh", "zh-hans");
|
||||
fxt.Test_parse_many(text, "tw cn hk tw", "zh-hant");
|
||||
fxt.Test_parse_many("h-{}-k", "hk", "zh-cn"); // semi-disabled
|
||||
}
|
||||
@Test public void Del() {
|
||||
String text = "-{H|zh-cn:cn;zh-hk:hk;zh-tw:tw}-cn hk tw-{-|zh-cn:cn;zh-hk:hk;zh-tw:tw}- cn hk tw";
|
||||
fxt.Test_parse_many(text, "cn cn cn cn hk tw", "zh-cn", "zh-sg");
|
||||
fxt.Test_parse_many(text, "hk hk hk cn hk tw", "zh-hk");
|
||||
fxt.Test_parse_many(text, "tw tw tw cn hk tw", "zh-tw");
|
||||
fxt.Test_parse_many(text, "cn hk tw cn hk tw", "zh", "zh-hans", "zh-hant");
|
||||
}
|
||||
@Test public void Title() {
|
||||
fxt.Test_parse_title("-{}-", null, "", "zh-cn");
|
||||
String text = "-{T|zh-cn:cn;zh-hk:hk;zh-tw:tw}-cn hk tw";
|
||||
fxt.Test_parse_title(text, "cn", "cn hk tw", "zh-cn");
|
||||
fxt.Test_parse_title(text, "cn", "cn hk tw", "zh-sg");
|
||||
fxt.Test_parse_title(text, "hk", "cn hk tw", "zh-hk");
|
||||
fxt.Test_parse_title(text, "tw", "cn hk tw", "zh-tw");
|
||||
fxt.Test_parse_title(text, "cn", "cn hk tw", "zh-hans");
|
||||
fxt.Test_parse_title(text, "tw", "cn hk tw", "zh-hant");
|
||||
fxt.Test_parse_title(text, null, "cn hk tw", "zh");
|
||||
}
|
||||
@Test public void Descrip() {
|
||||
String text = "-{D|zh-cn:cn;zh-hk:hk;zh-tw:tw}-";
|
||||
fxt.Test_parse_many(text, "ZH-CN:cn;ZH-HK:hk;ZH-TW:tw;", "zh", "zh-hans", "zh-hant", "zh-cn", "zh-hk", "zh-my", "zh-mo", "zh-sg", "zh-tw");
|
||||
}
|
||||
@Test public void Mixture() {
|
||||
String text = "-{H|zh-cn:cn;zh-hk:hk;zh-tw:tw}--{zh;zh-hans;zh-hant|cn hk tw}- -{zh;zh-cn;zh-hk;zh-tw|cn hk tw}-";
|
||||
fxt.Test_parse_many(text, "cn hk tw cn cn cn", "zh-cn", "zh-sg", "zh-hans");
|
||||
fxt.Test_parse_many(text, "cn hk tw hk hk hk", "zh-hk");
|
||||
fxt.Test_parse_many(text, "cn hk tw tw tw tw", "zh-tw", "zh-hant");
|
||||
fxt.Test_parse_many(text, "cn hk tw cn hk tw", "zh");
|
||||
}
|
||||
@Test public void Descrip__undi() {fxt.Test_parse("-{D|cn_k=>zh-cn:cn_v;hk_k=>zh-hk:hk_v}-", "cn_k⇒ZH-CN:cn_v;hk_k⇒ZH-HK:hk_v;");}
|
||||
@Test public void Descrip__mixd() {fxt.Test_parse("-{D|zh-tw:tw_v;cn_k=>zh-cn:cn_v;hk_k=>zh-hk:hk_v;zh-mo:mo_v}-", "ZH-TW:tw_v;ZH-MO:mo_v;cn_k⇒ZH-CN:cn_v;hk_k⇒ZH-HK:hk_v;");}
|
||||
}
|
||||
@@ -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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.langs.vnts.*; import gplx.xowa.langs.vnts.converts.*;
|
||||
class Vnt_convert_lang_fxt {
|
||||
private final Vnt_convert_lang converter_lang;
|
||||
private final Xol_convert_mgr convert_mgr = new Xol_convert_mgr();
|
||||
private final Xol_vnt_regy vnt_regy = Xol_vnt_regy_fxt.new_chinese();
|
||||
private Xol_vnt_itm vnt_itm;
|
||||
public Vnt_convert_lang_fxt() {
|
||||
converter_lang = new Vnt_convert_lang(convert_mgr, vnt_regy);
|
||||
this.Clear();
|
||||
}
|
||||
public void Clear() {
|
||||
convert_mgr.Init(vnt_regy);
|
||||
Init_cur("zh-cn");
|
||||
}
|
||||
public Vnt_convert_lang_fxt Init_cur(String vnt) {
|
||||
byte[] cur_vnt = Bry_.new_a7(vnt);
|
||||
this.vnt_itm = vnt_regy.Get_by(cur_vnt);
|
||||
return this;
|
||||
}
|
||||
public void Test_parse(String raw, String expd) {
|
||||
Tfds.Eq_str(expd, String_.new_u8(converter_lang.Parse_page(vnt_itm, -1, Bry_.new_u8(raw))));
|
||||
}
|
||||
public void Test_parse_many(String raw, String expd, String... vnts) {
|
||||
int len = vnts.length;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
String vnt_key = vnts[i];
|
||||
Init_cur(vnt_key);
|
||||
Xol_vnt_itm vnt = vnt_regy.Get_by(Bry_.new_a7(vnt_key));
|
||||
Tfds.Eq_str(expd, String_.new_u8(converter_lang.Parse_page(vnt, -1, Bry_.new_u8(raw))), vnt_key);
|
||||
}
|
||||
}
|
||||
public void Test_parse_title(String raw, String expd_title, String expd_text, String vnt_key) {
|
||||
Init_cur(vnt_key);
|
||||
Xol_vnt_itm vnt = vnt_regy.Get_by(Bry_.new_a7(vnt_key));
|
||||
Tfds.Eq_str(expd_text, String_.new_u8(converter_lang.Parse_page(vnt, -1, Bry_.new_u8(raw))), vnt_key);
|
||||
Tfds.Eq_str(expd_title, converter_lang.Converted_title());
|
||||
}
|
||||
}
|
||||
@@ -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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*; import gplx.xowa.langs.vnts.*;
|
||||
public class Vnt_flag_parser_tst {
|
||||
private final Vnt_flag_parser_fxt fxt = new Vnt_flag_parser_fxt();
|
||||
@Test public void Basic() {fxt.Test_parse("D" , "D");}
|
||||
@Test public void Multiple() {fxt.Test_parse("+;S;E" , "+;S;E");}
|
||||
@Test public void Ws() {fxt.Test_parse(" + ; S ; E " , "+;S;E");}
|
||||
@Test public void None() {fxt.Test_parse("" , "S");}
|
||||
@Test public void Wrong() {fxt.Test_parse("XYZ" , "S");}
|
||||
@Test public void Raw__limit() {fxt.Test_parse("R;S" , "R");}
|
||||
@Test public void Name__limit() {fxt.Test_parse("N;S" , "N");}
|
||||
@Test public void Del_limit() {fxt.Test_parse("-;S" , "-");}
|
||||
@Test public void Title__also_macro_y() {fxt.Test_parse("T" , "H;T");}
|
||||
@Test public void Title__also_macro_n() {fxt.Test_parse("T;S" , "S;T");}
|
||||
@Test public void Hide__remove_all() {fxt.Test_parse("H;S" , "+;H");}
|
||||
@Test public void Hide__keep_descrip() {fxt.Test_parse("H;S;D" , "+;H;D");}
|
||||
@Test public void Hide__keep_title() {fxt.Test_parse("H;S;T" , "+;H;T");}
|
||||
@Test public void Aout__also_show_all() {fxt.Test_parse("A" , "+;A;S");}
|
||||
@Test public void Descrip__remove_show() {fxt.Test_parse("D;S" , "D");}
|
||||
@Test public void Aout_w_descrip() {fxt.Test_parse("A;D;S" , "+;A;D");}
|
||||
@Test public void Lang__one() {fxt.Test_parse("zh-hans" , "S;zh-hans");}
|
||||
@Test public void Lang__many() {fxt.Test_parse("zh-cn;zh-hk" , "S;zh-cn;zh-hk");}
|
||||
@Test public void Lang__many__ws() {fxt.Test_parse(" zh-cn ; zh-hk " , "S;zh-cn;zh-hk");}
|
||||
@Test public void Lang__many__dupe() {fxt.Test_parse("zh-cn;zh-cn" , "S;zh-cn");}
|
||||
@Test public void Lang__zap__codes() {fxt.Test_parse("+;S;zh-hans;" , "zh-hans");}
|
||||
}
|
||||
class Vnt_flag_parser_fxt {
|
||||
private final Vnt_flag_parser parser = new Vnt_flag_parser();
|
||||
private final Vnt_flag_code_mgr codes = new Vnt_flag_code_mgr(); private final Vnt_flag_lang_mgr langs = new Vnt_flag_lang_mgr();
|
||||
private final Xol_vnt_regy vnt_regy = Xol_vnt_regy_fxt.new_chinese();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New();
|
||||
public void Test_parse(String raw, String expd) {
|
||||
byte[] src = Bry_.new_u8(raw);
|
||||
parser.Parse(codes, langs, vnt_regy, src, 0, src.length);
|
||||
codes.To_bfr__dbg(bfr);
|
||||
langs.To_bfr__dbg(bfr);
|
||||
Tfds.Eq_str(expd, bfr.To_str_and_clear());
|
||||
}
|
||||
}
|
||||
@@ -1,25 +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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Vnt_rule_parser__bidi_tst {
|
||||
private final Vnt_rule_parser_fxt fxt = new Vnt_rule_parser_fxt();
|
||||
@Test public void Basic() {fxt.Test_parse("x1:v1;" , "x1:v1");}
|
||||
@Test public void Ws() {fxt.Test_parse(" x1 : v1 ;" , "x1:v1");}
|
||||
@Test public void Entity() {fxt.Test_parse("x1:a x2:b;x2:b;" , "x1:a x2:b" , "x2:b");}
|
||||
@Test public void Unknown__nth() {fxt.Test_parse("x1:a;wx2:b;x2:b;" , "x1:a;wx2:b" , "x2:b");}
|
||||
@Test public void Unknown__1st() {fxt.Test_parse("wx1:a;x1:b;" , "");}
|
||||
}
|
||||
@@ -1,22 +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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Vnt_rule_parser__undi_tst {
|
||||
private final Vnt_rule_parser_fxt fxt = new Vnt_rule_parser_fxt();
|
||||
@Test public void One() {fxt.Test_parse("k1=>x1:v1;" , "x1:k1=v1");}
|
||||
@Test public void Many() {fxt.Test_parse("k1=>x1:v1;k2=>x2:v2;" , "x1:k1=v1", "x2:k2=v2");}
|
||||
}
|
||||
@@ -1,35 +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.parsers.vnts; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.langs.vnts.*;
|
||||
class Vnt_rule_parser_fxt {
|
||||
private final Vnt_rule_parser parser = new Vnt_rule_parser(); private final Vnt_rule_undi_mgr undis = new Vnt_rule_undi_mgr(); private final Vnt_rule_bidi_mgr bidis = new Vnt_rule_bidi_mgr();
|
||||
private final Bry_bfr bfr = Bry_bfr_.New_w_size(255);
|
||||
public Vnt_rule_parser_fxt() {
|
||||
Xol_vnt_regy vnt_regy = new Xol_vnt_regy();
|
||||
vnt_regy.Add(Bry_.new_a7("x1"), Bry_.new_a7("lang1"));
|
||||
vnt_regy.Add(Bry_.new_a7("x2"), Bry_.new_a7("lang2"));
|
||||
vnt_regy.Add(Bry_.new_a7("x3"), Bry_.new_a7("lang3"));
|
||||
parser.Init(null, vnt_regy);
|
||||
}
|
||||
public void Test_parse(String raw, String... expd_ary) {
|
||||
byte[] src = Bry_.new_u8(raw);
|
||||
parser.Clear(undis, bidis, src);
|
||||
parser.Parse(src, 0, src.length);
|
||||
parser.To_bry__dbg(bfr);
|
||||
Tfds.Eq_str_lines(String_.Concat_lines_nl_skip_last(expd_ary), bfr.To_str_and_clear());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user