mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
'v3.6.3.1'
This commit is contained in:
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_file_mgr implements GfoInvkAble {
|
||||
class Hiero_file_mgr implements Gfo_invk {
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_file_srl srl;
|
||||
public Hiero_file_mgr() {srl = new Hiero_file_srl(this);}
|
||||
@@ -28,7 +28,7 @@ class Hiero_file_mgr implements GfoInvkAble {
|
||||
public Hiero_file_itm Get_by_key(byte[] key) {return (Hiero_file_itm)hash.Get_by(key);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_srl)) return srl;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} private static final String Invk_srl = "srl";
|
||||
}
|
||||
class Hiero_file_itm {
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
class Hiero_html_mgr {
|
||||
private Bry_bfr html_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), content_bfr = Bry_bfr.reset_(255), tbl_content_bfr = Bry_bfr.reset_(Io_mgr.Len_kb), temp_bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr html_bfr = Bry_bfr_.Reset(Io_mgr.Len_kb), content_bfr = Bry_bfr_.Reset(255), tbl_content_bfr = Bry_bfr_.Reset(Io_mgr.Len_kb), temp_bfr = Bry_bfr_.Reset(255);
|
||||
private boolean cartouche_opened = false;
|
||||
public static int scale = 100;
|
||||
private Hiero_prefab_mgr prefab_mgr; private Hiero_file_mgr file_mgr; private Hiero_phoneme_mgr phoneme_mgr;
|
||||
@@ -227,8 +227,8 @@ class Hiero_html_mgr {
|
||||
public static final int Image_margin = 1;
|
||||
public static final int Cartouche_width = 2;
|
||||
public static final int Max_height = 44;
|
||||
private static final byte[] Bry_cls_mirrored = Bry_.new_a7("class=\"mw-mirrored\" ");
|
||||
private static final byte[]
|
||||
private static final byte[] Bry_cls_mirrored = Bry_.new_a7("class=\"mw-mirrored\" ");
|
||||
private static final byte[]
|
||||
Tkn_lt = new byte[] {Byte_ascii.Lt}
|
||||
, Tkn_gt = new byte[] {Byte_ascii.Gt}
|
||||
, Tkn_dot = new byte[] {Byte_ascii.Dot}
|
||||
|
||||
@@ -20,7 +20,7 @@ import gplx.core.brys.fmtrs.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.core.htmls.*;
|
||||
class Hiero_html_wtr {
|
||||
private Hiero_phoneme_mgr phoneme_mgr;
|
||||
private Bry_bfr temp_bfr = Bry_bfr.reset_(255);
|
||||
private Bry_bfr temp_bfr = Bry_bfr_.Reset(255);
|
||||
public Hiero_html_wtr(Hiero_html_mgr mgr, Hiero_phoneme_mgr phoneme_mgr) {this.phoneme_mgr = phoneme_mgr;}
|
||||
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
|
||||
public void Hr(Bry_bfr bfr) {bfr.Add(Gfh_tag_.Hr_inl).Add_byte_nl();}
|
||||
@@ -28,22 +28,22 @@ class Hiero_html_wtr {
|
||||
public byte[] Td_height(int height) {
|
||||
return temp_bfr.Add(Option_bgn_bry).Add_int_variable(height).Add(Option_end_bry).To_bry_and_clear();
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Option_bgn_bry = Bry_.new_a7("height: ")
|
||||
, Option_end_bry = Bry_.new_a7("px;")
|
||||
;
|
||||
public void Td(Bry_bfr bfr, byte[] glyph) {
|
||||
bfr.Add(Td_bgn_bry).Add(glyph).Add(Td_end_bry);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Td_bgn_bry = Bry_.new_a7("\n <td>")
|
||||
, Td_end_bry = Bry_.new_a7("\n </td>")
|
||||
;
|
||||
public void Cartouche_bgn(Bry_bfr bfr) {
|
||||
bfr.Add(Cartouche_bgn_lhs_bry).Add_int_variable((Hiero_html_mgr.Cartouche_width * Hiero_html_mgr.scale) / 100).Add(Cartouche_bgn_rhs_bry);
|
||||
}
|
||||
private static final String Tbl_bgn_str = "<table class=\"mw-hiero-table\">";
|
||||
private static final byte[]
|
||||
private static final String Tbl_bgn_str = "<table class=\"mw-hiero-table\">";
|
||||
private static final byte[]
|
||||
Cartouche_bgn_lhs_bry = Bry_.new_a7(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <td>"
|
||||
@@ -63,7 +63,7 @@ class Hiero_html_wtr {
|
||||
public void Cartouche_end(Bry_bfr bfr) {
|
||||
bfr.Add(Cartouche_end_lhs_bry).Add_int_variable((Hiero_html_mgr.Cartouche_width * Hiero_html_mgr.scale) / 100).Add(Cartouche_end_rhs_bry);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Cartouche_end_lhs_bry = Bry_.new_a7(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " </tr>"
|
||||
@@ -87,7 +87,7 @@ class Hiero_html_wtr {
|
||||
byte[] title = bgn ? Gfh_entity_.Lt_bry : Gfh_entity_.Gt_bry;
|
||||
return cartouche_img_fmtr.Bld_bry_many(temp_bfr, hiero_img_dir, code, height, title);
|
||||
}
|
||||
private static final Bry_fmtr cartouche_img_fmtr = Bry_fmtr.new_(String_.Concat
|
||||
private static final Bry_fmtr cartouche_img_fmtr = Bry_fmtr.new_(String_.Concat
|
||||
( "\n <img src='~{path}hiero_~{code}.png'"
|
||||
, " height='~{height}' title='~{title}'"
|
||||
, " alt='~{title}' />"
|
||||
@@ -96,7 +96,7 @@ class Hiero_html_wtr {
|
||||
public void Tbl_inner(Bry_bfr html_bfr, Bry_bfr text_bfr) {
|
||||
html_bfr.Add(Tbl_inner_bgn).Add_bfr_and_clear(text_bfr).Add(Tbl_inner_end); // $html .= self::TABLE_START . "<tr>\n" . $tableContentHtml . '</tr></table>';
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Tbl_inner_bgn = Bry_.new_u8(String_.Concat_lines_nl_skip_last
|
||||
( " <table class=\"mw-hiero-table\">"
|
||||
, " <tr>"
|
||||
@@ -112,7 +112,7 @@ class Hiero_html_wtr {
|
||||
bfr.Add_bfr_and_clear(html_bfr);
|
||||
bfr.Add(Outer_tbl_end);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Outer_tbl_bgn = Bry_.new_a7(String_.Concat_lines_nl_skip_last
|
||||
( "<table class='mw-hiero-table mw-hiero-outer' dir='ltr'>"
|
||||
, " <tr>"
|
||||
@@ -137,7 +137,7 @@ class Hiero_html_wtr {
|
||||
byte[] img_src = Bld_img_src(hiero_img_dir, img_src_name);
|
||||
return glyph_img_fmtr.Bld_bry_many(temp_bfr, img_cls, Hiero_html_mgr.Image_margin, td_height, img_src, img_title, glyph);
|
||||
}
|
||||
private static final byte[]
|
||||
private static final byte[]
|
||||
Tbl_eol_bry = Bry_.new_a7(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " </tr>"
|
||||
@@ -145,7 +145,7 @@ class Hiero_html_wtr {
|
||||
, " " + Tbl_bgn_str
|
||||
, " <tr>"
|
||||
));
|
||||
private static final Bry_fmtr glyph_img_fmtr = Bry_fmtr.new_
|
||||
private static final Bry_fmtr glyph_img_fmtr = Bry_fmtr.new_
|
||||
( "\n <img ~{img_cls}style='margin: ~{img_margin}px; ~{option}' src='~{img_src}' title='~{img_title}' alt='~{glyph}' />"
|
||||
, "img_cls", "img_margin", "option", "img_src", "img_title", "glyph");
|
||||
public byte[] Void(boolean half) { // render void
|
||||
@@ -153,7 +153,7 @@ class Hiero_html_wtr {
|
||||
if (half) width /= 2;
|
||||
return void_fmtr.Bld_bry_many(temp_bfr, width);
|
||||
}
|
||||
private static final Bry_fmtr void_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
private static final Bry_fmtr void_fmtr = Bry_fmtr.new_(String_.Concat_lines_nl_skip_last
|
||||
( ""
|
||||
, " <table class=\"mw-hiero-table\" style=\"width: ~{width}px;\">"
|
||||
, " <tr>"
|
||||
@@ -165,7 +165,7 @@ class Hiero_html_wtr {
|
||||
private static byte[] Bld_img_src(byte[] hiero_img_dir, byte[] name) {
|
||||
return Bry_.Add(hiero_img_dir, Img_src_prefix, name, Img_src_ext);
|
||||
}
|
||||
private static final byte[] Img_src_prefix = Bry_.new_a7("hiero_")
|
||||
private static final byte[] Img_src_prefix = Bry_.new_a7("hiero_")
|
||||
, Img_src_ext = Bry_.new_a7(".png")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class Hiero_mw_tables_parser {
|
||||
}
|
||||
}
|
||||
private void Parse_phonemes(Hiero_phoneme_mgr mgr, Php_line_assign line) { // $wh_phonemes = array(k => v, k => v ...);
|
||||
List_adp tmp_list = List_adp_.new_(); Byte_obj_ref tmp_rslt = Byte_obj_ref.zero_(); Bry_bfr tmp_bfr = Bry_bfr.new_();
|
||||
List_adp tmp_list = List_adp_.New(); Byte_obj_ref tmp_rslt = Byte_obj_ref.zero_(); Bry_bfr tmp_bfr = Bry_bfr_.New();
|
||||
Php_itm_ary ary = (Php_itm_ary)line.Val();
|
||||
int subs_len = ary.Subs_len();
|
||||
for (int i = 0; i < subs_len; i++) {
|
||||
|
||||
@@ -19,9 +19,9 @@ package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xo
|
||||
import gplx.core.btries.*; import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
class Hiero_parser {
|
||||
private Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
|
||||
private List_adp blocks = List_adp_.new_();
|
||||
private List_adp blocks = List_adp_.New();
|
||||
private Hiero_block cur_block;
|
||||
private Bry_bfr cur_tkn = Bry_bfr.reset_(16);
|
||||
private Bry_bfr cur_tkn = Bry_bfr_.Reset(16);
|
||||
public Hiero_block[] Parse(byte[] src, int bgn, int end) {
|
||||
blocks.Clear();
|
||||
this.cur_block = new Hiero_block();
|
||||
@@ -125,7 +125,7 @@ class Hiero_parser_itm {
|
||||
public static final byte Tid_block_spr = 1, Tid_tkn_spr = 2, Tid_single_char = 3, Tid_dot = 4, Tid_comment = 5;
|
||||
}
|
||||
class Hiero_block {
|
||||
private List_adp list = List_adp_.new_();
|
||||
private List_adp list = List_adp_.New();
|
||||
public int Len() {return list.Count();}
|
||||
public byte[] Get_at(int i) {return (byte[])list.Get_at(i);}
|
||||
public void Add(byte[] v) {list.Add(v);}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_phoneme_mgr implements GfoInvkAble {
|
||||
class Hiero_phoneme_mgr implements Gfo_invk {
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_phoneme_srl srl;
|
||||
public Hiero_phoneme_mgr() {srl = new Hiero_phoneme_srl(this);}
|
||||
@@ -28,7 +28,7 @@ class Hiero_phoneme_mgr implements GfoInvkAble {
|
||||
public Hiero_phoneme_itm Get_by_key(byte[] key) {return (Hiero_phoneme_itm)hash.Get_by(key);}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_srl)) return srl;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
}
|
||||
public static final String Invk_srl = "srl";
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.dsvs.*;
|
||||
class Hiero_prefab_mgr implements GfoInvkAble {
|
||||
class Hiero_prefab_mgr implements Gfo_invk {
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_prefab_srl srl;
|
||||
public Hiero_prefab_mgr() {srl = new Hiero_prefab_srl(this);}
|
||||
@@ -28,7 +28,7 @@ class Hiero_prefab_mgr implements GfoInvkAble {
|
||||
public void Clear() {hash.Clear();}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_srl)) return srl;
|
||||
else return GfoInvkAble_.Rv_unhandled;
|
||||
else return Gfo_invk_.Rv_unhandled;
|
||||
} private static final String Invk_srl = "srl";
|
||||
}
|
||||
class Hiero_prefab_itm {
|
||||
|
||||
@@ -17,10 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.htmls.modules.*; import gplx.xowa.apps.fsys.*;
|
||||
public class Hiero_xtn_mgr extends Xox_mgr_base implements GfoInvkAble {
|
||||
public class Hiero_xtn_mgr extends Xox_mgr_base implements Gfo_invk {
|
||||
@Override public boolean Enabled_default() {return true;}
|
||||
@Override public byte[] Xtn_key() {return Xtn_key_static;} public static final byte[] Xtn_key_static = Bry_.new_a7("hiero");
|
||||
@Override public Xox_mgr Clone_new() {return new Hiero_xtn_mgr();}
|
||||
@Override public byte[] Xtn_key() {return Xtn_key_static;} public static final byte[] Xtn_key_static = Bry_.new_a7("hiero");
|
||||
@Override public Xox_mgr Xtn_clone_new() {return new Hiero_xtn_mgr();}
|
||||
public static byte[] Img_src_dir;
|
||||
@Override public void Xtn_init_by_wiki(Xowe_wiki wiki) {}
|
||||
private static boolean xtn_init_done = false;
|
||||
@@ -35,10 +35,10 @@ public class Hiero_xtn_mgr extends Xox_mgr_base implements GfoInvkAble {
|
||||
parser.Init();
|
||||
xtn_init_done = true;
|
||||
}
|
||||
@gplx.Internal protected Hiero_parser Parser() {return parser;} private static final Hiero_parser parser = new Hiero_parser();
|
||||
@gplx.Internal protected Hiero_prefab_mgr Prefab_mgr() {return prefab_mgr;} private static final Hiero_prefab_mgr prefab_mgr = new Hiero_prefab_mgr();
|
||||
@gplx.Internal protected Hiero_file_mgr File_mgr() {return file_mgr;} private static final Hiero_file_mgr file_mgr = new Hiero_file_mgr();
|
||||
@gplx.Internal protected Hiero_phoneme_mgr Phoneme_mgr() {return phoneme_mgr;} private static final Hiero_phoneme_mgr phoneme_mgr = new Hiero_phoneme_mgr();
|
||||
@gplx.Internal protected Hiero_parser Parser() {return parser;} private static final Hiero_parser parser = new Hiero_parser();
|
||||
@gplx.Internal protected Hiero_prefab_mgr Prefab_mgr() {return prefab_mgr;} private static final Hiero_prefab_mgr prefab_mgr = new Hiero_prefab_mgr();
|
||||
@gplx.Internal protected Hiero_file_mgr File_mgr() {return file_mgr;} private static final Hiero_file_mgr file_mgr = new Hiero_file_mgr();
|
||||
@gplx.Internal protected Hiero_phoneme_mgr Phoneme_mgr() {return phoneme_mgr;} private static final Hiero_phoneme_mgr phoneme_mgr = new Hiero_phoneme_mgr();
|
||||
@gplx.Internal protected Hiero_html_mgr Html_wtr() {return html_wtr;} private static Hiero_html_mgr html_wtr;
|
||||
public void Clear() {
|
||||
prefab_mgr.Clear();
|
||||
|
||||
Reference in New Issue
Block a user