예제 #1
0
 public void Xtn_parse(
     Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
   Xox_xnde_.Xatr__set(wiki, this, xatrs_hash, src, xnde);
   this.html =
       Xop_parser_.Parse_text_to_html(
           wiki,
           ctx,
           ctx.Page(),
           ctx.Page().Ttl(),
           Bry_.Mid(src, xnde.Tag_open_end(), xnde.Tag_close_bgn()),
           false);
   Indicator_html_bldr html_bldr = ctx.Page().Html_data().Indicators();
   if (this.name != null)
     html_bldr.Add(this); // NOTE: must do null-check b/c Add will use Name as key for hashtable
 }
예제 #2
0
 public void Write_hdump(Bry_bfr bfr, Xop_ctx ctx, Xoh_wtr_ctx hctx, Xoae_page wpg) {
   if (wpg.Html_data().Xtn_pgbnr() != null) {
     ctx.Wiki()
         .Xtn_mgr()
         .Xtn_pgbnr()
         .Write_html(wpg, ctx, hctx)
         .Bfr_arg__add(bfr); // if pgbnr exists, write to top of html
   }
   this.Write_body(bfr, ctx, hctx, wpg);
 }
예제 #3
0
 public void Write_page(Bry_bfr rv, Xoae_page page, Xop_ctx ctx) {
   synchronized (thread_lock_1) {
     this.page = page;
     this.wiki = page.Wikie();
     this.app = wiki.Appe();
     ctx.Page_(page); // HACK: must update page for toc_mgr; WHEN: Xoae_page rewrite
     Bry_fmtr fmtr = null;
     if (mgr.Html_capable()) {
       wdata_lang_wtr.Page_(page);
       byte view_mode = page_mode;
       switch (page_mode) {
         case Xopg_page_.Tid_edit:
           fmtr = mgr.Page_edit_fmtr();
           break;
         case Xopg_page_.Tid_html:
           fmtr = mgr.Page_read_fmtr();
           view_mode = Xopg_page_.Tid_read;
           break; // set view_mode to read, so that "read" is highlighted in HTML
         case Xopg_page_.Tid_read:
           fmtr = mgr.Page_read_fmtr();
           // ctx.Page().Redlink_list().Clear();	// not sure if this is the best place to put it,
           // but redlinks (a) must only fire once; (b) must fire before html generation; (c)
           // cannot fire during edit (preview will handle separately); NOTE: probably put in to
           // handle reusable redlink lists; redlink lists are now instantiated per page, so clear
           // is not useful
           break;
       }
       Bry_bfr page_bfr =
           wiki.Utl__bfr_mkr()
               .Get_m001(); // NOTE: get separate page rv to output page; do not reuse tmp_bfr b/c
                            // it will be used inside Fmt_do
       Xoh_wtr_ctx hctx = null;
       if (page_mode == Xopg_page_.Tid_html
           && wiki.App().Api_root().Wiki().Hdump().Html_mode().Tid_is_hdump_save()) {
         hctx = Xoh_wtr_ctx.Hdump;
         Write_body(page_bfr, ctx, hctx, page);
         Write_page_by_tid(
             ctx,
             hctx,
             page_mode,
             rv,
             mgr.Page_html_fmtr(),
             Gfh_utl.Escape_html_as_bry(page_bfr.To_bry_and_clear()));
       } else {
         hctx = Xoh_wtr_ctx.Basic;
         Write_body(page_bfr, ctx, hctx, page);
         Write_page_by_tid(ctx, hctx, view_mode, rv, fmtr, page_bfr.To_bry_and_rls());
         new gplx.xowa.addons.apps.scripts.Xoscript_mgr().Write(rv, wiki, page);
         if (page_mode
             == Xopg_page_
                 .Tid_html) // if html, write page again, but wrap it in html skin this time
         Write_page_by_tid(
               ctx,
               hctx,
               page_mode,
               rv,
               mgr.Page_html_fmtr(),
               Gfh_utl.Escape_html_as_bry(rv.To_bry_and_clear()));
         wdata_lang_wtr.Page_(null);
       }
     } else Write_body(rv, ctx, Xoh_wtr_ctx.Basic, page);
     this.page = null;
   }
 }
예제 #4
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();
   }
 }
예제 #5
0
 public void Xtn_parse(
     Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
   itm.Parse(wiki, ctx, ctx.Page().Ttl().Full_txt_w_ttl_case(), src, xnde);
   Dpl_page_finder.Find_pages(pages, wiki, itm);
   if (itm.Sort_ascending() != Bool_.__byte) pages.Sort_by(new Dpl_page_sorter(itm));
 }