mirror of https://github.com/gnosygnu/xowa
parent
52c36aa4f8
commit
6d179ca59d
@ -0,0 +1,37 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.htmls.heads; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.guis.*;
|
||||
public class Xoh_head_itm__pgbnr extends Xoh_head_itm__base {
|
||||
@Override public byte[] Key() {return Xoh_head_itm_.Key__pgbnr;}
|
||||
@Override public int Flags() {return Flag__css_include;}
|
||||
@Override public void Write_css_include(Xoae_app app, Xowe_wiki wiki, Xoae_page page, Xoh_head_wtr wtr) {
|
||||
if (Url__css__styles == null) {
|
||||
Url__css__oojs_ui = app.Fsys_mgr().Bin_any_dir().GenSubFil_nest("xowa", "html", "res", "lib", "oojs-ui", "oojs-ui-mediawiki.css").To_http_file_bry(); // needed for icons; should move to own file
|
||||
Io_url resources_dir = app.Fsys_mgr().Bin_any_dir().GenSubDir_nest("xowa", "xtns", "WikidataPageBanner", "resources");
|
||||
Url__css__styles = resources_dir.GenSubFil_nest("ext.WikidataPageBanner.styles" , "ext.WikidataPageBanner.css").To_http_file_bry();
|
||||
Url__css__toc = resources_dir.GenSubFil_nest("ext.WikidataPageBanner.toc.styles" , "ext.WikidataPageBanner.toc.css").To_http_file_bry();
|
||||
Url__css__bottomtoc = resources_dir.GenSubFil_nest("ext.WikidataPageBanner.toc.styles" , "ext.WikidataPageBanner.bottomtoc.css").To_http_file_bry();
|
||||
}
|
||||
wtr.Write_css_include(Url__css__oojs_ui);
|
||||
wtr.Write_css_include(Url__css__styles);
|
||||
wtr.Write_css_include(Url__css__toc);
|
||||
wtr.Write_css_include(Url__css__bottomtoc);
|
||||
}
|
||||
private static byte[] Url__css__styles, Url__css__toc, Url__css__bottomtoc, Url__css__oojs_ui;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.parsers.tmpls; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*;
|
||||
import gplx.xowa.xtns.pfuncs.*;
|
||||
public class Xop_func_arg_itm {
|
||||
public byte[] key;
|
||||
public byte[] val;
|
||||
public void Set(Bry_bfr bfr, Xop_ctx ctx, byte[] src, Xot_invk caller, Xot_invk self, Arg_nde_tkn arg) {
|
||||
Pf_func_.Eval_arg_or(bfr, ctx, src, caller, self, arg, null);
|
||||
key = val = Bry_.Empty;
|
||||
int len = bfr.Len(); byte[] bry = bfr.Bfr();
|
||||
int bgn = -1, end = -1; boolean mode_is_key = true;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
byte b = bry[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Eq:
|
||||
if (mode_is_key) {
|
||||
mode_is_key = false;
|
||||
key = Bry_.Mid(bry, bgn, end);
|
||||
bgn = end = -1;
|
||||
}
|
||||
break;
|
||||
case Byte_ascii.Tab: case Byte_ascii.Nl: case Byte_ascii.Cr: case Byte_ascii.Space:
|
||||
break;
|
||||
default:
|
||||
if (bgn == -1) bgn = i;
|
||||
end = i + 1;
|
||||
break;
|
||||
}
|
||||
if (bgn != -1) // guard against 'key='
|
||||
val = Bry_.Mid(bry, bgn, end);
|
||||
}
|
||||
bfr.Clear();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012 gnosygnu@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.wikis.pages; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
|
||||
import gplx.core.brys.*; import gplx.core.brys.fmtrs.*;
|
||||
public class Xopg_page_heading implements Bfr_arg {
|
||||
private Xopg_html_data html_data;
|
||||
private Xoa_ttl page_ttl;
|
||||
public Xopg_page_heading Init(Xoae_page page) {
|
||||
this.html_data = page.Html_data();
|
||||
this.page_ttl = page.Ttl();
|
||||
return this;
|
||||
}
|
||||
public void Bfr_arg__add(Bry_bfr bfr) {
|
||||
if (html_data.Xtn_pgbnr() != null) return; // pgbnr exists; don't add title
|
||||
fmtr.Bld_bfr_many(bfr, page_ttl.Page_txt());
|
||||
}
|
||||
private final Bry_fmt fmtr = Bry_fmt.New(Bry_.New_u8_nl_apos("<h1 id='firstHeading' class='firstHeading'><span>~{page_title}</span></h1>"), "page_title");
|
||||
}
|
Binary file not shown.
Loading…
Reference in new issue