mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Cite: Change Cite to follow MediaWiki behavior for super-scripting [#382]
This commit is contained in:
26
400_xowa/src/gplx/langs/htmls/Gfh_atr_itm.java
Normal file
26
400_xowa/src/gplx/langs/htmls/Gfh_atr_itm.java
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 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.langs.htmls; import gplx.*; import gplx.langs.*;
|
||||
public class Gfh_atr_itm {
|
||||
public Gfh_atr_itm(byte[] key, byte[] val) {
|
||||
this.key = key;
|
||||
this.val = val;
|
||||
}
|
||||
public byte[] Key() {return key;} private final byte[] key;
|
||||
public byte[] Val() {return val;} private final byte[] val;
|
||||
public static Gfh_atr_itm New(byte[] key, String val) {return new Gfh_atr_itm(key, Bry_.new_u8(val));}
|
||||
public static Gfh_atr_itm New(byte[] key, byte[] val) {return new Gfh_atr_itm(key, val);}
|
||||
}
|
||||
39
400_xowa/src/gplx/langs/htmls/Gfh_html_.java
Normal file
39
400_xowa/src/gplx/langs/htmls/Gfh_html_.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 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.langs.htmls; import gplx.*; import gplx.langs.*;
|
||||
public class Gfh_html_ {
|
||||
public static byte[] rawElement(Bry_bfr bfr, int tag_id, byte[] body, Gfh_atr_itm... atrs) {
|
||||
// add "<tag"
|
||||
byte[] tag_name = Bry_.new_u8(Gfh_tag_.To_str(tag_id));
|
||||
Gfh_tag_.Bld_lhs_bgn(bfr, tag_name);
|
||||
|
||||
// add " key1=val1 ..."
|
||||
int len = atrs.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Gfh_atr_itm atr = atrs[i];
|
||||
Gfh_atr_.Add(bfr, atr.Key(), atr.Val());
|
||||
}
|
||||
|
||||
// add ">"
|
||||
Gfh_tag_.Bld_lhs_end_nde(bfr);
|
||||
|
||||
bfr.Add(body);
|
||||
|
||||
// add "</tag>"
|
||||
Gfh_tag_.Bld_rhs(bfr, tag_name);
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public class Gfh_tag_ { // NOTE: not serialized; used by tag_rdr
|
||||
, Comm_end_len = Comm_end.length
|
||||
;
|
||||
public static final byte[] Rhs_bgn = Bry_.new_a7("</");
|
||||
public static void Bld_lhs_bgn(Bry_bfr bfr, byte[] tag) {bfr.Add_byte(Byte_ascii.Lt).Add(tag);} // >
|
||||
public static void Bld_lhs_bgn(Bry_bfr bfr, byte[] tag) {bfr.Add_byte(Byte_ascii.Lt).Add(tag);} // <tag
|
||||
public static void Bld_lhs_end_nde(Bry_bfr bfr) {bfr.Add_byte(Byte_ascii.Gt);} // >
|
||||
public static void Bld_lhs_end_inl(Bry_bfr bfr) {bfr.Add_byte(Byte_ascii.Slash).Add_byte(Byte_ascii.Gt);} // "/>"
|
||||
public static void Bld_rhs(Bry_bfr bfr, byte[] name) {bfr.Add(Rhs_bgn).Add(name).Add_byte(Byte_ascii.Angle_end);} // EX:"</tag_name>"
|
||||
|
||||
Reference in New Issue
Block a user