~/bend-docscommunity

linkify.bend checks

raw source on the hub · import 0x3db8fc3ab5ba012b34ead11a441dd57c/linkify.bend as Linkify

bible-linkify surface (pure Bend): protect-aware Markdown walker + plain matcher

4 imports
import Base
import ./route.bend as Route
import ./protect.bend as Prot
import ./parse.bend as P

Types

type LinkOpts source · line 11 · raw

Data

Linkify options (baseUrl / src / rewriteExisting), matching bible-linkify.

type TvPh source · line 37 · raw

Data

Peek trailing " (ESV)" after a match — does not consume; code or "".

type SigPh source · line 219 · raw

Data

--- Passage signal ---

type TrPh source · line 257 · raw

Data

--- Trim wrappers: drop lead wrappers, reverse, drop lead (ex-trail), reverse ---

type TcPh source · line 305 · raw

Data

type VisCan source · line 397 · raw

Data

type CandGate source · line 400 · raw

Data

type TwPh source · line 436 · raw

Data

type ExPh source · line 473 · raw

Data

--- Urlish ---

type NaPh source · line 550 · raw

Data

type PlPh source · line 584 · raw

Data

--- Plain linkify ---

type LpGate source · line 800 · raw

Data

type FullHit2 source · line 803 · raw

Data

type MlPh source · line 875 · raw

Data

--- Extract label from [label](url); "" if image or malformed ---

type RwEq source · line 1002 · raw

Data

type RwPick source · line 1027 · raw

Data

type MdWalk source · line 1065 · raw

Data

--- Markdown walker ---

Definitions

def char1 source · line 7 · raw

@+c:Char -> String

def default_opts source · line 14 · raw

LinkOpts

def opts_base source · line 17 · raw

@+base:String -> @+src:String -> @rewrite:Bool -> LinkOpts

def linkify_parts source · line 20 · raw

@+visible:String -> @+canonical:String -> String

def linkify_parts_qv source · line 23 · raw

@+visible:String -> @+canonical:String -> @+translation:String -> String

def linkify_parts_opts source · line 26 · raw

@+visible:String -> @+canonical:String -> @+translation:String -> @+opts:LinkOpts -> String

def tv_letter_ok source · line 49 · raw

@+letters:Nat -> Bool

def tv_digit_ok source · line 52 · raw

@+digits:Nat -> Bool

def peek_translation_go source · line 55 · raw

@fuel:Nat -> @ph:TvPh -> @rest:String -> String

def peek_translation source · line 158 · raw

@+suffix:String -> String

def is_newline source · line 165 · raw

@+c:Char -> Bool

def is_alnum source · line 170 · raw

@+c:Char -> Bool

def is_wrapper_lead source · line 173 · raw

@+c:Char -> Bool

def is_wrapper_trail source · line 188 · raw

@+c:Char -> Bool

def has_signal_go source · line 223 · raw

@fuel:Nat -> @ph:SigPh -> @rest:String -> Bool

def has_passage_signal source · line 253 · raw

@+s:String -> Bool

def is_wrapper_either source · line 261 · raw

@+c:Char -> Bool

def trim_pass_go source · line 264 · raw

@fuel:Nat -> @ph:TrPh -> @rest:String -> String

def trim_pass source · line 287 · raw

@+s:String -> String

def trim_wrappers source · line 290 · raw

@+s:String -> String

def is_colon_dot_dash source · line 294 · raw

@+c:Char -> Bool

--- Candidate take ---

def is_cand_char source · line 299 · raw

@+c:Char -> Bool

def pick_sp source · line 316 · raw

@has_d:Bool -> @+n:Nat -> TcPh

def take_cand_go source · line 323 · raw

@fuel:Nat -> @ph:TcPh -> @+rest:String -> @acc:String -> String

def take_candidate source · line 393 · raw

@+s:String -> String

def cand_pick source · line 404 · raw

@empty:Bool -> @+visible:String -> @+canonical:String -> CandGate

def cand_from source · line 411 · raw

@+visible:String -> @+canonical:String -> CandGate

def try_parse_visible_gated source · line 414 · raw

@g:CandGate -> Maybe<&2, VisCan>

