Skip to content

Commit

Permalink
fix 同時修改 anchor 和 display_text。
Browse files Browse the repository at this point in the history
  • Loading branch information
kanasimi committed Jan 7, 2024
1 parent ed97cf6 commit daf9c4e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion routine/20201008.fix_anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ node 20201008.fix_anchor.js use_language=en "check_page=Sergio Pérez"
node 20201008.fix_anchor.js use_language=en "check_page=Wikipedia:Sandbox" only_modify_pages=Wikipedia:Sandbox
node 20201008.fix_anchor.js use_language=en "check_page=List of Latin phrases (full)" "only_modify_pages=Quod vide"
node 20201008.fix_anchor.js use_language=en "check_page=History of India" "only_modify_pages=History of Hinduism"
node 20201008.fix_anchor.js use_language=en "check_page=Law & Order: Special Victims Unit (season 1)"
node 20201008.fix_anchor.js archives use_language=zh only_modify_pages=Wikipedia:沙盒
node 20201008.fix_anchor.js archives use_language=zh "check_page=負整數" "only_modify_pages=負整數"
node 20201008.fix_anchor.js use_language=de "check_page=Scream 2" "only_modify_pages=Scream 2"
Expand Down Expand Up @@ -1392,7 +1393,8 @@ async function check_page(target_page_data, options) {
&& !token[2].toString().includes(to_anchor)) {
// 同時修改 anchor 和 display_text。
// e.g., [[w:de:Special:Diff/238049015]]: [[#ABCDE|{{lang|en|ABCDE}}]]
token[2] = token[2].toString().replace(original_anchor, to_anchor);
// [[w:en:Special:Diff/1193911830]]: [[Skateboarding trick#manual|manuals]]
token[2] = token[2].toString().replace(new RegExp('([\\W]|^)' + CeL.to_RegExp_pattern(original_anchor) + '([\\W]|$)'), `$1${to_anchor}$2`);
}
token[1] = to_anchor ? '#' + to_anchor : '';
}
Expand Down

0 comments on commit daf9c4e

Please sign in to comment.