mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v3.1.1.1
This commit is contained in:
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.parsers.paras; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Xop_nl_tab_lxr_tst {
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void teardown() {fxt.Init_para_n_();}
|
||||
@Test public void Basic() { // PURPOSE: \n\t|- should be recognized as tblw; EX:zh.v:西安; DATE:2014-05-06
|
||||
fxt.Test_parse_page_wiki_str(String_.Concat_lines_nl
|
||||
|
||||
@@ -38,14 +38,14 @@ public class Xop_para_tkn extends Xop_tkn_itm_base {
|
||||
}
|
||||
switch (para_end) {
|
||||
case Xop_para_tkn.Tid_none: break;
|
||||
case Xop_para_tkn.Tid_para: bfr.Add(Html_tag_.P_rhs).Add_byte_nl(); break; // '<p>'
|
||||
case Xop_para_tkn.Tid_pre: bfr.Add(Html_tag_.Pre_rhs).Add_byte_nl(); break; // '<pre>'
|
||||
case Xop_para_tkn.Tid_para: bfr.Add(Gfh_tag_.P_rhs).Add_byte_nl(); break; // '<p>'
|
||||
case Xop_para_tkn.Tid_pre: bfr.Add(Gfh_tag_.Pre_rhs).Add_byte_nl(); break; // '<pre>'
|
||||
default: throw Err_.new_unhandled(para_end);
|
||||
}
|
||||
switch (para_bgn) {
|
||||
case Xop_para_tkn.Tid_none: break;
|
||||
case Xop_para_tkn.Tid_para: Xoh_html_wtr_.Para__assert_tag_starts_on_nl(bfr, this.Src_bgn()); bfr.Add(Html_tag_.P_lhs); break; // '</p>'
|
||||
case Xop_para_tkn.Tid_pre: Xoh_html_wtr_.Para__assert_tag_starts_on_nl(bfr, this.Src_bgn()); bfr.Add(Html_tag_.Pre_lhs); break; // '</pre>'
|
||||
case Xop_para_tkn.Tid_para: Xoh_html_wtr_.Para__assert_tag_starts_on_nl(bfr, this.Src_bgn()); bfr.Add(Gfh_tag_.P_lhs); break; // '</p>'
|
||||
case Xop_para_tkn.Tid_pre: Xoh_html_wtr_.Para__assert_tag_starts_on_nl(bfr, this.Src_bgn()); bfr.Add(Gfh_tag_.Pre_lhs); break; // '</pre>'
|
||||
default: throw Err_.new_unhandled(para_bgn);
|
||||
}
|
||||
if (space_bgn > 0)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.parsers.paras; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Xop_para_wkr_para_tst {
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void teardown() {fxt.Init_para_n_();}
|
||||
@Test public void Pre_then_xnde_pre() { // PURPOSE: if ws_pre is in effect, xnde_pre should end it; EX: b:Knowing Knoppix/Other applications
|
||||
fxt.Test_parse_page_all_str(String_.Concat_lines_nl_skip_last
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.parsers.paras; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import org.junit.*;
|
||||
public class Xop_para_wkr_pre_tst {
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private Xop_fxt fxt = new Xop_fxt();
|
||||
@Before public void init() {fxt.Reset(); fxt.Init_para_y_();} private final Xop_fxt fxt = new Xop_fxt();
|
||||
@After public void teardown() {fxt.Init_para_n_();}
|
||||
@Test public void Pre_ignore_bos() { // PURPOSE: ignore pre at bgn; DATE:2013-07-09
|
||||
fxt.Test_parse_page_all_str(String_.Concat_lines_nl
|
||||
@@ -68,11 +68,11 @@ public class Xop_para_wkr_pre_tst {
|
||||
( "<p>a"
|
||||
, "</p>"
|
||||
, " <ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\">"
|
||||
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width: 155px\">"
|
||||
, " <div style=\"width: 155px\">"
|
||||
, " <div class=\"thumb\" style=\"width: 150px;\">"
|
||||
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width:155px;\">"
|
||||
, " <div style=\"width:155px;\">"
|
||||
, " <div class=\"thumb\" style=\"width:150px;\">"
|
||||
, " <div style=\"margin:15px auto;\">"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xowa_file_img_0\" alt=\"A.png\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" /></a>"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"A.png\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" /></a>"
|
||||
, " </div>"
|
||||
, " </div>"
|
||||
, " <div class=\"gallerytext\">"
|
||||
@@ -94,11 +94,11 @@ public class Xop_para_wkr_pre_tst {
|
||||
);
|
||||
fxt.Test_parse_page_wiki_str(raw, String_.Concat_lines_nl_skip_last
|
||||
( " <ul id=\"xowa_gallery_ul_0\" class=\"gallery mw-gallery-traditional\">" // NOTE: leading " " matches MW; DATE:2014-06-23
|
||||
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width: 155px\">"
|
||||
, " <div style=\"width: 155px\">"
|
||||
, " <div class=\"thumb\" style=\"width: 150px;\">"
|
||||
, " <li id=\"xowa_gallery_li_0\" class=\"gallerybox\" style=\"width:155px;\">"
|
||||
, " <div style=\"width:155px;\">"
|
||||
, " <div class=\"thumb\" style=\"width:150px;\">"
|
||||
, " <div style=\"margin:15px auto;\">"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xowa_file_img_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" /></a>"
|
||||
, " <a href=\"/wiki/File:A.png\" class=\"image\" xowa_title=\"A.png\"><img id=\"xoimg_0\" alt=\"\" src=\"file:///mem/wiki/repo/trg/thumb/7/0/A.png/120px.png\" width=\"120\" height=\"120\" /></a>"
|
||||
, " </div>"
|
||||
, " </div>"
|
||||
, " <div class=\"gallerytext\"><p>b"
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Xop_pre_tkn extends Xop_tkn_itm_base {
|
||||
public byte Pre_tid() {return pre_tid;} private byte pre_tid = Pre_tid_null;
|
||||
@Override public void Html__write(Bry_bfr bfr, Xoh_html_wtr wtr, Xowe_wiki wiki, Xoae_page page, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoh_html_wtr_cfg cfg, Xop_tkn_grp grp, int sub_idx, byte[] src) {
|
||||
switch (pre_tid) {
|
||||
case Xop_pre_tkn.Pre_tid_bgn: bfr.Add(Html_tag_.Pre_lhs); break; // '<pre>'
|
||||
case Xop_pre_tkn.Pre_tid_bgn: bfr.Add(Gfh_tag_.Pre_lhs); break; // '<pre>'
|
||||
case Xop_pre_tkn.Pre_tid_end: bfr.Add(Bry__pre__rhs); break; // '\n</pre>\n\n'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user