mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Html: Add 'lang' to <h1> [#724]
This commit is contained in:
parent
b551c1875b
commit
654810d56c
@ -138,7 +138,8 @@ public class Xoh_page_wtr_wkr {
|
||||
fmtr.Bld_bfr_many(bfr
|
||||
, root_dir_bry, Xoa_app_.Version, Xoa_app_.Build_date, app.Tcp_server().Running_str()
|
||||
, page.Db().Page().Id(), page.Ttl().Full_db()
|
||||
, pagename_for_tab, page.Html_data().Page_heading().Init(wiki, html_gen_tid == Xopg_view_mode_.Tid__read, page.Html_data(), page.Ttl().Full_db(), pagename_for_h1)
|
||||
, pagename_for_tab
|
||||
, page.Html_data().Page_heading().Init(wiki, html_gen_tid == Xopg_view_mode_.Tid__read, page.Html_data(), page.Ttl().Full_db(), pagename_for_h1, page.Lang().Key_bry())
|
||||
, modified_on_msg
|
||||
, mgr.Css_common_bry(), mgr.Css_wiki_bry()
|
||||
, mgr.Css_night_bry(nightmode_enabled)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
@ -13,9 +13,16 @@ The terms of each license can be found in the source code repository:
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*;
|
||||
import gplx.xowa.wikis.pages.htmls.*;
|
||||
package gplx.xowa.wikis.pages;
|
||||
|
||||
import gplx.Bry_;
|
||||
import gplx.Bry_bfr;
|
||||
import gplx.Bry_bfr_;
|
||||
import gplx.Bry_fmt;
|
||||
import gplx.core.brys.Bfr_arg;
|
||||
import gplx.xowa.Xowe_wiki;
|
||||
import gplx.xowa.wikis.pages.htmls.Xopg_html_data;
|
||||
|
||||
// TODO: move pagename_for_h1 here; also test; WHEN: next major change; NOTE: may go away for XOMW
|
||||
public class Xopg_page_heading implements Bfr_arg {
|
||||
private Xowe_wiki wiki;
|
||||
@ -23,12 +30,14 @@ public class Xopg_page_heading implements Bfr_arg {
|
||||
private byte[] ttl_full_db;
|
||||
private byte[] display_title;
|
||||
private boolean mode_is_read;
|
||||
public Xopg_page_heading Init(Xowe_wiki wiki, boolean mode_is_read, Xopg_html_data html_data, byte[] ttl_full_db, byte[] display_title) {
|
||||
private byte[] lang_code;
|
||||
public Xopg_page_heading Init(Xowe_wiki wiki, boolean mode_is_read, Xopg_html_data html_data, byte[] ttl_full_db, byte[] display_title, byte[] lang_code) {
|
||||
this.wiki = wiki;
|
||||
this.mode_is_read = mode_is_read;
|
||||
this.ttl_full_db = ttl_full_db;
|
||||
this.html_data = html_data;
|
||||
this.display_title = display_title;
|
||||
this.lang_code = lang_code;
|
||||
return this;
|
||||
}
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
@ -41,8 +50,8 @@ public class Xopg_page_heading implements Bfr_arg {
|
||||
edit_lead_section = tmp_bfr.To_bry_and_clear();
|
||||
}
|
||||
|
||||
fmtr.Bld_many(bfr, display_title, edit_lead_section);
|
||||
fmtr.Bld_many(bfr, lang_code, display_title, edit_lead_section);
|
||||
}
|
||||
private static final byte[] Bry__lead_section_hint = Bry_.new_u8("(Lead)");
|
||||
private final Bry_fmt fmtr = Bry_fmt.Auto_nl_apos("<h1 id='firstHeading' class='firstHeading'>~{page_title}~{edit_lead_section}</h1>"); // <span>~{page_title}</span>
|
||||
private static final byte[] Bry__lead_section_hint = Bry_.new_u8("(Lead)");
|
||||
private final Bry_fmt fmtr = Bry_fmt.Auto_nl_apos("<h1 id='firstHeading' class='firstHeading' lang='~{lang}'>~{page_title}~{edit_lead_section}</h1>");
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.wikis.pages;
|
||||
|
||||
import gplx.Bry_;
|
||||
import gplx.Bry_bfr;
|
||||
import gplx.Bry_bfr_;
|
||||
import gplx.tests.Gftest_fxt;
|
||||
import gplx.xowa.Xop_fxt;
|
||||
import gplx.xowa.Xowe_wiki;
|
||||
import gplx.xowa.wikis.pages.htmls.Xopg_html_data;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Xopg_page_headingTest {
|
||||
private Xopg_page_headingTstr tstr = new Xopg_page_headingTstr();
|
||||
@Test public void Basic() {
|
||||
tstr.Test("<h1 id=\"firstHeading\" class=\"firstHeading\" lang=\"en\">Page 1</h1>"
|
||||
, "Page_1", "Page 1", "en");
|
||||
}
|
||||
}
|
||||
class Xopg_page_headingTstr {
|
||||
private Xopg_page_heading heading = new Xopg_page_heading();
|
||||
private Xowe_wiki wiki;
|
||||
public Xopg_page_headingTstr() {
|
||||
Xop_fxt fxt = new Xop_fxt();
|
||||
wiki = fxt.Wiki();
|
||||
}
|
||||
|
||||
public void Test(String expd, String ttlDb, String ttlTxt, String lang) {
|
||||
heading.Init(wiki, true, new Xopg_html_data(), Bry_.new_u8(ttlDb), Bry_.new_u8(ttlTxt), Bry_.new_u8(lang));
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
heading.Bfr_arg__add(bfr);
|
||||
Gftest_fxt.Eq__str(expd, bfr.To_str_and_clear());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user