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;
 }
Exemple #2
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()));
   }
 }
 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);
   }
 }
 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;
   }
 }
Exemple #5
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();
   }
 }
Exemple #6
0
 public Xoa_ttl Ttl_parse(int ns_id, byte[] ttl) {
   return Xoa_ttl.Parse(this, ns_id, ttl);
 }
Exemple #7
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);
 }
Exemple #8
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);
 }