예제 #1
0
 private void Write_body_pre(
     Bry_bfr bfr,
     Xoae_app app,
     Xowe_wiki wiki,
     Xoh_wtr_ctx hctx,
     byte[] data_raw,
     Bry_bfr tmp_bfr) {
   Xoh_html_wtr_escaper.Escape(
       app.Parser_amp_mgr(), tmp_bfr, data_raw, 0, data_raw.length, false, false);
   if (hctx.Mode_is_hdump()) bfr.Add(data_raw);
   else app.Html_mgr().Page_mgr().Content_code_fmtr().Bld_bfr_many(bfr, tmp_bfr);
   tmp_bfr.Clear();
 }
예제 #2
0
 private void Write_body_edit(Bry_bfr bfr, byte[] data_raw, int ns_id, byte page_tid) {
   if (ns_id
           == Xow_ns_
               .Tid__mediawiki // if MediaWiki and wikitext, must be a message; convert args back
                               // to php; DATE:2014-06-13
       && page_tid == Xow_page_tid.Tid_wikitext)
     data_raw = Gfs_php_converter.Xto_php(tmp_bfr, Bool_.N, data_raw);
   int data_raw_len = data_raw.length;
   if (mgr.Html_capable())
     Xoh_html_wtr_escaper.Escape(
         page.Wikie().Appe().Parser_amp_mgr(),
         bfr,
         data_raw,
         0,
         data_raw_len,
         false,
         false); // NOTE: must escape; assume that browser will automatically escape (<) (which
                 // Mozilla does)
   else bfr.Add(data_raw);
   if (data_raw_len > 0) // do not add nl if empty String
   bfr
         .Add_byte_nl(); // per MW:EditPage.php: "Ensure there's a newline at the end, otherwise
                         // adding lines is awkward."
 }
예제 #3
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();
   }
 }