def try_parse_visible source · line 421 · raw

@+visible:String -> Maybe<&2, VisCan>

def drop_last_rev source · line 426 · raw

@rev:String -> String

def drop_last source · line 433 · raw

@s:String -> String

def try_windows_go source · line 442 · raw

@fuel:Nat -> @ph:TwPh -> Maybe<&2, VisCan>

def try_windows source · line 469 · raw

@+raw:String -> Maybe<&2, VisCan>

def expand_token_left source · line 477 · raw

@fuel:Nat -> @ph:ExPh -> @+left_rev:String -> @acc:String -> String

def expand_token_right source · line 500 · raw

@fuel:Nat -> @ph:ExPh -> @+right:String -> @acc:String -> String

def token_around source · line 523 · raw

@+prefix_rev:String -> @+matched:String -> @+suffix:String -> String

def is_urlish_token source · line 532 · raw

@+tok:String -> Bool

def is_book_num source · line 541 · raw

@+c:Char -> Bool

def looks_like_ref_start source · line 547 · raw

@+c:Char -> Bool

def not_alnum_next_go source · line 553 · raw

@ph:NaPh -> Bool

def not_alnum_next source · line 562 · raw

@next_suffix:String -> Bool

def standalone_from_prev source · line 569 · raw

@prev_alnum:Bool -> @+next_suffix:String -> Bool

def standalone_ok source · line 576 · raw

@+prev_rev:String -> @+next_suffix:String -> Bool

def pick_pl_ref source · line 597 · raw

@at_start:Bool -> PlPh

def pick_pl source · line 604 · raw

@is_ref:Bool -> @at_start:Bool -> PlPh

def linkify_plain_go source · line 631 · raw

@fuel:Nat -> @ph:PlPh -> @+rest:String -> @+prev_rev:String -> @out:String -> @+opts:LinkOpts -> String

def classify_rest source · line 808 · raw

@exact:Bool -> @+visible:String -> @+canonical:String -> @+rest:String -> FullHit2

def classify_hit source · line 815 · raw

@m:Maybe<&2, VisCan> -> @+text:String -> FullHit2

def linkify_plain_from_hit source · line 829 · raw

@h:FullHit2 -> @+text:String -> @+opts:LinkOpts -> String

def linkify_plain_gated source · line 855 · raw

@g:LpGate -> @+text:String -> @+opts:LinkOpts -> String

def linkify_plain_opts source · line 868 · raw

@+text:String -> @+opts:LinkOpts -> String

def linkify_plain source · line 871 · raw

@+text:String -> String

def md_label_go source · line 886 · raw

@fuel:Nat -> @ph:MlPh -> @rest:String -> String

def md_extract_label source · line 995 · raw

@+token:String -> String

def rewrite_from_eq source · line 1005 · raw

@g:RwEq -> @+opts:LinkOpts -> String

def rewrite_from_parse source · line 1014 · raw

@+label:String -> @m:Maybe<&2, VisCan> -> @+opts:LinkOpts -> String

def maybe_rewrite_pick_go source · line 1030 · raw

@g:RwPick -> String

def maybe_rewrite_pick source · line 1039 · raw

@+token:String -> @+repl:String -> String

def is_md_protect source · line 1052 · raw

@+rest:String -> @+plen:Nat -> Bool

def want_rewrite_md source · line 1055 · raw

@+opts:LinkOpts -> @+rest:String -> @+plen:Nat -> Bool

def linkify_md_go source · line 1074 · raw

@fuel:Nat -> @ph:MdWalk -> @+rest:String -> @plain:String -> @out:String -> @+opts:LinkOpts -> String

def linkify_markdown_opts source · line 1193 · raw

@+source:String -> @+opts:LinkOpts -> String

def linkify_markdown source · line 1203 · raw

@+source:String -> String

def linkify_markdown_src source · line 1206 · raw

@+source:String -> @+src:String -> String

def linkify_markdown_rewrite source · line 1209 · raw

@+source:String -> String

def opts_cli source · line 1212 · raw

@+src:String -> @rewrite:Bool -> LinkOpts

def linkify_markdown_cli source · line 1215 · raw

@+source:String -> @+src:String -> @rewrite:Bool -> String