1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-09-28 14:30:51 +00:00

Xtn.Pages: Do not escape XML in header previous / current / next links [#624]

This commit is contained in:
gnosygnu 2019-11-30 17:15:23 -05:00
parent 9d8ab5d206
commit 520a73537f
2 changed files with 19 additions and 1 deletions

View File

@ -145,7 +145,8 @@ public class Pp_pages_nde implements Xox_xnde, Mwh_atr_itm_owner1 {
private byte[] Get_caption(Bry_bfr full_bfr, byte[] index_page_src, Xop_lnki_tkn lnki) {
byte[] rv = Bry_.Empty;
try {
wiki.Html_mgr().Html_wtr().Write_tkn_to_html(full_bfr, ctx, Xoh_wtr_ctx.Basic, index_page_src, null, -1, lnki.Caption_tkn());
// NOTE: call "Lnki_wtr().Write_caption", not "Write_tkn_to_html" else XML in caption will be escaped; ISSUE#:624 DATE:2019-11-30
wiki.Html_mgr().Html_wtr().Lnki_wtr().Write_caption(full_bfr, Xoh_wtr_ctx.Basic, index_page_src, lnki, lnki.Ttl());
rv = full_bfr.To_bry_and_clear();
}
catch (Exception e) {

View File

@ -231,4 +231,21 @@ public class Pp_pages_nde_index_tst {
, "</p>"
));
}
@Test public void Index__caption_w_xml() { // PURPOSE: do not escape XML in caption; ISSUE#:624 DATE:2019-11-30
// create header page with just "prev" token
fxt.Init_page_create("MediaWiki:Proofreadpage_header_template", "{{{prev}}}\n");
// create index page with 3 links: "current" page and flanking "prev" and "next" pages; note the xml in the caption
fxt.Init_page_create("Index:A", String_.Concat_lines_nl
( "[[Test_page_prev|<b>prev</b>]]"
, "[[Test_page|<b>cur</b>]]"
, "[[Test_page_next|<b>next</b>]]"
));
// parse text; fails if "&lt;b&gt;prev&lt;/b&gt;"
fxt.Test_parse_page_wiki_str("<pages index='A' header=1 />", String_.Concat_lines_nl
( "<p><a href=\"/wiki/Test_page_prev\"><b>prev</b></a>"
, "</p>"
));
}
}