1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2014-07-06 22:58:35 -04:00
parent 57f65b4d0c
commit ecbe2918d8
187 changed files with 4184 additions and 2286 deletions

View File

@@ -55,7 +55,7 @@ class Xop_nl_lxr implements Xop_lxr {
switch (ctx.Cur_tkn_tid()) {
case Xop_tkn_itm_.Tid_hdr: // last tkn was hdr; close it; EX: \n==a==\nb; "\n" should close 2nd "=="; DATE:2014-02-17
int acs_pos = ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_hdr);
ctx.Stack_pop_til(root, src, acs_pos, true, bgn_pos, cur_pos);
ctx.Stack_pop_til(root, src, acs_pos, true, bgn_pos, cur_pos, Xop_tkn_itm_.Tid_newLine);
para_wkr.Process_block__bgn_n__end_y(Xop_xnde_tag_.Tag_h2);
break;
case Xop_tkn_itm_.Tid_list: // close list
@@ -64,7 +64,7 @@ class Xop_nl_lxr implements Xop_lxr {
break;
case Xop_tkn_itm_.Tid_lnke: // close lnke
if (ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_tmpl_invk) == -1) // only close if no tmpl; MWR: [[SHA-2]]; * {{cite journal|title=Proposed
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_lnke), true, bgn_pos, cur_pos);
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_lnke), true, bgn_pos, cur_pos, Xop_tkn_itm_.Tid_newLine);
break;
case Xop_tkn_itm_.Tid_lnki: // NOTE: \n in caption or other multipart lnki; don't call para_wkr.Process
Xop_tkn_itm nl_tkn = tkn_mkr.Space(root, bgn_pos, cur_pos); // convert \n to \s. may result in multiple \s, but rely on htmlViewer to suppress; EX: w:Schwarzschild_radius; and the stellar [[Velocity dispersion|velocity\ndispersion]];

View File

@@ -59,7 +59,7 @@ public class Xop_para_wkr implements Xop_ctx_wkr {
prv_ws_bgn = 0;
this.Process_block__bgn_n__end_y(Xop_xnde_tag_.Tag_div);
}
private void Process_block(Xop_xnde_tag tag, boolean bgn, boolean end) {
private void Process_block(Xop_xnde_tag tag, boolean bgn, boolean end) {
if (prv_ws_bgn > 0) {
prv_para.Space_bgn_(prv_ws_bgn);
prv_ws_bgn = 0;
@@ -112,7 +112,7 @@ public class Xop_para_wkr implements Xop_ctx_wkr {
prv_ws_bgn = 0; // MW: $t = substr( $t, 1 );
}
else {
if (bgn_pos - prv_nl_pos == 1 || line_is_ws) { // line is blank ("b" for blank) MW: if ( trim( $t ) === '' ) {
if (bgn_pos - prv_nl_pos == 1 || line_is_ws) { // line is blank ("b" for blank) MW: if ( trim( $t ) === '' ) {
if (para_stack != Para_stack_none) { // "b1"; stack has "<p>" or "</p><p>"; output "<br/>"; MW: if ( $paragraphStack ) {
Para_stack_end(cur_pos); Add_br(ctx, root, bgn_pos); // MW: $output .= $paragraphStack . '<br />';
para_stack = Para_stack_none; // MW: $paragraphStack = false;
@@ -135,7 +135,7 @@ public class Xop_para_wkr implements Xop_ctx_wkr {
cur_mode = Mode_para; // MW: $this->mLastSection = 'p';
}
else if (cur_mode != Mode_para) { // "t2"; cur is '' or <pre> MW: elseif ( $this->mLastSection !== 'p' ) {
Prv_para_end(); Prv_para_bgn(Xop_para_tkn.Tid_para); // MW: $output .= $this->closeParagraph() . '<p>';
Prv_para_end(); Prv_para_bgn(Xop_para_tkn.Tid_para); // MW: $output .= $this->closeParagraph() . '<p>';
cur_mode = Mode_para; // MW: $this->mLastSection = 'p';
}
else {} // "t3"

View File

@@ -73,7 +73,7 @@ class Xop_pre_lxr implements Xop_lxr {
if (Bry_finder.Find_fwd(src, ctx.Wiki().Ns_mgr().Ns_category().Name_db_w_colon(), txt_pos, src_len) == txt_pos) // look for "Category:"
return false; // "[[Category:" found; "\n\s[[Category:" should not close list; note that [[Category]] is invisible
}
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_list), true, bgn_pos, cur_pos); // "* a\n\sb" found; close *a
ctx.Stack_pop_til(root, src, ctx.Stack_idx_typ(Xop_tkn_itm_.Tid_list), true, bgn_pos, cur_pos, Xop_tkn_itm_.Tid_pre); // "* a\n\sb" found; close *a
if ( txt_pos < src_len // bounds check
&& src[txt_pos] == Byte_ascii.NewLine) { // NOTE: handle "*a\n\s\n" between lists; DATE:2013-07-12
Xop_list_wkr_.Close_list_if_present(ctx, root, src, bgn_pos, cur_pos); // NOTE: above line only closes one list; should probably change to close all lists, but for now, close all lists only if "\n\s", not "\n"; DATE:2013-07-12