scrivener_html_semi v3.0.1 Scrivener.HTML.Parse View Source
Link to this section Summary
Functions
Return default options.
Returns the raw data in order to generate the proper HTML for pagination.
Link to this section Functions
Return default options.
Link to this function
get_page_range(page_number, total_pages, range, left_distance, right_distance)
View SourceReturns the raw data in order to generate the proper HTML for pagination.
Default options
Default options are supplied as following:
[range: 5, prev: "PREV", next: "NEXT", first?: true, last?: true, ellipsis: {:safe, "…"}]
:range
declares how many pages are shown. It should be an integer greater than or equal to 3.:prev
and:next
declares text for previous and next buttons. Generally, they are string. Falsy values will remove them from output.:first?
andlast?
declares whether to show first / last page and corresponding ellipsis.:ellipsis
declares the text shown as ellipsis.
Return value
Return value is a list of tuples. The tuple is in a {text, page_number}
format
where text
is intended to be the text of the link and page_number
is the
page number it should go to.
Examples
iex> parse(%Scrivener.Page{total_pages: 10, page_number: 5}, [])
[
{"PREV", 4},
{1, 1},
{:ellipsis, {:safe, "…"}},
{4, 4},
{5, 5},
{6, 6},
{:ellipsis, {:safe, "…"}},
{10, 10},
{"NEXT", 6}
]