Ejemplo n.º 1
0
 public void Special__gen(Xoa_app app, Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
   int slash_pos =
       Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
   byte[] special_name =
       slash_pos == Bry_find_.Not_found
           ? ttl
               .Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get
                                   // page_names; EX: Search/Earth?fulltext=y;
                                   // Allpages?from=Earth...
           : Bry_.Mid(
               ttl.Page_txt_wo_qargs(),
               0,
               slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
   special_name =
       Xoa_ttl.Replace_spaces(special_name); // handle spaces; EX:Spezial:Zufällige_Seite
   Xow_special_page special = (Xow_special_page) hash.Get_by_bry(special_name);
   if (special != null) { // special found; generate it;
     special = special.Special__clone();
     page.Db().Page().Modified_on_(Datetime_now.Get());
     try {
       special.Special__gen(wiki, page, url, ttl);
     } catch (Exception e) {
       Gfo_log_.Instance.Warn(
           "failed to generate special page",
           "url",
           url.To_str(),
           "err",
           Err_.Message_gplx_log(e));
     }
   }
 }
Ejemplo n.º 2
0
	public static byte[] Write_wdata_links(List_adp slink_list, Xowe_wiki wiki, Xoa_ttl ttl, Wdata_external_lang_links_data external_links_mgr) {
		try {
			switch (wiki.Domain_tid()) {
				case Xow_domain_type_.Tid_home:		// home will never be in wikidata
				case Xow_domain_type_.Tid_wikidata:	// wikidata will never be in wikidata
					return Qid_null;
			}
			Wdata_wiki_mgr wdata_mgr = wiki.Appe().Wiki_mgr().Wdata_mgr();
			Wdata_doc doc = wdata_mgr.Pages_get(wiki, ttl); if (doc == null) return Qid_null;	// no links
			boolean external_links_mgr_enabled = external_links_mgr.Enabled();
			Ordered_hash links = doc.Slink_list();
			Bry_bfr tmp_bfr = wiki.Appe().Utl__bfr_mkr().Get_k004();
			Xow_wiki_abrv wiki_abrv = new Xow_wiki_abrv();
			int len = links.Count();
			for (int i = 0; i < len; i++) {
				Wdata_sitelink_itm slink = (Wdata_sitelink_itm)links.Get_at(i);
				byte[] xwiki_key = slink.Site();
				Xow_wiki_abrv_.parse_(wiki_abrv, xwiki_key, 0, xwiki_key.length);
				if (wiki_abrv.Domain_tid() == Xow_wiki_abrv_.Tid_null) {
					wiki.Appe().Usr_dlg().Warn_many("", "", "unknown wiki in wikidata: ttl=~{0} wiki=~{1}", ttl.Page_db_as_str(), String_.new_u8(xwiki_key));
					continue;
				}
				if (wiki_abrv.Domain_tid() != wiki.Domain_tid()) continue;	// ignore wikis in a different domain; EX: looking at enwiki:Earth, and wikidata has dewikiquote; ignore dewikiquote; DATE:2014-06-21
				byte[] lang_key = wiki_abrv.Lang_itm().Key();
				if (external_links_mgr_enabled && external_links_mgr.Langs_hide(lang_key, 0, lang_key.length)) continue;
				tmp_bfr.Add(lang_key);
				tmp_bfr.Add_byte(Byte_ascii.Colon);
				tmp_bfr.Add(slink.Name());
				Xoa_ttl slink_ttl = Xoa_ttl.parse_(wiki, tmp_bfr.Xto_bry_and_clear());
				if (slink_ttl == null) continue;								// invalid ttl
				Xow_xwiki_itm xwiki_itm = slink_ttl.Wik_itm();
				if (	xwiki_itm == null									// not a known xwiki; EX: [[zzz:abc]]
					||	Bry_.Eq(xwiki_itm.Domain_bry(), wiki.Domain_bry())	// skip if same as self; i.e.: do not include links to enwiki if already in enwiki
					) continue;
				slink.Page_ttl_(slink_ttl);
				slink_list.Add(slink);
			}
			tmp_bfr.Mkr_rls();
			if (external_links_mgr_enabled && external_links_mgr.Sort())
				slink_list.Sort_by(Xoa_ttl_sorter._);
			return doc.Qid();
		} catch (Exception e) {Err_.Noop(e); return Qid_null;}
	}
Ejemplo n.º 3
0
 public void Write_body(Bry_bfr bfr, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoae_page page) {
   synchronized (thread_lock_2) {
     this.page = page;
     this.wiki = page.Wikie();
     this.app = wiki.Appe();
     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()); // NOTE: can't cache page_tid b/c Write_body is called directly;
                              // DATE:2014-10-02
     byte[] data_raw = page.Db().Text().Text_bry();
     int bfr_page_bgn = bfr.Len();
     boolean page_tid_uses_pre = false;
     if (page_mode == Xopg_page_.Tid_edit) Write_body_edit(bfr, data_raw, page_ns_id, page_tid);
     else {
       switch (page_tid) {
         case Xow_page_tid.Tid_msg:
         case Xow_page_tid.Tid_js:
         case Xow_page_tid.Tid_css:
         case Xow_page_tid.Tid_lua:
           Write_body_pre(bfr, app, wiki, hctx, data_raw, tmp_bfr);
           page_tid_uses_pre = true;
           break;
         case Xow_page_tid.Tid_json:
           app.Wiki_mgr().Wdata_mgr().Write_json_as_html(bfr, page_ttl.Full_db(), data_raw);
           break;
         case Xow_page_tid.Tid_wikitext:
           Write_body_wikitext(bfr, app, wiki, data_raw, ctx, hctx, page, page_tid, page_ns_id);
           break;
       }
     }
     if (wiki.Domain_tid() != Xow_domain_tid_.Tid__home // allow home wiki to use javascript
         && !page_tid_uses_pre) { // if .js, .css or .lua, skip test; may have js fragments, but
                                  // entire text is escaped and put in pre; don't show spurious
                                  // warning; DATE:2013-11-21
       wiki.Html_mgr().Js_cleaner().Clean_bfr(wiki, page_ttl, bfr, bfr_page_bgn);
     }
   }
 }
Ejemplo n.º 4
0
 public static byte[] Bld_fmtr_viewed(
     Bry_fmtr fmtr, Xoae_app app, Xowe_wiki wiki, Bry_bfr wrdx_bfr, Xoa_ttl ttl) {
   byte[] view_time_item = Bry_.Empty;
   gplx.xowa.users.history.Xou_history_itm history_itm =
       app.Usere().History_mgr().Get_or_null(wiki.Domain_bry(), ttl.Full_txt_w_ttl_case());
   if (history_itm != null)
     view_time_item =
         fmtr.Bld_bry_many(wrdx_bfr, history_itm.View_end().XtoStr_fmt_yyyy_MM_dd_HH_mm_ss());
   return view_time_item;
 }
Ejemplo n.º 5
0
 private static boolean Navigate(
     Gfo_usr_dlg usr_dlg,
     Xoae_app app,
     Wdata_wiki_mgr wdata_mgr,
     Xoae_page page,
     byte[] site_bry,
     byte[] page_bry) {
   page_bry =
       Xoa_app_.Utl__encoder_mgr()
           .Http_url()
           .Decode(page_bry); // NOTE: space is converted to + on postback to url; decode
   byte[] wiki_domain = Xow_wiki_alias.Parse_wmf_key(site_bry);
   if (wiki_domain == null) {
     usr_dlg.Warn_many("", "", "site_bry parse failed; site_bry:~{0}", String_.new_u8(site_bry));
     return false;
   }
   Xowe_wiki wiki = app.Wiki_mgr().Get_by_key_or_make(wiki_domain);
   if (wiki == null) {
     usr_dlg.Warn_many(
         "", "", "wiki_domain does not exist; wiki_domain:~{0}", String_.new_u8(wiki_domain));
     return false;
   }
   Xoa_ttl wdata_ttl = Xoa_ttl.parse_(wiki, page_bry);
   if (wdata_ttl == null) {
     usr_dlg.Warn_many("", "", "ttl is invalid; ttl:~{0}", String_.new_u8(page_bry));
     return false;
   }
   Wdata_doc doc = wdata_mgr.Pages_get(wiki, wdata_ttl);
   if (doc == null) {
     usr_dlg.Warn_many(
         "", "", "ttl cannot be found in wikidata; ttl:~{0}", String_.new_u8(wdata_ttl.Raw()));
     return false;
   }
   byte[] qid_bry = doc.Qid();
   Xoae_page qid_page = wdata_mgr.Wdata_wiki().Data_mgr().Redirect(page, qid_bry);
   if (qid_page.Missing()) {
     usr_dlg.Warn_many(
         "", "", "qid cannot be found in wikidata; qid:~{0}", String_.new_u8(qid_bry));
     return false;
   }
   return true;
 }
Ejemplo n.º 6
0
 private static void Add_cur_pages_also_in_old(
     int i,
     Int_obj_ref tmp_id,
     Ordered_hash old_regy,
     Ordered_hash cur_regy,
     Ordered_hash new_regy,
     Ordered_hash exclude_pages,
     int ns_filter) {
   int found_len = cur_regy.Count();
   for (int j = 0; j < found_len; j++) { // if new_page is in cur, add it
     Xoctg_catpage_itm cur_itm = (Xoctg_catpage_itm) cur_regy.Get_at(j);
     Xoa_ttl cur_ttl = cur_itm.Page_ttl();
     if (cur_ttl == null) continue;
     if (ns_filter != Dpl_itm.Ns_filter_null && ns_filter != cur_ttl.Ns().Id()) continue;
     tmp_id.Val_(cur_itm.Page_id()); // set tmp_id, since it will be used at least once
     if (exclude_pages.Has(tmp_id)) continue; // ignore excluded pages
     if (i != 0) { // skip logic for first ctg (which doesn't have a predecessor)
       if (!old_regy.Has(tmp_id)) continue; // cur_itm not in old_regy; ignore
     }
     new_regy.Add_as_key_and_val(Int_obj_ref.New(cur_itm.Page_id()));
   }
 }
Ejemplo n.º 7
0
 public void Get_by_url1(Xow_wiki wiki, Xoa_page page, Xoa_url url, Xoa_ttl ttl) {
   int slash_pos =
       Bry_find_.Find_fwd(ttl.Page_txt_wo_qargs(), Xoa_ttl.Subpage_spr); // check for slash
   byte[] special_name =
       slash_pos == Bry_find_.Not_found
           ? ttl.Base_txt_wo_qarg() // no slash found; use base_txt; ignore qry args and just get
           // page_names; EX: Search/Earth?fulltext=y;
           // Allpages?from=Earth...
           : Bry_.Mid(
               ttl.Page_txt_wo_qargs(),
               0,
               slash_pos); // slash found; use root page; EX: Special:ItemByTitle/enwiki/Earth
   Object o = hash.Get_by_bry(special_name);
   if (o == null) {
     Xol_specials_itm special_itm = wiki.Lang().Specials_mgr().Get_by_alias(special_name);
     if (special_itm != null) o = hash.Get_by_bry(special_itm.Special());
   }
   if (o != null) {
     // Xow_special_page special = (Xow_special_page)o;
     // page.Revision_data().Modified_on_(Datetime_now.Get());
     // special.Special__gen(wiki, page, url, ttl);
   }
 }
Ejemplo n.º 8
0
 private void Parse_href(Xoh_hdoc_ctx hctx, Gfh_tag anch_head) {
   href_itm.Parse(rdr.Err_wkr(), hctx, src, anch_head);
   this.href_bgn = href_itm.Ttl_bgn();
   this.href_end = href_itm.Ttl_end();
   switch (href_itm.Tid()) {
     case Xoh_anch_href_data.Tid__wiki:
     case Xoh_anch_href_data.Tid__site:
       this.href_ns_id = href_itm.Ttl_ns_id();
       this.href_src = href_itm.Ttl_full_txt();
       this.href_bgn = 0;
       this.href_end = href_src.length;
       if (href_ns_id != Xow_ns_.Tid__main) { // not main; try to remove template name;		
         int colon_pos = Bry_find_.Find_fwd(href_src, Byte_ascii.Colon, href_bgn, href_end);
         this.href_ns_name =
             Xoa_ttl.Replace_unders(
                 Bry_.Mid(href_src, href_bgn, colon_pos + 1)); // EX: 11="Template talk:"
         this.href_ns_name_len = href_ns_name.length;
       }
       break;
   }
 }
Ejemplo n.º 9
0
 public void Special_gen(Xowe_wiki wiki, Xoae_page page, Xoa_url url, Xoa_ttl ttl) {
   if (cfg == null)
     cfg =
         (Wdata_itemByTitle_cfg) wiki.Appe().Special_mgr().Get_or_null(Wdata_itemByTitle_cfg.Key);
   // Special:ItemByTitle/enwiki/Earth -> www.wikidata.org/wiki/Q2
   Gfo_usr_dlg usr_dlg = wiki.Appe().Usr_dlg();
   byte[] site_bry = cfg.Site_default();
   byte[] page_bry = Bry_.Empty;
   byte[] raw_bry = ttl.Full_txt_wo_qarg(); // EX: enwiki/Earth
   int args_len = url.Args().length;
   if (args_len > 0) {
     arg_hash.Load(url);
     site_bry = arg_hash.Get_val_bry_or(Arg_site, Bry_.Empty);
     page_bry = arg_hash.Get_val_bry_or(Arg_page, Bry_.Empty);
   }
   int site_bgn = Bry_finder.Find_fwd(raw_bry, Xoa_ttl.Subpage_spr);
   if (site_bgn != Bry_.NotFound) { // leaf arg is available
     int page_bgn = Bry_finder.Find_fwd(raw_bry, Xoa_ttl.Subpage_spr, site_bgn + 1);
     int raw_bry_len = raw_bry.length;
     if (page_bgn != Bry_.NotFound
         && page_bgn < raw_bry_len) { // pipe is found and not last char (EX: "enwiki/" is invalid
       site_bry = Bry_.Mid(raw_bry, site_bgn + 1, page_bgn);
       page_bry = Bry_.Mid(raw_bry, page_bgn + 1, raw_bry_len);
     }
   }
   Xoae_app app = wiki.Appe();
   if (Bry_.Len_gt_0(site_bry) && Bry_.Len_gt_0(page_bry))
     if (Navigate(usr_dlg, app, app.Wiki_mgr().Wdata_mgr(), page, site_bry, page_bry)) return;
   Bry_bfr tmp_bfr = wiki.Utl__bfr_mkr().Get_k004();
   html_fmtr.Bld_bfr_many(
       tmp_bfr,
       "Search for items by site and title",
       "Site",
       site_bry,
       "Page",
       page_bry,
       "Search");
   page.Data_raw_(tmp_bfr.To_bry_and_rls());
   page.Html_data().Html_restricted_n_(); // [[Special:]] pages allow all HTML
 }
