我剛追蹤到某專案中一次崩潰的原因,出於一行代碼。不幸的是,當某人為 FRT 書籍撰寫範本時犯了一個錯誤,導致這行代碼被包含在內:
\rem sorta will sort by \toc1, sortb by \toc2, sortc by \toc3
這幾乎肯定會導致崩潰或未定義的行為。
如果您的前言(Front matter)包含該行,請修改它,使其讀作:
\rem sorta will sort by toc1, sortb by toc2 , sortc by toc3
也就是說,移除斜線。否則您將遇到崩潰。
早期版本的 USFM 標準有些模糊,但 Paratext 和 USFM-3 標準並未將 \rem 描述為「忽略此行的其餘部分」,而是將其描述為一種不產生輸出的段落樣式。
這意味著:
-
\rem 持續到下一個段落標記
-
\rem 仍必須處理其包含的任何標記。(否則它如何發現下一個段落標記?)
- 由於
\toc1 及其相關標記也被描述為段落標記(儘管未以此方式使用),它們應該取消 \rem
I’ve just tracked down the cause of a crash on someone’s project to a line Unfortunately there was a think-o when someone was writing the template for FRT books, and this line was included:
\rem sorta will sort by \toc1, sortb by \toc2, sortc by \toc3
This is pretty much guaranteed to cause a crash / undefined behaviour.
If you have a Front matter that includes that line, change it so that it reads:
\rem sorta will sort by toc1, sortb by toc2 , sortc by toc3
I.e. remove the slashes. Otherwise you will experience crashes.
Earlier versions of the USFM standard were a bit vague, but Paratext and the USFM-3 standard do NOT describe \rem as ‘ignore the rest of this line’, but as a paragraph style that produces no output.
This means:
-
\rem continues until the next paragraph marker
-
\rem still has to process any markers it contains. (how else will it spot the next paragraph-marker?).
- Since
\toc1 and friends are also described as paragraph markers (although not used as such) they should cancel \rem
機器翻譯自 English