diff --git a/assets/mods/basegame/books/btex.xml b/assets/mods/basegame/books/btex.xml index e0d7dfccb..7437daf9c 100644 --- a/assets/mods/basegame/books/btex.xml +++ b/assets/mods/basegame/books/btex.xml @@ -9,61 +9,169 @@ - - + The Book What Is a Book -

This example book is designed to give you the example of the Book Language.

+

This example book is written to give readers the example of the Book Language.

-
What Really Is a Book
+
What Qualifies as a Book
-

A book is a collection of texts printed in a special way that allows them to be read easily, with - enumerable pages and insertion of other helpful resources, such as illustrations and hyperlinks.

+

Under the book typesetting system, a Book is a collection of texts typesetted for an improved + legibility, enumerable pages, with insertion of other helpful resources such as illustrations + and hyperlinks.

+

Books are considered as bound and always presented in two pages for reading.

+ + Writing a Book Using a Typewriter + +

Typewriter allows quick scribbling of the words in convenient manners, just click on them and get + writing!

+

But it comes with big downsides: you cannot type in multiple writing systems, cannot have defined + chapters and sections, cannot include any illustrations, no hyperlinks, and of course, ragged texts.

+

Typed papers are considered as non-bound and only one page at a time will be presented.

+

All in all, you cannot write a true Book using a typewriter.

+ + Writing a Book with Publishers and Printing Presses + +

Professional-looking texts, with all the benefits of a real Book can be made, or even mass-produced + easily with the help of publishers.

+

To have your precious texts to be printed, you must send your manuscripts to a publisher, and the + manuscript must be written in a special language: the .

+

allows concise description of the entire shape of your book, any style the book typesetting + system can support can be described and printing presses will produce the papers accordingly. + You can even try to mimic the look and feel of papers created using a typewriter, if you want to.

+ + + The + + Introduction + +

is a markup language based on XML, with a resemblance of the LaTeX. The + abstracts away the meticulous styling and typesetting configurations, so you can focus on writing + texts than debugging the LaTeX macros. This does come with a downside of not being able to change + the given style.

+

document is divided up to five parts: the Style Declaration, the + Cover, the Table of Contents, the + Manuscript, and the Index Page. Of which the + Style Declaration and the Manuscript is the mandatory parts.

+ + + The Style Declaration + +

The Style Declaration is the very first line of a document. Its syntax is as follows:

+ + + + <btexdoc cover="hardcover" inner="standard" papersize="standard"> + + +

The btexdoc tag takes three attributes: cover, inner and papersize.

+ + + The Cover + +

The Cover defines the text on the cover of the book. If your text has no cover, this part can be omitted. Its syntax is as follows:

+ + + + + + + <cover> +   <title>Title of your book</title> +   <subtitle>Subtitle if necessary</subtitle> +   <author>Who wrote this book</author> +   <edition>Edition information if necessary</edition> + </cover> + +

Only the title tag is mandatory. Cover texts will be printed using a special font that has wider + gaps between characters. The title text will be printed in a double-size.

+ + + The Table of Contents + +

The contents of the Table of Contents is filled in automatically by reading through your manuscript; + parts, chapters and sections will be added. Its syntax is as follows:

+ + + + <tocpage title="Custom page name if necessary"><tableofcontents /></tocpage> + + +

The optional title attribute allows a custom name can be given to this page. + If unspecified, the default name is “Table of Contents”.

+

The tag <tableofcontents /> is an internal tag used by the typesetter.

+ + + The Manuscript + +

This is the part where you actually write your body texts in. The body text can have the following tags:

+ +

Self-closing tags have no child tags. To use a self-closing tag, simply do <tagname />.

+ + +
Hyperlinking
+ +

Hyperlinks can be defined using index and a tags.

+ + + The Index Page + +

The contents of the Index Page is filled in automatically by reading through your manuscript. + All the usage of index tags will be shown here. Its syntax is as follows:

+ + + + <indexpage title="Custom page name if necessary"><tableofindices /></indexpage> + + +

The optional title attribute allows a custom name can be given to this page. If unspecified, + the default name is “Index”.

+ + + Ending the Document + +

The document must begin with the opening btexdoc tag, and therefore must + end with a matching closing tag. Simply write away </btexdoc> and the + document is finished.

+ + + Conclusion + +

The finished book description using can be sent to a publisher, and if there are no errors + on your submission, the printed books of specified number of copies will be delivered to your + location within a reasonable amount of business days. Happy writing!

-

- this page is intentionally left blank -

+

this page is intentionally left blank

- - - - Writing a Book Using Pen and Papers - -

If you open a book on a writing table, you will be welcomed with a - toolbar used to put other book elements, such as chapters and sections.

- - - - - Writing a Book Using a Typewriter - -

Typewriters can only write in a single style of font, chapters and - sections are not available.

- - - - - Writing a Book Using a Computer - -

Writing book using a computer requires the use of the Book Typesetting Engine Extended, or .

- -
Full Control of the Shape
- -

With you can fully control how your publishing would look like, - from a pile of papers that look like they have been typed out using typewriter, a pile of printouts - that have pictures in it, to a true hardcover book.

- -

This style is controlled using the cover attribute on the root tag, - with following values: typewriter, printout and hardcover.

- -

Typewriter and Printout are considered not-bound and readers will only see one page at a time, - while Hardcover is considered bound and two pages are presented to the readers.

-
diff --git a/assets/mods/basegame/books/literature/koKR/yisang_nalgae.xml b/assets/mods/basegame/books/literature/koKR/yisang_nalgae.xml index 3316a5eff..82faeac93 100644 --- a/assets/mods/basegame/books/literature/koKR/yisang_nalgae.xml +++ b/assets/mods/basegame/books/literature/koKR/yisang_nalgae.xml @@ -14,8 +14,9 @@

“테이프가 끊어지면 피가 나오. 생채기도 머지않아 완치될 줄 믿소. 굿바이.” 감정은 어떤 ‘포즈’. (그 ‘포즈’의 원소만을 지적하는 것이 아닌지 나도 모르겠소.) 그 포우즈가 부동자세에까지 고도화할 때 감정은 딱 공급을 정지합네다.

나는 내 비범한 발육을 회고하여 세상을 보는 안목을 규정하였소.

여왕봉과 미망인—세상의 하고 많은 여인이 본질적으로 이미 미망인이 아닌 이가 있으리까? 아니, 여인의 전부가 그 일상에 있어서 개개 ‘미망인’이라는 내 논리가 뜻밖에도 여성에 대한 모독이 되오? 굿바이. -

-

그 33번지라는 것이 구조가 흡사 유곽이라는 느낌이 없지 않다. +

+ +

그 33번지라는 것이 구조가 흡사 유곽이라는 느낌이 없지 않다.

한 번지에 18가구가 죽 어깨를 맞대고 늘어서서 창호가 똑같고 아궁이 모양이 똑같다. 게다가 각 가구에 사는 사람들이 송이송이 꽃과 같이 젊다.

해가 들지 않는다. 해가 드는 것을 그들이 모른 체하는 까닭이다. 턱살밑에다 철줄을 매고 얼룩 진 이부자리를 널어 말린다는 핑계로 미닫이에 해가 드는 것을 막아 버린다. 침침한 방안에서 낮잠들을 잔다. 그들은 밤에는 잠을 자지 않나? 알 수 없다. 나는 밤이나 낮이나 잠만 자느라고 그런 것을 알 길이 없다. 33번지 18가구의 낮은 참 조용하다.

