Compare commits
10 commits
68983e9a80
...
4da53e4e00
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4da53e4e00 | ||
|
|
41e8b8d5e7 | ||
|
|
637e4121dc | ||
|
|
ce24650bfa | ||
|
|
a973a62478 | ||
|
|
c4e9f987f1 | ||
|
|
b99dcc23bc | ||
|
|
e751026153 | ||
|
|
f4bd2c03a4 | ||
|
|
b9ae5c0b22 |
12 changed files with 205 additions and 119 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5cb6026104f0a622b82721edf8510e75597ecc6c
|
Subproject commit 3ef08eb81ec11e009cf79bc92ba172b59c073001
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit e7201baf478d38b0ddf5b8e5f625e83f69c9c3bf
|
Subproject commit 8c1e853e2e7f08d20e0c78309509c90b46f73bae
|
||||||
|
|
@ -368,7 +368,14 @@ class HtmlInputTransformHelper {
|
||||||
throw new LocalizedHttpException( new MessageValue( "rest-bad-etag", [ $key ] ), 400 );
|
throw new LocalizedHttpException( new MessageValue( "rest-bad-etag", [ $key ] ), 400 );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$originalRendering = ParsoidRenderID::newFromKey( $key );
|
try {
|
||||||
|
$originalRendering = ParsoidRenderID::newFromKey( $key );
|
||||||
|
} catch ( InvalidArgumentException $e ) {
|
||||||
|
throw new LocalizedHttpException(
|
||||||
|
new MessageValue( 'rest-parsoid-bad-render-id', [ $key ] ),
|
||||||
|
400
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif ( !empty( $original['html'] ) || !empty( $original['data-parsoid'] ) ) {
|
} elseif ( !empty( $original['html'] ) || !empty( $original['data-parsoid'] ) ) {
|
||||||
// NOTE: We might have an incomplete PageBundle here, with no HTML but with data-parsoid!
|
// NOTE: We might have an incomplete PageBundle here, with no HTML but with data-parsoid!
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@
|
||||||
"rest-unsupported-target-format": "The requested target format is not supported.",
|
"rest-unsupported-target-format": "The requested target format is not supported.",
|
||||||
"rest-parsoid-resource-exceeded": "Resource limit exceeded",
|
"rest-parsoid-resource-exceeded": "Resource limit exceeded",
|
||||||
"rest-parsoid-error": "Parsoid error.",
|
"rest-parsoid-error": "Parsoid error.",
|
||||||
|
"rest-parsoid-bad-render-id": "Bad Parsoid render ID: $1",
|
||||||
"rest-bad-stash-key": "Bad stash key.",
|
"rest-bad-stash-key": "Bad stash key.",
|
||||||
"rest-html-key-expected": "Expected <var>html</var> key in body",
|
"rest-html-key-expected": "Expected <var>html</var> key in body",
|
||||||
"rest-invalid-transform": "Invalid transform: $1 to $2",
|
"rest-invalid-transform": "Invalid transform: $1 to $2",
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@
|
||||||
"rest-transform-missing-title": "Error message for REST API debugging, shown when no title or wikitext is provided",
|
"rest-transform-missing-title": "Error message for REST API debugging, shown when no title or wikitext is provided",
|
||||||
"rest-unsupported-target-format": "Error message for REST API debugging, shown when the requested target format is not supported",
|
"rest-unsupported-target-format": "Error message for REST API debugging, shown when the requested target format is not supported",
|
||||||
"rest-parsoid-resource-exceeded": "Error message for REST API debugging, shown when a resource limit is exceeded while converting between wikitext and HTML.",
|
"rest-parsoid-resource-exceeded": "Error message for REST API debugging, shown when a resource limit is exceeded while converting between wikitext and HTML.",
|
||||||
|
"rest-parsoid-bad-render-id": "Error message for REST API debugging, shown when a ParsoidRenderID object cannot be created from the provided key. Parameters:\n* $1: The key",
|
||||||
"rest-parsoid-error": "Error message for REST API debugging, indicating an unspecified backend error occurred while converting between wikitext and HTML.\n\n[[:mw:Parsoid|Parsoid]] is the name of a software library; do not translate that name.",
|
"rest-parsoid-error": "Error message for REST API debugging, indicating an unspecified backend error occurred while converting between wikitext and HTML.\n\n[[:mw:Parsoid|Parsoid]] is the name of a software library; do not translate that name.",
|
||||||
"rest-bad-stash-key": "Error message for REST API debugging, shown when When the rednerid or etag given in the request is not a valid stash key.",
|
"rest-bad-stash-key": "Error message for REST API debugging, shown when When the rednerid or etag given in the request is not a valid stash key.",
|
||||||
"rest-html-key-expected": "Error message for REST API debugging, shown when when the \"html\" key is missing from the request body",
|
"rest-html-key-expected": "Error message for REST API debugging, shown when when the \"html\" key is missing from the request body",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ namespace MediaWiki\Edit;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use MediaWiki\Parser\ParserOutput;
|
use MediaWiki\Parser\ParserOutput;
|
||||||
use Stringable;
|
use Stringable;
|
||||||
|
use function count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the identity of a specific rendering of a specific revision
|
* Represents the identity of a specific rendering of a specific revision
|
||||||
|
|
@ -37,12 +38,14 @@ class ParsoidRenderID implements Stringable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function newFromKey( string $key ): self {
|
public static function newFromKey( string $key ): self {
|
||||||
[ $revisionID, $uniqueID ] = explode( '/', $key, 2 );
|
$parts = explode( '/', $key, 2 );
|
||||||
|
|
||||||
if ( $revisionID === null || $uniqueID === null ) {
|
if ( count( $parts ) < 2 ) {
|
||||||
throw new InvalidArgumentException( 'Bad key: ' . $key );
|
throw new InvalidArgumentException( 'Bad key: ' . $key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ $revisionID, $uniqueID ] = $parts;
|
||||||
|
|
||||||
return new self( (int)$revisionID, $uniqueID );
|
return new self( (int)$revisionID, $uniqueID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,7 @@ $specialPageAliases = [
|
||||||
'Mypage' => [ '我的用户页' ],
|
'Mypage' => [ '我的用户页' ],
|
||||||
'Mytalk' => [ '我的讨论页', '我的对话页' ],
|
'Mytalk' => [ '我的讨论页', '我的对话页' ],
|
||||||
'Myuploads' => [ '我上传的文件', '我的文件' ],
|
'Myuploads' => [ '我上传的文件', '我的文件' ],
|
||||||
|
'NamespaceInfo' => [ '命名空间信息' ],
|
||||||
'Newimages' => [ '新建文件', '新建图像' ],
|
'Newimages' => [ '新建文件', '新建图像' ],
|
||||||
'Newpages' => [ '新建页面' ],
|
'Newpages' => [ '新建页面' ],
|
||||||
'NewSection' => [ '新章节' ],
|
'NewSection' => [ '新章节' ],
|
||||||
|
|
|
||||||
|
|
@ -139,118 +139,146 @@ $namespaceAliases = [
|
||||||
|
|
||||||
/** @phpcs-require-sorted-array */
|
/** @phpcs-require-sorted-array */
|
||||||
$specialPageAliases = [
|
$specialPageAliases = [
|
||||||
'Activeusers' => [ '活躍使用者' ],
|
'Activeusers' => [ '活躍使用者' ],
|
||||||
'Allmessages' => [ '所有訊息' ],
|
'Allmessages' => [ '所有訊息' ],
|
||||||
'AllMyUploads' => [ '所有我的上傳', '所有我的檔案', '所有本人上載', '所有本人檔案' ],
|
'AllMyUploads' => [ '所有我的上傳', '所有我的檔案', '所有本人上載', '所有本人檔案' ],
|
||||||
'Allpages' => [ '所有頁面' ],
|
'Allpages' => [ '所有頁面' ],
|
||||||
'Ancientpages' => [ '最舊頁面', '最早頁面' ],
|
'Ancientpages' => [ '最舊頁面', '最早頁面' ],
|
||||||
'ApiHelp' => [ 'Api使用說明' ],
|
'ApiHelp' => [ 'API說明', 'API使用說明' ],
|
||||||
'Badtitle' => [ '無效標題' ],
|
'ApiSandbox' => [ 'API沙盒' ],
|
||||||
'Blankpage' => [ '空白頁面' ],
|
'AuthenticationPopupSuccess' => [ '認證成功彈窗' ],
|
||||||
'Block' => [ '封鎖', '封鎖IP', '封鎖使用者', '封禁', '封禁IP', '封禁使用者' ],
|
'AutoblockList' => [ '自動封鎖清單', '列出自動封鎖' ],
|
||||||
'BlockList' => [ '封鎖清單', 'IP封鎖清單', '封禁列表', 'IP封禁列表' ],
|
'Badtitle' => [ '無效標題' ],
|
||||||
'Booksources' => [ '書籍來源', '網路書源' ],
|
'Blankpage' => [ '空白頁面' ],
|
||||||
'BrokenRedirects' => [ '損壞的重新導向', '損壞的重定向頁' ],
|
'Block' => [ '封鎖', '封鎖IP', '封鎖使用者', '封禁', '封禁IP', '封禁使用者' ],
|
||||||
'Categories' => [ '分類', '頁面分類' ],
|
'BlockList' => [ '封鎖清單', 'IP封鎖清單', '封禁列表', 'IP封禁列表' ],
|
||||||
'ChangeEmail' => [ '更改信箱', '修改郵箱' ],
|
'Booksources' => [ '書籍來源', '網路書源' ],
|
||||||
'ChangePassword' => [ '更改密碼', '修改密碼', '密碼重設' ],
|
'BotPasswords' => [ '機器人密碼' ],
|
||||||
'ComparePages' => [ '頁面比較' ],
|
'BrokenRedirects' => [ '損壞的重新導向', '損壞的重定向頁' ],
|
||||||
'Confirmemail' => [ '確認信箱', '確認電郵' ],
|
'Categories' => [ '分類', '頁面分類' ],
|
||||||
'Contributions' => [ '使用者貢獻', '用戶貢獻' ],
|
'ChangeContentModel' => [ '變更內容模型' ],
|
||||||
'CreateAccount' => [ '建立帳號', '建立帳戶' ],
|
'ChangeCredentials' => [ '變更憑證' ],
|
||||||
'Deadendpages' => [ '無連結頁面', '斷鏈頁面' ],
|
'ChangeEmail' => [ '變更信箱', '修改郵箱' ],
|
||||||
'DeletedContributions' => [ '已刪除的貢獻', '已刪除的用戶貢獻' ],
|
'ChangePassword' => [ '變更密碼', '修改密碼', '密碼重設' ],
|
||||||
'Diff' => [ '編輯差異' ],
|
'ComparePages' => [ '頁面比較' ],
|
||||||
'DoubleRedirects' => [ '雙重的重新導向', '雙重重定向頁面' ],
|
'Confirmemail' => [ '確認信箱', '確認電郵' ],
|
||||||
'EditWatchlist' => [ '編輯監視清單', '編輯監視列表' ],
|
'Contribute' => [ '做出貢獻' ],
|
||||||
'Emailuser' => [ '寄信給使用者', '寄信', '電郵使用者' ],
|
'Contributions' => [ '使用者貢獻', '用戶貢獻' ],
|
||||||
'ExpandTemplates' => [ '展開模板' ],
|
'CreateAccount' => [ '建立帳號', '建立帳戶' ],
|
||||||
'Export' => [ '匯出', '匯出頁面' ],
|
'Deadendpages' => [ '無連結頁面', '斷鏈頁面' ],
|
||||||
'Fewestrevisions' => [ '最少修訂頁面' ],
|
'DeletedContributions' => [ '已刪除的貢獻', '已刪除的用戶貢獻' ],
|
||||||
'FileDuplicateSearch' => [ '重複檔案搜尋', '搜尋重複檔案' ],
|
'DeletePage' => [ '刪除頁面', '刪除' ],
|
||||||
'Filepath' => [ '檔案路徑' ],
|
'Diff' => [ '編輯差異' ],
|
||||||
'Import' => [ '匯入', '匯入頁面' ],
|
'DoubleRedirects' => [ '雙重的重新導向', '雙重重定向頁面' ],
|
||||||
'Invalidateemail' => [ '無效的信箱' ],
|
'EditPage' => [ '編輯頁面', '編輯' ],
|
||||||
'JavaScriptTest' => [ 'JavaScript測試' ],
|
'EditRecovery' => [ '編輯恢復' ],
|
||||||
'LinkSearch' => [ '連結搜尋', '搜尋網頁連結' ],
|
'EditTags' => [ '編輯標籤' ],
|
||||||
'Listadmins' => [ '管理員清單', '管理員列表' ],
|
'EditWatchlist' => [ '編輯監視清單', '編輯監視列表' ],
|
||||||
'Listbots' => [ '機器人清單', '機械人列表' ],
|
'Emailuser' => [ '寄信給使用者', '寄信', '電郵使用者' ],
|
||||||
'ListDuplicatedFiles' => [ '重複檔案清單', '重複檔案列表' ],
|
'ExpandTemplates' => [ '展開模板' ],
|
||||||
'Listfiles' => [ '檔案清單', '圖片清單', '檔案列表', '圖像列表' ],
|
'Export' => [ '匯出', '匯出頁面' ],
|
||||||
'Listgrouprights' => [ '群組權限清單', '使用者群組權限', '群組權限列表' ],
|
'Fewestrevisions' => [ '最少修訂頁面' ],
|
||||||
'Listredirects' => [ '重新導向清單', '重定向頁面列表' ],
|
'FileDuplicateSearch' => [ '重複檔案搜尋', '搜尋重複檔案' ],
|
||||||
'Listusers' => [ '使用者清單', '使用者列表' ],
|
'Filepath' => [ '檔案路徑' ],
|
||||||
'Lockdb' => [ '鎖定資料庫', '鎖定數據庫' ],
|
'GoToInterwiki' => [ '前往跨wiki頁面' ],
|
||||||
'Log' => [ '日誌' ],
|
'Import' => [ '匯入', '匯入頁面' ],
|
||||||
'Lonelypages' => [ '孤立頁面' ],
|
'Invalidateemail' => [ '無效的信箱' ],
|
||||||
'Longpages' => [ '過長的頁面', '長頁面' ],
|
'JavaScriptTest' => [ 'JavaScript測試' ],
|
||||||
'MediaStatistics' => [ '媒體統計' ],
|
'LinkAccounts' => [ '連結帳號' ],
|
||||||
'MergeHistory' => [ '合併歷史' ],
|
'LinkSearch' => [ '連結搜尋', '搜尋網頁連結' ],
|
||||||
'MIMEsearch' => [ 'MIME搜尋' ],
|
'Listadmins' => [ '管理員清單', '管理員列表' ],
|
||||||
'Mostcategories' => [ '最多分類的頁面', '最多分類頁面' ],
|
'Listbots' => [ '機器人清單', '機械人列表' ],
|
||||||
'Mostimages' => [ '被連結最多的檔案', '最多連結檔案' ],
|
'ListDuplicatedFiles' => [ '重複檔案清單', '重複檔案列表' ],
|
||||||
'Mostinterwikis' => [ '最多_Interwiki_連結的頁面', '最多跨wiki連結' ],
|
'Listfiles' => [ '檔案清單', '圖片清單', '檔案列表', '圖像列表' ],
|
||||||
'Mostlinked' => [ '被連結最多的頁面', '最多連結頁面' ],
|
'Listgrants' => [ '列出授權' ],
|
||||||
'Mostlinkedcategories' => [ '被連結最多的分類', '最多連結分類' ],
|
'Listgrouprights' => [ '群組權限清單', '使用者群組權限', '群組權限列表' ],
|
||||||
'Mostlinkedtemplates' => [ '被引用最多的頁面', '被連結最多的模板', '被使用最多的模板' ],
|
'Listredirects' => [ '重新導向清單', '重定向頁面列表' ],
|
||||||
'Mostrevisions' => [ '最多修訂的頁面', '最多修訂頁面' ],
|
'Listusers' => [ '使用者清單', '使用者列表' ],
|
||||||
'Movepage' => [ '移動頁面' ],
|
'Lockdb' => [ '鎖定資料庫', '鎖定數據庫' ],
|
||||||
'Mycontributions' => [ '我的貢獻' ],
|
'Log' => [ '日誌' ],
|
||||||
'MyLanguage' => [ '我的語言' ],
|
'Lonelypages' => [ '孤立頁面' ],
|
||||||
'Mypage' => [ '我的使用者頁面', '我的用戶頁' ],
|
'Longpages' => [ '過長的頁面', '長頁面' ],
|
||||||
'Mytalk' => [ '我的對話', '我的討論頁' ],
|
'MediaStatistics' => [ '媒體統計' ],
|
||||||
'Myuploads' => [ '我的上傳', '我的上載', '我的檔案' ],
|
'MergeHistory' => [ '合併歷史' ],
|
||||||
'Newimages' => [ '新增檔案', '新增圖片' ],
|
'MIMEsearch' => [ 'MIME搜尋' ],
|
||||||
'Newpages' => [ '新增頁面', '新頁面' ],
|
'Mostcategories' => [ '最多分類的頁面', '最多分類頁面' ],
|
||||||
'PageLanguage' => [ '頁面語言' ],
|
'Mostimages' => [ '被連結最多的檔案', '最多連結檔案' ],
|
||||||
'PagesWithProp' => [ '擁有屬性的頁面', '帶屬性頁面' ],
|
'Mostinterwikis' => [ '最多跨wiki連結的頁面', '最多_Interwiki_連結的頁面', '最多跨wiki連結' ],
|
||||||
'PasswordReset' => [ '重設密碼' ],
|
'Mostlinked' => [ '被連結最多的頁面', '最多連結頁面' ],
|
||||||
'PermanentLink' => [ '靜態連結', '永久連結' ],
|
'Mostlinkedcategories' => [ '被連結最多的分類', '最多連結分類' ],
|
||||||
'Preferences' => [ '偏好設定' ],
|
'Mostlinkedtemplates' => [ '被引用最多的頁面', '被連結最多的模板', '被使用最多的模板' ],
|
||||||
'Prefixindex' => [ '字首索引', '前綴索引' ],
|
'Mostrevisions' => [ '最多修訂的頁面', '最多修訂頁面' ],
|
||||||
'Protectedpages' => [ '受保護頁面', '已保護頁面' ],
|
'Movepage' => [ '移動頁面' ],
|
||||||
'Protectedtitles' => [ '受保護標題', '已保護標題' ],
|
'Mute' => [ '靜音' ],
|
||||||
'RandomInCategory' => [ '隨機分類頁面', '於分類中隨機' ],
|
'Mycontributions' => [ '我的貢獻' ],
|
||||||
'Randompage' => [ '隨機頁面' ],
|
'MyLanguage' => [ '我的語言' ],
|
||||||
'Randomredirect' => [ '隨機重新導向', '隨機重定向頁面' ],
|
'Mylog' => [ '我的日誌' ],
|
||||||
'Randomrootpage' => [ '隨機根頁面' ],
|
'Mypage' => [ '我的使用者頁面', '我的用戶頁' ],
|
||||||
'Recentchanges' => [ '最近變更', '最近更改' ],
|
'Mytalk' => [ '我的對話', '我的討論頁' ],
|
||||||
'Recentchangeslinked' => [ '已連結的最近變更', '相關變更', '連出更改' ],
|
'Myuploads' => [ '我的上傳', '我的上載', '我的檔案' ],
|
||||||
'Redirect' => [ '重新導向', '重定向' ],
|
'NamespaceInfo' => [ '命名空間資訊' ],
|
||||||
'Renameuser' => [ '重新命名使用者' ],
|
'Newimages' => [ '新增檔案', '新增圖片' ],
|
||||||
'ResetTokens' => [ '重設密鑰', '覆寫令牌' ],
|
'Newpages' => [ '新增頁面', '新頁面' ],
|
||||||
'Revisiondelete' => [ '修訂刪除', '刪除或恢復版本' ],
|
'NewSection' => [ '新章節' ],
|
||||||
'RunJobs' => [ '執行作業', '運行工作' ],
|
'PageData' => [ '頁面資料' ],
|
||||||
'Search' => [ '搜尋' ],
|
'PageHistory' => [ '頁面歷史', '歷史' ],
|
||||||
'Shortpages' => [ '過短的頁面', '短頁面' ],
|
'PageInfo' => [ '頁面資訊', '資訊' ],
|
||||||
'Specialpages' => [ '特殊頁面' ],
|
'PageLanguage' => [ '頁面語言' ],
|
||||||
'Statistics' => [ '統計資訊' ],
|
'PagesWithProp' => [ '擁有屬性的頁面', '帶屬性頁面' ],
|
||||||
'Tags' => [ '標籤' ],
|
'PasswordPolicies' => [ '密碼原則' ],
|
||||||
'TrackingCategories' => [ '追蹤分類', '跟蹤分類' ],
|
'PasswordReset' => [ '重設密碼' ],
|
||||||
'Unblock' => [ '解除封鎖', '解除封禁', '解禁' ],
|
'PermanentLink' => [ '固定連結', '靜態連結', '永久連結' ],
|
||||||
'Uncategorizedcategories' => [ '未分類的分類', '未歸類分類' ],
|
'Preferences' => [ '偏好設定' ],
|
||||||
'Uncategorizedimages' => [ '未分類的檔案', '未分類的圖片', '未歸類檔案' ],
|
'Prefixindex' => [ '前綴索引', '字首索引' ],
|
||||||
'Uncategorizedpages' => [ '未分類的頁面', '未歸類頁面' ],
|
'Protectedpages' => [ '受保護頁面', '已保護頁面' ],
|
||||||
'Uncategorizedtemplates' => [ '未分類的模板', '未歸類模板' ],
|
'Protectedtitles' => [ '受保護標題', '已保護標題' ],
|
||||||
'Undelete' => [ '取消刪除' ],
|
'ProtectPage' => [ '保護頁面', '保護' ],
|
||||||
'Unlockdb' => [ '解除鎖定資料庫', '解除資料庫鎖定' ],
|
'Purge' => [ '更新快取' ],
|
||||||
'Unusedcategories' => [ '未使用的分類', '未使用分類' ],
|
'RandomInCategory' => [ '隨機分類頁面', '於分類中隨機' ],
|
||||||
'Unusedimages' => [ '未使用的檔案', '未使用檔案' ],
|
'Randompage' => [ '隨機頁面' ],
|
||||||
'Unusedtemplates' => [ '未使用的模板', '未使用模板' ],
|
'Randomredirect' => [ '隨機重新導向', '隨機重定向頁面' ],
|
||||||
'Unwatchedpages' => [ '未監視的頁面', '未被監視的頁面' ],
|
'Randomrootpage' => [ '隨機根頁面' ],
|
||||||
'Upload' => [ '上傳', '上載檔案' ],
|
'Recentchanges' => [ '最近變更', '最近更改' ],
|
||||||
'UploadStash' => [ '上傳儲藏庫' ],
|
'Recentchangeslinked' => [ '已連結的最近變更', '相關變更', '連出更改' ],
|
||||||
'Userlogin' => [ '使用者登入' ],
|
'Redirect' => [ '重新導向', '重定向' ],
|
||||||
'Userlogout' => [ '使用者登出' ],
|
'RemoveCredentials' => [ '移除憑證' ],
|
||||||
'Userrights' => [ '使用者權限' ],
|
'Renameuser' => [ '重新命名使用者' ],
|
||||||
'Version' => [ '版本', '版本資訊' ],
|
'ResetTokens' => [ '重設密鑰', '覆寫令牌' ],
|
||||||
'Wantedcategories' => [ '需要的分類', '待撰分類' ],
|
'RestSandbox' => [ 'REST沙盒' ],
|
||||||
'Wantedfiles' => [ '需要的檔案' ],
|
'Revisiondelete' => [ '修訂刪除', '刪除或恢復版本' ],
|
||||||
'Wantedpages' => [ '需要的頁面', '待撰頁面' ],
|
'RunJobs' => [ '執行作業', '運行工作' ],
|
||||||
'Wantedtemplates' => [ '需要的模板' ],
|
'Search' => [ '搜尋' ],
|
||||||
'Watchlist' => [ '監視清單' ],
|
'Shortpages' => [ '過短的頁面', '短頁面' ],
|
||||||
'Whatlinkshere' => [ '連入頁面' ],
|
'Specialpages' => [ '特殊頁面' ],
|
||||||
'Withoutinterwiki' => [ '無跨wiki連結頁面', '無跨維基連結頁面' ],
|
'Statistics' => [ '統計資訊' ],
|
||||||
|
'Tags' => [ '標籤' ],
|
||||||
|
'TalkPage' => [ '討論頁' ],
|
||||||
|
'TrackingCategories' => [ '追蹤分類', '跟蹤分類' ],
|
||||||
|
'Unblock' => [ '解除封鎖', '解除封禁', '解禁' ],
|
||||||
|
'Uncategorizedcategories' => [ '未分類的分類', '未歸類分類' ],
|
||||||
|
'Uncategorizedimages' => [ '未分類的檔案', '未分類的圖片', '未歸類檔案' ],
|
||||||
|
'Uncategorizedpages' => [ '未分類的頁面', '未歸類頁面' ],
|
||||||
|
'Uncategorizedtemplates' => [ '未分類的模板', '未歸類模板' ],
|
||||||
|
'Undelete' => [ '取消刪除' ],
|
||||||
|
'UnlinkAccounts' => [ '解除連結帳號' ],
|
||||||
|
'Unlockdb' => [ '解除鎖定資料庫', '解除資料庫鎖定' ],
|
||||||
|
'Unusedcategories' => [ '未使用的分類', '未使用分類' ],
|
||||||
|
'Unusedimages' => [ '未使用的檔案', '未使用檔案' ],
|
||||||
|
'Unusedtemplates' => [ '未使用的模板', '未使用模板' ],
|
||||||
|
'Unwatchedpages' => [ '未監視的頁面', '未被監視的頁面' ],
|
||||||
|
'Upload' => [ '上傳', '上載檔案' ],
|
||||||
|
'UploadStash' => [ '上傳儲藏庫' ],
|
||||||
|
'Userlogin' => [ '使用者登入' ],
|
||||||
|
'Userlogout' => [ '使用者登出' ],
|
||||||
|
'Userrights' => [ '使用者權限' ],
|
||||||
|
'Version' => [ '版本', '版本資訊' ],
|
||||||
|
'Wantedcategories' => [ '需要的分類', '待撰分類' ],
|
||||||
|
'Wantedfiles' => [ '需要的檔案' ],
|
||||||
|
'Wantedpages' => [ '需要的頁面', '待撰頁面' ],
|
||||||
|
'Wantedtemplates' => [ '需要的模板' ],
|
||||||
|
'Watchlist' => [ '監視清單' ],
|
||||||
|
'Whatlinkshere' => [ '連入頁面' ],
|
||||||
|
'Withoutinterwiki' => [ '無跨wiki連結頁面', '無跨維基連結頁面' ],
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @phpcs-require-sorted-array */
|
/** @phpcs-require-sorted-array */
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3cc5ea9debd9ecf3fd4a0b87a7d98dd69f816262
|
Subproject commit 4fb4f38f2a69dd525898a64acef6924ef5c45d67
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit b8febf782b5291d85c0d7a5f97fca9fd1b21abac
|
Subproject commit e3a1e3b3fc73f4c5257a2774a68105899952c307
|
||||||
|
|
@ -1188,6 +1188,20 @@ class HtmlInputTransformHelperTest extends MediaWikiIntegrationTestCase {
|
||||||
$helper->getContent();
|
$helper->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testHandlesInvalidRenderID(): void {
|
||||||
|
$page = $this->getExistingTestPage( __METHOD__ );
|
||||||
|
|
||||||
|
$body = [ 'html' => 'hi', 'original' => [ 'renderid' => 'foo' ] ];
|
||||||
|
$params = [];
|
||||||
|
|
||||||
|
$this->expectExceptionObject( new LocalizedHttpException(
|
||||||
|
new MessageValue( 'rest-parsoid-bad-render-id', [ 'foo' ] ),
|
||||||
|
400
|
||||||
|
) );
|
||||||
|
|
||||||
|
$this->newHelper( [], StatsFactory::newNull(), $page, $body, $params );
|
||||||
|
}
|
||||||
|
|
||||||
private function newHtmlToContentTransform( $html, $methodOverrides = [] ): HtmlToContentTransform {
|
private function newHtmlToContentTransform( $html, $methodOverrides = [] ): HtmlToContentTransform {
|
||||||
$transform = $this->getMockBuilder( HtmlToContentTransform::class )
|
$transform = $this->getMockBuilder( HtmlToContentTransform::class )
|
||||||
->onlyMethods( array_keys( $methodOverrides ) )
|
->onlyMethods( array_keys( $methodOverrides ) )
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace MediaWiki\Tests\Unit\Edit;
|
namespace MediaWiki\Tests\Unit\Edit;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use MediaWiki\Edit\ParsoidRenderID;
|
use MediaWiki\Edit\ParsoidRenderID;
|
||||||
use MediaWikiUnitTestCase;
|
use MediaWikiUnitTestCase;
|
||||||
|
|
||||||
|
|
@ -68,4 +69,34 @@ class ParsoidRenderIdTest extends MediaWikiUnitTestCase {
|
||||||
yield [ '"1/foo"XXX' ];
|
yield [ '"1/foo"XXX' ];
|
||||||
yield [ 'XXX"1/foo"' ];
|
yield [ 'XXX"1/foo"' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideNewFromKey
|
||||||
|
* @covers \MediaWiki\Edit\ParsoidRenderID::newFromKey
|
||||||
|
*/
|
||||||
|
public function testNewFromKey( string $key, ParsoidRenderID $expected ): void {
|
||||||
|
$actual = ParsoidRenderID::newFromKey( $key );
|
||||||
|
$this->assertSame( $expected->getKey(), $actual->getKey() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function provideNewFromKey(): iterable {
|
||||||
|
yield [ '1/abc', new ParsoidRenderID( 1, 'abc' ) ];
|
||||||
|
yield [ '2/bar', new ParsoidRenderID( 2, 'bar' ) ];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider provideBadKeys
|
||||||
|
* @covers \MediaWiki\Edit\ParsoidRenderID::newFromKey
|
||||||
|
*/
|
||||||
|
public function testBadNewFromKey( $key ): void {
|
||||||
|
$this->expectException( InvalidArgumentException::class );
|
||||||
|
$this->expectExceptionMessage( "Bad key: $key" );
|
||||||
|
|
||||||
|
ParsoidRenderID::newFromKey( $key );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function provideBadKeys(): iterable {
|
||||||
|
yield [ '' ];
|
||||||
|
yield [ '1' ];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue