mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Mw_parse: Add more implementation for thumbnails
This commit is contained in:
parent
b30f10b647
commit
6f9e92afff
@ -20,4 +20,19 @@ public class Php_utl_ {
|
||||
public static boolean Empty(byte[] v) {return v == null || v.length == 0;}
|
||||
public static boolean Empty(boolean v) {return v == false;}
|
||||
public static boolean Is_set(byte[] v) {return v != null;}
|
||||
public static boolean isnumeric(byte[] src) {
|
||||
if (src == null) return false;
|
||||
int len = src.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
byte b = src[i];
|
||||
switch (b) {
|
||||
case Byte_ascii.Num_0: case Byte_ascii.Num_1: case Byte_ascii.Num_2: case Byte_ascii.Num_3: case Byte_ascii.Num_4:
|
||||
case Byte_ascii.Num_5: case Byte_ascii.Num_6: case Byte_ascii.Num_7: case Byte_ascii.Num_8: case Byte_ascii.Num_9:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -239,14 +239,31 @@ public class Xomw_MagicWordArray {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public byte[] matchVariableStartToEnd(byte[] src) {
|
||||
public void matchVariableStartToEnd(byte[][] rv, byte[] src) {
|
||||
int src_end = src.length;
|
||||
if (src_end == 0) {
|
||||
rv[0] = rv[1] = null;
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] name = null;
|
||||
int val_bgn = -1, val_end = -1;
|
||||
|
||||
// check fwd; EX: "thumb=$1"
|
||||
if (fwd_trie != null) {
|
||||
Object o = fwd_trie.Match_at(trv, src, 0, src_end);
|
||||
if (o != null) {
|
||||
return ((Xomw_MagicWordSynonym)o).magic_name;
|
||||
Xomw_MagicWordSynonym syn = ((Xomw_MagicWordSynonym)o);
|
||||
name = syn.magic_name;
|
||||
val_bgn = trv.Pos();
|
||||
val_end = src_end;
|
||||
|
||||
// if "nil", then must be full match; EX: "thumbx" does not match "thumb"
|
||||
if (syn.arg1_tid == Xomw_MagicWordSynonym.Arg1__nil
|
||||
&& syn.text_wo_arg1.length != src_end) {
|
||||
rv[0] = rv[1] = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,20 +271,15 @@ public class Xomw_MagicWordArray {
|
||||
if (bwd_trie != null) {
|
||||
Object o = bwd_trie.Match_at(trv, src, src_end - 1, -1);
|
||||
if (o != null) {
|
||||
return ((Xomw_MagicWordSynonym)o).magic_name;
|
||||
Xomw_MagicWordSynonym syn = ((Xomw_MagicWordSynonym)o);
|
||||
name = syn.magic_name;
|
||||
val_bgn = 0;
|
||||
val_end = src_end - syn.text_wo_arg1.length;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
// regexes = this->getVariableStartToEndRegex();
|
||||
// foreach (regexes as regex) {
|
||||
// if (regex !== '') {
|
||||
// m = [];
|
||||
// if (preg_match(regex, text, m)) {
|
||||
// return this->parseMatch(m);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return [ false, false ];
|
||||
|
||||
rv[0] = name;
|
||||
rv[1] = val_end - val_bgn == 0 ? Bry_.Empty : Bry_.Mid(src, val_bgn, val_end);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
@ -20,27 +20,30 @@ import org.junit.*; import gplx.core.tests.*;
|
||||
public class Xomw_MagicWordArray__tst {
|
||||
private final Xomw_MagicWordArray__fxt fxt = new Xomw_MagicWordArray__fxt();
|
||||
@Test public void Nil() {
|
||||
fxt.Init__word(Bool_.Y, "nil", "nil");
|
||||
fxt.Init__ary("nil");
|
||||
fxt.Test__matchVariableStartToEnd("nil", "nil", "nila");
|
||||
fxt.Init__word(Bool_.Y, "img_nil", "nil");
|
||||
fxt.Init__ary("img_nil");
|
||||
fxt.Test__matchVariableStartToEnd("nil", "img_nil", "");
|
||||
fxt.Test__matchVariableStartToEnd("nila", null, null);
|
||||
}
|
||||
@Test public void Bgn() {
|
||||
fxt.Init__word(Bool_.Y, "bgn", "bgn$1");
|
||||
fxt.Init__ary("bgn");
|
||||
fxt.Test__matchVariableStartToEnd("bgn", "bgn", "bgna");
|
||||
fxt.Init__word(Bool_.Y, "img_bgn", "bgn$1");
|
||||
fxt.Init__ary("img_bgn");
|
||||
fxt.Test__matchVariableStartToEnd("bgna", "img_bgn", "a");
|
||||
fxt.Test__matchVariableStartToEnd("bgn", "img_bgn", "");
|
||||
}
|
||||
@Test public void End() {
|
||||
fxt.Init__word(Bool_.Y, "end", "$1end");
|
||||
fxt.Init__ary("end");
|
||||
fxt.Test__matchVariableStartToEnd("end", "end", "aend");
|
||||
fxt.Init__word(Bool_.Y, "img_end", "$1end");
|
||||
fxt.Init__ary("img_end");
|
||||
fxt.Test__matchVariableStartToEnd("aend", "img_end", "a");
|
||||
fxt.Test__matchVariableStartToEnd("end", "img_end", "");
|
||||
}
|
||||
@Test public void Smoke() {
|
||||
fxt.Init__word(Bool_.Y, "img_upright", "upright", "upright=$1", "upright $1");
|
||||
fxt.Init__word(Bool_.Y, "img_width", "$1px");
|
||||
fxt.Init__ary("img_upright", "img_width");
|
||||
|
||||
fxt.Test__matchVariableStartToEnd("img_upright", "upright", "upright=123", "upright 123");
|
||||
fxt.Test__matchVariableStartToEnd("img_width", "123px");
|
||||
fxt.Test__matchVariableStartToEnd("upright=123", "img_upright", "123");
|
||||
fxt.Test__matchVariableStartToEnd("123px", "img_width", "123");
|
||||
}
|
||||
}
|
||||
class Xomw_MagicWordArray__fxt {
|
||||
@ -52,11 +55,10 @@ class Xomw_MagicWordArray__fxt {
|
||||
public void Init__ary(String... words) {
|
||||
magic_word_ary = new Xomw_MagicWordArray(magic_word_mgr, Bry_.Ary(words));
|
||||
}
|
||||
public void Test__matchVariableStartToEnd(String expd_str, String... vals) {
|
||||
byte[] expd = Bry_.new_u8(expd_str);
|
||||
for (String val : vals) {
|
||||
byte[] actl = magic_word_ary.matchVariableStartToEnd(Bry_.new_u8(val));
|
||||
Gftest.Eq__bry(expd, actl, val);
|
||||
}
|
||||
public void Test__matchVariableStartToEnd(String src, String expd_name, String expd_val) {
|
||||
byte[][] rv = new byte[2][];
|
||||
magic_word_ary.matchVariableStartToEnd(rv, Bry_.new_u8(src));
|
||||
Gftest.Eq__str(expd_name, rv[0], expd_name);
|
||||
Gftest.Eq__str(expd_val , rv[1], expd_val);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import gplx.core.btries.*;
|
||||
import gplx.langs.htmls.*;
|
||||
import gplx.xowa.mws.htmls.*; import gplx.xowa.mws.linkers.*; import gplx.xowa.mws.parsers.*;
|
||||
import gplx.xowa.mws.filerepo.file.*; import gplx.xowa.mws.media.*;
|
||||
import gplx.xowa.mws.parsers.lnkis.*;
|
||||
import gplx.langs.phps.utls.*;
|
||||
/* TODO.XO
|
||||
* P8: wfMessage
|
||||
@ -92,7 +93,7 @@ public class Xomw_linker {
|
||||
// @param int|null width_option Used by the parser to remember the user preference thumbnailsize
|
||||
// @since 1.20
|
||||
// @return String HTML for an image, with links, wrappers, etc.
|
||||
public void Make_image_link(Bry_bfr bfr, Xomw_parser parser, Xoa_ttl title, Xomw_File file, Xomw_img_prms frame_params, Xomw_mda_prms handler_params, Object time, byte[] query, Object widthOption) {
|
||||
public void makeImageLink(Bry_bfr bfr, Xomw_parser parser, Xoa_ttl title, Xomw_File file, Xomw_params_frame frame_params, Xomw_params_handler handler_params, Object time, byte[] query, Object widthOption) {
|
||||
// XO.MW.HOOK:ImageBeforeProduceHTML
|
||||
|
||||
if (file != null && !file.allowInlineDisplay()) {
|
||||
@ -176,11 +177,12 @@ public class Xomw_linker {
|
||||
// If a thumbnail width has not been provided, it is set
|
||||
// to the default user option as specified in Language*.php
|
||||
if (frame_params.align == Bry_.Empty) {
|
||||
// frame_params.align = $parser->getTargetLanguage()->alignEnd();
|
||||
frame_params.align = parser.Env().Lang__align_end;
|
||||
}
|
||||
bfr.Add(prefix);
|
||||
this.Make_thumb_link2(bfr, title, file, frame_params, handler_params, time, query);
|
||||
bfr.Add(postfix);
|
||||
return;
|
||||
}
|
||||
|
||||
if (file != null && frame_params.frameless != null) {
|
||||
@ -197,7 +199,7 @@ public class Xomw_linker {
|
||||
if (file != null && handler_params.width != -1) {
|
||||
// Create a resized image, without the additional thumbnail features
|
||||
// $thumb = $file->transform(handler_params);
|
||||
thumb = new Xomw_mto(file.getUrl());
|
||||
thumb = new Xomw_mto(file.getUrl(), file.getWidth(), file.getHeight());
|
||||
}
|
||||
else {
|
||||
thumb = null;
|
||||
@ -216,7 +218,7 @@ public class Xomw_linker {
|
||||
params_list.valign = frame_params.valign;
|
||||
params_list.img_cls = frame_params.cls;
|
||||
if (frame_params.border != null) {
|
||||
params_list.img_cls = Xomw_img_prms.Cls_add(params_list.img_cls, Img_class__thumbborder);
|
||||
params_list.img_cls = Xomw_params_frame.Cls_add(params_list.img_cls, Img_class__thumbborder);
|
||||
}
|
||||
// $params = self::getImageLinkMTOParams(frame_params, $query, $parser) + $params;
|
||||
|
||||
@ -245,7 +247,7 @@ public class Xomw_linker {
|
||||
// @param Parser|null $parser
|
||||
// @return array
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-03
|
||||
public void Get_image_link_mto_params(Xomw_mto_params mto_params, Xomw_img_prms frame_params, byte[] query, Xomw_parser parser) {
|
||||
public void Get_image_link_mto_params(Xomw_mto_params mto_params, Xomw_params_frame frame_params, byte[] query, Xomw_parser parser) {
|
||||
if (Php_utl_.Is_set(frame_params.link_url) && frame_params.link_url != Bry_.Empty) {
|
||||
mto_params.custom_url_link = frame_params.link_url;
|
||||
if (Php_utl_.Is_set(frame_params.link_target)) {
|
||||
@ -271,8 +273,8 @@ public class Xomw_linker {
|
||||
}
|
||||
}
|
||||
|
||||
public void Make_thumb_link2(Bry_bfr bfr, Xoa_ttl title, Xomw_File file, Xomw_img_prms frame_params, Xomw_mda_prms handler_params, Object time, byte[] query) {
|
||||
boolean exists = false; // = $file && $file->exists();
|
||||
public void Make_thumb_link2(Bry_bfr bfr, Xoa_ttl title, Xomw_File file, Xomw_params_frame frame_params, Xomw_params_handler handler_params, Object time, byte[] query) {
|
||||
boolean exists = true; // = $file && $file->exists();
|
||||
|
||||
int page = handler_params.page;
|
||||
if (frame_params.align == null) {
|
||||
@ -317,7 +319,7 @@ public class Xomw_linker {
|
||||
else if (frame_params.framed != null) {
|
||||
// Use image dimensions, don't scale
|
||||
// thumb = $file->getUnscaledThumb(handler_params);
|
||||
thumb = new Xomw_mto(file.getUrl());
|
||||
thumb = new Xomw_mto(file.getUrl(), file.getWidth(), file.getHeight());
|
||||
no_scale = true;
|
||||
}
|
||||
else {
|
||||
@ -328,10 +330,11 @@ public class Xomw_linker {
|
||||
handler_params.width = src_width;
|
||||
}
|
||||
// thumb = $file->transform(handler_params);
|
||||
thumb = new Xomw_mto(file.getUrl(), file.getWidth(), file.getHeight());
|
||||
}
|
||||
|
||||
if (thumb != null) {
|
||||
// outer_width = thumb->getWidth() + 2;
|
||||
outer_width = thumb.getWidth() + 2;
|
||||
}
|
||||
else {
|
||||
outer_width = handler_params.width + 2;
|
||||
@ -373,7 +376,7 @@ public class Xomw_linker {
|
||||
mto_params.Clear();
|
||||
mto_params.alt = frame_params.alt;
|
||||
mto_params.title = frame_params.title;
|
||||
mto_params.img_cls = Xomw_img_prms.Cls_add(frame_params.cls, Img_class__thumbimage);
|
||||
mto_params.img_cls = Xomw_params_frame.Cls_add(frame_params.cls, Img_class__thumbimage);
|
||||
Get_image_link_mto_params(mto_params, frame_params, query, null);
|
||||
thumb.To_html(bfr, tmp, mto_params);
|
||||
if (frame_params.framed != null) {
|
||||
@ -388,7 +391,8 @@ public class Xomw_linker {
|
||||
, Bry_.Empty);
|
||||
// env.Message_mgr().Get_by_str("thumbnail-more").text();
|
||||
byte[] zoom_anch = tmp.To_bry_and_clear();
|
||||
html_utl.Raw_element(bfr, Gfh_tag_.Bry__div, tmp_attribs.Clear().Add(Gfh_atr_.Bry__class, Class__magnify), zoom_anch);
|
||||
html_utl.Raw_element(tmp, Gfh_tag_.Bry__div, tmp_attribs.Clear().Add(Gfh_atr_.Bry__class, Class__magnify), zoom_anch);
|
||||
zoom_icon = tmp.To_bry_and_clear();
|
||||
}
|
||||
}
|
||||
bfr.Add_str_a7(" <div class=\"thumbcaption\">").Add(zoom_icon).Add(frame_params.caption).Add_str_a7("</div></div></div>");
|
||||
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.mws.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.filerepo.*;
|
||||
import gplx.xowa.mws.media.*;
|
||||
import gplx.langs.phps.utls.*;
|
||||
import gplx.xowa.mws.parsers.*;
|
||||
/* TODO.XO:
|
||||
* P8: normalizeExtension
|
||||
* P8: normalizeTitle
|
||||
@ -442,9 +443,10 @@ public class Xomw_File {
|
||||
* @return int|boolean
|
||||
*/
|
||||
// @dflt: page = 1
|
||||
public int getWidth(int page) {
|
||||
@gplx.Virtual public int getWidth(int page) {
|
||||
return -1;
|
||||
}
|
||||
public int getWidth() {return this.getWidth(1);}
|
||||
|
||||
/**
|
||||
* Return the height of the image. Returns false if the height is unknown
|
||||
@ -460,6 +462,7 @@ public class Xomw_File {
|
||||
public int getHeight(int page) {
|
||||
return -1;
|
||||
}
|
||||
public int getHeight() {return this.getHeight(1);}
|
||||
|
||||
// /**
|
||||
// * Return the smallest bucket from wgThumbnailBuckets which is at least
|
||||
@ -680,18 +683,19 @@ public class Xomw_File {
|
||||
// public function getSize() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the MIME type of the file.
|
||||
// * Overridden by LocalFile, UnregisteredLocalFile
|
||||
// * STUB
|
||||
// *
|
||||
// * @return String
|
||||
// */
|
||||
// function getMimeType() {
|
||||
// return 'unknown/unknown';
|
||||
// }
|
||||
//
|
||||
|
||||
/**
|
||||
* Returns the MIME type of the file.
|
||||
* Overridden by LocalFile, UnregisteredLocalFile
|
||||
* STUB
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@gplx.Virtual public byte[] getMimeType() {
|
||||
return Mime_type__unknown;
|
||||
}
|
||||
private static final byte[] Mime_type__unknown = Bry_.new_a7("unknown/unknown");
|
||||
|
||||
// /**
|
||||
// * Return the type of the media in the file.
|
||||
// * Use the value returned by this function with the MEDIATYPE_xxx constants.
|
||||
@ -1347,9 +1351,9 @@ public class Xomw_File {
|
||||
* @return MediaHandler|boolean Registered MediaHandler for file's MIME type
|
||||
* or false if none found
|
||||
*/
|
||||
public Xomw_MediaHandler getHandler() {
|
||||
public Xomw_MediaHandler getHandler(Xomw_parser_env env) {
|
||||
if (this.handler == null) {
|
||||
// this.handler = MediaHandler::getHandler(this.getMimeType());
|
||||
this.handler = env.MediaHandlerFactory().getHandler(this.getMimeType());
|
||||
}
|
||||
|
||||
return this.handler;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,8 @@ public class Xomw_file_finder__mock implements Xomw_file_finder {
|
||||
public Xomw_File Find_file(Xoa_ttl ttl) {
|
||||
return (Xomw_File)hash.Get_by(ttl.Page_db_as_str());
|
||||
}
|
||||
public void Add(String title, Xomw_FileRepo repo, int w, int h) {
|
||||
Xomw_LocalFile file = new Xomw_LocalFile(Bry_.new_u8(title), repo, w, h);
|
||||
hash.Add(title, file);
|
||||
public void Add(String title, Xomw_FileRepo repo, int w, int h, byte[] mime) {
|
||||
Xomw_LocalFile file = new Xomw_LocalFile(Bry_.new_u8(title), repo, w, h, mime);
|
||||
hash.Add_if_dupe_use_nth(title, file);
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +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.mws.media; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
import gplx.xowa.mws.filerepo.file.*;
|
||||
public class Xomw_ImageHandler extends Xomw_MediaHandler { public Xomw_ImageHandler(byte[] key) {super(key);}
|
||||
import gplx.xowa.mws.filerepo.file.*; import gplx.xowa.mws.parsers.lnkis.*;
|
||||
// MEMORY:only one instance per wiki
|
||||
public class Xomw_ImageHandler extends Xomw_MediaHandler { private final Xomw_param_map paramMap = new Xomw_param_map();
|
||||
public Xomw_ImageHandler(byte[] key) {super(key);
|
||||
paramMap.Add(Xomw_param_itm.Mw__img_width, Xomw_param_map.Type__handler, Xomw_param_itm.Name_bry__width);
|
||||
}
|
||||
/**
|
||||
* @param File file
|
||||
* @return boolean
|
||||
@ -26,22 +30,24 @@ public class Xomw_ImageHandler extends Xomw_MediaHandler { public Xomw_ImageHand
|
||||
return (file.getWidth(1) != -1 && file.getHeight(1) != -1);
|
||||
}
|
||||
|
||||
// public function getParamMap() {
|
||||
// return [ 'img_width' => 'width' ];
|
||||
// }
|
||||
//
|
||||
// public function validateParam(name, value) {
|
||||
// if (in_array(name, [ 'width', 'height' ])) {
|
||||
// if (value <= 0) {
|
||||
// return false;
|
||||
// } else {
|
||||
// return true;
|
||||
// }
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
@Override public Xomw_param_map getParamMap() {
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
@Override public boolean validateParam(int name_uid, byte[] val_bry, int val_int) {
|
||||
if (name_uid == Xomw_param_itm.Name__width || name_uid == Xomw_param_itm.Name__height) {
|
||||
if (val_int <= 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// public function makeParamString(params) {
|
||||
// if (isset(params['physicalWidth'])) {
|
||||
// width = params['physicalWidth'];
|
||||
|
@ -17,7 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package gplx.xowa.mws.media; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
import gplx.xowa.mws.filerepo.file.*;
|
||||
public class Xomw_MediaHandler {
|
||||
import gplx.xowa.mws.parsers.lnkis.*;
|
||||
public abstract class Xomw_MediaHandler {
|
||||
public byte[] Key() {return key;} private byte[] key;
|
||||
public Xomw_MediaHandler(byte[] key) {
|
||||
this.key = key;
|
||||
@ -42,23 +43,23 @@ public class Xomw_MediaHandler {
|
||||
// return MediaWikiServices::getInstance()
|
||||
// ->getMediaHandlerFactory()->getHandler($type);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Get an associative array mapping magic word IDs to parameter names.
|
||||
// * Will be used by the parser to identify parameters.
|
||||
// */
|
||||
// abstract public function getParamMap();
|
||||
//
|
||||
// /**
|
||||
// * Validate a thumbnail parameter at parse time.
|
||||
// * Return true to accept the parameter, and false to reject it.
|
||||
// * If you return false, the parser will do something quiet and forgiving.
|
||||
// *
|
||||
// * @param String $name
|
||||
// * @param mixed $value
|
||||
// */
|
||||
// abstract public function validateParam($name, $value);
|
||||
//
|
||||
|
||||
/**
|
||||
* Get an associative array mapping magic word IDs to parameter names.
|
||||
* Will be used by the parser to identify parameters.
|
||||
*/
|
||||
public abstract Xomw_param_map getParamMap();
|
||||
|
||||
/**
|
||||
* Validate a thumbnail parameter at parse time.
|
||||
* Return true to accept the parameter, and false to reject it.
|
||||
* If you return false, the parser will do something quiet and forgiving.
|
||||
*
|
||||
* @param String $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public abstract boolean validateParam(int name_uid, byte[] val_bry, int val_int);
|
||||
|
||||
// /**
|
||||
// * Merge a parameter array into a String appropriate for inclusion in filenames
|
||||
// *
|
||||
|
@ -16,15 +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.mws.media; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
// XO.MW:MW has registry and instance cache; XO only has instance
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-05
|
||||
public class Xomw_MediaHandlerFactory {
|
||||
// /**
|
||||
// * Default, MediaWiki core media handlers
|
||||
// *
|
||||
// * @var array
|
||||
// */
|
||||
// private static $coreHandlers = [
|
||||
private final Hash_adp_bry handlers = Hash_adp_bry.cs();
|
||||
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-05
|
||||
public Xomw_MediaHandlerFactory() {
|
||||
// Default, MediaWiki core media handlers
|
||||
// 'image/jpeg' => JpegHandler::class,
|
||||
// 'image/png' => PNGHandler::class,
|
||||
handlers.Add(Mime__image__png, new Xomw_ImageHandler(Mime__image__png)); // PngHandler
|
||||
// 'image/gif' => GIFHandler::class,
|
||||
// 'image/tiff' => TiffHandler::class,
|
||||
// 'image/webp' => WebPHandler::class,
|
||||
@ -36,55 +37,27 @@ public class Xomw_MediaHandlerFactory {
|
||||
// 'image/vnd.djvu' => DjVuHandler::class, // official
|
||||
// 'image/x.djvu' => DjVuHandler::class, // compat
|
||||
// 'image/x-djvu' => DjVuHandler::class, // compat
|
||||
// ];
|
||||
//
|
||||
// /**
|
||||
// * @var array
|
||||
// */
|
||||
// private $registry;
|
||||
//
|
||||
// /**
|
||||
// * Instance cache of MediaHandler objects by mimetype
|
||||
// *
|
||||
// * @var MediaHandler[]
|
||||
// */
|
||||
// private $handlers;
|
||||
//
|
||||
// public function __construct( array $registry ) {
|
||||
// $this->registry = $registry + self::$coreHandlers;
|
||||
// }
|
||||
//
|
||||
// protected function getHandlerClass( $type ) {
|
||||
// if ( isset( $this->registry[$type] ) ) {
|
||||
// return $this->registry[$type];
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param String $type mimetype
|
||||
// * @return boolean|MediaHandler
|
||||
// */
|
||||
// public function getHandler( $type ) {
|
||||
// if ( isset( $this->handlers[$type] ) ) {
|
||||
// return $this->handlers[$type];
|
||||
// }
|
||||
//
|
||||
// $class = $this->getHandlerClass( $type );
|
||||
// if ( $class !== false ) {
|
||||
// /** @var MediaHandler $handler */
|
||||
// $handler = new $class;
|
||||
// if ( !$handler->isEnabled() ) {
|
||||
// wfDebug( __METHOD__ . ": $class is not enabled\n" );
|
||||
// $handler = false;
|
||||
// }
|
||||
// } else {
|
||||
// wfDebug( __METHOD__ . ": no handler found for $type.\n" );
|
||||
// $handler = false;
|
||||
// }
|
||||
//
|
||||
// $this->handlers[$type] = $handler;
|
||||
// return $handler;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// XO.MW:SYNC:1.29; DATE:2017-02-05
|
||||
public Xomw_MediaHandler getHandler(byte[] type) {
|
||||
return (Xomw_MediaHandler)handlers.Get_by(type);
|
||||
}
|
||||
|
||||
public static byte[]
|
||||
Mime__image__jpeg = Bry_.new_a7("image/jpeg")
|
||||
, Mime__image__png = Bry_.new_a7("image/png")
|
||||
, Mime__image__gif = Bry_.new_a7("image/gif")
|
||||
, Mime__image__tiff = Bry_.new_a7("image/tiff")
|
||||
, Mime__image__webp = Bry_.new_a7("image/webp")
|
||||
, Mime__image__x_ms_bmp = Bry_.new_a7("image/x-ms-bmp")
|
||||
, Mime__image__x_bmp = Bry_.new_a7("image/x-bmp")
|
||||
, Mime__image__x_xcf = Bry_.new_a7("image/x-xcf")
|
||||
, Mime__image__svg_xml = Bry_.new_a7("image/svg+xml")
|
||||
, Mime__image__svg = Bry_.new_a7("image/svg")
|
||||
, Mime__image__vnd_djvu = Bry_.new_a7("image/vnd.djvu")
|
||||
, Mime__image__x_djvu_dot = Bry_.new_a7("image/x.djvu")
|
||||
, Mime__image__x_djvu_dash = Bry_.new_a7("image/x-djvu")
|
||||
;
|
||||
}
|
||||
|
@ -22,8 +22,23 @@ public class Xomw_mto {
|
||||
private int width = -1, height = -1;
|
||||
public byte[] url;
|
||||
private final List_adp attribs = List_adp_.New(), link_attribs = List_adp_.New();
|
||||
public Xomw_mto(byte[] url) {
|
||||
public Xomw_mto(byte[] url, int width, int height) {
|
||||
this.url = url;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
/**
|
||||
* @return int Width of the output box
|
||||
*/
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Height of the output box
|
||||
*/
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
// Return HTML <img ... /> tag for the thumbnail, will include
|
||||
@ -87,7 +102,7 @@ public class Xomw_mto {
|
||||
// link_attribs.Add_many(Gfh_atr_.Bry__title, Php_utl_.Empty(options_title) ? title.Get_full_text() : options_title);
|
||||
}
|
||||
else if (!Php_utl_.Empty(options.desc_link)) {
|
||||
// link_attribs = $this->getDescLinkAttribs(
|
||||
// link_attribs = this.getDescLinkAttribs(
|
||||
// empty(options['title']) ? null : options['title'],
|
||||
// $query
|
||||
// );
|
||||
@ -122,7 +137,7 @@ public class Xomw_mto {
|
||||
|
||||
// Additional densities for responsive images, if specified.
|
||||
// If any of these urls is the same as src url, it'll be excluded.
|
||||
// $responsiveUrls = array_diff($this->responsiveUrls, [ $this->url ]);
|
||||
// $responsiveUrls = array_diff(this.responsiveUrls, [ this.url ]);
|
||||
// if (!Php_utl_.Empty($responsiveUrls)) {
|
||||
// $attribs['srcset'] = Html::srcSet($responsiveUrls);
|
||||
// }
|
||||
|
@ -16,8 +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.mws.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
import gplx.xowa.mws.parsers.lnkis.*;
|
||||
public class Xomw_parser_ctx {
|
||||
public Xoa_ttl Page_title() {return page_title;} private Xoa_ttl page_title;
|
||||
public Xomw_image_params Lnki_wkr__make_image__img_params = new Xomw_image_params();
|
||||
public byte[][] Lnki_wkr__make_image__match_magic_word = new byte[2][];
|
||||
public int[] Lnki_wkr__make_image__img_size = new int[2];
|
||||
|
||||
public void Init_by_page(Xoa_ttl page_title) {
|
||||
this.page_title = page_title;
|
||||
|
@ -16,11 +16,13 @@ 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.mws.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
import gplx.xowa.mws.filerepo.file.*;
|
||||
import gplx.xowa.mws.filerepo.file.*; import gplx.xowa.mws.media.*;
|
||||
public class Xomw_parser_env {
|
||||
public byte[] Lang__align_end = Bry_.new_a7("right");
|
||||
public Xomw_MagicWordMgr Magic_word_mgr() {return magic_word_mgr;} private final Xomw_MagicWordMgr magic_word_mgr = new Xomw_MagicWordMgr();
|
||||
public Xomw_message_mgr Message_mgr() {return message_mgr;} private final Xomw_message_mgr message_mgr = new Xomw_message_mgr();
|
||||
public Xomw_file_finder File_finder() {return file_finder;} private Xomw_file_finder file_finder = new Xomw_file_finder__noop();
|
||||
public Xomw_MediaHandlerFactory MediaHandlerFactory() {return mediaHandlerFactory;} private final Xomw_MediaHandlerFactory mediaHandlerFactory = new Xomw_MediaHandlerFactory();
|
||||
|
||||
public Xomw_parser_env File_finder_(Xomw_file_finder v) {file_finder = v; return this;}
|
||||
}
|
||||
|
@ -15,24 +15,8 @@ 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.mws.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
public class Xomw_prm_itm {
|
||||
public int type = 0;
|
||||
public int name_type = 1;
|
||||
public byte[] name = null;
|
||||
public byte[] val = null;
|
||||
|
||||
public static final int
|
||||
Type__handler = 0
|
||||
;
|
||||
public static final int
|
||||
Name__width = 0
|
||||
, Name__manual_thumb = 0
|
||||
, Name__alt = 1
|
||||
, Name__class = 2
|
||||
, Name__link = 3
|
||||
, Name__frameless = 4
|
||||
, Name__framed = 5
|
||||
, Name__thumbnail = 6
|
||||
;
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_image_params {
|
||||
public Xomw_param_map paramMap = null;
|
||||
public Xomw_MagicWordArray mwArray = null;
|
||||
}
|
@ -377,7 +377,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// cloak any absolute URLs inside the image markup, so replaceExternalLinks() won't touch them
|
||||
bfr.Add(prefix);
|
||||
// Armor_links(Make_image(bfr, nt, text, holders))
|
||||
Make_image(pctx, bfr, nt, text, holders);
|
||||
this.makeImage(pctx, bfr, nt, text, holders);
|
||||
bfr.Add(trail);
|
||||
continue;
|
||||
}
|
||||
@ -443,7 +443,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Make_image(Xomw_parser_ctx pctx, Bry_bfr bfr, Xoa_ttl title, byte[] link_args, Xomw_link_holders holders) {
|
||||
public void makeImage(Xomw_parser_ctx pctx, Bry_bfr bfr, Xoa_ttl title, byte[] options_at_link, Xomw_link_holders holders) {
|
||||
// Check if the options text is of the form "options|alt text"
|
||||
// Options are:
|
||||
// * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
|
||||
@ -471,78 +471,78 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// * text-bottom
|
||||
|
||||
// Protect LanguageConverter markup when splitting into parts
|
||||
byte[][] parts = Xomw_string_utils.Delimiter_explode(tmp_list, trv, link_args);
|
||||
byte[][] parts = Xomw_string_utils.Delimiter_explode(tmp_list, trv, options_at_link);
|
||||
|
||||
// Give extensions a chance to select the file revision for us
|
||||
// $options = [];
|
||||
byte[] desc_query = null;
|
||||
// MW.HOOK:BeforeParserFetchFileAndTitle
|
||||
// XO.MW.HOOK:BeforeParserFetchFileAndTitle
|
||||
|
||||
// Fetch and register the file (file title may be different via hooks)
|
||||
Xomw_File file = fetchFileAndTitle(title, null);
|
||||
// list($file, $title) = $this->fetchFileAndTitle($title, $options);
|
||||
Xomw_File file = fetchFileAndTitle(title, null);
|
||||
|
||||
// Get parameter map
|
||||
Xomw_MediaHandler handler2 = file == null ? null : file.getHandler();
|
||||
Xomw_MediaHandler handler = file == null ? null : file.getHandler(env);
|
||||
|
||||
Xomw_image_params tmp_img_params = new Xomw_image_params();
|
||||
this.getImageParams(tmp_img_params, handler2);
|
||||
Xomw_image_params tmp_img_params = pctx.Lnki_wkr__make_image__img_params;
|
||||
this.getImageParams(tmp_img_params, handler);
|
||||
Xomw_param_map paramMap = tmp_img_params.paramMap;
|
||||
Xomw_MagicWordArray mwArray = tmp_img_params.mwArray;
|
||||
|
||||
// XO.MW.UNSUPPORTED.TrackingCategory:
|
||||
//if (!$file) {
|
||||
// $this->addTrackingCategory('broken-file-category');
|
||||
//}
|
||||
// XO.MW.UNSUPPORTED.TrackingCategory: if (!$file) $this->addTrackingCategory('broken-file-category');
|
||||
|
||||
// Process the input parameters
|
||||
byte[] caption = Bry_.Empty;
|
||||
// XO.MW: $params = [ 'frame' => [], 'handler' => [], 'horizAlign' => [], 'vertAlign' => [] ];
|
||||
// Xomw_prm_mgr param_map = new Xomw_prm_mgr();
|
||||
// Xomw_prm_mgr param_mgr = new Xomw_prm_mgr();
|
||||
Xomw_img_prms frame = new Xomw_img_prms();
|
||||
Xomw_mda_prms handler = new Xomw_mda_prms();
|
||||
Xomw_params_frame frameParams = paramMap.Frame.Clear();
|
||||
Xomw_params_handler handlerParams = paramMap.Handler.Clear();
|
||||
// Xomw_params_horizAlign horizAlignParams = paramMap.HorizAlign.Clear();
|
||||
// Xomw_params_vertAlign vertAlignParams = paramMap.VertAlign.Clear();
|
||||
boolean seen_format = false;
|
||||
|
||||
int parts_len = parts.length;
|
||||
for (int i = 0; i < parts_len; i++) {
|
||||
|
||||
byte[] part = parts[i];
|
||||
part = Bry_.Trim(part);
|
||||
byte[] magic_name = mwArray.matchVariableStartToEnd(part);
|
||||
byte[][] tmp_match_word = pctx.Lnki_wkr__make_image__match_magic_word;
|
||||
mwArray.matchVariableStartToEnd(tmp_match_word, part);
|
||||
byte[] magic_name = tmp_match_word[0];
|
||||
byte[] val = tmp_match_word[1];
|
||||
boolean validated = false;
|
||||
|
||||
Xomw_param_itm prm_itm = paramMap.Get_by(magic_name);
|
||||
if (prm_itm != null) {
|
||||
int prm_type = -1;
|
||||
int paramNameType = prm_itm.name_type;
|
||||
Xomw_param_itm param_item = paramMap.Get_by(magic_name);
|
||||
if (param_item != null) {
|
||||
int typeUid = param_item.type_uid;
|
||||
int paramNameUid = param_item.name_uid;
|
||||
// Special case; width and height come in one variable together
|
||||
if (prm_type == Xomw_prm_itm.Type__handler && paramNameType == Xomw_prm_itm.Name__width) {
|
||||
// $parsedWidthParam = $this->parseWidthParam($value);
|
||||
// if (isset($parsedWidthParam['width'])) {
|
||||
// $width = $parsedWidthParam['width'];
|
||||
// if ($handler->validateParam('width', $width)) {
|
||||
// $params[$type]['width'] = $width;
|
||||
// validated = true;
|
||||
// }
|
||||
// }
|
||||
// if (isset($parsedWidthParam['height'])) {
|
||||
// $height = $parsedWidthParam['height'];
|
||||
// if ($handler->validateParam('height', $height)) {
|
||||
// $params[$type]['height'] = $height;
|
||||
// validated = true;
|
||||
// }
|
||||
// }
|
||||
if (typeUid == Xomw_param_map.Type__handler && paramNameUid == Xomw_param_itm.Name__width) {
|
||||
int[] tmp_img_size = pctx.Lnki_wkr__make_image__img_size;
|
||||
this.parseWidthParam(tmp_img_size, val);
|
||||
int parsedW = tmp_img_size[0];
|
||||
int parsedH = tmp_img_size[1];
|
||||
if (parsedW != 0) {
|
||||
if (handler.validateParam(Xomw_param_itm.Name__width, null, parsedW)) {
|
||||
paramMap.Set(typeUid, Xomw_param_itm.Name__width, null, parsedW);
|
||||
validated = true;
|
||||
}
|
||||
}
|
||||
if (parsedH != 0) {
|
||||
if (handler.validateParam(Xomw_param_itm.Name__height, null, parsedH)) {
|
||||
paramMap.Set(typeUid, Xomw_param_itm.Name__height, null, parsedH);
|
||||
validated = true;
|
||||
}
|
||||
}
|
||||
// else no validation -- T15436
|
||||
}
|
||||
else {
|
||||
if (prm_type == Xomw_prm_itm.Type__handler) {
|
||||
if (typeUid == Xomw_param_map.Type__handler) {
|
||||
// Validate handler parameter
|
||||
// validated = $handler->validateParam($paramName, $value);
|
||||
}
|
||||
else {
|
||||
// Validate @gplx.Internal protected parameters
|
||||
switch (paramNameType) {
|
||||
switch (paramNameUid) {
|
||||
case Xomw_param_itm.Name__manual_thumb:
|
||||
case Xomw_param_itm.Name__alt:
|
||||
case Xomw_param_itm.Name__class:
|
||||
@ -586,17 +586,16 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// use first appearing option, discard others.
|
||||
validated = !seen_format;
|
||||
seen_format = true;
|
||||
frame.thumbnail = Bry_.Empty;
|
||||
break;
|
||||
default:
|
||||
// Most other things appear to be empty or numeric...
|
||||
// validated = ($value === false || is_numeric(trim($value)));
|
||||
validated = (val == null || Php_utl_.isnumeric(Bry_.Trim(val)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validated) {
|
||||
// $params[$type][$paramName] = $value;
|
||||
paramMap.Set(typeUid, paramNameUid, val, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!validated) {
|
||||
@ -605,22 +604,22 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
}
|
||||
|
||||
// Process alignment parameters
|
||||
Xomw_param_itm tmp = paramMap.Get_by(Xomw_prm_mgr.Name__horiz_align);
|
||||
Xomw_param_itm tmp = paramMap.Get_by(Xomw_param_map.Type__horizAlign);
|
||||
if (tmp != null) {
|
||||
// frame.align = tmp.val;
|
||||
// frameParams.align = tmp.val;
|
||||
}
|
||||
tmp = paramMap.Get_by(Xomw_prm_mgr.Name__vert_align);
|
||||
tmp = paramMap.Get_by(Xomw_param_map.Type__vertAlign);
|
||||
if (tmp != null) {
|
||||
// frame.valign = tmp.val;
|
||||
// frameParams.valign = tmp.val;
|
||||
}
|
||||
|
||||
frame.caption = caption;
|
||||
frameParams.caption = caption;
|
||||
|
||||
boolean image_is_framed
|
||||
= frame.frame != null
|
||||
|| frame.framed != null
|
||||
|| frame.thumbnail != null
|
||||
|| frame.manual_thumb != null
|
||||
= frameParams.frame != null
|
||||
|| frameParams.framed != null
|
||||
|| frameParams.thumbnail != null
|
||||
|| frameParams.manual_thumb != null
|
||||
;
|
||||
|
||||
// Will the image be presented in a frame, with the caption below?
|
||||
@ -639,28 +638,28 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// plicit caption= parameter and preserving the old magic unnamed para-
|
||||
// meter for BC; ...
|
||||
if (image_is_framed) { // Framed image
|
||||
if (caption == Bry_.Empty && frame.alt == null) {
|
||||
if (caption == Bry_.Empty && frameParams.alt == null) {
|
||||
// No caption or alt text, add the filename as the alt text so
|
||||
// that screen readers at least get some description of the image
|
||||
frame.alt = title.Get_text();
|
||||
frameParams.alt = title.Get_text();
|
||||
}
|
||||
// Do not set $params['frame']['title'] because tooltips don't make sense
|
||||
// for framed images
|
||||
}
|
||||
else { // Inline image
|
||||
if (frame.alt == null) {
|
||||
if (frameParams.alt == null) {
|
||||
// No alt text, use the "caption" for the alt text
|
||||
if (caption != Bry_.Empty) {
|
||||
// frame.alt = $this->stripAltText(caption, $holders);
|
||||
// frameParams.alt = $this->stripAltText(caption, $holders);
|
||||
}
|
||||
else {
|
||||
// No caption, fall back to using the filename for the
|
||||
// alt text
|
||||
frame.alt = title.Get_text();
|
||||
frameParams.alt = title.Get_text();
|
||||
}
|
||||
}
|
||||
// Use the "caption" for the tooltip text
|
||||
// frame.title = $this->stripAltText(caption, $holders);
|
||||
// frameParams.title = $this->stripAltText(caption, $holders);
|
||||
}
|
||||
|
||||
// MW.HOOK:ParserMakeImageParams
|
||||
@ -669,7 +668,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// byte[] time = options.time;
|
||||
Object time = null;
|
||||
// options = $this->mOptions->getThumbSize()
|
||||
linker.Make_image_link(bfr, parser, title, file, frame, handler, time, desc_query, null);
|
||||
linker.makeImageLink(bfr, parser, title, file, frameParams, handlerParams, time, desc_query, null);
|
||||
|
||||
// Give the handler a chance to modify the parser Object
|
||||
// if (handler != null) {
|
||||
@ -697,25 +696,26 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
|
||||
private static Xomw_param_list[] internalParamNames;
|
||||
private static Xomw_param_map internalParamMap;
|
||||
|
||||
private void getImageParams(Xomw_image_params rv, Xomw_MediaHandler handler) {
|
||||
byte[] handlerClass = handler == null ? Bry_.Empty : handler.Key();
|
||||
rv.paramMap = (Xomw_param_map)mImageParams.Get_by(handlerClass);
|
||||
// NOTE: lazy-init; code below can be inefficent
|
||||
if (rv.paramMap == null) {
|
||||
// Initialise static lists
|
||||
if (internalParamNames == null) {
|
||||
internalParamNames = new Xomw_param_list[]
|
||||
{ Xomw_param_list.New("horizAlign", "left", "right", "center", "none")
|
||||
, Xomw_param_list.New("vertAlign", "baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom")
|
||||
, Xomw_param_list.New("frame", "thumbnail", "manual_thumb", "framed", "frameless", "upright", "border", "link", "alt", "class")
|
||||
{ Xomw_param_list.New(Xomw_param_map.Type__horizAlign, "horizAlign", "left", "right", "center", "none")
|
||||
, Xomw_param_list.New(Xomw_param_map.Type__vertAlign , "vertAlign", "baseline", "sub", "super", "top", "text-top", "middle", "bottom", "text-bottom")
|
||||
, Xomw_param_list.New(Xomw_param_map.Type__frame , "frame", "thumbnail", "manual_thumb", "framed", "frameless", "upright", "border", "link", "alt", "class")
|
||||
};
|
||||
|
||||
internalParamMap = new Xomw_param_map();
|
||||
byte[] bry_img = Bry_.new_a7("img_");
|
||||
for (Xomw_param_list param_list : internalParamNames) {
|
||||
byte[] type = param_list.type;
|
||||
for (byte[] name : param_list.names) {
|
||||
byte[] magic_name = Bry_.Add(bry_img, Bry_.Replace(name, Byte_ascii.Dash, Byte_ascii.Underline));
|
||||
internalParamMap.Add(magic_name, type, name);
|
||||
internalParamMap.Add(magic_name, param_list.type_uid, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -723,10 +723,12 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// Add handler params
|
||||
Xomw_param_map paramMap = internalParamMap.Clone();
|
||||
if (handler != null) {
|
||||
// $handlerParamMap = $handler->getParamMap();
|
||||
// foreach ($handlerParamMap as $magic => $paramName) {
|
||||
// $paramMap[$magic] = [ 'handler', $paramName ];
|
||||
// }
|
||||
Xomw_param_map handlerParamMap = handler.getParamMap();
|
||||
int handlerParamMapLen = handlerParamMap.Len();
|
||||
for (int i = 0; i < handlerParamMapLen; i++) {
|
||||
Xomw_param_itm itm = (Xomw_param_itm)handlerParamMap.Get_at(i);
|
||||
paramMap.Add(itm.magic, itm.type_uid, itm.name);
|
||||
}
|
||||
}
|
||||
this.mImageParams.Add(handlerClass, paramMap);
|
||||
rv.paramMap = paramMap;
|
||||
@ -738,6 +740,35 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
rv.mwArray = (Xomw_MagicWordArray)mImageParamsMagicArray.Get_by(handlerClass);
|
||||
}
|
||||
}
|
||||
// Parsed a width param of imagelink like 300px or 200x300px
|
||||
// XO.MW.NOTE: for MW, "" -> null, null while "AxB" -> 0x0
|
||||
public void parseWidthParam(int[] img_size, byte[] src) {
|
||||
img_size[0] = img_size[1] = -1;
|
||||
if (src == Bry_.Empty) {
|
||||
return;
|
||||
}
|
||||
// (T15500) In both cases (width/height and width only),
|
||||
// permit trailing "px" for backward compatibility.
|
||||
int src_bgn = 0;
|
||||
int src_end = src.length;
|
||||
// XO: "px" is optional; if exists at end, ignore it
|
||||
if (Bry_.Has_at_end(src, Bry__px)) {
|
||||
src_end -= 2;
|
||||
}
|
||||
|
||||
// XO.MW: if ( preg_match( '/^([0-9]*)x([0-9]*)\s*(?:px)?\s*$/', $value, $m ) ) {
|
||||
int w_bgn = 0;
|
||||
int w_end = Bry_find_.Find_fwd_while_num(src, src_bgn, src_end);
|
||||
int h_bgn = -1;
|
||||
int h_end = -1;
|
||||
if (w_end < src_end && src[w_end] == Byte_ascii.Ltr_x) {
|
||||
h_bgn = w_end + 1;
|
||||
h_end = Bry_find_.Find_fwd_while_num(src, h_bgn, src_end);
|
||||
}
|
||||
img_size[0] = Bry_.To_int_or(src, w_bgn, w_end, 0);
|
||||
img_size[1] = Bry_.To_int_or(src, h_bgn, h_end, 0);
|
||||
}
|
||||
private static final byte[] Bry__px = Bry_.new_a7("px");
|
||||
|
||||
/**
|
||||
* Fetch a file and its title and register a reference to it.
|
||||
@ -826,7 +857,3 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
|
||||
// pipe -> \\|
|
||||
// other chars... -> (.*)
|
||||
}
|
||||
class Xomw_image_params {
|
||||
public Xomw_param_map paramMap = null;
|
||||
public Xomw_MagicWordArray mwArray = null;
|
||||
}
|
||||
|
@ -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.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
import org.junit.*;
|
||||
import org.junit.*; import gplx.core.tests.*; import gplx.xowa.mws.filerepo.*; import gplx.xowa.mws.filerepo.file.*;
|
||||
public class Xomw_lnki_wkr__file__tst {
|
||||
private final Xomw_lnki_wkr__fxt fxt = new Xomw_lnki_wkr__fxt();
|
||||
@Before public void init() {
|
||||
@ -27,6 +27,72 @@ public class Xomw_lnki_wkr__file__tst {
|
||||
fxt.Test__to_html("[[File:A.png]]", "<img alt='A.png' src='/orig/7/70/A.png' />");
|
||||
}
|
||||
@Test public void Thumb() {
|
||||
fxt.Test__to_html("[[File:A.png|thumb]]", "<div class='thumb t'><div class='thumbinner' style='width:2px;'> <div class='thumbcaption'></div></div></div><img alt='A.png' src='/orig/7/70/A.png' />");
|
||||
fxt.Test__to_html("[[File:A.png|thumb]]", "<div class='thumb tright'><div class='thumbinner' style='width:302px;'><a><img alt='A.png' src='/orig/7/70/A.png' class='thumbimage' /></a> <div class='thumbcaption'><div class='magnify'><a href='' class='internal'></a></div></div></div></div>");
|
||||
}
|
||||
@Test public void Size() {
|
||||
fxt.Test__to_html("[[File:A.png|123x456px]]", "<img alt='A.png' src='/orig/7/70/A.png' />");
|
||||
}
|
||||
@Test public void Test__parseWidthParam() {
|
||||
int[] img_size = new int[2];
|
||||
// WxHpx
|
||||
fxt.Test__parseWidthParam(img_size, "12x34px" , 12, 34);
|
||||
// WxH
|
||||
fxt.Test__parseWidthParam(img_size, "12x34" , 12, 34);
|
||||
// Wpx
|
||||
fxt.Test__parseWidthParam(img_size, "12px" , 12, 0);
|
||||
// W
|
||||
fxt.Test__parseWidthParam(img_size, "12" , 12, 0);
|
||||
// 12x
|
||||
fxt.Test__parseWidthParam(img_size, "12x" , 12, 0);
|
||||
// x34
|
||||
fxt.Test__parseWidthParam(img_size, "x34" , 0, 34);
|
||||
}
|
||||
}
|
||||
class Xomw_lnki_wkr__fxt {
|
||||
private final Xomw_lnki_wkr wkr;
|
||||
private final Xomw_parser_ctx pctx;
|
||||
private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr();
|
||||
private final Xomw_file_finder__mock file_finder = new Xomw_file_finder__mock();
|
||||
private final Xomw_FileRepo repo = new Xomw_FileRepo(Bry_.new_a7("/orig"), Bry_.new_a7("/thumb"));
|
||||
private boolean apos = true;
|
||||
public Xomw_lnki_wkr__fxt() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xomw_parser parser = new Xomw_parser();
|
||||
wkr = parser.Lnki_wkr();
|
||||
|
||||
// env
|
||||
parser.Env().File_finder_(file_finder);
|
||||
parser.Env().Magic_word_mgr().Add(Bry_.new_u8("img_thumbnail"), Bool_.Y, Bry_.Ary("thumb"));
|
||||
parser.Env().Magic_word_mgr().Add(Bry_.new_u8("img_width"), Bool_.Y, Bry_.Ary("$1px"));
|
||||
parser.Init_by_wiki(wiki);
|
||||
|
||||
// ctx
|
||||
pctx = new Xomw_parser_ctx();
|
||||
pctx.Init_by_page(wiki.Ttl_parse(Bry_.new_a7("Page_1")));
|
||||
}
|
||||
public void Clear() {
|
||||
wkr.Clear_state();
|
||||
}
|
||||
public void Init__file(String title, int w, int h) {
|
||||
file_finder.Add(title, repo, w, h, gplx.xowa.files.Xof_ext_.Mime_type__ary[gplx.xowa.files.Xof_ext_.Id_png]);
|
||||
}
|
||||
public void Test__parse(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
wkr.Replace_internal_links(pctx, pbfr.Init(src_bry));
|
||||
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);
|
||||
Gftest.Eq__ary__lines(expd, pbfr.Rslt().To_str_and_clear(), src_str);
|
||||
}
|
||||
public void Test__to_html(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
wkr.Replace_internal_links(pctx, pbfr.Init(src_bry));
|
||||
wkr.Replace_link_holders(pctx, pbfr);
|
||||
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);
|
||||
Gftest.Eq__ary__lines(expd, pbfr.Rslt().To_str_and_clear(), src_str);
|
||||
}
|
||||
public void Test__parseWidthParam(int[] img_size, String src_str, int expd_w, int expd_h) {
|
||||
wkr.parseWidthParam(img_size, Bry_.new_u8(src_str));
|
||||
Gftest.Eq__int(expd_w, img_size[0], "w");
|
||||
Gftest.Eq__int(expd_h, img_size[1], "h");
|
||||
}
|
||||
}
|
||||
|
@ -27,45 +27,3 @@ public class Xomw_lnki_wkr__text__tst {
|
||||
@Test public void Html__text() {fxt.Test__to_html("[[A]]" , "<a href='/wiki/A' title='A'>A</a>");}
|
||||
@Test public void Html__capt() {fxt.Test__to_html("[[A|a]]" , "<a href='/wiki/A' title='A'>a</a>");}
|
||||
}
|
||||
class Xomw_lnki_wkr__fxt {
|
||||
private final Xomw_lnki_wkr wkr;
|
||||
private final Xomw_parser_ctx pctx;
|
||||
private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr();
|
||||
private final Xomw_file_finder__mock file_finder = new Xomw_file_finder__mock();
|
||||
private final Xomw_FileRepo repo = new Xomw_FileRepo(Bry_.new_a7("/orig"), Bry_.new_a7("/thumb"));
|
||||
private boolean apos = true;
|
||||
public Xomw_lnki_wkr__fxt() {
|
||||
Xoae_app app = Xoa_app_fxt.Make__app__edit();
|
||||
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
|
||||
Xomw_parser parser = new Xomw_parser();
|
||||
wkr = parser.Lnki_wkr();
|
||||
|
||||
// env
|
||||
parser.Env().File_finder_(file_finder);
|
||||
parser.Env().Magic_word_mgr().Add(Bry_.new_u8("img_thumbnail"), Bool_.Y, Bry_.Ary("thumb"));
|
||||
parser.Init_by_wiki(wiki);
|
||||
|
||||
// ctx
|
||||
pctx = new Xomw_parser_ctx();
|
||||
pctx.Init_by_page(wiki.Ttl_parse(Bry_.new_a7("Page_1")));
|
||||
}
|
||||
public void Clear() {
|
||||
wkr.Clear_state();
|
||||
}
|
||||
public void Init__file(String title, int w, int h) {
|
||||
file_finder.Add(title, repo, w, h);
|
||||
}
|
||||
public void Test__parse(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
wkr.Replace_internal_links(pctx, pbfr.Init(src_bry));
|
||||
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);
|
||||
Tfds.Eq_str_lines(expd, pbfr.Rslt().To_str_and_clear(), src_str);
|
||||
}
|
||||
public void Test__to_html(String src_str, String expd) {
|
||||
byte[] src_bry = Bry_.new_u8(src_str);
|
||||
wkr.Replace_internal_links(pctx, pbfr.Init(src_bry));
|
||||
wkr.Replace_link_holders(pctx, pbfr);
|
||||
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);
|
||||
Tfds.Eq_str_lines(expd, pbfr.Rslt().To_str_and_clear(), src_str);
|
||||
}
|
||||
}
|
||||
|
@ -18,25 +18,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_param_itm {
|
||||
public final byte[] magic;
|
||||
public final byte[] type;
|
||||
public final int type_uid;
|
||||
public final byte[] name;
|
||||
public final int name_type;
|
||||
public Xomw_param_itm(byte[] magic, byte[] type, byte[] name) {
|
||||
public final int name_uid;
|
||||
public Xomw_param_itm(byte[] magic, int type_uid, byte[] name) {
|
||||
this.magic = magic;
|
||||
this.type = type;
|
||||
this.type_uid = type_uid;
|
||||
this.name = name;
|
||||
this.name_type = name_types.Get_as_int_or(name, -1);
|
||||
this.name_uid = name_uids.Get_as_int_or(name, -1);
|
||||
}
|
||||
public static final int
|
||||
Name__width = 0
|
||||
, Name__manual_thumb = 1
|
||||
, Name__alt = 2
|
||||
, Name__class = 3
|
||||
, Name__link = 4
|
||||
, Name__frameless = 5
|
||||
, Name__framed = 6
|
||||
, Name__thumbnail = 7
|
||||
, Name__height = 1
|
||||
, Name__manual_thumb = 2
|
||||
, Name__alt = 3
|
||||
, Name__class = 4
|
||||
, Name__link = 5
|
||||
, Name__frameless = 6
|
||||
, Name__framed = 7
|
||||
, Name__thumbnail = 8
|
||||
;
|
||||
private static final Hash_adp_bry name_uids = Hash_adp_bry.cs()
|
||||
.Add_str_int("width" , Name__width)
|
||||
.Add_str_int("manual_thumb" , Name__manual_thumb)
|
||||
.Add_str_int("alt" , Name__alt)
|
||||
.Add_str_int("class" , Name__class)
|
||||
.Add_str_int("link" , Name__link)
|
||||
.Add_str_int("frameless" , Name__frameless)
|
||||
.Add_str_int("framed" , Name__framed)
|
||||
.Add_str_int("thumbnail" , Name__thumbnail)
|
||||
;
|
||||
public static final byte[]
|
||||
Mw__img_width = Bry_.new_a7("img_width")
|
||||
;
|
||||
public static final byte[]
|
||||
Name_bry__width = Bry_.new_a7("width")
|
||||
;
|
||||
private static final Hash_adp_bry name_types = Hash_adp_bry.cs()
|
||||
.Add_str_int("thumbnail", Name__thumbnail);
|
||||
}
|
||||
|
@ -18,12 +18,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_param_map {
|
||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||
public final Xomw_params_frame Frame = new Xomw_params_frame();
|
||||
public final Xomw_params_handler Handler = new Xomw_params_handler();
|
||||
public final Xomw_params_horizAlign HorizAlign = new Xomw_params_horizAlign();
|
||||
public final Xomw_params_vertAlign VertAlign = new Xomw_params_vertAlign();
|
||||
public int Len() {return hash.Len();}
|
||||
public Xomw_param_itm Get_at(int i) {return (Xomw_param_itm)hash.Get_at(i);}
|
||||
public Xomw_param_itm Get_by(byte[] name) {
|
||||
return (Xomw_param_itm)hash.Get_by(name);
|
||||
}
|
||||
public Xomw_param_itm Get_by(int name_type) {
|
||||
return null;
|
||||
}
|
||||
public void Set(int type, int paramNameUid, byte[] paramBry, int paramInt) {
|
||||
switch (type) {
|
||||
case Type__frame: Frame.Set(paramNameUid, paramBry, paramInt); break;
|
||||
case Type__handler: Handler.Set(paramNameUid, paramBry, paramInt); break;
|
||||
}
|
||||
}
|
||||
public byte[][] Keys() {
|
||||
int len = hash.Len();
|
||||
byte[][] rv = new byte[len][];
|
||||
@ -32,8 +44,8 @@ public class Xomw_param_map {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public void Add(byte[] magic, byte[] type, byte[] name) {
|
||||
Xomw_param_itm itm = new Xomw_param_itm(magic, type, name);
|
||||
public void Add(byte[] magic, int type_uid, byte[] name) {
|
||||
Xomw_param_itm itm = new Xomw_param_itm(magic, type_uid, name);
|
||||
hash.Add(magic, itm);
|
||||
}
|
||||
public Xomw_param_map Clone() {
|
||||
@ -41,17 +53,23 @@ public class Xomw_param_map {
|
||||
int len = hash.Len();
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xomw_param_itm itm = (Xomw_param_itm)hash.Get_at(i);
|
||||
rv.Add(itm.magic, itm.type, itm.name);
|
||||
rv.Add(itm.magic, itm.type_uid, itm.name);
|
||||
}
|
||||
rv.Frame.Copy_to(this.Frame);
|
||||
rv.Handler.Copy_to(this.Handler);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static final int Type__horizAlign = 0, Type__vertAlign = 1, Type__frame = 2, Type__handler = 3;
|
||||
}
|
||||
class Xomw_param_list {
|
||||
public int type_uid;
|
||||
public byte[] type;
|
||||
public byte[][] names;
|
||||
|
||||
public static Xomw_param_list New(String type, String... names) {
|
||||
public static Xomw_param_list New(int type_uid, String type, String... names) {
|
||||
Xomw_param_list rv = new Xomw_param_list();
|
||||
rv.type_uid = type_uid;
|
||||
rv.type = Bry_.new_u8(type);
|
||||
rv.names = Bry_.Ary(names);
|
||||
return rv;
|
||||
|
@ -15,8 +15,8 @@ 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.mws.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
public class Xomw_img_prms {
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_params_frame {
|
||||
public byte[] align = null;
|
||||
public byte[] valign = null;
|
||||
public byte[] caption = null;
|
||||
@ -35,11 +35,37 @@ public class Xomw_img_prms {
|
||||
public byte[] no_link = null;
|
||||
public byte[] border = null;
|
||||
public double upright = -1;
|
||||
public void Clear() {
|
||||
public void Set(int uid, byte[] val_bry, int val_int) {
|
||||
switch (uid) {
|
||||
case Xomw_param_itm.Name__thumbnail: thumbnail = val_bry; break;
|
||||
}
|
||||
}
|
||||
public Xomw_params_frame Clear() {
|
||||
align = valign = caption = frame = framed = frameless
|
||||
= thumbnail = manual_thumb = alt = title = cls = img_cls
|
||||
= link_title = link_url = link_target = no_link = null;
|
||||
upright = -1;
|
||||
return this;
|
||||
}
|
||||
public void Copy_to(Xomw_params_frame src) {
|
||||
this.align = src.align;
|
||||
this.valign = src.valign;
|
||||
this.caption = src.caption;
|
||||
this.frame = src.frame;
|
||||
this.framed = src.framed;
|
||||
this.frameless = src.frameless;
|
||||
this.thumbnail = src.thumbnail;
|
||||
this.manual_thumb = src.manual_thumb;
|
||||
this.alt = src.alt;
|
||||
this.title = src.title;
|
||||
this.cls = src.cls;
|
||||
this.img_cls = src.img_cls;
|
||||
this.link_title = src.link_title;
|
||||
this.link_url = src.link_url;
|
||||
this.link_target = src.link_target;
|
||||
this.no_link = src.no_link;
|
||||
this.border = src.border;
|
||||
this.upright = src.upright;
|
||||
}
|
||||
public static byte[] Cls_add(byte[] lhs, byte[] rhs) {
|
||||
return Bry_.Len_eq_0(lhs) ? rhs : Bry_.Add(lhs, Byte_ascii.Space_bry, rhs);
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
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.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_params_handler {
|
||||
public int width = -1;
|
||||
public int height = -1;
|
||||
public int page = -1;
|
||||
public Xomw_params_handler Clear() {
|
||||
width = height = page = -1;
|
||||
return this;
|
||||
}
|
||||
public void Copy_to(Xomw_params_handler src) {
|
||||
this.width = src.width;
|
||||
this.height = src.height;
|
||||
this.page = src.page;
|
||||
}
|
||||
public void Set(int uid, byte[] val_bry, int val_int) {
|
||||
switch (uid) {
|
||||
case Xomw_param_itm.Name__width: width = val_int; break;
|
||||
case Xomw_param_itm.Name__height: height = val_int; break;
|
||||
default: throw Err_.new_unhandled_default(uid);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,9 +15,9 @@ 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.mws.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
public class Xomw_mda_prms {
|
||||
public int width = -1;
|
||||
public int height = -1;
|
||||
public int page = -1;
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_params_horizAlign {
|
||||
public Xomw_params_horizAlign Clear() {
|
||||
return this;
|
||||
}
|
||||
}
|
@ -15,16 +15,9 @@ 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.mws.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*;
|
||||
public class Xomw_prm_mgr {
|
||||
public Xomw_prm_itm Get_or_null(int name_type) {
|
||||
return null;
|
||||
package gplx.xowa.mws.parsers.lnkis; import gplx.*; import gplx.xowa.*; import gplx.xowa.mws.*; import gplx.xowa.mws.parsers.*;
|
||||
public class Xomw_params_vertAlign {
|
||||
public Xomw_params_vertAlign Clear() {
|
||||
return this;
|
||||
}
|
||||
public Xomw_prm_itm Get_or_null(byte[] key) {
|
||||
return null;
|
||||
}
|
||||
public static final int
|
||||
Name__horiz_align = 0
|
||||
, Name__vert_align = 1
|
||||
;
|
||||
}
|
Loading…
Reference in New Issue
Block a user