Scrivener.HTML.Parse (scrivener_html_semi v3.1.1) 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, "…"}]:rangedeclares how many pages are shown. It should be an integer greater than or equal to 3.:prevand:nextdeclares 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.:ellipsisdeclares the text shown as ellipsis.
Return value
Return value is a list of tuples.
Examples
iex> parse(%Scrivener.Page{total_pages: 10, page_number: 5}, [])
[
{:prev, 4, "PREV"},
{1, 1},
{:ellipsis, {:safe, "…"}},
{4, 4},
{5, 5},
{6, 6},
{:ellipsis, {:safe, "…"}},
{10, 10},
{:next, 6, "NEXT"}
]