mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.4.3.1'
This commit is contained in:
@@ -19,7 +19,7 @@ package gplx.xowa.htmls; import gplx.*; import gplx.xowa.*;
|
||||
import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private final Bry_bfr tmp_bfr = Bry_bfr.reset_(255);
|
||||
private Xoh_page_wtr_wkr edit_wtr, html_wtr, read_wtr;
|
||||
public Xoh_page_wtr_mgr(boolean html_capable) {
|
||||
this.html_capable = html_capable;
|
||||
@@ -79,9 +79,9 @@ public class Xoh_page_wtr_mgr implements GfoInvkAble {
|
||||
, " </a>"
|
||||
), "src_full_db");
|
||||
public static final String Invk_page_read_ = "page_read_", Invk_page_edit_ = "page_edit_", Invk_page_html_ = "page_html_", Invk_xowa_div_edit_rename_ = "xowa_div_edit_rename_";
|
||||
private static final String[] Fmtr_keys = new String[]
|
||||
private static final String[] Fmtr_keys = new String[]
|
||||
{ "app_root_dir", "app_version", "app_build_date", "xowa_mode_is_server"
|
||||
, "page_id", "page_name", "page_title", "page_modified_on_msg", "page_heading"
|
||||
, "page_id", "page_name", "page_heading", "page_modified_on_msg"
|
||||
, "html_css_common_path", "html_css_wiki_path", "xowa_head"
|
||||
, "page_lang_ltr", "page_indicators", "page_content_sub", "page_jumpto", "page_pgbnr", "page_body_cls", "html_content_editable"
|
||||
, "page_data", "page_langs"
|
||||
|
||||
@@ -87,14 +87,14 @@ public class Xoh_page_wtr_wkr {
|
||||
page_ttl = Xoa_ttl.parse(wiki, page_ttl.Ns().Id(), converted_title);
|
||||
}
|
||||
byte[] page_name = Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, page_ttl, null); // NOTE: page_name does not show display_title (<i>). always pass in null
|
||||
byte[] page_display = Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, page_ttl, page.Html_data().Display_ttl());
|
||||
byte[] page_display_title = Xoh_page_wtr_wkr_.Bld_page_name(tmp_bfr, page_ttl, page.Html_data().Display_ttl());
|
||||
page.Html_data().Custom_tab_name_(page_name); // set tab_name to page_name; note that if null, gui code will ignore and use Ttl.Page_txt; PAGE: zh.w:釣魚臺列嶼主權問題 DATE:2015-10-05
|
||||
Xow_portal_mgr portal_mgr = wiki.Html_mgr().Portal_mgr().Init_assert();
|
||||
fmtr.Bld_bfr_many(bfr
|
||||
, root_dir_bry, Xoa_app_.Version, Xoa_app_.Build_date, app.Tcp_server().Running_str()
|
||||
, page.Revision_data().Id()
|
||||
, page_name, page_display
|
||||
, modified_on_msg, page.Html_data().Page_heading().Init(page)
|
||||
, page_name, page.Html_data().Page_heading().Init(page.Html_data(), page_display_title)
|
||||
, modified_on_msg
|
||||
, mgr.Css_common_bry(), mgr.Css_wiki_bry(), page.Html_data().Head_mgr().Init(app, wiki, page).Init_dflts()
|
||||
, page.Lang().Dir_ltr_bry(), page.Html_data().Indicators(), page_content_sub, wiki.Html_mgr().Portal_mgr().Div_jump_to(), wiki.Xtn_mgr().Xtn_pgbnr().Write_html(ctx, page, hctx, page_data), page_body_class, html_content_editable
|
||||
, page_data, wdata_lang_wtr
|
||||
@@ -102,8 +102,8 @@ public class Xoh_page_wtr_wkr {
|
||||
, portal_mgr.Div_logo_bry(), portal_mgr.Div_home_bry(), new Xopg_xtn_skin_fmtr_arg(page, Xopg_xtn_skin_itm_tid.Tid_sidebar), portal_mgr.Div_wikis_bry(app.Utl__bfr_mkr()), portal_mgr.Sidebar_mgr().Html_bry()
|
||||
, mgr.Edit_rename_div_bry(page_ttl), page.Html_data().Edit_preview_w_dbg(), js_edit_toolbar_bry
|
||||
);
|
||||
Xoh_page_wtr_wkr_.Bld_head_end(bfr, page); // add after </head>
|
||||
Xoh_page_wtr_wkr_.Bld_html_end(bfr, page); // add after </html>
|
||||
Xoh_page_wtr_wkr_.Bld_head_end(bfr, tmp_bfr, page); // add after </head>
|
||||
Xoh_page_wtr_wkr_.Bld_html_end(bfr, tmp_bfr, page); // add after </html>
|
||||
}
|
||||
public void Write_body(Bry_bfr bfr, Xoh_wtr_ctx hctx, Xoae_page page) {
|
||||
synchronized (thread_lock_2) {
|
||||
|
||||
@@ -35,9 +35,9 @@ public class Xoh_page_wtr_wkr_ {
|
||||
else
|
||||
return ttl.Full_txt_w_ttl_case(); // NOTE: include ns with ttl as per defect d88a87b3
|
||||
}
|
||||
public static void Bld_head_end(Bry_bfr html_bfr, Xoae_page page) {
|
||||
byte[] head_end = page.Html_data().Custom_head_end();
|
||||
if (head_end == null) return;
|
||||
public static void Bld_head_end(Bry_bfr html_bfr, Bry_bfr tmp_bfr, Xoae_page page) {
|
||||
byte[] head_end = page.Html_data().Custom_head_tags().To_html(tmp_bfr);
|
||||
if (Bry_.Len_eq_0(head_end)) return;
|
||||
int insert_pos = Bry_find_.Find_fwd(html_bfr.Bfr(), Gfh_tag_.Head_rhs);
|
||||
if (insert_pos == Bry_find_.Not_found) {
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "could not find </head>");
|
||||
@@ -45,8 +45,8 @@ public class Xoh_page_wtr_wkr_ {
|
||||
}
|
||||
html_bfr.Insert_at(insert_pos, head_end);
|
||||
}
|
||||
public static void Bld_html_end(Bry_bfr html_bfr, Xoae_page page) {
|
||||
byte[] html_end = page.Html_data().Custom_html_end();
|
||||
public static void Bld_html_end(Bry_bfr html_bfr, Bry_bfr tmp_bfr, Xoae_page page) {
|
||||
byte[] html_end = page.Html_data().Custom_tail_tags().To_html(tmp_bfr);
|
||||
if (html_end == null) return;
|
||||
int insert_pos = Bry_find_.Find_bwd(html_bfr.Bfr(), Gfh_tag_.Html_rhs, html_bfr.Len());
|
||||
if (insert_pos == Bry_find_.Not_found) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Xoh_html_wtr {
|
||||
public Xow_html_mgr Html_mgr() {return html_mgr;} private Xow_html_mgr html_mgr;
|
||||
public Xoh_html_wtr_cfg Cfg() {return cfg;} private Xoh_html_wtr_cfg cfg = new Xoh_html_wtr_cfg();
|
||||
public Xoh_lnke_html Wkr__lnke() {return wkr__lnke;} private Xoh_lnke_html wkr__lnke = new Xoh_lnke_html();
|
||||
public Xoh_hdr_html Wkr__hdr() {return wkr__hdr;} private final Xoh_hdr_html wkr__hdr = new Xoh_hdr_html();
|
||||
public Xoh_hdr_html Wkr__hdr() {return wkr__hdr;} private final Xoh_hdr_html wkr__hdr = new Xoh_hdr_html();
|
||||
public Xoh_lnki_wtr Lnki_wtr() {return lnki_wtr;} private Xoh_lnki_wtr lnki_wtr;
|
||||
public Ref_html_wtr Ref_wtr() {return ref_wtr;} private Ref_html_wtr ref_wtr;
|
||||
public void Init_by_page(Xop_ctx ctx, Xoh_wtr_ctx hctx, byte[] src, Xoae_page page) {this.page = page; lnki_wtr.Init_by_page(ctx, hctx, src, page);}
|
||||
@@ -515,7 +515,7 @@ public class Xoh_html_wtr {
|
||||
bfr.Add_byte_if_not_last(Byte_ascii.Nl);
|
||||
}
|
||||
}
|
||||
public static final byte[] Tag__end_quote = Bry_.new_a7("\">"), Tag__end_bgn = Bry_.new_a7("</")
|
||||
public static final byte[] Tag__end_quote = Bry_.new_a7("\">"), Tag__end_bgn = Bry_.new_a7("</")
|
||||
, Tag_hr = Bry_.new_a7("<hr/>"), Tag_br = Bry_.new_a7("<br/>")
|
||||
, Tag_list_grp_ul_bgn = Bry_.new_a7("<ul>"), Tag_list_grp_ul_end = Bry_.new_a7("</ul>")
|
||||
, Tag_list_grp_ol_bgn = Bry_.new_a7("<ol>"), Tag_list_grp_ol_end = Bry_.new_a7("</ol>")
|
||||
@@ -536,7 +536,7 @@ public class Xoh_html_wtr {
|
||||
public static final int Sub_idx_null = -1; // nonsense placeholder
|
||||
}
|
||||
class Xoh_display_ttl_wtr {
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Atr_key_style = Bry_.new_a7("style")
|
||||
, Msg_style_restricted = Bry_.new_a7(" style='/* attempt to bypass $wgRestrictDisplayTitle */'")
|
||||
;
|
||||
@@ -561,7 +561,7 @@ class Xoh_display_ttl_wtr {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static final Xoh_display_ttl_wtr Instance = new Xoh_display_ttl_wtr(); Xoh_display_ttl_wtr() {}
|
||||
public static final Xoh_display_ttl_wtr Instance = new Xoh_display_ttl_wtr(); Xoh_display_ttl_wtr() {}
|
||||
}
|
||||
/*
|
||||
NOTE_1:inline always written as <tag></tag>, not <tag/>
|
||||
|
||||
@@ -21,9 +21,17 @@ import gplx.langs.htmls.*; import gplx.xowa.htmls.hrefs.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.lnkes.*;
|
||||
import gplx.xowa.htmls.core.htmls.*;
|
||||
public class Xoh_lnke_html {
|
||||
private static final byte[] Disabled_button = Bry_.new_a7("⊗");
|
||||
public void Write_html(Bry_bfr bfr, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, Xop_ctx ctx, byte[] src, Xop_lnke_tkn lnke) {
|
||||
int href_bgn = lnke.Lnke_href_bgn(), href_end = lnke.Lnke_href_end(); boolean proto_is_xowa = lnke.Proto_tid() == Gfo_protocol_itm.Tid_xowa;
|
||||
byte lnke_type = Calc_type(lnke);
|
||||
if (proto_is_xowa && hctx.Mode() == Xoh_wtr_ctx.Mode_file_dump) { // if protocol and file-dump, then don't write link; DATE:2016-04-12
|
||||
bfr.Add(Gfh_tag_.Div_lhs);
|
||||
Write_caption(bfr, html_wtr, hctx, ctx, src, lnke, href_bgn, href_end, proto_is_xowa);
|
||||
bfr.Add(Gfh_entity_.Nbsp_num_bry).Add(Disabled_button);
|
||||
bfr.Add(Gfh_tag_.Div_rhs);
|
||||
return;
|
||||
}
|
||||
if (!hctx.Mode_is_alt()) { // do not write "<a ...>" if mode is alt
|
||||
bfr.Add(Gfh_bldr_.Bry__a_lhs_w_href);
|
||||
if (Write_href(bfr, hctx, ctx, src, lnke, href_bgn, href_end, proto_is_xowa))
|
||||
@@ -40,7 +48,7 @@ public class Xoh_lnke_html {
|
||||
public boolean Write_href(Bry_bfr bfr, Xoh_wtr_ctx hctx, Xop_ctx ctx, byte[] src, Xop_lnke_tkn lnke, int href_bgn, int href_end, boolean proto_is_xowa) {
|
||||
byte[] lnke_xwiki_wiki = lnke.Lnke_xwiki_wiki();
|
||||
if ( lnke_xwiki_wiki == null
|
||||
|| hctx.Mode_is_hdump() // if hdump, never write xwiki format (/site/); always write in url format (https:); note that xwiki is set when wiki is installed locally
|
||||
|| hctx.Mode_is_hdump() // if hdump, never write xwiki format (/site/); always write in url format (https:); note that xwiki is set when wiki is installed locally
|
||||
|| hctx.Mode() == Xoh_wtr_ctx.Mode_file_dump
|
||||
) {
|
||||
if (lnke.Lnke_relative()) { // relative; EX: //a.org
|
||||
|
||||
@@ -99,7 +99,9 @@ public class Xoh_href_wtr {
|
||||
encoder.Encode(encoder_bfr, ttl_full, page_bgn, page_end); // add page
|
||||
if (hctx.Mode() == Xoh_wtr_ctx.Mode_file_dump) {
|
||||
byte[] href_end = hctx.Anch__href__end();
|
||||
if (href_end != null) encoder_bfr.Add(href_end);
|
||||
if ( href_end != null
|
||||
&& page_end - page_bgn > 0) // handle [[#A]] which will have no page; else will dump "home/page/.html#A"; DATE:2016-04-12
|
||||
encoder_bfr.Add(href_end);
|
||||
}
|
||||
encoder.Encode(encoder_bfr, ttl_full, anch_bgn, ttl_full.length); // add anchor
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user