Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

morebits: Add addMaintenanceTag #215

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

Xi-Plus
Copy link
Member

@Xi-Plus Xi-Plus commented May 20, 2021

Morebits.wiki.page下新增該函數能根據內容模型自動添加模板。

測試此函數:

var page = new Morebits.wiki.page(mw.config.get('wgPageName'));
page.load((page)=>{
    page.setHatnoteRegex(Twinkle.hatnoteRegex); // Only for wikitext
    page.addMaintenanceTag('{{d|G1}}/* G1 */');
    page.setEditSummary('Test addMaintenanceTag');
    page.save(()=>{
        location.reload();
    });
});

equals += '=';
}
ctx.pageText = "require('Module:Module wikitext')._addText([" + equals + '[' + tag + ']' + equals + ']);\n' + ctx.pageText;
} else if (['javascript', 'css', 'sanitized-css'].indexOf(ctx.contentModel) !== -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要是內容模型是text好像也可以這樣加

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我不確定你講的 1. text是否指wikitext 2. 是否指wikitext可同javascript處理,但總之我覺得不行。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指的是 https://w.wiki/3R8U 的內容模組 "text"

Copy link

@a2569875 a2569875 Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

見此 https://zh.wikipedia.org/wiki/User:A2569875/FakeText.txt
頁面內容模型 : 純文字

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建議讓其格式為 /* _addText : "tag" */ 以顯示模板。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我想等方針正式通過再根據方針處理,以免又有什麼變動。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants