mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
HTTP Server: Do not show new logic for SWT/GUI tabs ('wikiName - message' if mainPage, else 'pageName - wikiName') [#715]
This commit is contained in:
parent
105446f5ca
commit
0c3cb1ba3d
@ -126,7 +126,7 @@ public class Xoh_page_wtr_wkr {
|
||||
}
|
||||
|
||||
// get pagename for (a) SWT tab name or (b) HTTP_server's <head><title>
|
||||
byte[] pagename_for_tab = Xoh_page_wtr_wkr_.BuildPagenameForTab(tmp_bfr, wiki.Msg_mgr(), page_ttl, wiki.Props().Main_page()); // NOTE: page_name does not show display_title (<i>). always pass in null
|
||||
byte[] pagename_for_tab = Xoh_page_wtr_wkr_.BuildPagenameForTab(tmp_bfr, app.Mode().Tid_is_http(), wiki.Msg_mgr(), page_ttl, wiki.Props().Main_page()); // NOTE: page_name does not show display_title (<i>). always pass in null
|
||||
page.Html_data().Custom_tab_name_(pagename_for_tab); // set tab_name to page_name; note that if null, gui code will ignore and use Ttl.Page_txt; PAGE: zh.w:釣魚臺列嶼主權問題 DATE:2015-10-05
|
||||
|
||||
// get pagename for <h1 id="firstHeading" class="firstHeading"></h1>
|
||||
|
@ -37,18 +37,22 @@ public class Xoh_page_wtr_wkr_ {
|
||||
byte[] redirect_msg = Xop_redirect_mgr.Bld_redirect_msg(app, wiki, page.Redirect_trail());
|
||||
return Bry_.Add(subpages, page_content_sub, redirect_msg);
|
||||
}
|
||||
public static byte[] BuildPagenameForTab(Bry_bfr tmp, Xow_msg_mgr msgMgr, Xoa_ttl ttl, byte[] mainPageTtl) {
|
||||
public static byte[] BuildPagenameForTab(Bry_bfr tmp, boolean isHttpServer, Xow_msg_mgr msgMgr, Xoa_ttl ttl, byte[] mainPageTtl) {
|
||||
byte[] pagename = BuildPagename(tmp, ttl);
|
||||
|
||||
// default to sitewide pagetitle; ISSUE#:715; DATE:2020-05-01
|
||||
byte[] msgKey = Bry_.new_a7("pagetitle"); // $1 – Travel guide at {{SITENAME}}
|
||||
if (isHttpServer) {
|
||||
// default to sitewide pagetitle; ISSUE#:715; DATE:2020-05-01
|
||||
byte[] msgKey = Bry_.new_a7("pagetitle"); // $1 – Travel guide at {{SITENAME}}
|
||||
|
||||
// if MAIN_PAGE, use the pageTitle for MAIN_PAGE; may not need Replace_unders depending on whether "mainPageTtl" is "MAIN PAGE"
|
||||
if (Bry_.Eq(Xoa_ttl.Replace_unders(ttl.Raw()), Xoa_ttl.Replace_unders(mainPageTtl)))
|
||||
msgKey = Bry_.new_a7("pagetitle-view-mainpage"); // {{SITENAME}} – The free worldwide travel guide that you can edit
|
||||
// if MAIN_PAGE, use the pageTitle for MAIN_PAGE; may not need Replace_unders depending on whether "mainPageTtl" is "MAIN PAGE"
|
||||
if (Bry_.Eq(Xoa_ttl.Replace_unders(ttl.Raw()), Xoa_ttl.Replace_unders(mainPageTtl)))
|
||||
msgKey = Bry_.new_a7("pagetitle-view-mainpage"); // {{SITENAME}} – The free worldwide travel guide that you can edit
|
||||
|
||||
// do the actual swap
|
||||
return msgMgr.Val_by_key_args(msgKey, pagename);
|
||||
return msgMgr.Val_by_key_args(msgKey, pagename);
|
||||
}
|
||||
else {
|
||||
return pagename;
|
||||
}
|
||||
}
|
||||
public static byte[] BuildPagenameForH1(Bry_bfr tmp, Xoa_ttl ttl, byte[] displayTtl) {
|
||||
// display_ttl explicitly set; use it
|
||||
|
@ -15,6 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.htmls;
|
||||
|
||||
import gplx.Bool_;
|
||||
import gplx.Bry_;
|
||||
import gplx.Bry_bfr;
|
||||
import gplx.Bry_bfr_;
|
||||
@ -37,11 +38,12 @@ public class Xoh_page_wtr_wkr_tst {
|
||||
fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_a7("pagetitle-view-mainpage")).Atrs_set(Bry_.new_a7("{{SITENAME}} - WikiDescription"), false, true);
|
||||
fxt.Wiki().Msg_mgr().Get_or_make(Bry_.new_a7("pagetitle")).Atrs_set(Bry_.new_a7("~{0} - {{SITENAME}}"), true, true);
|
||||
|
||||
fxt.Test_BuildPagenameForTab("basic" , "Earth - Wikipedia" , "Earth");
|
||||
fxt.Test_BuildPagenameForTab("ns" , "File:A.png - Wikipedia" , "File:A.png");
|
||||
fxt.Test_BuildPagenameForTab("special" , "Special:Search/earth - Wikipedia" , "Special:Search/earth");
|
||||
fxt.Test_BuildPagenameForTab("special:no qargs" , "Special:Search/earth - Wikipedia" , "Special:Search/earth?fulltext=y");
|
||||
fxt.Test_BuildPagenameForTab("mainpage" , "Wikipedia - WikiDescription" , "Main_Page");
|
||||
fxt.Test_BuildPagenameForTab("basic" , "Earth" , Bool_.N,"Earth");
|
||||
fxt.Test_BuildPagenameForTab("ns" , "File:A.png" , Bool_.N,"File:A.png");
|
||||
fxt.Test_BuildPagenameForTab("special" , "Special:Search/earth" , Bool_.N,"Special:Search/earth");
|
||||
fxt.Test_BuildPagenameForTab("special:no qargs" , "Special:Search/earth" , Bool_.N,"Special:Search/earth?fulltext=y");
|
||||
fxt.Test_BuildPagenameForTab("http.page" , "Earth - Wikipedia" , Bool_.Y,"Earth");
|
||||
fxt.Test_BuildPagenameForTab("http.mainpage" , "Wikipedia - WikiDescription" , Bool_.Y,"Main_Page");
|
||||
}
|
||||
@Test public void BuildPagenameForH1() {
|
||||
fxt.Test_BuildPagenameForH1("Full_txt" , "Two words" , "Two_words", null);
|
||||
@ -74,11 +76,11 @@ class Xoh_page_wtr_fxt {
|
||||
Xoa_ttl page_ttl = Xoa_ttl.Parse(wiki, Bry_.new_a7(ttl));
|
||||
Gftest.Eq__str(expd, Xoh_page_wtr_wkr_.BuildPagenameForH1(tmp_bfr, page_ttl, Bry_.new_a7(display)), note);
|
||||
}
|
||||
public void Test_BuildPagenameForTab(String note, String expd, String raw) {
|
||||
public void Test_BuildPagenameForTab(String note, String expd, boolean isHttpServer, String raw) {
|
||||
Xoa_ttl page_ttl = Xoa_ttl.Parse(wiki, Bry_.new_a7(raw));
|
||||
byte[] mainpage_title = Xoa_page_.Main_page_bry;
|
||||
|
||||
Gftest.Eq__str(expd, Xoh_page_wtr_wkr_.BuildPagenameForTab(tmp_bfr, wiki.Msg_mgr(), page_ttl, mainpage_title));
|
||||
Gftest.Eq__str(expd, Xoh_page_wtr_wkr_.BuildPagenameForTab(tmp_bfr, isHttpServer, wiki.Msg_mgr(), page_ttl, mainpage_title));
|
||||
}
|
||||
public void Test_edit(String raw, String expd) {
|
||||
wiki.Html_mgr().Page_wtr_mgr().Html_capable_(true);
|
||||
|
Loading…
Reference in New Issue
Block a user