internal/util

Values

pub fn casefold(s: String) -> String

Unicode casefold (for labels)

pub fn collapse_interior_space(s: String) -> String
pub fn count_spaces(line: String, acc: Int) -> Int
pub fn do_countdrop_spaces(
  line: String,
  spaces: Int,
  count: Int,
) -> #(Int, String)
pub fn do_drop_spaces(line: String, spaces: Int) -> String
pub fn drop_3_spaces(line: String) -> String
pub fn drop_all_blockquote_markers(line: String) -> String
pub fn drop_blockquote_marker(line: String) -> String

Removes the blockquote marker from the beginning of the line, and also expands any tab following the blockquote marker

pub fn drop_indent(line: String, count: Int) -> String

Strip indent from the beginning of the line while expanding indent tabs

pub fn drop_marker(
  line: String,
  marker: String,
  indent: Int,
) -> String
pub fn expand_tabs(s: String, col: Int) -> String
pub fn expand_tabs_blockquote(s: String, col: Int) -> String
pub fn expand_tabs_full(s: String, col: Int) -> String
pub fn expand_tabs_indent(s: String) -> #(String, Int)
pub fn find_indent(line: String) -> Int

Figure out the indent of the line with tab stop at 4

pub fn gobble_hspace(in: String) -> String
pub fn gobble_link_label(rest: String) -> #(String, String)
pub fn has_list_marker(line: String, marker: String) -> Bool

Presuppose that this IS a list item starting line If so, does it have a matching line marker to the given marker?

pub fn is_a_html_tag(
  in: String,
  anchor_start: Bool,
  anchor_end: Bool,
) -> Bool
pub fn is_blank(line: String) -> Bool
pub fn is_blankn(line: String) -> Bool
pub fn is_empty_list(line: String) -> Bool
pub fn is_html_block(tag: String) -> Bool
pub fn length_with_tabstop(s: String) -> Int

Returns the length of the string with tab expansion

pub fn parse_bullet_item(
  line: String,
) -> Result(#(String, Int), Nil)

Returns Ok(#(marker, indent)) or Error(Nil)

pub fn parse_link_dest(
  in: String,
  value: fn(document.Destination, String) -> Result(a, Nil),
) -> Result(a, Nil)

expects to find a link destination.. can be empty can be < … > can end with ) or eof

pub fn parse_link_dest_tag(
  in: String,
  value: fn(document.Destination, String) -> Result(c, Nil),
) -> Result(c, Nil)
pub fn parse_link_title(
  in: String,
  value: fn(option.Option(String), String) -> Result(b, Nil),
) -> Result(b, Nil)

a successful parse leaves the state pointing at a )

pub fn parse_ordinal_item(
  line: String,
) -> Result(#(String, Int, Int), Nil)

Returns Ok(#(marker, indent, ord)) or Error(Nil)

pub fn range(
  p: atto.Parser(a, t, s, c, e),
  from: Int,
  to: Int,
) -> atto.Parser(List(a), t, s, c, e)
pub fn strip_indent(line: String) -> #(String, Int)

Calculate and strip the indent of the line returns the stripped line and indent

pub fn try_atto(
  in: atto.ParserInput(String, String),
  parser: atto.Parser(value, String, String, Nil, d),
  cont: fn() -> a,
  value: fn(value) -> a,
) -> a
pub fn unless_atto(
  in: atto.ParserInput(String, String),
  parser: atto.Parser(value, String, String, Nil, d),
  cont: fn() -> a,
  value: fn() -> a,
) -> a
pub fn unwrap_map(
  r: Result(a, Nil),
  ok_fn: fn(a) -> b,
  errval: b,
) -> b
Search Document