mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Mw_parse: Port over more code for thumb links (part 2)
This commit is contained in:
@@ -1106,9 +1106,9 @@ public class Bry_ {
|
||||
return Bry_.Replace(Bry_.Mid(src, bgn, end), Byte_ascii.Nl, Byte_ascii.Tab);
|
||||
}
|
||||
public static byte[] Escape_html(byte[] src) {
|
||||
return Escape_html(null, src, 0, src.length);
|
||||
return Escape_html(null, Bool_.N, src, 0, src.length);
|
||||
}
|
||||
public static byte[] Escape_html(Bry_bfr bfr, byte[] src, int src_bgn, int src_end) { // uses PHP rules for htmlspecialchars; REF.PHP:http://php.net/manual/en/function.htmlspecialchars.php
|
||||
public static byte[] Escape_html(Bry_bfr bfr, boolean ws, byte[] src, int src_bgn, int src_end) { // uses PHP rules for htmlspecialchars; REF.PHP:http://php.net/manual/en/function.htmlspecialchars.php
|
||||
boolean dirty = false;
|
||||
int cur = src_bgn;
|
||||
int prv = cur;
|
||||
@@ -1133,6 +1133,9 @@ public class Bry_ {
|
||||
case Byte_ascii.Apos: escaped = Gfh_entity_.Apos_num_bry; break;
|
||||
case Byte_ascii.Lt: escaped = Gfh_entity_.Lt_bry; break;
|
||||
case Byte_ascii.Gt: escaped = Gfh_entity_.Gt_bry; break;
|
||||
case Byte_ascii.Nl: if (ws) escaped = Gfh_entity_.Nl_bry; break;
|
||||
case Byte_ascii.Cr: if (ws) escaped = Gfh_entity_.Cr_bry; break;
|
||||
case Byte_ascii.Tab: if (ws) escaped = Gfh_entity_.Tab_bry; break;
|
||||
}
|
||||
|
||||
// not escaped; increment and continue
|
||||
|
||||
@@ -311,7 +311,11 @@ public class Bry_bfr {
|
||||
return Add_bry_escape_html(val, 0, val.length);
|
||||
}
|
||||
public Bry_bfr Add_bry_escape_html(byte[] val, int bgn, int end) {
|
||||
Bry_.Escape_html(this, val, bgn, end);
|
||||
Bry_.Escape_html(this, Bool_.N, val, bgn, end);
|
||||
return this;
|
||||
}
|
||||
public Bry_bfr Add_bry_escape_xml(byte[] val, int bgn, int end) {
|
||||
Bry_.Escape_html(this, Bool_.Y, val, bgn, end);
|
||||
return this;
|
||||
}
|
||||
public Bry_bfr Add_str_u8_w_nl(String s) {Add_str_u8(s); return Add_byte_nl();}
|
||||
|
||||
@@ -17,8 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx;
|
||||
public class Keyval_hash {
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
private final Ordered_hash hash = Ordered_hash_.New();
|
||||
public int Count() {return hash.Count();}
|
||||
public int Len() {return hash.Count();}
|
||||
public Keyval_hash Clear() {hash.Clear(); return this;}
|
||||
public boolean Has(String key) {return hash.Has(key);}
|
||||
public Keyval Get_at(int i) {return (Keyval)hash.Get_at(i);}
|
||||
|
||||
@@ -98,7 +98,6 @@ public class Ordered_hash_base extends Hash_adp_base implements Ordered_hash, Gf
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
return this;
|
||||
} static final String Invk_SetKeyOnly = "SetKeyOnly", Invk_Print = "Print";
|
||||
public int Len() {return ordered.Count();}
|
||||
@Override public int Count() {return ordered.Count();}
|
||||
public Ordered_hash_base() {}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public abstract class Hash_adp_base implements Hash_adp {
|
||||
|
||||
// private final java.util.HashMap<Object, Object> hash = new java.util.HashMap<Object, Object>();
|
||||
private final java.util.Hashtable hash = new java.util.Hashtable();
|
||||
@gplx.Virtual public int Len() {return hash.size();}
|
||||
@gplx.Virtual public int Count() {return hash.size();}
|
||||
@gplx.Virtual public void Clear() {hash.clear();}
|
||||
@gplx.Virtual protected void Add_base(Object key, Object val) {hash.put(key, val);}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Gfh_entity_ {
|
||||
, Apos_num_bry = Bry_.new_a7("'")
|
||||
, Apos_key_bry = Bry_.new_a7("'")
|
||||
, Eq_bry = Bry_.new_a7("=")
|
||||
, Nl_bry = Bry_.new_a7(Nl_str), Space_bry = Bry_.new_a7(" ")
|
||||
, Nl_bry = Bry_.new_a7(Nl_str), Cr_bry = Bry_.new_a7(" "), Tab_bry = Bry_.new_a7("	"), Space_bry = Bry_.new_a7(" ")
|
||||
, Pipe_bry = Bry_.new_a7("|")
|
||||
, Colon_bry = Bry_.new_a7(":"), Underline_bry = Bry_.new_a7("_"), Asterisk_bry = Bry_.new_a7("*")
|
||||
, Brack_bgn_bry = Bry_.new_a7("["), Brack_end_bry = Bry_.new_a7("]")
|
||||
|
||||
Reference in New Issue
Block a user