添加詩歌索引最簡單的方法是,使用如下 Changes.txt 規則來複製 \s 詩歌標題的內容:
'(\\s )([^\\]+)( ?\r?\n)' > '\\toc1 \2\3\1\2\3'
這表示,查找 \s 章節標題,並將該匹配組稱為 1。
然後獲取該標題的內容/文字,並將該匹配組稱為 2。
獲取行尾(至少需要一個 \n,但在最終的 \n 之前可能有一個空格和/或 \r),並將該匹配組稱為 3。
然後,在替換側,放入新的標記 \toc1,後接組 2 的內容和行尾部分。然後將其他所有內容恢復為原樣(1,2,3)。
這些 \toc1 欄位現在應該會被識別並用於目錄中。
請注意,您也可以使用這些相同的 \toc1 標記生成排序後的(目錄),作為詩歌集末尾的索引。只需使用 \ztoc|sorta\* 而不是 \ztoc|main\*
The easiest way to add an index of songs is to duplicate the contents of the \s Song Titles using a Changes.txt rule like this:
'(\\s )([^\\]+)( ?\r?\n)' > '\\toc1 \2\3\1\2\3'
This says, look for a \s section heading and call that match-group 1.
Then grab the content/text of that heading, calling that match-group 2.
Grab the end of line (which needs at least an \n but might have a space and/or \r before the final \n) and call that match-group 3.
Then, on the replace-with side, put in the new marker \toc1 followed by the contents of 2 and the end of line piece. Then put everything else back as you found it (1,2,3).
These \toc1 fields should now get picked up and used in the Table of Contents.
Note that you can also generate a sorted (table of contents) from these same \toc1 markers for an index at the back of the song book. Just use \ztoc|sorta\* instead of \ztoc|main\*
機器翻譯自 English