Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare SILE.scratch.headers in twoside only #2087

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions classes/bible.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ local plain = require("classes.plain")
local class = pl.class(plain)
class._name = "bible"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is a joke.

When will we kill it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is a joke.

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er? What is supposed to be a "bible" class?

Food for thought: I did typeset many bibles (Freely-Given-org/BibleTypesetter#3 -- Still pending any sort of review and approval, which is sad, but anyway) without needing a "bible" class.

So what is supposed to be a "bible" class in layman terms?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bible typesetting comes with a standard set of features over and above what most books require. Defaulting to grid typesetting, having headers that keep track of the verse at start and end of pages for use in headers, multiple types of footnotes/cross references, etc. The bible class should build on the book class with a few default features available that cover common needs that aren't so common in regular books. Of course you don't have to use it, it's just a starting point.

Additionally it's where I'd put stuff to cover default processing functions for OSIS/USFM/whatever tags that don't have any relevance to non-Bible content.


if not SILE.scratch.headers then
SILE.scratch.headers = {}
end

class.defaultFrameset = {
content = {
left = "8.3%pw",
Expand Down
3 changes: 0 additions & 3 deletions classes/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ function class:_init (options)
insertInto = "footnotes",
stealFrom = { "content" },
})
if not SILE.scratch.headers then
SILE.scratch.headers = {}
end
end

function class:endPage ()
Expand Down
3 changes: 3 additions & 0 deletions packages/twoside/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ function package:_init (options)
end)
self.class:registerHook("newpage", spreadHook)
self.class:registerHook("newpage", switchPage)
if not SILE.scratch.headers then
SILE.scratch.headers = {}
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place "twoside" uses headers scratch are in \open-spread -- but is it approached as it should, there?

Is even this command \open-spread in the right package/module? Is the solution general? (The answer is obviously "no" to me, so I'd like seeing good rationales for it...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is even this command \open-spread in the right package/module?

I have no idea... Where do you think it should be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea... Where do you think it should be?

My deep feeling is that only the class knows how to handle page breaks and what do to with "empty" pages, (based on the reason why it it introducing them with so-called spreads).

It's hard to explain with the "limited" book class provided by SILE, but I can try, based on my experience designing books with my own resilient.book class (again, it does have some flaws I am aware of, however)1:

  • Consider a \part (yep, resilient has these) followed by a chapter, and both open on odd pages, so a blank even page is gonna be inserted in between. Are you in a "novel" or in a "technical documentation"? Why I am asking? 'Cause in a novel, usually, the book name is on even pages (so it's not a problem to repeat it, at least), but in a technical documentation, the chapter name is usually on even pages (so it has to be cleared after a part...)
  • Consider a \chapter followed by another chapter, also opening on an odd page2, and a blank even page might be needed. Same question, but trickier: to which chapter belongs the empty page? Should it have a header (not to say a footer), and which one? There's no simple answer, except that "it depends" on some publisher preferences...

And here we're indeed discussing parts, chapters, etc. -- that is, things that are (currently) a class-design topic.

Footnotes

  1. If you read its doc, you'll see for instance that resilient uses its own header logic, and that it has provision for "novel" and "technical" headers... Though the underlying implementation is a bit of a hack.

  2. Though that ought to be configurable: Some books do allow chapters to begin on even pages... No wonder it took me years to design my resilient.book solution, as all styling decisions are configurable -- and suddenly, all sort of edge cases pop up :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanation, I got your point.

Well, I did this PR without ever thinking about twoside not being the most suitable place for open-spread or that scratch is about to deprecate... For me it was way simpler.

end

function package:registerCommands ()
Expand Down
Loading