1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Section_edit: Support headers with covering behavior, dupes, xml, math, and templates

This commit is contained in:
gnosygnu
2016-12-09 12:23:02 -05:00
parent 998937ca26
commit 780062ebb4
15 changed files with 250 additions and 109 deletions

View File

@@ -226,7 +226,7 @@ public class Xoh_page_wtr_wkr {
data_raw = Gfs_php_converter.Xto_php(tmp_bfr, Bool_.N, data_raw);
int data_raw_len = data_raw.length;
if (mgr.Html_capable()) {
data_raw = wiki.Parser_mgr().Hdr__section_editable__mgr().Extract_section(app, page.Url(), page.Ttl(), data_raw);
data_raw = wiki.Parser_mgr().Hdr__section_editable__mgr().Slice_section(page.Url(), page.Ttl(), data_raw);
data_raw_len = data_raw.length;
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)
}

View File

@@ -31,6 +31,7 @@ public class Xoh_hdr_html {
// register hdr with TOC
byte[] hdr_text_bry = Bld_hdr_html(hdr_text_bfr, wtr, page, ctx, hctx, src, hdr);
hdr_text_bry = wiki.Parser_mgr().Uniq_mgr().Convert(hdr_text_bry); // need for math; DATE:2016-12-09
Xoh_toc_itm toc_itm = hdr_is_valid && hdr_text_bry.length > 0
? page.Html_data().Toc_mgr().Add(hdr_num, hdr_text_bry)
: invalid_toc_itm;

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.htmls.core.wkrs.hdrs; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*; import gplx.xowa.htmls.core.wkrs.*;
import org.junit.*; import gplx.xowa.htmls.core.makes.tests.*;
public class Xoh_hdr_html_tst {
private final Xoh_make_fxt fxt = new Xoh_make_fxt();
private final Xoh_make_fxt fxt = new Xoh_make_fxt();
@Test public void Basic() {
fxt.Test__html(String_.Concat_lines_nl_skip_last
( "z"
@@ -36,4 +36,14 @@ public class Xoh_hdr_html_tst {
, "b"
));
}
@Test public void Uniq() {
byte[] uniq = fxt.Parser_fxt().Wiki().Parser_mgr().Uniq_mgr().Add(Bry_.new_a7("bcd"));
fxt.Test__html(String_.Concat_lines_nl_skip_last
( "== a" + String_.new_u8(uniq) + "e =="
, "text"
), String_.Concat_lines_nl_skip_last
( "<h2><span class='mw-headline' id='abcde'> abcde </span></h2>"
, "text"
));
}
}