Skip to content

Commit

Permalink
Improve the docs slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Apr 14, 2023
1 parent be62e14 commit 31918c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ line option.
### Quarto / R Markdown

The use of this filter with either Quarto or R Markdown is
discouraged, as both systems ship with their own fork of this
*discouraged*, as both systems ship with their own fork of this
extension. Use those instead.

Note also that Quarto allows to use the [`{{ pagebreak }}`
Expand Down
6 changes: 5 additions & 1 deletion pagebreak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ local function newpage(format, pagebreak)
end
end

--- Checkes whether a the given string contains a LaTeX pagebreak or
--- newpage command.
local function is_newpage_command(command)
return command:match '^\\newpage%{?%}?$'
or command:match '^\\pagebreak%{?%}?$'
end

-- Returns a filter function for RawBlock elements, checking for LaTeX
-- pagebreak/newpage commands; returns `nil` when the target format is latex.
-- pagebreak/newpage commands; returns `nil` when the target format is
-- latex.
local function latex_pagebreak (pagebreak)
-- Don't do anything if the output is TeX
if FORMAT:match 'tex$' then
Expand Down Expand Up @@ -107,6 +110,7 @@ local function ascii_pagebreak (raw_pagebreak)
end
end

--- Filter function; this is the entrypoint when used as a filter.
function Pandoc (doc)
local config = doc.meta.pagebreak or {}
local break_on = config['break-on'] or {}
Expand Down

0 comments on commit 31918c6

Please sign in to comment.