mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
btex: new macro 'resetchapterafterpart'
This commit is contained in:
@@ -234,6 +234,7 @@
|
||||
<li><index id="thechapter (macro)"/><code>thechapter</code> — Chapter heading. Default: <code>%1$s</code></li>
|
||||
<li><index id="chaptertype (macro)"/><code>chaptertype</code> — Default style of the <code>chapter</code> tag. Default: <code>1</code></li>
|
||||
<li><index id="chapteronnewpage (macro)"/><code>chapteronnewpage</code> — Controls if a chapter must start on a new page. Put non-zero value to enable this behaviour. Default: <code>0</code></li>
|
||||
<li><index id="resetchapterafterpart (macro)"/><code>resetchapterafterpart</code> — Controls if the chapter number should reset after a part. Put non-zero value to enable this behaviour. Default: <code>0</code></li>
|
||||
<li><index id="parindent (macro)"/><code>parindent</code> — Controls the indentation size of the paragraphs. Default: <code>16</code></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@
|
||||
<li><index id="thechapter (매크로)"/><code>thechapter</code> — 장 제목 번호. 기본값: <code>%1$s</code></li>
|
||||
<li><index id="chaptertype (매크로)"/><code>chaptertype</code> — <code>chapter</code> 태그의 기본 스타일. 기본값: <code>1</code></li>
|
||||
<li><index id="chapteronnewpage (매크로)"/><code>chapteronnewpage</code> — 새 페이지에서 장이 시작되게 하기. 활성화하려면 0이 아닌 임의의 값을 넣을 것. 기본값: <code>0</code></li>
|
||||
<li><index id="resetchapterafterpart (매크로)"/><code>resetchapterafterpart</code> — 부(part) 뒤에 오는 장번호가 1에서 시작되게 하기. 활성화하려면 0이 아닌 임의의 값을 넣을 것. 기본값: <code>0</code></li>
|
||||
<li><index id="parindent (매크로)"/><code>parindent</code> — 문단의 들여쓰기 크기를 조절함. 기본값: <code>16</code></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ object BTeXParser {
|
||||
"thechapter" to "%1\$s",
|
||||
"chaptertype" to "1",
|
||||
"chapteronnewpage" to "0",
|
||||
"resetchapterafterpart" to "0",
|
||||
"parindent" to "16"
|
||||
)
|
||||
|
||||
@@ -1325,7 +1326,21 @@ object BTeXParser {
|
||||
@CloseTag // reflective access is impossible with 'private'
|
||||
fun closeElemCHAPTER(handler: BTeXHandler, doc: BTeXDocument, uri: String, siblingIndex: Int) {
|
||||
val partOrder = cptSectMap.count { it.type.startsWith("part") }
|
||||
val cptOrder = cptSectMap.count { it.type.startsWith("chapter") } + 1
|
||||
val cptOrder = if (macrodefs["resetchapterafterpart"] != "0") {
|
||||
var cnt = cptSectMap.size - 1
|
||||
var sectOrder = 0
|
||||
while (cnt >= 0) {
|
||||
if (cptSectMap[cnt].type.startsWith("chapter")) {
|
||||
sectOrder += 1
|
||||
}
|
||||
else break
|
||||
|
||||
cnt -= 1
|
||||
}
|
||||
sectOrder + 1
|
||||
}
|
||||
else
|
||||
cptSectMap.count { it.type.startsWith("chapter") } + 1
|
||||
|
||||
val thePar = paragraphBuffer.toString().trim()
|
||||
|
||||
@@ -1364,7 +1379,22 @@ object BTeXParser {
|
||||
if (doc.linesPrintedOnPage.last() >= doc.pageLines - 1) doc.addNewPage(progressIndicator)
|
||||
|
||||
val partOrder = cptSectMap.count { it.type.startsWith("part") }
|
||||
val cptOrder = cptSectMap.count { it.type.startsWith("chapter") }
|
||||
val cptOrder = if (macrodefs["resetchapterafterpart"] != "0") {
|
||||
var cnt = cptSectMap.size - 1
|
||||
var sectOrder = 0
|
||||
while (cnt >= 0) {
|
||||
if (cptSectMap[cnt].type.startsWith("chapter")) {
|
||||
sectOrder += 1
|
||||
}
|
||||
else break
|
||||
|
||||
cnt -= 1
|
||||
}
|
||||
sectOrder + 1
|
||||
}
|
||||
else
|
||||
cptSectMap.count { it.type.startsWith("chapter") } + 1
|
||||
|
||||
var sectOrder = 1
|
||||
|
||||
var cnt = cptSectMap.size - 1
|
||||
|
||||
Reference in New Issue
Block a user