조용한 것은 낮뿐이다. 어둑어둑하면 그들은 이부자리를 걷어 들인다. 전등불이 켜진 뒤의 18가구는 낮보다 훨씬 화려하다. 저물도록 미닫이 여닫는 소리가 잦다. 바빠진다. 여러 가지 냄새가 나기 시작한다. 비웃 굽는 내, 탕고도오랑내, 뜨물내, 비눗내. diff --git a/src/net/torvald/btex/BTeXParser.kt b/src/net/torvald/btex/BTeXParser.kt index 3b46a251b..98ad0f1ec 100644 --- a/src/net/torvald/btex/BTeXParser.kt +++ b/src/net/torvald/btex/BTeXParser.kt @@ -38,7 +38,7 @@ import kotlin.reflect.full.findAnnotation */ object BTeXParser { - internal val textTags = hashSetOf("P", "TITLE", "AUTHOR", "EDITION", "CHAPTER", "SECTION") + internal val textTags = hashSetOf("P", "PBOX", "TITLE", "AUTHOR", "EDITION", "CHAPTER", "SECTION", "LI") internal val textDecorTags = hashSetOf("SPAN", "CODE") operator fun invoke(file: FileHandle) = invoke(file.file()) @@ -590,7 +590,7 @@ object BTeXParser { @OpenTag // reflective access is impossible with 'private' fun processElemINDEXPAGE(handler: BTeXHandler, doc: BTeXDocument, uri: String, attribs: HashMap) { - doc.addNewPage() + if (doc.currentPageObj.isNotEmpty()) doc.addNewPage() val header = attribs["title"] ?: "Index" typesetChapterHeading(header, handler, 16) } @@ -725,7 +725,6 @@ object BTeXParser { typesetParagraphs("${ccDefault}――――――――――――", handler).also {it.first().let { it.posX += (doc.textWidth - it.width) / 2 } } - doc.linesPrintedOnPage[doc.currentPage] = (doc.linesPrintedOnPage[doc.currentPage] - 1).coerceAtLeast(0) handler.paragraphBuffer.clear() } @@ -792,8 +791,9 @@ object BTeXParser { } @CloseTag // reflective access is impossible with 'private' fun closeElemCHAPTER(handler: BTeXHandler, doc: BTeXDocument, uri: String, siblingIndex: Int) { - // insert new page for second+ chapters - if (siblingIndex > 0) doc.addNewPage() + // if current line is the last line, proceed to the next page + if (doc.linesPrintedOnPage.last() >= doc.pageLines - 2) doc.addNewPage() + val thePar = handler.paragraphBuffer.toString().trim() typesetChapterHeading(thePar, handler, 16) @@ -807,7 +807,7 @@ object BTeXParser { @CloseTag // reflective access is impossible with 'private' fun closeElemSECTION(handler: BTeXHandler, doc: BTeXDocument, uri: String, siblingIndex: Int) { // if current line is the last line, proceed to the next page - if (doc.linesPrintedOnPage.last() == doc.pageLines - 1) doc.addNewPage() + if (doc.linesPrintedOnPage.last() >= doc.pageLines - 1) doc.addNewPage() val thePar = handler.paragraphBuffer.toString().trim() typesetSectionHeading(thePar, handler, 8) diff --git a/src/net/torvald/terrarum/tests/BTeXTest.kt b/src/net/torvald/terrarum/tests/BTeXTest.kt index 1443526a1..f1b6f5831 100644 --- a/src/net/torvald/terrarum/tests/BTeXTest.kt +++ b/src/net/torvald/terrarum/tests/BTeXTest.kt @@ -27,8 +27,8 @@ import kotlin.system.measureTimeMillis class BTeXTest : ApplicationAdapter() { val filePath = "btex.xml" -// val filePath = "literature/en/daniel_defoe_robinson_crusoe.btexbin" -// val filePath = "literature/ruRU/anton_chekhov_palata_no_6.btexbin" +// val filePath = "literature/en/daniel_defoe_robinson_crusoe.xml" +// val filePath = "literature/ruRU/anton_chekhov_palata_no_6.xml" // val filePath = "literature/koKR/yisang_nalgae.btexbin"