1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2025-06-07 09:54:13 +00:00

Xomw: Convert Xoa_ttl to Xomw_Title

This commit is contained in:
gnosygnu 2017-02-11 09:55:27 -05:00
parent 8bc1a37531
commit 451c504166
17 changed files with 157 additions and 162 deletions

View File

@ -798,16 +798,16 @@ public class Xomw_Title {
return this.mInterwiki != Bry_.Empty; return this.mInterwiki != Bry_.Empty;
} }
// /** /**
// * Get the interwiki prefix * Get the interwiki prefix
// * *
// * Use Title::isExternal to check if a interwiki is set * Use Title::isExternal to check if a interwiki is set
// * *
// * @return String Interwiki prefix * @return String Interwiki prefix
// */ */
// public function getInterwiki() { public byte[] getInterwiki() {
// return this.mInterwiki; return this.mInterwiki;
// } }
/** /**
* Was this a local interwiki link? * Was this a local interwiki link?
@ -889,16 +889,16 @@ public class Xomw_Title {
// public function getPartialURL() { // public function getPartialURL() {
// return this.mUrlform; // return this.mUrlform;
// } // }
//
// /** /**
// * Get the main part with underscores * Get the main part with underscores
// * *
// * @return String Main part of the title, with underscores * @return String Main part of the title, with underscores
// */ */
// public function getDBkey() { public byte[] getDBkey() {
// return this.mDbkeyform; return this.mDbkeyform;
// } }
//
// /** // /**
// * Get the DB key with the initial letter case as specified by the user // * Get the DB key with the initial letter case as specified by the user
// * // *
@ -912,16 +912,16 @@ public class Xomw_Title {
// return this.mDbkeyform; // return this.mDbkeyform;
// } // }
// } // }
//
// /** /**
// * Get the namespace index, i.e. one of the NS_xxxx constants. * Get the namespace index, i.e. one of the NS_xxxx constants.
// * *
// * @return int Namespace index * @return int Namespace index
// */ */
// public function getNamespace() { public int getNamespace() {
// return this.mNamespace; return this.mNamespace;
// } }
//
// /** // /**
// * Get the page's content model id, see the CONTENT_MODEL_XXX constants. // * Get the page's content model id, see the CONTENT_MODEL_XXX constants.
// * // *
@ -1391,22 +1391,23 @@ public class Xomw_Title {
// public function setFragment($fragment) { // public function setFragment($fragment) {
// this.mFragment = strtr(substr($fragment, 1), '_', ' '); // this.mFragment = strtr(substr($fragment, 1), '_', ' ');
// } // }
//
// /** /**
// * Creates a new Title for a different fragment of the same page. * Creates a new Title for a different fragment of the same page.
// * *
// * @since 1.27 * @since 1.27
// * @param String $fragment * @param String $fragment
// * @return Title * @return Title
// */ */
// public function createFragmentTarget($fragment) { public Xomw_Title createFragmentTarget(byte[] fragment) {
return null;
// return self::makeTitle( // return self::makeTitle(
// this.getNamespace(), // this.getNamespace(),
// this.getText(), // this.getText(),
// $fragment, // $fragment,
// this.getInterwiki() // this.getInterwiki()
// ); // );
// } }
/** /**
* Prefix some arbitrary text with the namespace or interwiki prefix * Prefix some arbitrary text with the namespace or interwiki prefix
@ -1808,7 +1809,7 @@ public class Xomw_Title {
// $ret = this.getLocalURL($query, $query2) . this.getFragmentForURL(); // $ret = this.getLocalURL($query, $query2) . this.getFragmentForURL();
// } // }
// return $ret; // return $ret;
return Bry_.Add(gplx.xowa.htmls.hrefs.Xoh_href_.Bry__wiki, this.mPrefixedText); return Bry_.Add(gplx.xowa.htmls.hrefs.Xoh_href_.Bry__wiki, this.getPrefixedText());
} }
// /** // /**
@ -4219,20 +4220,20 @@ public class Xomw_Title {
// $authors = this.getAuthorsBetween($old, $new, $limit, $options); // $authors = this.getAuthorsBetween($old, $new, $limit, $options);
// return $authors ? count($authors) : 0; // return $authors ? count($authors) : 0;
// } // }
//
// /** /**
// * Compare with another title. * Compare with another title.
// * *
// * @param Title $title * @param Title $title
// * @return boolean * @return boolean
// */ */
// public function equals(Title $title) { public boolean equals(Xomw_Title title) {
// // Note: == is necessary for proper matching of number-like titles. // Note: == is necessary for proper matching of number-like titles.
// return this.getInterwiki() == $title.getInterwiki() return Bry_.Eq(this.getInterwiki(), title.getInterwiki())
// && this.getNamespace() == $title.getNamespace() && this.getNamespace() == title.getNamespace()
// && this.getDBkey() == $title.getDBkey(); && Bry_.Eq(this.getDBkey(), title.getDBkey());
// } }
//
// /** // /**
// * Check if this title is a subpage of another title // * Check if this title is a subpage of another title
// * // *
@ -4320,22 +4321,23 @@ public class Xomw_Title {
// } // }
return false; return false;
} }
//
// /** /**
// * Does this title refer to a page that can (or might) be meaningfully * Does this title refer to a page that can (or might) be meaningfully
// * viewed? In particular, this function may be used to determine if * viewed? In particular, this function may be used to determine if
// * links to the title should be rendered as "bluelinks" (as opposed to * links to the title should be rendered as "bluelinks" (as opposed to
// * "redlinks" to non-existent pages). * "redlinks" to non-existent pages).
// * Adding something else to this function will cause inconsistency * Adding something else to this function will cause inconsistency
// * since LinkHolderArray calls isAlwaysKnown() and does its own * since LinkHolderArray calls isAlwaysKnown() and does its own
// * page existence check. * page existence check.
// * *
// * @return boolean * @return boolean
// */ */
// public function isKnown() { public boolean isKnown() {
// return this.isAlwaysKnown() || this.exists(); // return this.isAlwaysKnown() || this.exists();
// } return true;
// }
// /** // /**
// * Does this page have source text? // * Does this page have source text?
// * // *

View File

@ -127,7 +127,7 @@ public class Xomw_linker {
// 'https': Force a full URL with https:// as the scheme. // 'https': Force a full URL with https:// as the scheme.
// 'stubThreshold' => (int): Stub threshold to use when determining link classes. // 'stubThreshold' => (int): Stub threshold to use when determining link classes.
// @return String HTML <a> attribute // @return String HTML <a> attribute
public void Link(Bry_bfr bfr, Xoa_ttl target, byte[] html, Xomw_atr_mgr custom_attribs, Xomw_qry_mgr query, Xomw_opt_mgr options) { public void Link(Bry_bfr bfr, Xomw_Title target, byte[] html, Xomw_atr_mgr custom_attribs, Xomw_qry_mgr query, Xomw_opt_mgr options) {
// XO.MW.UNSUPPORTED:MW has different renderers -- presumably for forcing "https:" and others; XO only has one // XO.MW.UNSUPPORTED:MW has different renderers -- presumably for forcing "https:" and others; XO only has one
//if (options != null) { //if (options != null) {
// // Custom options, create new LinkRenderer // // Custom options, create new LinkRenderer
@ -193,10 +193,10 @@ public class Xomw_linker {
* @return String * @return String
*/ */
// XO.MW:SYNC:1.29; DATE:2017-02-08 // XO.MW:SYNC:1.29; DATE:2017-02-08
public void makeSelfLinkObj(Bry_bfr bfr, Xoa_ttl nt, byte[] html, byte[] query, byte[] trail, byte[] prefix) { public void makeSelfLinkObj(Bry_bfr bfr, Xomw_Title nt, byte[] html, byte[] query, byte[] trail, byte[] prefix) {
// MW.HOOK:SelfLinkBegin // MW.HOOK:SelfLinkBegin
if (html == Bry_.Empty) { if (html == Bry_.Empty) {
html = tmp.Add_bry_escape_html(nt.Get_prefixed_text()).To_bry_and_clear(); html = tmp.Add_bry_escape_html(nt.getPrefixedText()).To_bry_and_clear();
} }
byte[] inside = Bry_.Empty; byte[] inside = Bry_.Empty;
byte[][] split_trail = splitTrail(trail); byte[][] split_trail = splitTrail(trail);
@ -239,7 +239,7 @@ public class Xomw_linker {
// * @param LinkTarget $target // * @param LinkTarget $target
// * @return LinkTarget // * @return LinkTarget
// */ // */
public static Xoa_ttl normaliseSpecialPage(Xoa_ttl target) { public static Xomw_Title normaliseSpecialPage(Xomw_Title target) {
// if (target.Ns().Id_is_special() && !target.Is_external()) { // if (target.Ns().Id_is_special() && !target.Is_external()) {
// list($name, $subpage) = SpecialPageFactory::resolveAlias($target->getDBkey()); // list($name, $subpage) = SpecialPageFactory::resolveAlias($target->getDBkey());
// if (!$name) { // if (!$name) {
@ -334,7 +334,7 @@ public class Xomw_linker {
// @since 1.20 // @since 1.20
// @return String HTML for an image, with links, wrappers, etc. // @return String HTML for an image, with links, wrappers, etc.
// XO.MW:SYNC:1.29; DATE:2017-02-08 // XO.MW:SYNC:1.29; DATE:2017-02-08
public void makeImageLink(Bry_bfr bfr, Xomw_parser_ctx pctx, Xomw_parser parser, Xoa_ttl title, Xomw_File file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query, int widthOption) { public void makeImageLink(Bry_bfr bfr, Xomw_parser_ctx pctx, Xomw_parser parser, Xomw_Title title, Xomw_File file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query, int widthOption) {
Xomw_parser_env env = parser.Env(); Xomw_parser_env env = parser.Env();
// XO.MW.HOOK:ImageBeforeProduceHTML // XO.MW.HOOK:ImageBeforeProduceHTML
@ -538,7 +538,7 @@ public class Xomw_linker {
* @return String * @return String
*/ */
// XO.MW:SYNC:1.29; DATE:2017-02-08 // XO.MW:SYNC:1.29; DATE:2017-02-08
private void makeThumbLink2(Bry_bfr bfr, Xomw_parser_ctx pctx, Xoa_ttl title, Xomw_File file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query) { private void makeThumbLink2(Bry_bfr bfr, Xomw_parser_ctx pctx, Xomw_Title title, Xomw_File file, Xomw_params_frame frameParams, Xomw_params_handler handlerParams, Object time, byte[] query) {
boolean exists = file != null && file.exists(); boolean exists = file != null && file.exists();
int page = handlerParams.page; int page = handlerParams.page;
@ -1372,7 +1372,7 @@ public class Xomw_linker {
* @return String * @return String
*/ */
// XO.MW:SYNC:1.29; DATE:2017-02-08 // XO.MW:SYNC:1.29; DATE:2017-02-08
public void normalizeSubpageLink(Xomw_linker__normalize_subpage_link rv, Xoa_ttl context_title, byte[] target, byte[] text) { public void normalizeSubpageLink(Xomw_linker__normalize_subpage_link rv, Xomw_Title context_title, byte[] target, byte[] text) {
// Valid link forms: // Valid link forms:
// Foobar -- normal // Foobar -- normal
// :Foobar -- override special treatment of prefix (images, language links) // :Foobar -- override special treatment of prefix (images, language links)
@ -1388,7 +1388,7 @@ public class Xomw_linker {
// Some namespaces don't allow subpages, // Some namespaces don't allow subpages,
// so only perform processing if subpages are allowed // so only perform processing if subpages are allowed
if (context_title != null && context_title.Ns().Subpages_enabled()) { if (context_title != null) {// && context_title.Ns().Subpages_enabled()) {
int hash = Bry_find_.Find_fwd(target, Byte_ascii.Hash); int hash = Bry_find_.Find_fwd(target, Byte_ascii.Hash);
byte[] suffix = null; byte[] suffix = null;
if (hash != Bry_find_.Not_found) { if (hash != Bry_find_.Not_found) {
@ -1413,7 +1413,7 @@ public class Xomw_linker {
no_slash = Bry_.Mid(target, 1); no_slash = Bry_.Mid(target, 1);
} }
ret = Bry_.Add(context_title.Get_prefixed_text(), Byte_ascii.Slash_bry, Bry_.Trim(no_slash), suffix); ret = Bry_.Add(context_title.getPrefixedText(), Byte_ascii.Slash_bry, Bry_.Trim(no_slash), suffix);
if (text == Bry_.Empty) { if (text == Bry_.Empty) {
text = Bry_.Add(target, suffix); text = Bry_.Add(target, suffix);
} // this might be changed for ugliness reasons } // this might be changed for ugliness reasons
@ -1427,7 +1427,7 @@ public class Xomw_linker {
dot2_stripped = Bry_.Mid(dot2_stripped, 3); dot2_stripped = Bry_.Mid(dot2_stripped, 3);
} }
if (dot2_count > 0) { if (dot2_count > 0) {
byte[][] exploded = Bry_split_.Split(context_title.Get_prefixed_text(), Byte_ascii.Slash); byte[][] exploded = Bry_split_.Split(context_title.getPrefixedText(), Byte_ascii.Slash);
int exploded_len = exploded.length; int exploded_len = exploded.length;
if (exploded_len > dot2_count) { // not allowed to go below top level page if (exploded_len > dot2_count) { // not allowed to go below top level page
// PORTED: ret = implode('/', array_slice($exploded, 0, -dot2_count)); // PORTED: ret = implode('/', array_slice($exploded, 0, -dot2_count));

View File

@ -29,14 +29,9 @@ public class Xomw_linker__normalize_subpage_link__tst {
} }
class Xomw_linker__normalize_subpage_link__fxt { class Xomw_linker__normalize_subpage_link__fxt {
private final Xomw_linker mgr = new Xomw_linker(new gplx.xowa.mediawiki.includes.linkers.Xomw_link_renderer(new Xomw_sanitizer())); private final Xomw_linker mgr = new Xomw_linker(new gplx.xowa.mediawiki.includes.linkers.Xomw_link_renderer(new Xomw_sanitizer()));
private final Xowe_wiki wiki;
private final Xomw_linker__normalize_subpage_link normalize_subpage_link = new Xomw_linker__normalize_subpage_link(); private final Xomw_linker__normalize_subpage_link normalize_subpage_link = new Xomw_linker__normalize_subpage_link();
public Xomw_linker__normalize_subpage_link__fxt() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
}
public void Test__normalize_subpage_link(String page_title_str, String link, String text, String expd_link, String expd_text) { public void Test__normalize_subpage_link(String page_title_str, String link, String text, String expd_link, String expd_text) {
mgr.normalizeSubpageLink(normalize_subpage_link, wiki.Ttl_parse(Bry_.new_u8(page_title_str)), Bry_.new_u8(link), Bry_.new_u8(text)); mgr.normalizeSubpageLink(normalize_subpage_link, Xomw_Title.newFromText(Bry_.new_u8(page_title_str)), Bry_.new_u8(link), Bry_.new_u8(text));
Gftest.Eq__str(expd_link, String_.new_u8(normalize_subpage_link.link)); Gftest.Eq__str(expd_link, String_.new_u8(normalize_subpage_link.link));
Gftest.Eq__str(expd_text, String_.new_u8(normalize_subpage_link.text)); Gftest.Eq__str(expd_text, String_.new_u8(normalize_subpage_link.text));
} }

View File

@ -17,5 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*; package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*;
public interface Xomw_file_finder { public interface Xomw_file_finder {
Xomw_File Find_file(Xoa_ttl ttl); Xomw_File Find_file(Xomw_Title ttl);
} }

View File

@ -20,13 +20,14 @@ import gplx.xowa.mediawiki.includes.parsers.*;
public class Xomw_file_finder__mock implements Xomw_file_finder { public class Xomw_file_finder__mock implements Xomw_file_finder {
private final Xomw_parser_env env; private final Xomw_parser_env env;
public Xomw_file_finder__mock(Xomw_parser_env env) {this.env = env;} public Xomw_file_finder__mock(Xomw_parser_env env) {this.env = env;}
private final Hash_adp hash = Hash_adp_.New(); private final Hash_adp_bry hash = Hash_adp_bry.cs();
public void Clear() {hash.Clear();} public void Clear() {hash.Clear();}
public Xomw_File Find_file(Xoa_ttl ttl) { public Xomw_File Find_file(Xomw_Title ttl) {
return (Xomw_File)hash.Get_by(ttl.Page_db_as_str()); return (Xomw_File)hash.Get_by(ttl.getPrefixedDBkey());
} }
public void Add(String title, Xomw_FileRepo repo, int w, int h, byte[] mime) { public void Add(String title, Xomw_FileRepo repo, int w, int h, byte[] mime) {
Xomw_LocalFile file = new Xomw_LocalFile(env, Bry_.new_u8(title), repo, w, h, mime); byte[] title_bry = Bry_.new_u8(title);
hash.Add_if_dupe_use_nth(title, file); Xomw_LocalFile file = new Xomw_LocalFile(env, title_bry, repo, w, h, mime);
hash.Add_if_dupe_use_nth(title_bry, file);
} }
} }

View File

@ -17,5 +17,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*; package gplx.xowa.mediawiki.includes.filerepo.file; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.filerepo.*;
public class Xomw_file_finder__noop implements Xomw_file_finder { public class Xomw_file_finder__noop implements Xomw_file_finder {
public Xomw_File Find_file(Xoa_ttl ttl) {return null;} public Xomw_File Find_file(Xomw_Title ttl) {return null;}
} }

View File

@ -34,8 +34,8 @@ public class Xomw_link_renderer {
this.sanitizer = sanitizer; this.sanitizer = sanitizer;
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
public void Make_link(Bry_bfr bfr, Xoa_ttl target, byte[] text, byte[] classes, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) { public void Make_link(Bry_bfr bfr, Xomw_Title target, byte[] text, byte[] classes, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) {
if (target.Is_known()) { if (target.isKnown()) {
this.Make_known_link(bfr, target, text, extra_atrs, query); this.Make_known_link(bfr, target, text, extra_atrs, query);
} else { } else {
this.Make_broken_link(bfr, target, text, extra_atrs, query); this.Make_broken_link(bfr, target, text, extra_atrs, query);
@ -45,7 +45,7 @@ public class Xomw_link_renderer {
// If you have already looked up the proper CSS classes using LinkRenderer::getLinkClasses() // If you have already looked up the proper CSS classes using LinkRenderer::getLinkClasses()
// or some other method, use this to avoid looking it up again. // or some other method, use this to avoid looking it up again.
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
public void Make_preloaded_link(Bry_bfr bfr, Xoa_ttl target, byte[] text, byte[] classes, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) { public void Make_preloaded_link(Bry_bfr bfr, Xomw_Title target, byte[] text, byte[] classes, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) {
// XO.MW.HOOK: $this->runBeginHook --> 'HtmlPageLinkRendererBegin', 'LinkBegin' // XO.MW.HOOK: $this->runBeginHook --> 'HtmlPageLinkRendererBegin', 'LinkBegin'
target = Normalize_target(target); target = Normalize_target(target);
@ -54,7 +54,7 @@ public class Xomw_link_renderer {
attribs.Add(Gfh_atr_.Bry__href, url); // XO.MW: add url 1st; MW does attribs["url", url] + attribs + extra_attribs attribs.Add(Gfh_atr_.Bry__href, url); // XO.MW: add url 1st; MW does attribs["url", url] + attribs + extra_attribs
if (classes.length > 0) // XO.MW:do not bother adding if empty if (classes.length > 0) // XO.MW:do not bother adding if empty
attribs.Add(Gfh_atr_.Bry__class, classes); attribs.Add(Gfh_atr_.Bry__class, classes);
byte[] prefixed_text = target.Get_prefixed_text(); byte[] prefixed_text = target.getPrefixedText();
if (prefixed_text != Bry_.Empty) { if (prefixed_text != Bry_.Empty) {
attribs.Add(Gfh_atr_.Bry__title, prefixed_text); attribs.Add(Gfh_atr_.Bry__title, prefixed_text);
} }
@ -69,9 +69,9 @@ public class Xomw_link_renderer {
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
public void Make_known_link(Bry_bfr bfr, Xoa_ttl target, byte[] text, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) { public void Make_known_link(Bry_bfr bfr, Xomw_Title target, byte[] text, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) {
byte[] classes = Bry_.Empty; byte[] classes = Bry_.Empty;
if (target.Is_external()) { if (target.isExternal()) {
classes = Bry__classes__extiw; classes = Bry__classes__extiw;
} }
byte[] colour = Get_link_classes(target); byte[] colour = Get_link_classes(target);
@ -82,17 +82,17 @@ public class Xomw_link_renderer {
Make_preloaded_link(bfr, target, text, classes, extra_atrs, query); Make_preloaded_link(bfr, target, text, classes, extra_atrs, query);
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
public void Make_broken_link(Bry_bfr bfr, Xoa_ttl target, byte[] text, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) { public void Make_broken_link(Bry_bfr bfr, Xomw_Title target, byte[] text, Xomw_atr_mgr extra_atrs, Xomw_qry_mgr query) {
// XO.MW.HOOK: Run legacy hook // XO.MW.HOOK: Run legacy hook
// We don't want to include fragments for broken links, because they // We don't want to include fragments for broken links, because they
// generally make no sense. // generally make no sense.
if (target.Has_fragment()) { if (target.hasFragment()) {
target = target.Create_fragment_target(); target = target.createFragmentTarget(target.getFragment());
} }
target = Normalize_target(target); target = Normalize_target(target);
if (query.action == null && target.Ns().Id() != gplx.xowa.wikis.nss.Xow_ns_.Tid__special) { if (query.action == null && target.getNamespace() != Xomw_Defines.NS_SPECIAL) {
query.action = Bry_.new_a7("edit"); query.action = Bry_.new_a7("edit");
query.redlink = 1; query.redlink = 1;
} }
@ -118,7 +118,7 @@ public class Xomw_link_renderer {
Build_a_element(bfr, target, text, attribs, false); Build_a_element(bfr, target, text, attribs, false);
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
private void Build_a_element(Bry_bfr bfr, Xoa_ttl target, byte[] text, Xomw_atr_mgr attribs, boolean is_known) { private void Build_a_element(Bry_bfr bfr, Xomw_Title target, byte[] text, Xomw_atr_mgr attribs, boolean is_known) {
// XO.MW.HOOK:HtmlPageLinkRendererEnd // XO.MW.HOOK:HtmlPageLinkRendererEnd
byte[] html = text; byte[] html = text;
@ -129,16 +129,16 @@ public class Xomw_link_renderer {
html_utl.Raw_element(bfr, Gfh_tag_.Bry__a, attribs, html); html_utl.Raw_element(bfr, Gfh_tag_.Bry__a, attribs, html);
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
private byte[] Get_link_text(Xoa_ttl target) { private byte[] Get_link_text(Xomw_Title target) {
byte[] prefixed_text = target.Get_prefixed_text(); byte[] prefixed_text = target.getPrefixedText();
// If the target is just a fragment, with no title, we return the fragment // If the target is just a fragment, with no title, we return the fragment
// text. Otherwise, we return the title text itself. // text. Otherwise, we return the title text itself.
if (prefixed_text == Bry_.Empty && target.Has_fragment()) { if (prefixed_text == Bry_.Empty && target.hasFragment()) {
return target.Get_fragment(); return target.getFragment();
} }
return prefixed_text; return prefixed_text;
} }
private byte[] Get_link_url(Xoa_ttl target, Xomw_qry_mgr query) { private byte[] Get_link_url(Xomw_Title target, Xomw_qry_mgr query) {
// TODO: Use a LinkTargetResolver service instead of Title // TODO: Use a LinkTargetResolver service instead of Title
// if ($this->forceArticlePath) { // if ($this->forceArticlePath) {
@ -148,7 +148,7 @@ public class Xomw_link_renderer {
// else { // else {
// $realQuery = []; // $realQuery = [];
// } // }
byte[] url = target.Get_link_url(query, false, expand_urls); byte[] url = target.getLinkURL(query, false, expand_urls);
// if ($this->forceArticlePath && $realQuery) { // if ($this->forceArticlePath && $realQuery) {
// $url = wfAppendQuery($url, $realQuery); // $url = wfAppendQuery($url, $realQuery);
@ -156,7 +156,7 @@ public class Xomw_link_renderer {
return url; return url;
} }
// XO.MW:SYNC:1.29; DATE:2017-01-31 // XO.MW:SYNC:1.29; DATE:2017-01-31
private Xoa_ttl Normalize_target(Xoa_ttl target) { private Xomw_Title Normalize_target(Xomw_Title target) {
return Xomw_linker.normaliseSpecialPage(target); return Xomw_linker.normaliseSpecialPage(target);
} }
// XO.MW:SYNC:1.29; DATE:2017-02-01 // XO.MW:SYNC:1.29; DATE:2017-02-01
@ -188,7 +188,7 @@ public class Xomw_link_renderer {
tmp_merge_deleted.Clear(); tmp_merge_deleted.Clear();
} }
} }
public byte[] Get_link_classes(Xoa_ttl target) { public byte[] Get_link_classes(Xomw_Title target) {
// Make sure the target is in the cache // Make sure the target is in the cache
// $id = $this->linkCache->addLinkObj($target); // $id = $this->linkCache->addLinkObj($target);
// if ($id == 0) { // if ($id == 0) {

View File

@ -36,7 +36,7 @@ public class Xomw_link_holders {
link_id = 0; link_id = 0;
} }
public void Make_holder(Bry_bfr bfr, Xoa_ttl nt, byte[] text, byte[][] query, byte[] trail, byte[] prefix) { public void Make_holder(Bry_bfr bfr, Xomw_Title nt, byte[] text, byte[][] query, byte[] trail, byte[] prefix) {
if (nt == null) { if (nt == null) {
// Fail gracefully // Fail gracefully
bfr.Add_str_a7("<!-- ERROR -->").Add(prefix).Add(text).Add(trail); bfr.Add_str_a7("<!-- ERROR -->").Add(prefix).Add(text).Add(trail);
@ -62,7 +62,7 @@ public class Xomw_link_holders {
} }
} }
} }
public void Test__add(Xoa_ttl ttl, byte[] capt) { public void Test__add(Xomw_Title ttl, byte[] capt) {
int key = link_id++; int key = link_id++;
Xomw_link_holder_item item = new Xomw_link_holder_item(ttl, capt, Bry_.Ary_empty); Xomw_link_holder_item item = new Xomw_link_holder_item(ttl, capt, Bry_.Ary_empty);
internals.Add(key, item); internals.Add(key, item);
@ -239,13 +239,13 @@ class Xomw_link_holder_list {
public Xomw_link_holder_item Get_by(int key) {return ary[key];} public Xomw_link_holder_item Get_by(int key) {return ary[key];}
} }
class Xomw_link_holder_item { class Xomw_link_holder_item {
public Xomw_link_holder_item(Xoa_ttl title, byte[] text, byte[][] query) { public Xomw_link_holder_item(Xomw_Title title, byte[] text, byte[][] query) {
this.title = title; this.title = title;
this.text = text; this.text = text;
this.query = query; this.query = query;
} }
public Xoa_ttl Title() {return title;} private final Xoa_ttl title; public Xomw_Title Title() {return title;} private final Xomw_Title title;
public byte[] Text() {return text;} private final byte[] text; public byte[] Text() {return text;} private final byte[] text;
public byte[] Pdbk() {return title.Get_prefixed_db_key();} public byte[] Pdbk() {return title.getPrefixedDBkey();}
public byte[][] Query() {return query;} private final byte[][] query; public byte[][] Query() {return query;} private final byte[][] query;
} }

View File

@ -28,14 +28,11 @@ public class Xomw_link_holders__tst {
class Xomw_link_holders__fxt { class Xomw_link_holders__fxt {
private final Xomw_link_holders holders = new Xomw_link_holders(new Xomw_link_renderer(new Xomw_sanitizer()), Bry_bfr_.New()); private final Xomw_link_holders holders = new Xomw_link_holders(new Xomw_link_renderer(new Xomw_sanitizer()), Bry_bfr_.New());
private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr(); private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr();
private final Xowe_wiki wiki;
private boolean apos = true; private boolean apos = true;
public Xomw_link_holders__fxt() { public Xomw_link_holders__fxt() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
} }
public void Init__add(String ttl, String capt) { public void Init__add(String ttl, String capt) {
holders.Test__add(wiki.Ttl_parse(Bry_.new_u8(ttl)), Bry_.new_u8(capt)); holders.Test__add(Xomw_Title.newFromText(Bry_.new_u8(ttl)), Bry_.new_u8(capt));
} }
public void Test__replace(String src, String expd) { public void Test__replace(String src, String expd) {
if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd); if (apos) expd = gplx.langs.htmls.Gfh_utl.Replace_apos(expd);

View File

@ -81,7 +81,7 @@ public class Xomw_parser {
doubleunder_wkr.Init_by_wiki(doubleunder_data, wiki.Lang()); doubleunder_wkr.Init_by_wiki(doubleunder_data, wiki.Lang());
magiclinks_wkr.Init_by_wiki(); magiclinks_wkr.Init_by_wiki();
} }
public void Init_by_page(Xoa_ttl ttl) { public void Init_by_page(Xomw_Title ttl) {
pctx.Init_by_page(ttl); pctx.Init_by_page(ttl);
} }
public void Internal_parse(Xomw_parser_bfr pbfr, byte[] text) { public void Internal_parse(Xomw_parser_bfr pbfr, byte[] text) {

View File

@ -66,7 +66,7 @@ class Xomw_parser__fxt {
Xoae_app app = Xoa_app_fxt.Make__app__edit(); Xoae_app app = Xoa_app_fxt.Make__app__edit();
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app); Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
mgr.Init_by_wiki(wiki); mgr.Init_by_wiki(wiki);
mgr.Init_by_page(wiki.Ttl_parse(Bry_.new_a7("Page_1"))); mgr.Init_by_page(Xomw_Title.newFromText(Bry_.new_a7("Page_1")));
} }
public void Test__parse(String src_str, String expd) { public void Test__parse(String src_str, String expd) {
byte[] src_bry = Bry_.new_u8(src_str); byte[] src_bry = Bry_.new_u8(src_str);

View File

@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import gplx.xowa.mediawiki.includes.parsers.lnkis.*; import gplx.xowa.mediawiki.includes.parsers.lnkis.*;
public class Xomw_parser_ctx { public class Xomw_parser_ctx {
public Xoa_ttl Page_title() {return page_title;} private Xoa_ttl page_title; public Xomw_Title Page_title() {return page_title;} private Xomw_Title page_title;
public Xomw_image_params Lnki_wkr__make_image__img_params = new Xomw_image_params(); 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 byte[][] Lnki_wkr__make_image__match_magic_word = new byte[2][];
public int[] Lnki_wkr__make_image__img_size = new int[2]; public int[] Lnki_wkr__make_image__img_size = new int[2];
public Xomw_params_mto Linker__makeImageLink__prms = new Xomw_params_mto(); public Xomw_params_mto Linker__makeImageLink__prms = new Xomw_params_mto();
public void Init_by_page(Xoa_ttl page_title) { public void Init_by_page(Xomw_Title page_title) {
this.page_title = page_title; this.page_title = page_title;
} }

View File

@ -45,8 +45,8 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
private final Xomw_strip_state strip_state; private final Xomw_strip_state strip_state;
private Xomw_parser_env env; private Xomw_parser_env env;
private Xow_wiki wiki; private Xow_wiki wiki;
private Xoa_ttl page_title; private Xomw_Title mPageTitle;
private final Xomw_linker__normalize_subpage_link normalize_subpage_link = new Xomw_linker__normalize_subpage_link(); // private final Xomw_linker__normalize_subpage_link normalize_subpage_link = new Xomw_linker__normalize_subpage_link();
private final Bry_bfr tmp; private final Bry_bfr tmp;
private final Xomw_parser parser; private final Xomw_parser parser;
private final Xomw_atr_mgr extra_atrs = new Xomw_atr_mgr(); private final Xomw_atr_mgr extra_atrs = new Xomw_atr_mgr();
@ -88,7 +88,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
Bry_bfr bfr = pbfr.Trg(); Bry_bfr bfr = pbfr.Trg();
pbfr.Switch(); pbfr.Switch();
this.page_title = pctx.Page_title(); this.mPageTitle = pctx.Page_title();
Replace_internal_links(pctx, bfr, src, src_bgn, src_end); Replace_internal_links(pctx, bfr, src, src_bgn, src_end);
} }
@ -254,17 +254,16 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
link = Bry_.Mid(link, 1); link = Bry_.Mid(link, 1);
} }
// $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null; // $nt = is_string( $unstrip ) ? Title::newFromText( $unstrip ) : null;
// Xomw_Title nt2 = Xomw_Title.newFromText(link); Xomw_Title nt = Xomw_Title.newFromText(link);
Xoa_ttl nt = wiki.Ttl_parse(link);
// Make subpage if necessary // Make subpage if necessary
boolean subpages_enabled = nt.Ns().Subpages_enabled(); // boolean useSubpages = nt.Ns().Subpages_enabled();
if (subpages_enabled) { // if (useSubpages) {
Maybe_do_subpage_link(normalize_subpage_link, orig_link, text); // Maybe_do_subpage_link(normalize_subpage_link, orig_link, text);
link = normalize_subpage_link.link; // link = normalize_subpage_link.link;
text = normalize_subpage_link.text; // text = normalize_subpage_link.text;
nt = wiki.Ttl_parse(link); // nt = Xomw_Title.newFromText(link);
} // }
// IGNORE: handled in rewrite above // IGNORE: handled in rewrite above
// else { // else {
// link = orig_link; // link = orig_link;
@ -272,18 +271,18 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
byte[] unstrip = strip_state.Unstrip_nowiki(link); byte[] unstrip = strip_state.Unstrip_nowiki(link);
if (!Bry_.Eq(unstrip, link)) if (!Bry_.Eq(unstrip, link))
nt = wiki.Ttl_parse(unstrip); nt = Xomw_Title.newFromText(unstrip);
if (nt == null) { if (nt == null) {
bfr.Add_mid(src, prv, lnki_bgn + 2); // $s .= $prefix . '[[' . $line; bfr.Add_mid(src, prv, lnki_bgn + 2); // $s .= $prefix . '[[' . $line;
prv = cur = lnki_bgn + 2; prv = cur = lnki_bgn + 2;
continue; continue;
} }
Xow_ns ns = nt.Ns(); byte[] iw = nt.getInterwiki();
Xow_xwiki_itm iw = nt.Wik_itm(); int ns = nt.getNamespace();
if (might_be_img) { // if this is actually an invalid link if (might_be_img) { // if this is actually an invalid link
if (ns.Id_is_file() && no_force) { // but might be an image if (ns == Xomw_Defines.NS_FILE && no_force) { // but might be an image
boolean found = false; boolean found = false;
// while (true) { // while (true) {
// // look at the next 'line' to see if we can close it there // // look at the next 'line' to see if we can close it there
@ -358,7 +357,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
// continue; // continue;
// } // }
// //
if (ns.Id_is_file()) { if (ns == Xomw_Defines.NS_FILE) {
// boolean is_good_image = !wfIsBadImage(nt->getDBkey(), this->mTitle) // boolean is_good_image = !wfIsBadImage(nt->getDBkey(), this->mTitle)
boolean is_good_image = true; boolean is_good_image = true;
if (is_good_image) { if (is_good_image) {
@ -384,7 +383,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
continue; continue;
} }
} }
else if (ns.Id_is_ctg()) { else if (ns == Xomw_Defines.NS_CATEGORY) {
bfr.Trim_end_ws(); // s = rtrim(s . "\n"); // T2087 bfr.Trim_end_ws(); // s = rtrim(s . "\n"); // T2087
if (was_blank) { if (was_blank) {
@ -408,7 +407,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
// Self-link checking. For some languages, variants of the title are checked in // Self-link checking. For some languages, variants of the title are checked in
// LinkHolderArray::doVariants() to allow batching the existence checks necessary // LinkHolderArray::doVariants() to allow batching the existence checks necessary
// for linking to a different variant. // for linking to a different variant.
if (!ns.Id_is_special() && nt.Eq_full_db(page_title) && !nt.Has_fragment()) { if (ns != Xomw_Defines.NS_SPECIAL && nt.equals(mPageTitle) && !nt.hasFragment()) {
bfr.Add(prefix); bfr.Add(prefix);
linker.makeSelfLinkObj(bfr, nt, text, Bry_.Empty, trail, Bry_.Empty); linker.makeSelfLinkObj(bfr, nt, text, Bry_.Empty, trail, Bry_.Empty);
continue; continue;
@ -416,7 +415,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
// NS_MEDIA is a pseudo-namespace for linking directly to a file // NS_MEDIA is a pseudo-namespace for linking directly to a file
// @todo FIXME: Should do batch file existence checks, see comment below // @todo FIXME: Should do batch file existence checks, see comment below
if (ns.Id_is_media()) { if (ns == Xomw_Defines.NS_MEDIA) {
// Give extensions a chance to select the file revision for us // Give extensions a chance to select the file revision for us
// options = []; // options = [];
// desc_query = false; // desc_query = false;
@ -435,7 +434,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
// batch file existence checks for NS_FILE and NS_MEDIA // batch file existence checks for NS_FILE and NS_MEDIA
bfr.Add_mid(src, prv, lnki_bgn); bfr.Add_mid(src, prv, lnki_bgn);
prv = cur; prv = cur;
if (iw == null && nt.Is_always_known()) { if (iw == null && nt.isAlwaysKnown()) {
// this->mOutput->addLink(nt); // this->mOutput->addLink(nt);
Make_known_link_holder(bfr, nt, text, trail, prefix); Make_known_link_holder(bfr, nt, text, trail, prefix);
} }
@ -445,7 +444,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
} }
} }
} }
public void makeImage(Xomw_parser_ctx pctx, Bry_bfr bfr, Xoa_ttl title, byte[] options_at_link, Xomw_link_holders holders) { public void makeImage(Xomw_parser_ctx pctx, Bry_bfr bfr, Xomw_Title title, byte[] options_at_link, Xomw_link_holders holders) {
// Check if the options text is of the form "options|alt text" // Check if the options text is of the form "options|alt text"
// Options are: // Options are:
// * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang // * thumbnail make a thumbnail with enlarge-icon and caption, alignment depends on lang
@ -643,7 +642,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
if (caption == Bry_.Empty && frameParams.alt == null) { if (caption == Bry_.Empty && frameParams.alt == null) {
// No caption or alt text, add the filename as the alt text so // No caption or alt text, add the filename as the alt text so
// that screen readers at least get some description of the image // that screen readers at least get some description of the image
frameParams.alt = title.Get_text(); frameParams.alt = title.getText();
} }
// Do not set $params['frame']['title'] because tooltips don't make sense // Do not set $params['frame']['title'] because tooltips don't make sense
// for framed images // for framed images
@ -657,7 +656,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
else { else {
// No caption, fall back to using the filename for the // No caption, fall back to using the filename for the
// alt text // alt text
frameParams.alt = title.Get_text(); frameParams.alt = title.getText();
} }
} }
// Use the "caption" for the tooltip text // Use the "caption" for the tooltip text
@ -778,7 +777,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
* @param array $options Array of options to RepoGroup::findFile * @param array $options Array of options to RepoGroup::findFile
* @return array ( File or false, Title of file ) * @return array ( File or false, Title of file )
*/ */
public Xomw_File fetchFileAndTitle(Xoa_ttl title, Hash_adp options) { public Xomw_File fetchFileAndTitle(Xomw_Title title, Hash_adp options) {
Xomw_File file = fetchFileNoRegister(title, options); Xomw_File file = fetchFileNoRegister(title, options);
//$time = $file ? $file->getTimestamp() : false; //$time = $file ? $file->getTimestamp() : false;
@ -802,7 +801,7 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
* @param array $options Array of options to RepoGroup::findFile * @param array $options Array of options to RepoGroup::findFile
* @return File|boolean * @return File|boolean
*/ */
private Xomw_File fetchFileNoRegister(Xoa_ttl title, Hash_adp options) { private Xomw_File fetchFileNoRegister(Xomw_Title title, Hash_adp options) {
Xomw_File file = null; Xomw_File file = null;
// if ( isset( $options['broken'] ) ) { // if ( isset( $options['broken'] ) ) {
// file = false; // broken thumbnail forced by hook // file = false; // broken thumbnail forced by hook
@ -814,18 +813,18 @@ public class Xomw_lnki_wkr {// THREAD.UNSAFE: caching for repeated calls
return file; return file;
} }
public void Maybe_do_subpage_link(Xomw_linker__normalize_subpage_link rv, byte[] target, byte[] text) { public void Maybe_do_subpage_link(Xomw_linker__normalize_subpage_link rv, byte[] target, byte[] text) {
linker.normalizeSubpageLink(rv, page_title, target, text); linker.normalizeSubpageLink(rv, mPageTitle, target, text);
} }
public void Replace_link_holders(Xomw_parser_ctx pctx, Xomw_parser_bfr pbfr) { public void Replace_link_holders(Xomw_parser_ctx pctx, Xomw_parser_bfr pbfr) {
holders.Replace(pctx, pbfr); holders.Replace(pctx, pbfr);
} }
public void Make_known_link_holder(Bry_bfr bfr, Xoa_ttl nt, byte[] text, byte[] trail, byte[] prefix) { public void Make_known_link_holder(Bry_bfr bfr, Xomw_Title nt, byte[] text, byte[] trail, byte[] prefix) {
byte[][] split_trail = linker.splitTrail(trail); byte[][] split_trail = linker.splitTrail(trail);
byte[] inside = split_trail[0]; byte[] inside = split_trail[0];
trail = split_trail[1]; trail = split_trail[1];
if (text == Bry_.Empty) { if (text == Bry_.Empty) {
text = Bry_.Escape_html(nt.Get_prefixed_text()); text = Bry_.Escape_html(nt.getPrefixedText());
} }
// PORTED:new HtmlArmor( "$prefix$text$inside" ) // PORTED:new HtmlArmor( "$prefix$text$inside" )

View File

@ -86,7 +86,7 @@ class Xomw_lnki_wkr__fxt {
// ctx // ctx
pctx = new Xomw_parser_ctx(); pctx = new Xomw_parser_ctx();
pctx.Init_by_page(wiki.Ttl_parse(Bry_.new_a7("Page_1"))); pctx.Init_by_page(Xomw_Title.newFromText(Bry_.new_a7("Page_1")));
} }
public void Clear() { public void Clear() {
wkr.Clear_state(); wkr.Clear_state();

View File

@ -188,7 +188,7 @@ public class Xomw_magiclinks_wkr {
else { else {
// handle free // handle free
if (regex_tid == Regex__free) { if (regex_tid == Regex__free) {
this.page_title = pctx.Page_title().Full_db(); this.page_title = pctx.Page_title().getPrefixedDBkey();
dirty = true; dirty = true;
bfr.Add_mid(src, prv, hook_bgn); bfr.Add_mid(src, prv, hook_bgn);
byte[] url = Bry_.Mid(src, hook_bgn, cur); byte[] url = Bry_.Mid(src, hook_bgn, cur);

View File

@ -71,11 +71,8 @@ class Xomw_magiclinks_wkr__fxt {
private final Xomw_parser_ctx pctx = new Xomw_parser_ctx(); private final Xomw_parser_ctx pctx = new Xomw_parser_ctx();
private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr(); private final Xomw_parser_bfr pbfr = new Xomw_parser_bfr();
public Xomw_magiclinks_wkr__fxt() { public Xomw_magiclinks_wkr__fxt() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
Xomw_regex_space regex_space = new Xomw_regex_space(); Xomw_regex_space regex_space = new Xomw_regex_space();
pctx.Init_by_page(wiki.Ttl_parse(Bry_.new_a7("Page_1"))); pctx.Init_by_page(Xomw_Title.newFromText(Bry_.new_a7("Page_1")));
Xomw_parser parser = new Xomw_parser(); Xomw_parser parser = new Xomw_parser();
this.wkr = new Xomw_magiclinks_wkr(parser, parser.Sanitizer(), parser.Linker(), new Xomw_regex_boundary(regex_space), new Xomw_regex_url(regex_space)); this.wkr = new Xomw_magiclinks_wkr(parser, parser.Sanitizer(), parser.Linker(), new Xomw_regex_boundary(regex_space), new Xomw_regex_url(regex_space));
wkr.Init_by_wiki(); wkr.Init_by_wiki();

View File

@ -273,6 +273,10 @@ public class Xomw_MediaWikiTitleCodec {
} }
// Namespace or interwiki prefix // Namespace or interwiki prefix
if (Bry_.Has_at_bgn(dbkey, Bry_.new_a7("File:"))) {
parts.ns = Xomw_Defines.NS_FILE;
dbkey = Bry_.Mid(dbkey, 5);
}
// $prefixRegexp = "/^(.+?)_*:_*(.*)$/S"; // $prefixRegexp = "/^(.+?)_*:_*(.*)$/S";
// do { // do {
// $m = []; // $m = [];