jenkins-bot has submitted this change and it was merged.
Change subject: Add prefix option to anchor string generator
..
Add prefix option to anchor string generator
Change-Id: I27f181645a12b7f711507091bb4194c8fdbdbcab
---
M MathQueryObject.php
M MathSearch.hooks.php
M SpecialUploadResult.php
M maintenance/CreateBaseXMathTable.php
M maintenance/CreateMWSHarvest.php
5 files changed, 8 insertions(+), 8 deletions(-)
Approvals:
Physikerwelt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MathQueryObject.php b/MathQueryObject.php
index 7aeae76..3ecc1e9 100644
--- a/MathQueryObject.php
+++ b/MathQueryObject.php
@@ -67,7 +67,7 @@
$title = Title::newFromId( $this-getPageID() );
$absUrl =
$title-getFullURL( array( oldid =
$title-getLatestRevID() ) ) .
- MathSearchHooks::generateMathAnchorString(
$title-getLatestRevID(), $this-getAnchorID() );
+ MathSearchHooks::generateMathAnchorString(
$title-getLatestRevID(), $this-getAnchorID(), '' );
return TeX
\begin{topic}{{$this-getPageTitle()}-{$this-getAnchorID()}}
\begin{fquery}\${$this-getTeXQuery()}\$\end{fquery}
diff --git a/MathSearch.hooks.php b/MathSearch.hooks.php
index 60d99b3..12cd3c5 100644
--- a/MathSearch.hooks.php
+++ b/MathSearch.hooks.php
@@ -207,7 +207,7 @@
if ( preg_match( '#math(.*)?\sid=(?Pid[\w\.]+)#', $Result,
$matches ) ) {
$rendererId = $matches['id'];
$oldId = self::curId2OldId( $pid );
- $newID = self::generateMathAnchorString($oldId,$eid);
+ $newID = self::generateMathAnchorString( $oldId, $eid,
'' );
$Result = str_replace( $rendererId, $newID, $Result );
}
return true;
@@ -225,7 +225,7 @@
return true;
}
- static function generateMathAnchorString($pageID, $anchorID){
- return #math.$pageID.$anchorID;
+ static function generateMathAnchorString($pageID, $anchorID, $prefix =
#){
+ return {$prefix}math.$pageID.$anchorID;
}
}
diff --git a/SpecialUploadResult.php b/SpecialUploadResult.php
index 9f569cc..b980765 100644
--- a/SpecialUploadResult.php
+++ b/SpecialUploadResult.php
@@ -187,8 +187,8 @@
} else {
$renderedMath = $md5;
}
- $formulaId = MathSearchHooks::generateMathAnchorString(
$row['oldId'], $row['fId'] );
- $link=Revision::newFromId( $row['oldId']
)-getTitle()-getCanonicalURL().#$formulaId;
+ $formulaId = MathSearchHooks::generateMathAnchorString(
$row['oldId'], $row['fId'] );
+ $link=Revision::newFromId( $row['oldId']
)-getTitle()-getCanonicalURL().$formulaId;
$this-getOutput()-addHTML(trtd${row['qId']}/tdtda
href=\${link}\$formulaId/a/td
td${row['rank']}/tdtd$renderedMath/td/tr);
}
diff --git a/maintenance/CreateBaseXMathTable.php
b/maintenance/CreateBaseXMathTable.php
index 6ce615d..fb0945a 100644
--- a/maintenance/CreateBaseXMathTable.php
+++ b/maintenance/CreateBaseXMathTable.php
@@ -59,7 +59,7 @@
return ;
}
$out .= \n . self::$mwsns . expr url=\ .
- MathSearchHooks::generateMathAnchorString(
$row-mathindex_page_id, $row-mathindex_anchor ) . \\n\t;
+ MathSearchHooks::generateMathAnchorString(
$row-mathindex_page_id, $row-mathindex_anchor, '' ) . \\n\t;
$out .= utf8_decode( $row-math_mathml );//
$xml-math-children()-asXML();
$out .= \n/ . self::$mwsns . expr\n;
// TODO: This does not work yet.
diff --git a/maintenance/CreateMWSHarvest.php b/maintenance/CreateMWSHarvest.php
index 8a5b8e6..876cafb 100644
--- a/maintenance/CreateMWSHarvest.php
+++ b/maintenance/CreateMWSHarvest.php
@@ -58,7 +58,7 @@
// if ( $xml-math ) {
// $smath = $xml-math-semantics- { 'annotation-xml'
} -children()-asXML();
$out .= \n . self::$mwsns . expr url=\ .
- MathSearchHooks::generateMathAnchorString(
$row-mathindex_page_id, $row-mathindex_anchor ) .
+ MathSearchHooks::generateMathAnchorString(
$row-mathindex_page_id, $row-mathindex_anchor, '' ) .
\\n\t;
$out .= utf8_decode( $row-math_mathml );//
$xml-math-children()-asXML();
$out .= \n/ . self::$mwsns . expr\n;
--
To view, visit https://gerrit.wikimedia.org/r/178979
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I27f181645a12b7f711507091bb4194c8fdbdbcab
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MathSearch