mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Xomw: Add XomwMessage class and related
This commit is contained in:
parent
2416ccb7e9
commit
1f10e61371
@ -150,4 +150,7 @@ public class XophpString {
|
|||||||
public static byte[] str_replace(byte find, byte repl, byte[] src) {
|
public static byte[] str_replace(byte find, byte repl, byte[] src) {
|
||||||
return Bry_.Replace(src, 0, src.length, find, repl);
|
return Bry_.Replace(src, 0, src.length, find, repl);
|
||||||
}
|
}
|
||||||
|
public static byte[] str_replace(byte[] find, byte[] repl, byte[] src) {
|
||||||
|
return Bry_.Replace(src, find, repl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
import gplx.core.btries.*;
|
import gplx.core.btries.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
/* TODO.XO:
|
/* TODO.XO:
|
||||||
* handle spaceSeparatedListAttributes; EX: "cls=a cls=b" -> "cls='a b'"
|
* handle spaceSeparatedListAttributes; EX: "cls=a cls=b" -> "cls='a b'"
|
||||||
* self::dropDefaults($element, $attribs)
|
* self::dropDefaults($element, $attribs)
|
||||||
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
import org.junit.*; import gplx.core.tests.*;
|
import org.junit.*; import gplx.core.tests.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
public class XomwHtml_expandAttributesTest {
|
public class XomwHtml_expandAttributesTest {
|
||||||
private final XomwHtml_expandAttributesFxt fxt = new XomwHtml_expandAttributesFxt();
|
private final XomwHtml_expandAttributesFxt fxt = new XomwHtml_expandAttributesFxt();
|
||||||
@Test public void Basic() {
|
@Test public void Basic() {
|
||||||
|
@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
import gplx.core.btries.*;
|
import gplx.core.btries.*;
|
||||||
import gplx.langs.htmls.*;
|
import gplx.langs.htmls.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*; import gplx.xowa.mediawiki.includes.linkers.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*; import gplx.xowa.mediawiki.includes.linkers.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||||
import gplx.xowa.mediawiki.includes.filerepo.file.*; import gplx.xowa.mediawiki.includes.media.*;
|
import gplx.xowa.mediawiki.includes.filerepo.file.*; import gplx.xowa.mediawiki.includes.media.*;
|
||||||
import gplx.xowa.mediawiki.includes.parsers.lnkis.*;
|
import gplx.xowa.mediawiki.includes.parsers.lnkis.*;
|
||||||
/* TODO.XO
|
/* TODO.XO
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
XOWA: the XOWA Offline Wiki Application
|
||||||
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||||
|
|
||||||
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
|
|
||||||
|
You may use XOWA according to either of these licenses as is most appropriate
|
||||||
|
for your project on a case-by-case basis.
|
||||||
|
|
||||||
|
The terms of each license can be found in the source code repository:
|
||||||
|
|
||||||
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
|
*/
|
||||||
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
|
/**
|
||||||
|
* Variant of the Message cls.
|
||||||
|
*
|
||||||
|
* Rather than treating the message key as a lookup
|
||||||
|
* value (which is passed to the MessageCache and
|
||||||
|
* translated as necessary), a RawMessage key is
|
||||||
|
* treated as the actual message.
|
||||||
|
*
|
||||||
|
* All other functionality (parsing, escaping, etc.)
|
||||||
|
* is preserved.
|
||||||
|
*
|
||||||
|
* @since 1.21
|
||||||
|
*/
|
||||||
|
class XomwRawMessage { // : XomwMessage
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Call the parent constructor, then store the key as
|
||||||
|
// * the message.
|
||||||
|
// *
|
||||||
|
// * @see Message::__construct
|
||||||
|
// *
|
||||||
|
// * @param String $text Message to use.
|
||||||
|
// * @param array $params Parameters for the message.
|
||||||
|
// *
|
||||||
|
// * @throws InvalidArgumentException
|
||||||
|
// */
|
||||||
|
// public function __construct( $text, $params = [] ) {
|
||||||
|
// if ( !is_string( $text ) ) {
|
||||||
|
// throw new InvalidArgumentException( '$text must be a String' );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// parent::__construct( $text, $params );
|
||||||
|
//
|
||||||
|
// // The key is the message.
|
||||||
|
// $this->message = $text;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Fetch the message (in this case, the key).
|
||||||
|
// *
|
||||||
|
// * @return String
|
||||||
|
// */
|
||||||
|
// public function fetchMessage() {
|
||||||
|
// // Just in case the message is unset somewhere.
|
||||||
|
// if ( $this->message === null ) {
|
||||||
|
// $this->message = $this->key;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return $this->message;
|
||||||
|
// }
|
||||||
|
}
|
@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
import gplx.core.brys.*; import gplx.core.btries.*; import gplx.core.encoders.*; import gplx.core.primitives.*; import gplx.langs.htmls.entitys.*;
|
import gplx.core.brys.*; import gplx.core.btries.*; import gplx.core.encoders.*; import gplx.core.primitives.*; import gplx.langs.htmls.entitys.*;
|
||||||
import gplx.xowa.parsers.htmls.*;
|
import gplx.xowa.parsers.htmls.*;
|
||||||
import gplx.langs.htmls.*; import gplx.xowa.mediawiki.includes.htmls.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
import gplx.langs.htmls.*; import gplx.xowa.mediawiki.includes.xohtml.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||||
import gplx.xowa.mediawiki.includes.libs.*;
|
import gplx.xowa.mediawiki.includes.libs.*;
|
||||||
public class XomwSanitizer {
|
public class XomwSanitizer {
|
||||||
private final Mwh_doc_wkr__atr_bldr atr_bldr = new Mwh_doc_wkr__atr_bldr();
|
private final Mwh_doc_wkr__atr_bldr atr_bldr = new Mwh_doc_wkr__atr_bldr();
|
||||||
|
@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
|||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
|
||||||
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*; import gplx.xowa.mediawiki.includes.htmls.*;
|
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*; import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
public class XomwSanitizerTest {
|
public class XomwSanitizerTest {
|
||||||
private final XomwSanitizerFxt fxt = new XomwSanitizerFxt();
|
private final XomwSanitizerFxt fxt = new XomwSanitizerFxt();
|
||||||
@Test public void Normalize__text() {fxt.Test__normalize_char_references("abc" , "abc");}
|
@Test public void Normalize__text() {fxt.Test__normalize_char_references("abc" , "abc");}
|
||||||
|
1282
gplx.xowa.mediawiki/src/gplx/xowa/mediawiki/includes/cache/XomwMessageCache.java
vendored
Normal file
1282
gplx.xowa.mediawiki/src/gplx/xowa/mediawiki/includes/cache/XomwMessageCache.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,179 @@
|
|||||||
|
/*
|
||||||
|
XOWA: the XOWA Offline Wiki Application
|
||||||
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||||
|
|
||||||
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
|
|
||||||
|
You may use XOWA according to either of these licenses as is most appropriate
|
||||||
|
for your project on a case-by-case basis.
|
||||||
|
|
||||||
|
The terms of each license can be found in the source code repository:
|
||||||
|
|
||||||
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
|
*/
|
||||||
|
package gplx.xowa.mediawiki.includes.interwiki; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
|
/**
|
||||||
|
* Value Object for representing interwiki records.
|
||||||
|
*/
|
||||||
|
public class XomwInterwiki {
|
||||||
|
|
||||||
|
/** @var String The interwiki prefix, (e.g. "Meatball", or the language prefix "de") */
|
||||||
|
private byte[] mPrefix;
|
||||||
|
|
||||||
|
/** @var String The URL of the wiki, with "1" as a placeholder for an article name. */
|
||||||
|
private byte[] mURL;
|
||||||
|
|
||||||
|
/** @var String The URL of the file api.php */
|
||||||
|
private byte[] mAPI;
|
||||||
|
|
||||||
|
/** @var String The name of the database (for a connection to be established
|
||||||
|
* with wfGetLB('wikiid'))
|
||||||
|
*/
|
||||||
|
private byte[] mWikiID;
|
||||||
|
|
||||||
|
/** @var boolean Whether the wiki is in this project */
|
||||||
|
private boolean mLocal;
|
||||||
|
|
||||||
|
/** @var boolean Whether interwiki transclusions are allowed */
|
||||||
|
private boolean mTrans;
|
||||||
|
|
||||||
|
public XomwInterwiki(byte[] prefix, byte[] url, byte[] api, byte[] wikiId, boolean local, boolean trans) {
|
||||||
|
this.mPrefix = prefix;
|
||||||
|
this.mURL = url;
|
||||||
|
this.mAPI = api;
|
||||||
|
this.mWikiID = wikiId;
|
||||||
|
this.mLocal = local;
|
||||||
|
this.mTrans = trans;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Check whether an interwiki prefix exists
|
||||||
|
// *
|
||||||
|
// * @deprecated since 1.28, use InterwikiLookup instead
|
||||||
|
// *
|
||||||
|
// * @param String prefix Interwiki prefix to use
|
||||||
|
// * @return boolean Whether it exists
|
||||||
|
// */
|
||||||
|
// public static function isValidInterwiki(prefix) {
|
||||||
|
// return MediaWikiServices::getInstance().getInterwikiLookup().isValidInterwiki(prefix);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Fetch an Interwiki Object
|
||||||
|
// *
|
||||||
|
// * @deprecated since 1.28, use InterwikiLookup instead
|
||||||
|
// *
|
||||||
|
// * @param String prefix Interwiki prefix to use
|
||||||
|
// * @return Interwiki|null|boolean
|
||||||
|
// */
|
||||||
|
// public static function fetch(prefix) {
|
||||||
|
// return MediaWikiServices::getInstance().getInterwikiLookup().fetch(prefix);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Purge the cache (local and persistent) for an interwiki prefix.
|
||||||
|
// *
|
||||||
|
// * @param String prefix
|
||||||
|
// * @since 1.26
|
||||||
|
// */
|
||||||
|
// public static function invalidateCache(prefix) {
|
||||||
|
// return MediaWikiServices::getInstance().getInterwikiLookup().invalidateCache(prefix);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Returns all interwiki prefixes
|
||||||
|
// *
|
||||||
|
// * @deprecated since 1.28, unused. Use InterwikiLookup instead.
|
||||||
|
// *
|
||||||
|
// * @param String|null local If set, limits output to local/non-local interwikis
|
||||||
|
// * @return array List of prefixes
|
||||||
|
// * @since 1.19
|
||||||
|
// */
|
||||||
|
// public static function getAllPrefixes(local = null) {
|
||||||
|
// return MediaWikiServices::getInstance().getInterwikiLookup().getAllPrefixes(local);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the URL for a particular title (or with 1 if no title given)
|
||||||
|
*
|
||||||
|
* @param String title What text to put for the article name
|
||||||
|
* @return String The URL
|
||||||
|
* @note Prior to 1.19 The getURL with an argument was broken.
|
||||||
|
* If you if you use this arg in an extension that supports MW earlier
|
||||||
|
* than 1.19 please wfUrlencode and substitute 1 on your own.
|
||||||
|
*/
|
||||||
|
// title=null
|
||||||
|
public byte[] getURL(byte[] title) {
|
||||||
|
byte[] url = this.mURL;
|
||||||
|
if (title != null) {
|
||||||
|
url = XophpString.str_replace(ARG_1, XomwGlobalFunctions.wfUrlencode(title), url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API URL for this wiki
|
||||||
|
*
|
||||||
|
* @return String The URL
|
||||||
|
*/
|
||||||
|
public byte[] getAPI() {
|
||||||
|
return this.mAPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the DB name for this wiki
|
||||||
|
*
|
||||||
|
* @return String The DB name
|
||||||
|
*/
|
||||||
|
public byte[] getWikiID() {
|
||||||
|
return this.mWikiID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is this a local link from a sister project, or is
|
||||||
|
* it something outside, like Google
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isLocal() {
|
||||||
|
return this.mLocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can pages from this wiki be transcluded?
|
||||||
|
* Still requires wgEnableScaryTransclusion
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public boolean isTranscludable() {
|
||||||
|
return this.mTrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name for the interwiki site
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public byte[] getName(XomwEnv env) {
|
||||||
|
// XomwMessage msg = XomwGlobalFunctions.wfMessage(env, "interwiki-name-" + this.mPrefix).inContentLanguage();
|
||||||
|
//
|
||||||
|
// return !msg.exists() ? Bry_.Empty : msg.text();
|
||||||
|
Tfds.Write(mPrefix);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Get a description for this interwiki
|
||||||
|
// *
|
||||||
|
// * @return String
|
||||||
|
// */
|
||||||
|
// public function getDescription() {
|
||||||
|
// msg = wfMessage('interwiki-desc-' . this.mPrefix).inContentLanguage();
|
||||||
|
//
|
||||||
|
// return !msg.exists() ? '' : msg.text();
|
||||||
|
// }
|
||||||
|
private static final byte[] ARG_1 = Bry_.new_a7("$1");
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
XOWA: the XOWA Offline Wiki Application
|
||||||
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||||
|
|
||||||
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
|
|
||||||
|
You may use XOWA according to either of these licenses as is most appropriate
|
||||||
|
for your project on a case-by-case basis.
|
||||||
|
|
||||||
|
The terms of each license can be found in the source code repository:
|
||||||
|
|
||||||
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
|
*/
|
||||||
|
package gplx.xowa.mediawiki.includes.interwiki; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
|
/**
|
||||||
|
* Service interface for looking up Interwiki records.
|
||||||
|
*
|
||||||
|
* @since 1.28
|
||||||
|
*/
|
||||||
|
public interface XomwInterwikiLookup {
|
||||||
|
/**
|
||||||
|
* Check whether an interwiki prefix exists
|
||||||
|
*
|
||||||
|
* @param String $prefix Interwiki prefix to use
|
||||||
|
* @return boolean Whether it exists
|
||||||
|
*/
|
||||||
|
boolean isValidInterwiki(byte[] prefix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch an Interwiki Object
|
||||||
|
*
|
||||||
|
* @param String $prefix Interwiki prefix to use
|
||||||
|
* @return Interwiki|null|boolean
|
||||||
|
*/
|
||||||
|
XomwInterwiki fetch(byte[] prefix);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all interwiki prefixes
|
||||||
|
*
|
||||||
|
* @param String|null $local If set, limits output to local/non-local interwikis
|
||||||
|
* @return String[] List of prefixes
|
||||||
|
*/
|
||||||
|
byte[][] getAllPrefixes(byte[] local);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purge the in-process and persistent Object cache for an interwiki prefix
|
||||||
|
* @param String $prefix
|
||||||
|
*/
|
||||||
|
void invalidateCache(byte[] prefix);
|
||||||
|
}
|
@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
XOWA: the XOWA Offline Wiki Application
|
||||||
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||||
|
|
||||||
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||||
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
|
|
||||||
|
You may use XOWA according to either of these licenses as is most appropriate
|
||||||
|
for your project on a case-by-case basis.
|
||||||
|
|
||||||
|
The terms of each license can be found in the source code repository:
|
||||||
|
|
||||||
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
|
*/
|
||||||
|
package gplx.xowa.mediawiki.includes.interwiki; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
|
class XomwInterwikiLookupAdapter {
|
||||||
|
// /**
|
||||||
|
// * @var SiteLookup
|
||||||
|
// */
|
||||||
|
// private $siteLookup;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @var Interwiki[]|null associative array mapping interwiki prefixes to Interwiki objects
|
||||||
|
// */
|
||||||
|
// private $interwikiMap;
|
||||||
|
//
|
||||||
|
// function __construct(
|
||||||
|
// SiteLookup $siteLookup,
|
||||||
|
// array $interwikiMap = null
|
||||||
|
// ) {
|
||||||
|
// $this->siteLookup = $siteLookup;
|
||||||
|
// $this->interwikiMap = $interwikiMap;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * See InterwikiLookup::isValidInterwiki
|
||||||
|
// * It loads the whole interwiki map.
|
||||||
|
// *
|
||||||
|
// * @param String $prefix Interwiki prefix to use
|
||||||
|
// * @return boolean Whether it exists
|
||||||
|
// */
|
||||||
|
// public function isValidInterwiki( $prefix ) {
|
||||||
|
//
|
||||||
|
// return array_key_exists( $prefix, $this->getInterwikiMap() );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * See InterwikiLookup::fetch
|
||||||
|
// * It loads the whole interwiki map.
|
||||||
|
// *
|
||||||
|
// * @param String $prefix Interwiki prefix to use
|
||||||
|
// * @return Interwiki|null|boolean
|
||||||
|
// */
|
||||||
|
// public function fetch( $prefix ) {
|
||||||
|
// if ( $prefix == '' ) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ( !$this->isValidInterwiki( $prefix ) ) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return $this->interwikiMap[$prefix];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * See InterwikiLookup::getAllPrefixes
|
||||||
|
// *
|
||||||
|
// * @param String|null $local If set, limits output to local/non-local interwikis
|
||||||
|
// * @return String[] List of prefixes
|
||||||
|
// */
|
||||||
|
// public function getAllPrefixes( $local = null ) {
|
||||||
|
// if ( $local === null ) {
|
||||||
|
// return array_keys( $this->getInterwikiMap() );
|
||||||
|
// }
|
||||||
|
// $res = [];
|
||||||
|
// foreach ( $this->getInterwikiMap() as $interwikiId => $interwiki ) {
|
||||||
|
// if ( $interwiki->isLocal() === $local ) {
|
||||||
|
// $res[] = $interwikiId;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return $res;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * See InterwikiLookup::invalidateCache
|
||||||
|
// *
|
||||||
|
// * @param String $prefix
|
||||||
|
// */
|
||||||
|
// public function invalidateCache( $prefix ) {
|
||||||
|
// if ( !isset( $this->interwikiMap[$prefix] ) ) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// $globalId = $this->interwikiMap[$prefix]->getWikiID();
|
||||||
|
// unset( $this->interwikiMap[$prefix] );
|
||||||
|
//
|
||||||
|
// // Reload the interwiki
|
||||||
|
// $site = $this->siteLookup->getSites()->getSite( $globalId );
|
||||||
|
// $interwikis = $this->getSiteInterwikis( $site );
|
||||||
|
// $this->interwikiMap = array_merge( $this->interwikiMap, [ $interwikis[$prefix] ] );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Load interwiki map to use as cache
|
||||||
|
// */
|
||||||
|
// private function loadInterwikiMap() {
|
||||||
|
// $interwikiMap = [];
|
||||||
|
// $siteList = $this->siteLookup->getSites();
|
||||||
|
// foreach ( $siteList as $site ) {
|
||||||
|
// $interwikis = $this->getSiteInterwikis( $site );
|
||||||
|
// $interwikiMap = array_merge( $interwikiMap, $interwikis );
|
||||||
|
// }
|
||||||
|
// $this->interwikiMap = $interwikiMap;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Get interwikiMap attribute, load if needed.
|
||||||
|
// *
|
||||||
|
// * @return Interwiki[]
|
||||||
|
// */
|
||||||
|
// private function getInterwikiMap() {
|
||||||
|
// if ( $this->interwikiMap === null ) {
|
||||||
|
// $this->loadInterwikiMap();
|
||||||
|
// }
|
||||||
|
// return $this->interwikiMap;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Load interwikis for the given site
|
||||||
|
// *
|
||||||
|
// * @param Site $site
|
||||||
|
// * @return Interwiki[]
|
||||||
|
// */
|
||||||
|
// private function getSiteInterwikis( Site $site ) {
|
||||||
|
// $interwikis = [];
|
||||||
|
// foreach ( $site->getInterwikiIds() as $interwiki ) {
|
||||||
|
// $url = $site->getPageUrl();
|
||||||
|
// if ( $site instanceof MediaWikiSite ) {
|
||||||
|
// $path = $site->getFileUrl( 'api.php' );
|
||||||
|
// } else {
|
||||||
|
// $path = '';
|
||||||
|
// }
|
||||||
|
// $local = $site->getSource() === 'local';
|
||||||
|
// // TODO: How to adapt trans?
|
||||||
|
// $interwikis[$interwiki] = new Interwiki(
|
||||||
|
// $interwiki,
|
||||||
|
// $url,
|
||||||
|
// $path,
|
||||||
|
// $site->getGlobalId(),
|
||||||
|
// $local
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return $interwikis;
|
||||||
|
// }
|
||||||
|
}
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.linkers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.linkers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
import gplx.langs.htmls.*;
|
import gplx.langs.htmls.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
/* TODO.XO
|
/* TODO.XO
|
||||||
* P7: $html = HtmlArmor::getHtml($text);
|
* P7: $html = HtmlArmor::getHtml($text);
|
||||||
* P3: getLinkUrl [alternate urls? EX: mw/wiki/index.php/title?]
|
* P3: getLinkUrl [alternate urls? EX: mw/wiki/index.php/title?]
|
||||||
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
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.langs.htmls.*;
|
import gplx.langs.htmls.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
import gplx.xowa.mediawiki.includes.linkers.*;
|
import gplx.xowa.mediawiki.includes.linkers.*;
|
||||||
/**
|
/**
|
||||||
* Holder of replacement pairs for wiki links
|
* Holder of replacement pairs for wiki links
|
||||||
|
@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
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.core.btries.*;
|
import gplx.core.btries.*;
|
||||||
import gplx.core.net.*;
|
import gplx.core.net.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
import gplx.xowa.mediawiki.includes.linkers.*;
|
import gplx.xowa.mediawiki.includes.linkers.*;
|
||||||
import gplx.xowa.mediawiki.includes.parsers.tables.*;
|
import gplx.xowa.mediawiki.includes.parsers.tables.*;
|
||||||
import gplx.xowa.mediawiki.includes.parsers.hrs.*;
|
import gplx.xowa.mediawiki.includes.parsers.hrs.*;
|
||||||
|
@ -14,7 +14,7 @@ GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
|||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
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.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
import gplx.xowa.mediawiki.includes.linkers.*;
|
import gplx.xowa.mediawiki.includes.linkers.*;
|
||||||
public interface XomwParserIface {
|
public interface XomwParserIface {
|
||||||
int nextLinkID();
|
int nextLinkID();
|
||||||
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.parsers.lnkes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
package gplx.xowa.mediawiki.includes.parsers.lnkes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||||
import gplx.core.btries.*; import gplx.core.primitives.*;
|
import gplx.core.btries.*; import gplx.core.primitives.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
/* TODO.XO
|
/* TODO.XO
|
||||||
* P3: $langObj->formatNum( ++$this->mAutonumber );
|
* P3: $langObj->formatNum( ++$this->mAutonumber );
|
||||||
* P2: $this->getConverterLanguage()->markNoConversion( $text );
|
* P2: $this->getConverterLanguage()->markNoConversion( $text );
|
||||||
|
@ -17,7 +17,7 @@ package gplx.xowa.mediawiki.includes.parsers.lnkis; import gplx.*; import gplx.x
|
|||||||
import gplx.core.btries.*; import gplx.core.primitives.*;
|
import gplx.core.btries.*; import gplx.core.primitives.*;
|
||||||
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.xwikis.*;
|
import gplx.xowa.wikis.nss.*; import gplx.xowa.wikis.xwikis.*;
|
||||||
import gplx.xowa.mediawiki.includes.parsers.*; import gplx.xowa.mediawiki.includes.parsers.quotes.*;
|
import gplx.xowa.mediawiki.includes.parsers.*; import gplx.xowa.mediawiki.includes.parsers.quotes.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*; import gplx.xowa.mediawiki.includes.linkers.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*; import gplx.xowa.mediawiki.includes.linkers.*;
|
||||||
import gplx.xowa.mediawiki.includes.libs.*;
|
import gplx.xowa.mediawiki.includes.libs.*;
|
||||||
import gplx.xowa.mediawiki.includes.media.*; import gplx.xowa.mediawiki.includes.filerepo.file.*;
|
import gplx.xowa.mediawiki.includes.media.*; import gplx.xowa.mediawiki.includes.filerepo.file.*;
|
||||||
import gplx.xowa.parsers.uniqs.*;
|
import gplx.xowa.parsers.uniqs.*;
|
||||||
|
@ -15,7 +15,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
|||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.parsers.magiclinks; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
package gplx.xowa.mediawiki.includes.parsers.magiclinks; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||||||
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.core.net.*;
|
import gplx.core.primitives.*; import gplx.core.btries.*; import gplx.core.net.*;
|
||||||
import gplx.xowa.mediawiki.includes.htmls.*;
|
import gplx.xowa.mediawiki.includes.xohtml.*;
|
||||||
import gplx.langs.regxs.*;
|
import gplx.langs.regxs.*;
|
||||||
// TODO.XO: this->getConverterLanguage()->markNoConversion($url, true),
|
// TODO.XO: this->getConverterLanguage()->markNoConversion($url, true),
|
||||||
public class Xomw_magiclinks_wkr {
|
public class Xomw_magiclinks_wkr {
|
||||||
|
@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.xohtml; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
public class Xomw_atr_itm {
|
public class Xomw_atr_itm {
|
||||||
public Xomw_atr_itm(int key_int, byte[] key, byte[] val) {
|
public Xomw_atr_itm(int key_int, byte[] key, byte[] val) {
|
||||||
this.key_int = key_int;
|
this.key_int = key_int;
|
@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.xohtml; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
public class Xomw_atr_mgr {
|
public class Xomw_atr_mgr {
|
||||||
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
private final Ordered_hash hash = Ordered_hash_.New_bry();
|
||||||
public int Len() {return hash.Len();}
|
public int Len() {return hash.Len();}
|
@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.xohtml; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
public class Xomw_html_elem {
|
public class Xomw_html_elem {
|
||||||
public Xomw_html_elem(byte[] name) {
|
public Xomw_html_elem(byte[] name) {
|
||||||
this.name = name;
|
this.name = name;
|
@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.xohtml; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
public class Xomw_opt_mgr {
|
public class Xomw_opt_mgr {
|
||||||
public boolean known;
|
public boolean known;
|
||||||
public boolean broken;
|
public boolean broken;
|
@ -13,7 +13,7 @@ The terms of each license can be found in the source code repository:
|
|||||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki.includes.htmls; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
package gplx.xowa.mediawiki.includes.xohtml; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||||||
public class Xomw_qry_mgr {
|
public class Xomw_qry_mgr {
|
||||||
public byte[] action;
|
public byte[] action;
|
||||||
public int redlink;
|
public int redlink;
|
Loading…
Reference in New Issue
Block a user