1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.6.3.1'

This commit is contained in:
gnosygnu
2016-06-20 13:34:48 -04:00
parent d4e8590345
commit d43e0d2341
28 changed files with 162 additions and 344 deletions

View File

@@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.skins.*; import gplx.xowa.files.*;
import gplx.xowa.wikis.pages.*; import gplx.xowa.wikis.pages.skins.*; import gplx.xowa.wikis.pages.lnkis.*; import gplx.xowa.files.*;
import gplx.xowa.htmls.heads.*; import gplx.xowa.htmls.sections.*; import gplx.xowa.htmls.core.makes.imgs.*;
public class Xoh_page implements Xoa_page {
// core
@@ -44,8 +44,8 @@ public class Xoh_page implements Xoa_page {
public Xopg_html_data Html_data() {return html_data;} private Xopg_html_data html_data = new Xopg_html_data();
public byte[] Redirect_to_ttl() {return redirect_to_ttl;} private byte[] redirect_to_ttl; public void Redirect_to_ttl_(byte[] v) {this.redirect_to_ttl = v;}
// util
public Xopg_lnki_list Redlink_list() {return redlink_list;} private Xopg_lnki_list redlink_list;
public Xoa_page__commons_mgr Commons_mgr() {return commons_mgr;} private final Xoa_page__commons_mgr commons_mgr = new Xoa_page__commons_mgr();
public int Exec_tid() {return exec_tid;} private int exec_tid = Xof_exec_tid.Tid_wiki_page;
public byte[] Html_head_xtn() {return html_head_xtn;} public void Html_head_xtn_(byte[] v) {html_head_xtn = v;} private byte[] html_head_xtn = Bry_.Empty; // drd:web_browser
@@ -53,6 +53,7 @@ public class Xoh_page implements Xoa_page {
public void Init(Xow_wiki wiki, Xoa_url page_url, Xoa_ttl page_ttl, int page_id) {
this.wiki = wiki; this.page_url = page_url; this.page_ttl = page_ttl; this.page_id = page_id;
this.Clear();
this.redlink_list = new Xopg_lnki_list(page_ttl.Ns().Id_is_module());
}
public void Ctor_by_db(int head_flag, byte[] display_ttl, byte[] content_sub, byte[] sidebar_div, int zip_tid, int hzip_tid, byte[] body) {
head_mgr.Flag_(head_flag);

View File

@@ -40,7 +40,7 @@ public class Xoh_page_wtr_wkr {
case Xopg_page_.Tid_edit: fmtr = mgr.Page_edit_fmtr(); break;
case Xopg_page_.Tid_html: fmtr = mgr.Page_read_fmtr(); view_mode = Xopg_page_.Tid_read; break; // set view_mode to read, so that "read" is highlighted in HTML
case Xopg_page_.Tid_read: fmtr = mgr.Page_read_fmtr();
ctx.Page().Redlink_lnki_list().Clear(); // not sure if this is the best place to put it, but redlinks (a) must only fire once; (b) must fire before html generation; (c) cannot fire during edit (preview will handle separately)
ctx.Page().Redlink_list().Clear(); // not sure if this is the best place to put it, but redlinks (a) must only fire once; (b) must fire before html generation; (c) cannot fire during edit (preview will handle separately)
break;
}
Bry_bfr page_bfr = Xoa_app_.Utl__bfr_mkr().Get_m001(); // NOTE: get separate page bfr to output page; do not reuse tmp_bfr b/c it will be used inside Fmt_do

View File

@@ -140,6 +140,11 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
break;
}
}
// generate stub for redlink
// Xopg_lnki_itm__hdump lnki_itm = new Xopg_lnki_itm__hdump(null);
// hpg.Redlink_list().Add(lnki_itm);
// gen html
bfr.Add(Gfh_bldr_.Bry__a_lhs_w_href);
switch (href_type) {
@@ -166,7 +171,7 @@ public class Xoh_lnki_hzip implements Xoh_hzip_wkr, Gfo_poolable_itm {
}
if (cls_bry != null) bfr.Add(Gfh_bldr_.Bry__cls__nth).Add(cls_bry);
if (!hctx.Mode_is_diff())
bfr.Add(Gfh_bldr_.Bry__id__nth).Add_str_a7(gplx.xowa.parsers.lnkis.redlinks.Xopg_redlink_lnki_list.Lnki_id_prefix).Add_int_variable(hctx.Uid__lnki_nxt());
bfr.Add(Gfh_bldr_.Bry__id__nth).Add_str_a7(gplx.xowa.wikis.pages.lnkis.Xopg_lnki_list.Lnki_id_prefix).Add_int_variable(hctx.Uid__lnki_nxt());
if ( href_type != Xoh_anch_href_data.Tid__anch) { // anchs never have title;
if (title_bry != null) {
bfr.Add(Gfh_bldr_.Bry__title__nth);

View File

@@ -0,0 +1,24 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.htmls.core.wkrs.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*;
import gplx.xowa.wikis.pages.lnkis.*;
class Xopg_lnki_itm__hdump implements Xopg_lnki_itm {
public Xopg_lnki_itm__hdump(Xoa_ttl ttl) {this.ttl = ttl;}
public Xoa_ttl Ttl() {return ttl;} private final Xoa_ttl ttl;
public int Html_uid() {return html_uid;} private int html_uid; public void Html_uid_(int v) {html_uid = v;}
}

View File

@@ -20,14 +20,14 @@ import gplx.langs.htmls.*; import gplx.xowa.files.*; import gplx.xowa.users.hist
import gplx.xowa.wikis.nss.*;
import gplx.xowa.wikis.xwikis.*; import gplx.xowa.xtns.wdatas.core.*;
import gplx.xowa.htmls.core.htmls.*; import gplx.xowa.htmls.core.hzips.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.parsers.lnkis.redlinks.*;
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkis.*; import gplx.xowa.wikis.pages.lnkis.*;
public class Xoh_lnki_wtr {
private Xoae_app app; private Xowe_wiki wiki; private Xoae_page page; private Xop_ctx ctx;
private Xoh_html_wtr_cfg cfg;
private Xou_history_mgr history_mgr;
private Xop_lnki_caption_wtr_tkn caption_tkn_wtr;
private Xop_lnki_caption_wtr_bry caption_bry_wtr;
private Xopg_redlink_lnki_list redlinks_mgr;
private Xopg_lnki_list redlinks_mgr;
public Xoh_lnki_wtr(Xoh_html_wtr html_wtr, Xowe_wiki wiki, Xow_html_mgr html_mgr, Xoh_html_wtr_cfg cfg) {
caption_tkn_wtr = new Xop_lnki_caption_wtr_tkn(html_wtr);
caption_bry_wtr = new Xop_lnki_caption_wtr_bry();
@@ -38,7 +38,7 @@ public class Xoh_lnki_wtr {
public void Init_by_page(Xop_ctx ctx, Xoh_wtr_ctx hctx, byte[] src, Xoae_page page) {
this.ctx = ctx; this.page = page; // NOTE: must set ctx for file.v2; DATE:2014-06-22
this.wiki = ctx.Wiki();
redlinks_mgr = page.Redlink_lnki_list(); // NOTE: need to set redlinks_mgr, else toc parse may fail; EX:pl.d:head_sth_off;DATE:2014-05-07
redlinks_mgr = page.Redlink_list(); // NOTE: need to set redlinks_mgr, else toc parse may fail; EX:pl.d:head_sth_off;DATE:2014-05-07
file_wtr.Init_by_page(hctx, page);
this.history_mgr = app.Usere().History_mgr();
if (hctx.Mode_is_hdump()) cfg.Lnki__id_(false);
@@ -61,7 +61,7 @@ public class Xoh_lnki_wtr {
return;
}
boolean literal_link = lnki_ttl.ForceLiteralLink(); // NOTE: if literal link, then override ns behavior; for File, do not show image; for Ctg, do not display at bottom of page
redlinks_mgr.Lnki_add(lnki);
redlinks_mgr.Add(lnki);
boolean stage_is_alt = hctx.Mode_is_alt();
switch (lnki.Ns_id()) {
case Xow_ns_.Tid__media: if (!stage_is_alt) file_wtr.Write_or_queue(bfr, page, ctx, hctx, src, lnki); return; // NOTE: literal ":" has no effect; PAGE:en.w:Beethoven and [[:Media:De-Ludwig_van_Beethoven.ogg|listen]]

View File

@@ -1,86 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//namespace gplx.xowa.htmls.core.to_delete {
// using gplx.core.primitives; using gplx.core.btries; using gplx.dbs; using gplx.core.ios;
// using gplx.xowa.wikis.dbs; using gplx.xowa.wikis.pages; using gplx.xowa.htmls.core.makes.imgs; using gplx.xowa.wikis.pages.skins;
// using gplx.xowa.wikis.data; using gplx.xowa.wikis.data.tbls; using gplx.xowa.guis;
// public class Xohd_page_html_mgr__load {
// private final Bry_rdr_old rdr = new Bry_rdr_old(); private final List_adp rows = List_adp_.New(), imgs = List_adp_.New();
// public void Load_page(Xow_wiki wiki, Xoh_page hpg, Xowd_html_tbl tbl, int page_id, Xoa_ttl page_ttl) {
// Xoa_app_.Usr_dlg().Plog_many("", "", "hdump.load.text: ttl=~{0}", page_ttl.Full_db_as_str());
// tbl.Select_by_page(rows, page_id);
// Parse_rows(wiki, hpg, page_id, Xoa_url.blank(), page_ttl, rows);
// }
// public void Parse_rows(Xow_wiki wiki, Xoh_page hpg, int page_id, Xoa_url page_url, Xoa_ttl page_ttl, List_adp rows) { // TEST:
// hpg.Init(wiki, page_id, page_url, page_ttl);
// imgs.Clear();
// int len = rows.Count();
// for (int i = 0; i < len; ++i) {
// Xowd_html_row row = (Xowd_html_row)rows.Get_at(i);
// switch (row.Tid()) {
// case Xowd_html_row.Tid__img:
// case Xowd_html_row.Tid__redlink:
// Parse_data(hpg, row); break;
// }
// }
// rows.Clear();
// }
// private void Parse_data(Xoh_page hpg, Xowd_html_row row) {
// rdr.Init(row.Data());
// while (!rdr.Pos_is_eos()) {
// int tid = rdr.Read_int_to_pipe();
// switch (tid) {
// case Xohd_img_tid.Tid_img : Load_data_img(); break; // 1|0|A.png|0|220|110|...
// case Xohd_img_tid.Tid_gallery : Load_data_gallery(hpg); break; // 3|0|800
// case Xohd_img_tid.Tid_redlink : Load_data_redlink(hpg); break; // 2|2|0|1
// }
// }
// if (imgs.Count() > 0) hpg.Img_itms_((Xohd_img_itm__base[])imgs.To_ary_and_clear(typeof(Xohd_img_itm__base)));
// }
// public static Xohd_img_itm__base Load_img(Bry_rdr_old rdr) {
// int tid = rdr.Read_int_to_pipe();
// Xohd_img_itm__base img_itm = null;
// switch (tid) {
// case Xohd_img_itm__base.Tid_basic : img_itm = new Xohd_img_itm__img(); break;
// case Xohd_img_itm__base.Tid_gallery : img_itm = new Xohd_img_itm__gallery_itm(); break;
// default : throw Err_.new_unhandled(tid);
// }
// img_itm.Data_parse(rdr);
// // Xoa_app_.Usr_dlg().Log_many("", "", "itm: ~{0}", img_itm.Data_print());
// rdr.Pos_add_one();
// return img_itm;
// }
// private void Load_data_img() {
// Xohd_img_itm__base img = Load_img(rdr);
// if (img == null) return;
// imgs.Add(img);
// }
// private void Load_data_redlink(Xoh_page hpg) {
// Ordered_hash redlink_hash = hpg.Redlink_uids();
// while (!rdr.Pos_is_eos()) {
// Int_obj_ref redlink_uid = Int_obj_ref.New(rdr.Read_int_to_pipe());
// redlink_hash.Add(redlink_uid, redlink_uid);
// }
// }
// private void Load_data_gallery(Xoh_page hpg) {
// int uid = rdr.Read_int_to_pipe();
// int box_max = rdr.Read_int_to_pipe();
// hpg.Gallery_itms().Add_if_dupe_use_nth(uid, new Xohd_img_itm__gallery_mgr(uid, box_max)); // TODO_OLD: temporarily added b/c last build did not add gallery uid correctly
// }
// }
//}

View File

@@ -1,50 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//namespace gplx.xowa.htmls.core.to_delete {
// using gplx.xowa.wikis.data; using gplx.xowa.wikis.data.tbls; using gplx.xowa.htmls.core.makes.imgs;
// using gplx.xowa.guis; using gplx.xowa.wikis.pages; using gplx.xowa.parsers.lnkis.redlinks;
// public class Xohd_page_html_mgr__save {
// public void Update(Bry_bfr tmp_bfr, Xowd_html_tbl tbl, Xoae_page page) {
// Xoh_page hpg = new Xoh_page().Ctor_by_page(tmp_bfr, page);
// tbl.Delete(page.Revision_data().Id());
// this.Insert(tmp_bfr, tbl, hpg, page.Hdump_data());
// }
// public int Insert(Bry_bfr tmp_bfr, Xowd_html_tbl tbl, Xoh_page hpg, Xopg_hdump_data hdump_data) {
// int rv = 0;
// int page_id = hpg.Page_id();
// rv += Insert_row(tbl, page_id, Xowd_html_row.Tid__img , Write_imgs(tmp_bfr, hdump_data.Imgs()));
// rv += Insert_row(tbl, page_id, Xowd_html_row.Tid__redlink , Write_redlinks(tmp_bfr, hdump_data.Redlink_mgr()));
// return rv;
// }
// private int Insert_row(Xowd_html_tbl tbl, int page_id, int row_tid, byte[] bry) {return bry == null ? 0 : tbl.Insert(page_id, row_tid, bry);}
// public static byte[] Write_redlinks(Bry_bfr bfr, Xopg_redlink_idx_list redlink_mgr) {
// int len = redlink_mgr.Len(); if (len == 0) return null;
// for (int i = 0; i < len; ++i)
// bfr.Add_int_variable(redlink_mgr.Get_at(i)).Add_byte_pipe();
// return bfr.To_bry_and_clear();
// }
// public static byte[] Write_imgs(Bry_bfr bfr, List_adp imgs) {
// int len = imgs.Count(); if (len == 0) return null; // no images; exit early, else will write blank String
// for (int i = 0; i < len; ++i) {
// Xohd_img_itm itm = (Xohd_img_itm)imgs.Get_at(i);
// itm.Data_write(bfr);
// }
// return bfr.To_bry_and_clear();
// }
// }
//}