private void Write_page_by_tid( Xop_ctx ctx, Xoh_wtr_ctx hctx, byte html_gen_tid, Bry_bfr bfr, Bry_fmtr fmtr, byte[] page_data) { // if custom_html, use it and exit; needed for Default_tab byte[] custom_html = page.Html_data().Custom_html(); if (custom_html != null) { bfr.Add(custom_html); return; } // temp variables if (root_dir_bry == null) this.root_dir_bry = app.Fsys_mgr().Root_dir().To_http_file_bry(); Xoa_ttl page_ttl = page.Ttl(); int page_ns_id = page_ttl.Ns().Id(); byte page_tid = Xow_page_tid.Identify(wiki.Domain_tid(), page_ns_id, page_ttl.Page_db()); DateAdp modified_on = page.Db().Page().Modified_on(); byte[] modified_on_msg = wiki.Msg_mgr() .Val_by_id_args( Xol_msg_itm_.Id_portal_lastmodified, modified_on.XtoStr_fmt_yyyy_MM_dd(), modified_on.XtoStr_fmt_HHmm()); byte[] page_body_class = Xoh_page_body_cls.Calc(tmp_bfr, page_ttl, page_tid); byte[] html_content_editable = wiki.Gui_mgr().Cfg_browser().Content_editable() ? Content_editable_bry : Bry_.Empty; byte[] page_content_sub = Xoh_page_wtr_wkr_.Bld_page_content_sub(app, wiki, page, tmp_bfr); byte[] js_edit_toolbar_bry = html_gen_tid == Xopg_page_.Tid_edit ? wiki.Fragment_mgr().Html_js_edit_toolbar() : Bry_.Empty; Xol_vnt_mgr vnt_mgr = wiki.Lang().Vnt_mgr(); if (vnt_mgr.Enabled()) { byte[] converted_title = vnt_mgr.Convert_lang().Converted_title(); // prefer converted title if (converted_title == null) // converted title does not exist; use regular page title and convert it converted_title = vnt_mgr.Convert_lang().Auto_convert(vnt_mgr.Cur_itm(), page_ttl.Page_txt()); 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_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.Db().Page().Id(), page.Ttl().Full_db(), 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(page, ctx, hctx), page_body_class, html_content_editable, page_data, wdata_lang_wtr // sidebar divs , portal_mgr.Div_personal_bry(), portal_mgr.Div_ns_bry(wiki.Utl__bfr_mkr(), page_ttl, wiki.Ns_mgr()), portal_mgr.Div_view_bry( wiki.Utl__bfr_mkr(), html_gen_tid, page.Html_data().Xtn_search_text()), 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_sync_bry( tmp_bfr, app.Api_root().Addon().Bldr().Sync().Manual_enabled(), wiki, page), portal_mgr.Div_wikis_bry(wiki.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, tmp_bfr, page); // add after </head> Xoh_page_wtr_wkr_.Bld_html_end(bfr, tmp_bfr, page); // add after </html> }
public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) { return Xoa_ttl.Parse(this, ns_id, ttl); }
public void Xtn_write( Bry_bfr bfr, Xoae_app app, Xop_ctx ctx, Xoh_html_wtr html_wtr, Xoh_wtr_ctx hctx, Xoae_page wpg, Xop_xnde_tkn xnde, byte[] src) { Xowe_wiki wiki = ctx.Wiki(); Dpl_html_data html_mode = Dpl_html_data.new_(Dpl_itm_keys.Key_unordered); int itms_len = pages.Count(); if (itms_len == 0) { if (!itm.Suppress_errors()) bfr.Add_str_a7("No pages meet these criteria."); return; } int itms_bgn = 0; if (itm.Offset() != Int_.Min_value) { itms_bgn = itm.Offset(); } if (itm.Count() != Int_.Min_value && itms_bgn + itm.Count() < itms_len) { itms_len = itms_bgn + itm.Count(); } boolean show_ns = itm.Show_ns(); Bry_bfr tmp_bfr = Bry_bfr_.Get(); Xop_amp_mgr amp_mgr = wiki.Appe().Parser_amp_mgr(); try { bfr.Add(html_mode.Grp_bgn()).Add_byte_nl(); for (int i = itms_bgn; i < itms_len; i++) { Xowd_page_itm page = (Xowd_page_itm) pages.Get_at(i); Xoa_ttl ttl = Xoa_ttl.Parse(wiki, page.Ns_id(), page.Ttl_page_db()); byte[] ttl_page_txt = show_ns ? ttl.Full_txt_w_ttl_case() : ttl.Page_txt(); if (ttl_page_txt == null) continue; // NOTE: apparently DynamicPageList allows null pages; DATE:2013-07-22 switch (html_mode.Tid()) { case Dpl_html_data.Tid_list_ul: case Dpl_html_data.Tid_list_ol: bfr.Add(Xoh_consts.Space_2).Add(html_mode.Itm_bgn()).Add(Gfh_bldr_.Bry__a_lhs_w_href); bfr.Add_str_a7("/wiki/") .Add(Gfo_url_encoder_.Href.Encode(ttl.Full_db())) .Add_byte_quote(); // NOTE: Full_db to encode spaces as underscores; // PAGE:en.q:Wikiquote:Speedy_deletions DATE:2016-01-19 Gfh_atr_.Add( bfr, Gfh_atr_.Bry__title, Xoh_html_wtr_escaper.Escape( amp_mgr, tmp_bfr, ttl .Full_txt_w_ttl_case())); // NOTE: Full_txt b/c title always includes ns, // even if show_ns is off; // PAGE:en.b:Wikibooks:WikiProject DATE:2016-01-20 if (itm.No_follow()) bfr.Add(Bry_nofollow); bfr.Add_byte(Byte_ascii.Gt); Xoh_html_wtr_escaper.Escape( amp_mgr, bfr, ttl_page_txt, 0, ttl_page_txt.length, false, false); bfr.Add(Gfh_bldr_.Bry__a_rhs).Add(html_mode.Itm_end()).Add_byte_nl(); // TODO_OLD: // lnki_wtr.Clear().Href_wiki_(ttl).Title_(ttl).Nofollow_().Write_head(bfr).Write_text(bfr).Write_tail(bfr) break; default: break; } } bfr.Add(html_mode.Grp_end()).Add_byte_nl(); } finally { tmp_bfr.Mkr_rls(); } }
public Xoa_ttl Ttl_parse(byte[] src, int src_bgn, int src_end) { return Xoa_ttl.Parse( app.Utl_amp_mgr(), app.Utl_case_mgr(), xwiki_mgr, ns_mgr, src, src_bgn, src_end); }