模板:Xiangqi diagram plus/doc
使用Lua語言編寫: |
{{Xiangqi diagram}}的擴展版,可用於顯示一盤象棋對局的局面。
使用方法
編輯基本功能
編輯與{{Xiangqi diagram}}基本相同。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例1 |车|马|象|士|将|士|象|马|车 | | | | | | | | | | |砲| | | | | |砲| |卒| |卒| |卒| |卒| |卒 | | | | | | | | | | | | | | | | | | |兵| |兵| |兵| |兵| |兵 | |炮| | | | | |炮| | | | | | | | | | |伡|㐷|相|仕|帅|仕|相|㐷|伡 |(说明文字) |size=25 }} |
示例1 (說明文字) |
擴展功能
編輯顯示特殊標記
編輯在從第3到第92個參數中,除了填入棋子的中文名或英文代碼外,還可以填入某些特定代碼,在棋盤上顯示相對應的標記。
- 輸入「[]」,可在相應位置顯示一個方框。可用於突出強調某塊區域、某個棋子,或表示當前正在移動的棋子。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例2 | | | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | | | |砲| | | | | | | | | | | | | | | | |[㐷]| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |帅| | | |“㐷” |size=25 }} |
示例2 「傌」 |
- 輸入「..」,可在相應位置顯示一個圓點,可用於表示某個棋子的起落點、允許着法等。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例3 | | | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | |..| |.砲.| | | | | |..| | | |.. | | | | | | |[㐷]| | | | | | |..| | | |.. | | | | | |..| |..| | | | | | | | | | | | | | | |帅| | | |马踏八方 |size=25 }} |
示例3 馬踏八方 |
- 輸入「xx」,可在相應位置顯示一個叉號,可用於表示某個棋子的禁止着法等。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例4 | | | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | |.砲.| |..| | | | | |..| | | |xx | | | | | | |[㐷]|卒| | | | | |..| | | |xx | | | | | |xx| |..| | | | | | | | | | | | | | | |帅| | | |“蹩马腿”/禁止“送将” |size=25 }} |
示例4 「蹩馬腿」/禁止「送將」 |
顯示指定範圍
編輯可使用rows、startrow、cols、startcol等參數讓棋圖的一部分可見,其餘部分則隱藏:
- rows參數用以控制需要顯示的行數,startrow參數指定起始行數。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例5 | | | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | |..| |.砲.| | | | | |..| | | |.. | | | | | | |[㐷]| | | | | | |..| | | |.. | | | | | |..| |..| | | | | | | | | | | | | | | |帅| | | |从第三行开始显示,共显示6行 |size=40 |rows=6 |startrow=3 }} |
示例5 從第三行開始顯示,共顯示6行 |
- cols參數用以控制需要顯示的列數,startcol參數指定起始列數。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例6 | | | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | |..| |.砲.| | | | | |..| | | |.. | | | | | | |[㐷]| | | | | | |..| | | |.. | | | | | |..| |..| | | | | | | | | | | | | | | |帅| | | |从第三行开始显示,共显示6行<br/>从第四列开始显示,共显示6列 |size=50 |rows=6 |startrow=3 |cols=6 |startcol=4 }} |
示例6 從第三行開始顯示,共顯示6行 從第四列開始顯示,共顯示6列 |
顯示箭頭
編輯此功能需要CSS3(層疊樣式表第三份標準)的支持,不支持CSS3的瀏覽器(如Internet Explorer 8等)可能無法正確顯示
- arrow參數用於顯示箭頭,可更直觀的展示某個棋子的行棋路線。
- 格式:
arrow = a, b, c, d
- arrow由四個數字組成,用英文逗號分隔。第一個數(a)為箭頭的起始橫坐標,第二個數(b)為箭頭的起始縱坐標,第三個數(c)為箭頭長度,第四個數(d)為箭頭的旋轉角度。坐標以最左上角的交叉點位作為原點(1, 1)。角度以右箭頭(→)作為0°,按順時針旋轉。
- 若要使用多個箭頭可以用arrow2或者是更大的數字和arrow組合,但需要從2開始且必須是連續數字,例如需要五個箭頭則必須設定arrow、arrow2、arrow3、arrow4、arrow5。
源代碼 | 頁面顯示效果 |
---|---|
{{Xiangqi diagram plus |tleft |示例7 | | | |士|将|士| | | | | | | | | | | | | | | | |傌| | | | | | | | | | | | | | | | | | | | | | | | |炮| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |帅| | | | |size=25 |arrow=3, 6, 2, 0 }} |
示例7 |
{{Xiangqi diagram plus |tleft |示例8 |车| | | |将| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |帅| | | | |size=25 |arrow=1, 1, 9, 90 }} |
示例8 |
{{Xiangqi diagram plus |tleft |示例9 |车| | | |将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |伡 | | | | | | | | | | | | | | |帅| | | | |size=25 |arrow=9, 8, 4, 180 }} |
示例9 |
{{Xiangqi diagram plus |tleft |示例10 |车| | | |将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |炮 | | | | | | | | | | | | | | |帅| | | | |size=25 |arrow=9, 8, 7, 270 }} |
示例10 |
{{Xiangqi diagram plus |tleft |示例11 | | | |士|将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |炮| | | | | | |相| | |帅| | | | |size=25 |arrow=3, 10, 2.8, 315 }} |
示例11 |
{{Xiangqi diagram plus |tleft |示例12 | | | |士|将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |傌| | | | | | | | | | | | | | | | | | | | | | | | | | | |炮| | | | | | | | | |帅| | | | |size=25 |arrow=4, 6, 2.2, 63.4 }} |
示例12 |
{{Xiangqi diagram plus |tleft |示例13 | | | |士|将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |傌| | | | | | | | | | | | | | | | | | | |炮| | | | | | | | | |帅| | | | |size=25 |arrow=3, 7, 2.2, 26.6 }} |
示例13 |
{{Xiangqi diagram plus |tleft |示例14 | | | |士|将|士| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |仕| | | | | | | | | | | | | | | | | | |炮|帅| | | | |size=25 |arrow=4, 8, 1.4, 45 }} |
示例14 |