Ejemplo n.º 10
0
 public static Xof_fsdb_itm Make_fsdb(
     Xowe_wiki wiki, byte[] lnki_ttl, Xof_img_size img_size, Xof_url_bldr url_bldr) {
   Xof_fsdb_itm fsdb = new Xof_fsdb_itm();
   lnki_ttl = Xoa_ttl.Replace_spaces(Xoa_app_.Utl__encoder_mgr().Http_url().Decode(lnki_ttl));
   fsdb.Init_at_lnki(
       Xof_exec_tid.Tid_viewer_app,
       wiki.Domain_itm().Abrv_xo(),
       lnki_ttl,
       Xop_lnki_type.Id_none,
       Xop_lnki_tkn.Upright_null,
       Xof_img_size.Size_null_deprecated,
       Xof_img_size.Size_null_deprecated,
       Xof_lnki_time.Null,
       Xof_lnki_page.Null,
       Xof_patch_upright_tid_.Tid_all);
   fsdb.Init_at_hdoc(
       Int_.MaxValue,
       Xof_html_elem
           .Tid_img); // NOTE: set elem_id to "impossible" number, otherwise it will auto-update an
   // image on the page with a super-large size; [[File:Alfred Sisley 062.jpg]]
   Xof_orig_itm orig = wiki.File__orig_mgr().Find_by_ttl_or_null(lnki_ttl);
   if (orig == Xof_orig_itm.Null) return null; // orig not found; need orig in order to get repo
   Xof_repo_itm repo =
       wiki.File__repo_mgr().Get_trg_by_id_or_null(orig.Repo(), lnki_ttl, Bry_.Empty);
   if (repo == null) return null; // repo not found
   fsdb.Init_at_orig(
       orig.Repo(),
       repo.Wiki_domain(),
       orig.Ttl(),
       orig.Ext(),
       orig.W(),
       orig.H(),
       orig.Redirect());
   fsdb.Init_at_html(Xof_exec_tid.Tid_viewer_app, img_size, repo, url_bldr);
   fsdb.File_is_orig_(true);
   return fsdb;
 }
Ejemplo n.º 11
0
	public void Init_page_create(Xowe_wiki wiki, String ttl, String txt) {
		Xoa_ttl page_ttl = Xoa_ttl.parse_(wiki, Bry_.new_u8(ttl));
		byte[] page_raw = Bry_.new_u8(txt);
		wiki.Db_mgr().Save_mgr().Data_create(page_ttl, page_raw);
	}
Ejemplo n.º 12
0
 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);
 }
Ejemplo n.º 13
0
 public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) {
   return Xoa_ttl.Parse(this, ns_id, ttl);
 }
Ejemplo n.º 14
0
  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>		
  }
Ejemplo n.º 15
0
 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();
   }
 }
Ejemplo n.º 16
0
 public void Pages_get(Xoh_page rv, Gfo_url url, Xoa_ttl ttl) {
   if (init_needed) Init_by_wiki();
   if (ttl.Ns().Id_is_special()) special_mgr.Get_by_ttl(rv, url, ttl);
   else html__hdump_mgr.Load_mgr().Load(rv, ttl);
 }
Ejemplo n.º 17
0
	public int compare(Object lhsObj, Object rhsObj) {
		Xoa_ttl lhs = (Xoa_ttl)lhsObj, rhs = (Xoa_ttl)rhsObj;
		return Bry_.Compare(lhs.Raw(), rhs.Raw());
	}