Exemplo n.º 1
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
 }