mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.10.3.1
This commit is contained in:
@@ -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.dsvs.*;
|
||||
class Hiero_file_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_file_srl srl;
|
||||
public Hiero_file_mgr() {srl = new Hiero_file_srl(this);}
|
||||
public int Len() {return hash.Count();}
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.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 Xoh_wtr_ctx hctx;
|
||||
@@ -102,7 +102,7 @@ class Hiero_html_mgr {
|
||||
else
|
||||
temp_bfr.Add(v);
|
||||
}
|
||||
byte[] prefab_bry = temp_bfr.Xto_bry_and_clear();
|
||||
byte[] prefab_bry = temp_bfr.To_bry_and_clear();
|
||||
Hiero_prefab_itm prefab_itm = prefab_mgr.Get_by_key(prefab_bry);
|
||||
if (prefab_itm != null) {
|
||||
byte[] td_height = wtr.Td_height(Resize_glyph(prefab_bry, cartouche_opened));
|
||||
@@ -159,7 +159,7 @@ class Hiero_html_mgr {
|
||||
byte[] td_height = wtr.Td_height(Resize_glyph(v, cartouche_opened, total));
|
||||
temp_bfr.Add(Render_glyph(v, td_height));
|
||||
}
|
||||
wtr.Td(content_bfr, temp_bfr.Xto_bry_and_clear());
|
||||
wtr.Td(content_bfr, temp_bfr.To_bry_and_clear());
|
||||
}
|
||||
}
|
||||
private byte[] Render_glyph(byte[] src) {return Render_glyph(src, Bry_.Empty);}
|
||||
|
||||
@@ -16,16 +16,16 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
import gplx.langs.htmls.*; import gplx.xowa.htmls.*;
|
||||
class Hiero_html_wtr {
|
||||
private Hiero_phoneme_mgr phoneme_mgr;
|
||||
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 = hctx.Mode_is_hdump() ? gplx.xowa.html.hdumps.abrvs.Xohd_abrv_.Key_hiero_dir : Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
|
||||
public void Init_for_write(Xoh_wtr_ctx hctx) {this.hiero_img_dir = hctx.Mode_is_hdump() ? gplx.xowa.htmls.hdumps.abrvs.Xohd_abrv_.Key_hiero_dir : Hiero_xtn_mgr.Img_src_dir;} private byte[] hiero_img_dir = null;
|
||||
public void Hr(Bry_bfr bfr) {bfr.Add(Html_tag_.Hr_inl).Add_byte_nl();}
|
||||
public void Tbl_eol(Bry_bfr bfr) {bfr.Add(Tbl_eol_bry);}
|
||||
public byte[] Td_height(int height) {
|
||||
return temp_bfr.Add(Option_bgn_bry).Add_int_variable(height).Add(Option_end_bry).Xto_bry_and_clear();
|
||||
return temp_bfr.Add(Option_bgn_bry).Add_int_variable(height).Add(Option_end_bry).To_bry_and_clear();
|
||||
}
|
||||
private static final byte[]
|
||||
Option_bgn_bry = Bry_.new_a7("height: ")
|
||||
@@ -130,7 +130,7 @@ class Hiero_html_wtr {
|
||||
;
|
||||
public byte[] Img_phoneme(byte[] img_cls, byte[] td_height, byte[] glyph_esc, byte[] code) {
|
||||
byte[] code_esc = Html_utl.Escape_html_as_bry(temp_bfr, code);
|
||||
byte[] img_title = temp_bfr.Add(code_esc).Add_byte_space().Add_byte(Byte_ascii.Brack_bgn).Add(glyph_esc).Add_byte(Byte_ascii.Brack_end).Xto_bry_and_clear(); // "~{code} [~{glyph}]"
|
||||
byte[] img_title = temp_bfr.Add(code_esc).Add_byte_space().Add_byte(Byte_ascii.Brack_bgn).Add(glyph_esc).Add_byte(Byte_ascii.Brack_end).To_bry_and_clear(); // "~{code} [~{glyph}]"
|
||||
return Img(img_cls, td_height, glyph_esc, code_esc, img_title);
|
||||
}
|
||||
public byte[] Img_file(byte[] img_cls, byte[] td_height, byte[] glyph_esc) {return Img(img_cls, td_height, glyph_esc, glyph_esc, glyph_esc);}
|
||||
|
||||
@@ -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.core.primitives.*;
|
||||
import gplx.langs.phps.*; import gplx.langs.dsvs.*;
|
||||
import gplx.xowa.apps.gfss.*;
|
||||
import gplx.xowa.apps.gfs.*;
|
||||
public class Hiero_mw_tables_parser {
|
||||
private Php_parser parser = new Php_parser(); private Php_evaluator evaluator;
|
||||
private Php_text_itm_parser quote_parser = new Php_text_itm_parser();
|
||||
@@ -31,7 +31,7 @@ public class Hiero_mw_tables_parser {
|
||||
}
|
||||
public void Load_data(Hiero_xtn_mgr xtn_mgr, Io_url load_fil) {// NOTE: parsing tables.php instead of tables.ser b/c latter is too difficult to read / debug
|
||||
evaluator.Clear();
|
||||
parser.Parse_tkns(Io_mgr.I.LoadFilBry(load_fil), evaluator);
|
||||
parser.Parse_tkns(Io_mgr.Instance.LoadFilBry(load_fil), evaluator);
|
||||
Php_line[] lines = (Php_line[])evaluator.List().To_ary(Php_line.class);
|
||||
int lines_len = lines.length;
|
||||
for (int i = 0; i < lines_len; i++) {
|
||||
@@ -79,7 +79,7 @@ public class Hiero_mw_tables_parser {
|
||||
}
|
||||
}
|
||||
public void Save_data(Hiero_xtn_mgr xtn_mgr, Io_url save_fil) {
|
||||
Gfs_bldr bldr = new Gfs_bldr();
|
||||
Xoa_gfs_bldr bldr = new Xoa_gfs_bldr();
|
||||
int len = -1;
|
||||
|
||||
Hiero_prefab_mgr prefab_mgr = xtn_mgr.Prefab_mgr();
|
||||
@@ -112,7 +112,7 @@ public class Hiero_mw_tables_parser {
|
||||
}
|
||||
bldr.Add_quote_xtn_end();
|
||||
bldr.Add_paren_end().Add_term_nl();
|
||||
Io_mgr.I.SaveFilBfr(save_fil, bldr.Bfr());
|
||||
Io_mgr.Instance.SaveFilBfr(save_fil, bldr.Bfr());
|
||||
}
|
||||
private static final byte Tid_prefabs = 0, Tid_files = 1, Tid_phonemes = 2;
|
||||
private static Hash_adp_bry Tid_hash = Hash_adp_bry.cs().Add_str_byte("wh_prefabs", Tid_prefabs).Add_str_byte("wh_files", Tid_files).Add_str_byte("wh_phonemes", Tid_phonemes);
|
||||
|
||||
@@ -65,9 +65,9 @@ class Hiero_mw_tables_parser_fxt {
|
||||
public void Test_bld_all(String raw, String expd) {
|
||||
Io_url load_url = Io_url_.mem_fil_("mem/hiero/load.php");
|
||||
Io_url save_url = Io_url_.mem_fil_("mem/hiero/save.php");
|
||||
Io_mgr.I.SaveFilStr(load_url, raw);
|
||||
Io_mgr.Instance.SaveFilStr(load_url, raw);
|
||||
parser.Bld_all(load_url, save_url);
|
||||
Tfds.Eq_str_lines(expd, Io_mgr.I.LoadFilStr(save_url));
|
||||
Tfds.Eq_str_lines(expd, Io_mgr.Instance.LoadFilStr(save_url));
|
||||
}
|
||||
public void Exec_bld_all(String load, String save) {
|
||||
parser.Bld_all(Io_url_.new_fil_(load), Io_url_.new_fil_(save));
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.core.btries.*; import gplx.langs.htmls.*; import gplx.xowa.html.*;
|
||||
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_();
|
||||
@@ -75,7 +75,7 @@ class Hiero_parser {
|
||||
}
|
||||
private void New_token(Hiero_parser_itm itm) {
|
||||
if (cur_tkn.Len_gt_0())
|
||||
cur_block.Add(cur_tkn.Xto_bry_and_clear());
|
||||
cur_block.Add(cur_tkn.To_bry_and_clear());
|
||||
if (itm != null)
|
||||
cur_block.Add(itm.Key());
|
||||
}
|
||||
|
||||
@@ -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.dsvs.*;
|
||||
class Hiero_phoneme_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_phoneme_srl srl;
|
||||
public Hiero_phoneme_mgr() {srl = new Hiero_phoneme_srl(this);}
|
||||
public int Len() {return hash.Count();}
|
||||
|
||||
@@ -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.dsvs.*;
|
||||
class Hiero_prefab_mgr implements GfoInvkAble {
|
||||
private Ordered_hash hash = Ordered_hash_.new_bry_();
|
||||
private Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
private Hiero_prefab_srl srl;
|
||||
public Hiero_prefab_mgr() {srl = new Hiero_prefab_srl(this);}
|
||||
public int Len() {return hash.Count();}
|
||||
|
||||
@@ -16,12 +16,12 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.html.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*;
|
||||
public class Hiero_xnde implements Xox_xnde, Xop_xnde_atr_parser {
|
||||
import gplx.xowa.htmls.*;
|
||||
import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*; import gplx.xowa.parsers.xndes.*; import gplx.xowa.parsers.htmls.*;
|
||||
public class Hiero_xnde implements Xox_xnde {
|
||||
private Hiero_xtn_mgr xtn_mgr;
|
||||
private Hiero_block[] blocks;
|
||||
public void Xatr_parse(Xowe_wiki wiki, byte[] src, Xop_xatr_itm xatr, Object xatr_key_obj) {}
|
||||
public void Xatr__set(Xowe_wiki wiki, byte[] src, Mwh_atr_itm xatr, Object xatr_id_obj) {}
|
||||
public void Xtn_parse(Xowe_wiki wiki, Xop_ctx ctx, Xop_root_tkn root, byte[] src, Xop_xnde_tkn xnde) {
|
||||
ctx.Para().Process_block__xnde(xnde.Tag(), Xop_xnde_tag.Block_bgn);
|
||||
xtn_mgr = (Hiero_xtn_mgr)wiki.Xtn_mgr().Get_or_fail(Hiero_xtn_mgr.Xtn_key_static);
|
||||
|
||||
@@ -16,7 +16,7 @@ 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.xtns.hieros; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import gplx.xowa.wikis.*; import gplx.xowa.html.modules.*; import gplx.xowa.apps.fsys.*;
|
||||
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 {
|
||||
@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");
|
||||
|
||||
Reference in New Issue
Block a user