Franklin.ALL_PAGE_VARSConstant

Dict to keep track of all pages and their vars. Each key is a relative path to a page, values are PageVars. The keys don't have the file extension so "blog/pg1" => PageVars.

Franklin.ASType

Shorter name for a type that we use everywhere

Franklin.ASSIGN_PATConstant
ASSIGN_PAT

Regex to match 'var' in an assignment of the form

var = value
Franklin.CLOSEP_INSERTConstant

CLOSE_INSERT

String that is plugged as a placeholder of blocks that need further processing in a place where any open paragraph must be closed first. For instance this will be the replacement for a header.

Franklin.CODE_LANGConstant

Dict to keep track of languages and how comments are indicated and their extensions. This is relevant to allow hiding lines of code.

Franklin.EOSConstant

EOS

Convenience symbol to mark the end of the string to parse (helps with corner cases where a token ends a document without being followed by a space).

Franklin.GLOBAL_LXDEFSConstant
GLOBAL_LXDEFS

List of latex definitions accessible to all pages. This is filled when the config file is read (via manager/file_utils.jl:process_config).

Franklin.GLOBAL_VARSConstant
GLOBAL_VARS

Dictionary of variables accessible to all pages. Used as an initialiser for LOCAL_VARS and modified by config.md. Entries have the format KEY => PAIR where KEY is a string (e.g.: "author") and PAIR is a pair where the first element is the current value for the variable and the second is a tuple of accepted possible (super)types for that value. (e.g.: "THE AUTHOR" => (String, Nothing))

Franklin.HBLOCK_FOR_PATConstant
HBLOCK_FOR_PAT

Regex to match {{ for v in iterate }} or {{ for (v1, v2) in iterate}} etc where iterate is an iterator

Franklin.HBLOCK_FUN_PATConstant

HBLOCKFUNPAT

Regex to match {{ fname param₁ param₂ }} where fname is a html processing function and paramᵢ should refer to appropriate variables in the current scope.

Franklin.HFUN_PARAMS_PATConstant
HFUN_PARAMS_PAT

Splits the parameter string of a hfun based on whitespaces but allowing single quoted strings with whitespace not to be split.

Franklin.HTML_1C_TOKENSConstant

HTML1CTOKENS

Dictionary of single-char tokens for HTML. Note that these characters are exclusive, they cannot appear again in a larger token.

Franklin.HTML_TOKENSConstant

HTML_TOKENS

Dictionary of tokens for HTML. Note that for each, there may be several possibilities to consider in which case the order is important: the first case that works will be taken.

Franklin.IGNORE_FILESConstant

IGNORE_FILES

Collection of file names that will be ignored at compile time.

Franklin.INFRA_FILESConstant

INFRA_EXT

Collection of file extensions considered as potential infrastructure files.

Franklin.INSERTConstant

INSERT

String that is plugged as a placeholder of blocks that need further processing. Note: left space in the pattern is to preserve lists.

Franklin.LOCAL_VARSConstant

Dictionary of variables accessible to the current page. It's initialised with GLOBAL_VARS and modified via @def ....

Franklin.LX_NAME_PATConstant

LXNAMEPAT

Regex to find the name in a newcommand or a newenvironment within a brace block. For example:

\newcommand{\com}[2]{def}

will give as first capture group \com.

Franklin.LX_NARG_PATConstant

LXNARGPAT

Regex to find the number of argument in a new command (if it is given). For example:

\newcommand{\com}[2]{def}

will give as second capture group 2. If there are no number of arguments, the second capturing group will be nothing.

Franklin.LX_TOKENSConstant

LX_TOKENS

List of names of latex tokens. (See markdown tokens)

Franklin.L_RETURNSConstant
L_RETURNS

Convenience tuple containing the name for standard line returns and line returns followed by an indentation (either a quadruple space or a tab).

Franklin.MATH_BLOCKS_PARENSConstant
MATH_BLOCKS_PARENS

Dictionary to keep track of how math blocks are fenced in standard LaTeX and how these fences need to be adapted for compatibility with KaTeX. Each tuple contains the number of characters to chop off the front and the back of the maths expression (fences) as well as the KaTeX-compatible repl. For instance, $ ... $ will become \( ... \) chopping off 1 character at the front and the back ($ sign).

Franklin.MD_1C_TOKENSConstant
MD_1C_TOKENS

Dictionary of single-char tokens for Markdown. Note that these characters are exclusive, they cannot appear again in a larger token.

Franklin.MD_1C_TOKENS_LXConstant
MD_TOKENS_LX

Subset of MD_1C_TOKENS with only the latex tokens (for parsing what's in a math environment).

Franklin.MD_CLOSEPConstant
MD_CLOSEP

Blocks which, upon insertion, should close any open paragraph. Order doesn't matter.

Franklin.MD_OCBConstant
MD_OCB

List of Open-Close Blocks whose content should be deactivated (any token within their span should be marked as inactive) until further processing. The keys are identifier for the type of block, the value is a pair with the opening and closing tokens followed by a boolean indicating whether the content of the block should be reprocessed. The only OCBlock not in this dictionary is the brace block since it should not deactivate its content which is needed to find latex definitions (see parser/markdown/findblocks/findlxdefs).

Franklin.MD_OCB_ALLConstant
MD_OCB_ALL

Combination of all MD_OCB in order. DEV: only really used in tests.

Franklin.MD_OCB_ESCConstant
MD_OCB_ESC

Blocks that will be escaped (tokens in their span will be ignored on the current parsing round).

Franklin.MD_OCB_IGNOREConstant
MD_OCB_IGNORE

List of names of blocks that will need to be dropped at compile time.

Franklin.MD_OCB_MATHConstant
MD_OCB_MATH

Same concept as MD_OCB but for math blocks, they can't be nested. Separating them from the other dictionary makes their processing easier. Dev note: order does not matter.

Franklin.MD_TOKENSConstant
MD_TOKENS

Dictionary of tokens for Markdown. Note that for each, there may be several possibilities to consider in which case the order is important: the first case that works will be taken.

Franklin.MD_TOKENS_LXConstant
MD_TOKENS_LX

Subset of MD_TOKENS with only the latex tokens (for parsing what's in a math environment).

Franklin.NUM_CHARConstant

SPACER

Convenience list of characters corresponding to digits.

Franklin.PAGE_BIBREFSConstant

PAGE_BIBREFS

Dictionary to keep track of bibliographical references on a page to allow citation within the page.

Franklin.PAGE_EQREFSConstant

PAGE_EQREFS

Dictionary to keep track of equations that are labelled on a page to allow references within the page.

Franklin.PAGE_EQREFS_COUNTERConstant

PAGEEQREFSCOUNTER

Counter to keep track of equation numbers as they appear along the page, this helps with equation referencing. (The _XC0q is just a random string to avoid clashes).

Franklin.PAGE_FNREFSConstant

PAGE_FNREFS

Keep track of name of seen footnotes; the order is kept as it's a list.

Franklin.PAGE_HEADERSConstant

Keep track of seen headers. The key is the refstring, the value contains the title, the occurence number for the first appearance of that title and the level (1, ..., 6).

Franklin.PATHSConstant

PATHS

Dictionary for the paths of the input folders and the output folders. The simpler case only requires the main input folder to be defined i.e. PATHS[:src] and infers the others via the set_paths!() function.

Franklin.SPACE_CHARConstant

SPACE_CHARS

Convenience list of characters that would correspond to a \s regex. see also https://github.com/JuliaLang/julia/blob/master/base/strings/unicode.jl. To this are added things that would definitely switch token:

  • EOS (end of string)
  • '}' (if in command)
Franklin.AbstractBlockType
abstract type AbstractBlock

This is the supertype defining a section of the string into consideration which can be considered as a "block". For instance, abc { ... } def contains one braces block corresponding to the substring { ... }. All subtypes of AbstractBlock must have a ss field corresponding to the substring associated to the block. See also Token, OCBlock.

Franklin.HCondType
struct HCond <: Franklin.AbstractBlock

HTML conditional block corresponding to {{if var}} ... {{else}} ... {{end}}.

Franklin.HElseType
struct HElse <: Franklin.AbstractBlock

HTML token corresponding to {{else}}.

Franklin.HElseIfType
struct HElseIf <: Franklin.AbstractBlock

HTML token corresponding to {{elseif var}}.

Franklin.HEndType
struct HEnd <: Franklin.AbstractBlock

HTML token corresponding to {{end}}.

Franklin.HForType
struct HFor <: Franklin.AbstractBlock

HTML token corresponding to {{for x in iterable}}.

Franklin.HFunType
struct HFun <: Franklin.AbstractBlock

HTML function block corresponding to {{ fname p1 p2 ...}}.

Franklin.HIfType
struct HIf <: Franklin.AbstractBlock

HTML token corresponding to {{if var}}.

Franklin.HIsDefType
struct HIsDef <: Franklin.AbstractBlock

HTML token corresponding to {{isdef var}}.

Franklin.HIsEmptyType
struct HIsEmpty <: Franklin.AbstractBlock

HTML token corresponding to {{isempty var}}.

Franklin.HIsNotDefType
struct HIsNotDef <: Franklin.AbstractBlock

HTML token corresponding to {{isnotdef var}}.

Franklin.HIsNotEmptyType
struct HIsNotEmpty <: Franklin.AbstractBlock

HTML token corresponding to {{isnotempty var}}.

Franklin.HIsNotPageType
struct HIsNotPage <: Franklin.AbstractBlock

HTML token corresponding to {{isnotpage path/page}}.

Franklin.HIsPageType
struct HIsPage <: Franklin.AbstractBlock

HTML token corresponding to {{ispage path/page}}.

Franklin.HTML_SPCHType
struct HTML_SPCH <: Franklin.AbstractBlock

A special block to wrap special characters like like a html entity and have it left unaffected by the Markdown to HTML transformation so that it can be inserted "as is" in the HTML.

Franklin.HTocType
struct HToc <: Franklin.AbstractBlock

Empty struct to keep the same taxonomy.

Franklin.LxComType
struct LxCom <: Franklin.LxObj

A LxCom has a similar content as a Block, with the addition of the definition and a vector of brace blocks.

Franklin.LxDefType
struct LxDef{T}

Structure to keep track of the definition of a latex command declared via a \newcommand{\name}[narg]{def} or of an environment via \newenvironment{name}[narg]{pre}{post}. The parametric type depends on the definition type, for a command it will be a SubString (<: AbstractString), for an environment it will be a Pair of SubString (corresponding to pre-post).

Franklin.LxEnvType
struct LxEnv <: Franklin.LxObj

A LxEnv is similar to a LxCom but for an environment.

`\begin{aaa} ... \end{aaa}`
`\begin{aaa}{opt1}{opt2} ... \end{aaa}`
Franklin.LxObjType
abstract type LxObj <: Franklin.AbstractBlock

Super type for LxCom and LxEnv.

Franklin.LxObjErrorType

A latex command or environment was found but could not be processed properly.

Franklin.OCBlockType
OCBlock(η, ω)
OCBlock(η, ω, nestable)

Shorthand constructor to instantiate an OCBlock inferring the associated substring from the ocpair (since it's the substring in between the tokens).

Franklin.OCBlockType
struct OCBlock <: Franklin.AbstractBlock

Open-Close block, blocks that are defined by an opening Token and a closing Token, they may be nested. For instance braces block are formed of an opening { and a closing } and could be nested.

Franklin.OCProtoType
struct OCProto

Prototype for an open-close block (see OCBlock) with the symbol of the opening token (e.g. :MATH_A) and a corresponding list of closing tokens (e.g. (:MATH_A,)). See also their definitions in parser/md_tokens.jl.

Franklin.PageVarsType

Type of the containers for page variables (local and global).

Franklin.TokenType
struct Token <: Franklin.AbstractBlock

A token τ::Token denotes a part of the source string indicating a region that may need further processing. It is identified by a symbol τ.name (e.g.: :MATH_ALIGN_OPEN). Tokens are typically used in this code to identify delimiters of environments. For instance, abc $ ... $ def contains two tokens :MATH_A associated with the $ sign. Together they delimit here an inline math expression.

Franklin.add_if_new_file!Function
add_if_new_file!(dict, fpair, verb)
add_if_new_file!(dict, fpair, verb, in_loop)

Helper function, if fpair is not referenced in the dictionary (new file) add the entry to the dictionary with the time of last modification as val.

Franklin.attrMethod

Convenience function to add an id attribute to a html element.

Franklin.build_pageMethod
build_page(head, content, pgfoot, foot)

Convenience function to assemble the html of a page out of its parts:

  • head
  • content and pgfoot (which will be wrapped to form the body)
  • foot.
Franklin.change_extFunction
change_ext(fname)
change_ext(fname, ext)

Convenience function to replace the extension of a filename with another.

Franklin.check_for_patMethod
check_for_pat(v)

Check that we have something like {{for v in iterate}} or {for (v1,v2) in iterate}} but not something with unmatched parens.

Franklin.check_pingMethod
check_ping(ipaddr, ttl)

Try a single ping to an address ipaddr. ttl limits the maximum number of IP routers that the packet can go through before being thrown away.

Franklin.check_typeMethod
check_type(t, tt)

Checks if a data type t is a subtype of a tuple of accepted types tt.

Franklin.clean_tagsFunction
clean_tags(rm_tags=nothing)

Check the content of the tag folder and remove orphan pages.

Franklin.cleanpullMethod

Allows you to pull from your remote git repository after having removed the local output directory. This will help avoid merge clashes.

Franklin.contentMethod
content(lxe)

Content of an LxEnv block.

`\begin{aaa}{opt1} XXX nd{aaa}` --> ` XXX `
Franklin.contentMethod
content(ocb)

Convenience function to return the content of an open-close block (OCBlock), for instance the content of a {...} block would be ....

Franklin.contextMethod
context(parent, position)

Return an informative message of the context of a position and where the position is, this is useful when throwing error messages.

Franklin.convert_and_writeMethod
convert_and_write(
    root,
    file,
    head,
    pgfoot,
    foot,
    output_path
)

Take a path to an input markdown file (via root and file), then construct the appropriate HTML page (inserting head, pgfoot and foot) and finally write it at the appropriate place.

Franklin.convert_blockMethod
convert_block(β, lxdefs)

Helper function for convert_inter_html that processes an extracted block given a latex context lxc and returns the processed html that needs to be plugged in the final html.

Franklin.convert_footnote_refMethod
convert_footnote_ref(β)

Helper function to convert a [^1] into a html sup object with appropriate ref and backref.

Franklin.convert_headerMethod
convert_header(β, lxdefs)

Helper function for the case of a header block (H1, ..., H6).

  • gets a short string for the header anchor
  • processes the actual header string as standard markdown (e.g. if has code)
  • return the html.
Franklin.convert_htmlMethod

Convert a Franklin html string into a html string (i.e. replace {{ ... }} blocks).

Franklin.convert_inter_htmlMethod
convert_inter_html(ihtml, blocks, lxdefs)

Take a partial markdown string with the INSERT markers and plug in the appropriately processed block.

Arguments

  • ihtml: the intermediary html string (with INSERT markers)
  • blocks: vector of blocks
  • lxdefs: latex context
Franklin.convert_math_blockMethod
convert_math_block(β, lxdefs)

Helper function for the math block case of convert_block taking the inside of a math block, resolving any latex command in it and returning the correct syntax that KaTeX can render.

Franklin.convert_mdFunction
convert_md(mds)
convert_md(
    mds,
    pre_lxdefs;
    isrecursive,
    isinternal,
    isconfig,
    has_mddefs,
    pagevar,
    nostripp
)

Convert a Franklin-Markdown file read as mds into a Franklin HTML string. Returns the html string as well as a dictionary of page variables.

Arguments

  • mds: the markdown string to process
  • pre_lxdefs: a vector of LxDef that are already available.

Keyword arguments

  • isrecursive=false: a bool indicating whether the call is the parent call or a child call
  • isinternal=false: a bool indicating whether the call stems from fd2html in internal mode
  • isconfig=false: a bool indicating whether the file to convert is the configuration file
  • has_mddefs=true: a bool indicating whether to look for definitions of page variables
Franklin.convert_md_mathFunction
convert_md_math(ms)
convert_md_math(ms, lxdefs)
convert_md_math(ms, lxdefs, offset)

Same as convert_md except tailored for conversion of the inside of a math block (no command definitions, restricted tokenisation to latex tokens). The offset keeps track of where the math block was, which is useful to check whether any of the latex command used in the block have not yet been defined.

Arguments

  • ms: the string to convert
  • lxdefs: existing latex definitions prior to the math block
  • offset: where the mathblock is with respect to the parent string
Franklin.csv2htmlMethod
csv2html(path, header)

Internal function to process an array of strings to markdown table (in one single string). If header is empty, the first row of the file will be used as header.

Franklin.ctokMethod
ctok(ocb)

Convenience function to retrieve the closing token of an OCBlock.

Franklin.deactivate_blocks_in_envs!Method
deactivate_blocks_in_envs!(blocks, lxenvs)

Deactivate blocks that are contained in an environment so that they be reprocessed later.

Franklin.deactivate_divsMethod
deactivate_divs(blocks)

Since divs are recursively processed, once they've been found, everything inside them needs to be deactivated and left for further re-processing to avoid double inclusion.

Franklin.deactivate_inner_blocks!Function
deactivate_inner_blocks!(blocks)
deactivate_inner_blocks!(blocks, nin)

Deactivate blocks inside other blocks when the outer block is bound to be reprocessed. There's effectively two cases:

  1. (solved here) when a block is inside a larger 'escape' block.
  2. (solved in check_and_merge_indented_blocks!) when an indented code block is contained inside a larger block.
Franklin.deactivate_inner_dbb!Method
deactivate_inner_dbb!(dbb, ranges)

Given ranges found by deactivate_inner_blocks! deactivate double brace blocks that are within those ranges (they will be reprocessed later).

Franklin.def_GLOBAL_LXDEFS!Method
def_GLOBAL_LXDEFS!()

Convenience function to allocate default values for global latex commands and environments accessible throughout the site. See resolve_lxobj.

Franklin.def_LOCAL_VARS!Method

Re-initialise the local page vars dictionary. (This is done for every page). Note that a global default overrides a local default. So for instance if title is defined in the config as @def title = "Universal", then the default title on every page will be that.

Franklin.dpairMethod
dpair

Helper function to create a default pair for a page variable.

Franklin.emojiMethod
emoji(token)

Return the emoji corresponding to an Emoji token by querying emoji_symbols. This assumes that the token has name :EMOJI and so we know it's in the dict.

Franklin.envbalanceMethod
envbalance(τ, env)

Helper function to update the inbalance counter when looking for the closing token of an environment block. Adds 1 if the token corresponds to an opening token, removes 1 if it's a closing token and 0 otherwise.

Franklin.envnameMethod
envname(τ)

Convenience function to get the name of a lx-env delimiter (ignores spaces).

Franklin.fd2htmlMethod
fd2html(s; kw)

Take a Markdown string and return the HTML that Franklin would produce for it.

Keywords

  • internal=false: if set to true, the current scope (in terms of page variables) will be passed to process the String, otherwise the string will be processed in an isolated scope.
  • dir="": if given and if internal=false, sets up a temporary dir for Franklin processing.
  • nop=false: if set to true, check if the returned HTML string has a starting <p> and ending </p> and, if so, strips them off. This should be used with care: for simple strings this is likely to be ok but for strings which would contain multiple paragraphs (e.g. with headers) this may not work well.
Franklin.fd2html_vMethod
fd2html_v(st; internal, dir, nop)

Return the HTML corresponding to a Franklin-Markdown string as well as all the page variables. See also fd2html which only returns the html.

Franklin.fd2textMethod
fd2text(s; kw)

Take a Markdown string and return a version with no markup (used in RSS circumstances). This is bruteforce to say the least, it just discards all HTML tags. It should be safe in that '<' and '>' should have been escaped by the fd2html pass.

Franklin.fd_dateMethod
fd_date(d)

Convenience function taking a DateTime object and returning the corresponding formatted string with the format contained in LOCAL_VARS["date_format"] and with the locale data provided in date_months, date_shortmonths, date_days, and date_shortdays local variables. If short variations are not provided, automatically construct them using the first three letters of the names in date_months and date_days.

Franklin.fd_fullpassFunction
fd_fullpass(watched_files)
fd_fullpass(watched_files, join_to_prepath)

A single full pass of Franklin looking at all watched files and processing them as appropriate.

Keyword arguments

  • clear=false: whether to remove any existing output directory
  • verb=false: whether to display messages
  • is_final_pass=false : whether it's the final pass before deployment
  • prerender=false: whether to prerender katex and code blocks
  • no_fail_prerender=true: whether to skip if a prerendering goes wrong in which case don't prerender

See also fd_loop, serve and publish.

Franklin.fd_loopMethod
fd_loop(cycle_counter, _, watched_files)

This is the function that is continuously run, checks if files have been modified and if so, processes them. Every 30 cycles, it checks whether any file was added or deleted and consequently updates the watched_files.

Franklin.fd_setupFunction
fd_setup()
fd_setup(no_set_paths)

Sets up the collection of watched files by doing an initial scan of the input directory. It also sets the paths variables and prepares the output directory.

See also serve.

Franklin.fdplotlyMethod

Display a Plotly plot given an exported JSON String.

using PlotlyJS
fdplotly(json(plot([1, 2]))
Franklin.filter_indented_blocks!Method
filter_indented_blocks!(blocks)

Discard any indented block that is within a larger block to avoid ambiguities (see #285).

Franklin.filter_lr_indent!Method
filter_lr_indent!(vt, s)

In initial phase, discard all :LR_INDENT that don't meet the requirements for an indented code block. I.e.: where the first line is not preceded by a blank line and then subsequently followed by indented lines.

Franklin.find_all_ocblocksMethod
find_all_ocblocks(tokens, ocplist; inmath)

Convenience function to find all ocblocks e.g. such as MD_OCBLOCKS. Returns a vector of vectors of ocblocks.

Franklin.find_and_fix_md_linksMethod
find_and_fix_md_links(hs)

Direct inline-style links are properly processed by Julia's Markdown processor but not:

  • [link title][some reference] and later [some reference]: http://www.reddit.com
  • [link title] and later [link title]: https://www.mozilla.org
  • [link title](https://www.google.com "Google's Homepage") (we don't either)
Franklin.find_hrules!Method
find_hrules!(tokens)

Check that a --- or *** or ___ starts at the beginning of a line and is preceded by an empty line, if that's not the case, discard it.

Franklin.find_indented_blocks!Method
find_indented_blocks!(tokens, st)

Find markers for indented lines (i.e. a line return followed by a tab or 4 spaces).

Franklin.find_lxcomsFunction
find_lxcoms(tokens, lxdefs, braces)
find_lxcoms(tokens, lxdefs, braces, offset; inmath)

Find \command{arg1}{arg2}... outside of xblocks and lxdefs.

Franklin.find_lxdefsMethod
find_lxdefs(tokens, blocks)

Find \newcommand and \newenvironment elements and try to parse what follows to form a proper Latex command/environment. Return a list of such elements.

The format is:

\newcommand{\NAME}[NARGS]{DEFINITION}
\newenvironment{NAMING}[NARGS]{PRE}{POST}

where [NARGS] is optional.

Franklin.find_lxenvsFunction
find_lxenvs(tokens, lxdefs, braces)
find_lxenvs(tokens, lxdefs, braces, offset; inmath)

Find active environment blocks between an opening and matching closing delimiter. These can be nested. See also find_ocblocks and find_lxcoms, this is essentially a mix of the two.

Franklin.find_ocblocksMethod
find_ocblocks(tokens, ocproto; inmath)

Find active blocks between an opening token (otoken) and a closing token ctoken. These can be nested (e.g. braces). Return the list of such blocks.

Franklin.find_opts_bracesFunction
find_opts_braces(τ, narg, braces)
find_opts_braces(τ, narg, braces, name)

For a command or an environment, find the arguments (i.e. a sequence of braces immediately after the opening token).

Franklin.find_special_charsMethod
find_special_chars(tokens)

Take a list of token and return those corresponding to special characters or html entities wrapped in HTML_SPCH types (will be left alone by the markdown conversion and be inserted as is in the HTML).

Franklin.find_tokensMethod
find_tokens(str, dictn, dict1)

Go through a text left to right, one (valid) char at the time and keep track of sequences of chars that match specific tokens. The list of tokens found is returned.

Arguments

  • str: the initial text
  • dictn: dictionary of possible tokens (multiple characters long)
  • dict1: dictionaro of possible tokens (single character)
Franklin.fix_insertsMethod
fix_inserts(s)

The insertion token have whitespaces around them: ##FDINSERT##, this mostly helps but causes a problem when combined with italic or bold markdown mode since _blah_ works but not _ blah _. This function looks for any occurrence of [\*_] ##FDINSERT## or the opposite and removes the extraneous whitespace.

Franklin.fix_linksMethod
fix_links(pg)

For a project website, for instance username.github.io/project/ all relative paths should eventually be pre-pended with /project/. This would happen just before you publish the website (see optimize or publish).

Franklin.form_codepathsMethod
form_codepaths(rpath)

A convenience internal function to get the system paths related to a code script these paths are given raw, without checking whether things exist.

Franklin.form_custom_output_pathMethod
form_custom_output_path(slug)

A user can provide a slug which will then specify the output path. There is the underlying assumption that the path will not clash.

Franklin.form_hrefMethod
form_href(lxc, dname; parens, class)

Given a latex command such as \eqref{abc}, hash the reference (here abc), check if the given dictionary d has an entry corresponding to that hash and return the appropriate HTML for it.

Franklin.form_inter_mdMethod
form_inter_md(mds, blocks, lxdefs; isrecursive)

Form an intermediate MD file where special blocks are replaced by a marker (INSERT) indicating that a piece will need to be plugged in there later.

Arguments

  • mds: the (sub)string to convert
  • blocks: vector of blocks
  • lxdefs: existing latex definitions prior to the math block
Franklin.form_output_pathMethod
form_output_path(base, file, case)

Given a file path split in (base, file), form the output path (where the output file will be written/copied).

Franklin.fromMethod
from(ss)

Given a substring ss, returns the position in the parent string where the substring starts.

Example

julia> ss = SubString("hello", 2:4); Franklin.from(ss)
2
Franklin.from_ifsmallerMethod
from_ifsmaller(v, idx, len)

Convenience function to check if idx is smaller than the length of v, if it is, then return the starting point of v[idx] (via from), otherwise return BIG_INT.

Franklin.generate_tag_pagesFunction
generate_tag_pages()
generate_tag_pages(refresh_tags)

Create and/or update __site/tag folders/files. It takes the set of tags to refresh (in which case only the pages associated to those tags will be refreshed) or an empty set in which case all tags will be (re)-generated. Note that if a tag is removed from a page, it may be that refresh_tags contains a tag which should effectively be removed because no page have it. (This only matters at the end in the call to write_tag_page). Note: the clean_tags cleans up orphan tags (tags that wouldn't be pointing to any page anymore).

Franklin.get_for_bodyMethod
get_for_body(i, qblocks)

Extract the body of a for loop, keeping track of balancing.

Franklin.get_lxdef_refFunction
get_lxdef_ref(lxname, lxdefs)
get_lxdef_ref(lxname, lxdefs, inmath)
get_lxdef_ref(lxname, lxdefs, inmath, offset; isenv)

Get the reference pointing to a LxDef corresponding to a given lxname. If no reference is found but inmath=true, we propagate and let KaTeX deal with it. If something is found, the reference is returned and will be accessed further down. The boolean that is also returned helps keeps track of whether the command or environment was defined in the utils.

Franklin.get_rpathMethod
get_rpath(fpath)

Extracts the relative file system path out of the full system path to a file currently being processed. Does not start with a path separator. So [some_fs_path]/blog/page.md –> blog/page.md (keeps the extension).

Franklin.get_urlMethod
get_url

Take a rpath and return the corresponding valid url

Franklin.getdefMethod
getdef(lxo)

For a given LxObj, retrieve the definition attached to the corresponding LxDef via the reference.

Franklin.getnameMethod
getname(lxc)

For a given LxObj, retrieve the name of the object via the reference. Example: \cite –> cite or \begin{aaa} –> aaa.

Franklin.globvarMethod
globvar(name; default=nothing)

Convenience function to get the value associated with a global var. Return default (which is nothing if not specified) if the variable is not found.

Franklin.hfun_fd2rssMethod
hfun_fd2rss

Take a fd-markdown string, convert it to HTML and fix relative links.

Franklin.hfun_fillMethod
hfun_fill(params)

H-Function of the form {{ fill vname }} or {{ fill vname rpath}} to plug in the content of a franklin-var vname (assuming it can be represented as a string).

Franklin.hfun_insertMethod
hfun_insert(params)

H-Function of the form {{ insert fpath }} to plug in the content of a file at fpath. Note that the base path is assumed to be PATHS[:layout] and so paths have to be expressed relative to that.

Franklin.hfun_paginateMethod
hfun_paginate

Called with {{paginate iterable n_per_page}}. It is assumed there is only one such call per page. Evaluation is actually delayed.

Franklin.hfun_redirectMethod
hfun_redirect(params)

H-Function of the form {{redirect /addr/blah.html}} or {{redirect /addr/blah/}} if the last part ends with / then index.html is appended. Note that the first / can be omitted.

Franklin.hfun_sitemap_optsMethod
hfun_sitemap_opts

Called with {{sitemap_opts monthly 0.5}}. It is assumed this is called only on raw html pages (e.g. custom landing page).

Example usage

  • {{sitemap_opts exclude}}
  • {{sitemap_opts monthly 0.5}}
Franklin.hfun_tocMethod
hfun_toc(params)

H-Function of the form {{toc min max}} (table of contents). Where min and max control the minimum level and maximum level of the table of content. The split is as follows:

  • key is the refstring
  • f[1] is the title (header text)
  • f[2] is irrelevant (occurence, used for numbering)
  • f[3] is the level
Franklin.html_ahref_keyMethod
html_ahref_key

Convenience function to introduce a hyper reference relative to a key.

Franklin.html_codeFunction
html_code

Convenience function to introduce a code block. With indented blocks, the language will be resolved at build time; as a result no lines will be hidden for such blocks.

Franklin.html_errFunction
html_err

Insertion of a visible red message in HTML to show there was a problem.

Franklin.html_imgFunction
html_img

Convenience function to introduce an image. The alt is escaped just in case the user adds quotation marks in the alt string.

Franklin.html_plotlyMethod
html_plotly

Convenience function to plot a Plotly. User need to add a Javascript function PlotlyJS_json.

Franklin.html_spanMethod
html_span

Convenience function to introduce a named span block.

Franklin.html_unescapeMethod
html_unescape

Internal function to reverse the escaping of some html code (in order to avoid double escaping when pre-rendering with highlight, see issue 326).

Franklin.include_external_configMethod
include_external_config(filepath)

Given a path to a markdown file, this checks if that file exists. If so, this processes the file as though it were the config.md markdown file. See process_config for details.

Note: this should be called from within the utils.jl so that it's processed before the user's config.md which then takes precedence.

Franklin.incrlookFunction
incrlook(λ)
incrlook(λ, validator)

Syntactic sugar for the incremental look case for which steps=0 as well as the offset. This is a case where from a start character we lazily accept the next sequence of characters stopping as soon as a character fails to verify λ(c). See also isexactly.

Franklin.invert_dictMethod
invert_dict(dict)

Invert a dictionary i.e transform a=>[1,2],b=>[1] to 1=>[a,b], 2=>[a]

Franklin.is_div_openMethod
is_div_open(i, c)

In combination with incrlook, checks to see if we have something that looks like a @@div describing the opening of a div block. Triggering char is a first @.

Franklin.is_emojiMethod
is_emoji(i, c)

Check if it looks like an emoji indicator :... note that it does not take the final : this is checked and added in validate_emoji!.

Franklin.is_html_entityMethod
is_html_entity(i, c)

In combination with incrlook, checks to see if we have something that looks like a html entity. Note that there can be fake matches, so this will need to be validated later on; if validated it will be treated as HTML; otherwise it will be shown as markdown. Triggerin char is a &.

Franklin.is_languageMethod
is_language(j)

In combination with incrlook, checks to see if we have something that looks like a triple backtick followed by a valid combination of letter defining a language. Triggering char is a first backtick.

Franklin.isexactlyFunction
isexactly(refstring)
isexactly(refstring, follow)
isexactly(refstring, follow, isfollowed)

Forward lookup checking if a sequence of characters matches refstring and is followed (or not followed if isfollowed==false) by a character out of a list of characters (follow). It returns

  1. a number of steps indicating the number of characters to check,
  2. whether there is an offset or not (if it is required to check a following

character or not),

  1. a function that can be applied on a sequence of character.

Example

julia> (s, b, f) = isexactly("aabbc", "d", isfollowed=false);
julia> f("aabbcd")
false
julia> f("aabbce")
true
julia> s
5
Franklin.ismoduleMethod
ismodule(name)

Checks whether a name is a defined module.

Franklin.join_rpathMethod
join_rpath(rpath)

Internal function to take a unix path, split it along / and re-join it (which will lead to the same path on unix but not on Windows). This undoes what unixify does.

Franklin.js2htmlMethod
js2html(hs, jsbuffer, matches, splitter)

Convenience function to run the content of jsbuffer with node, and lace the results with hs.

Franklin.js_prerender_highlightMethod
js_prerender_highlight(hs)

Takes a html string that may contain <pre><code ... </code></pre> blocks and use node and highlight.js to pre-render them to HTML.

Franklin.js_prerender_katexMethod
js_prerender_katex(hs)

Takes a html string that may contain inline katex blocks \(...\) or display katex blocks \[ ... \] and use node and katex to pre-render them to HTML.

Franklin.literate_post_processMethod
literate_post_process(s)

Take a markdown string generated by literate and post-process it to number each code block and mark them as eval-ed ones.

Franklin.locvarMethod
locvar(name; default=nothing)

Convenience function to get the value associated with a local var. Return default (which is nothing if not specified) if the variable is not found.

Franklin.lx_figaltMethod
\figalt{...}{...}

Resolve a \figalt{alt}{rpath} (find a fig and include it with alt).

Franklin.lx_inputMethod
\input{qualifier}{rpath}

Resolve a command of the form \input{qualifier}{rpath} where

  • qualifier indicates what should be inserted (either a code block or a generated figure).
  • rpath indication where it is (in Unix format, see parse_rpath).

This command is expected to be used to insert code blocks or the output of code blocks.

Different actions can be taken based on the qualifier:

  1. {lang} will insert the code in the script with appropriate language indicator. If you want to just include it as plain text, use {plaintext}.
  2. {plot} or {plot:id} will look for a displayable image file (gif, png, jp(e)g or svg) in [path_to_script_dir]/output/ and will add an img block as a result. If an id is specified, it will try to find an image with the same root name ending with id.ext where id can help identify a specific image if several are generated by the script, typically a number will be used, e.g.: \input{plot:4}{ex2}.
Franklin.lx_literateMethod
\literate{...}

Resolve a \literate{rpath} (find a literate script and insert it).

Franklin.lx_outputMethod
\output{...}

Return the output of a code. Possibly including the result of the code (res=true) and possibly reprocessing the whole (reproc=true). At most one will be true. See lx_show.

Franklin.lx_tableinputMethod
\tableinput{...}{...}

Resolve a \tableinput{header}{rpath} (find a table+header and include it).

Franklin.lx_textinputMethod
\textinput{...}

Resolve a \textinput{rpath} command: insert and reprocess some text. If you just want to include text as a plaintext block use \input{plaintext}{rpath} instead.

Franklin.lxdFunction
lxd(n, k)
lxd(n, k, d)

Convenience function to create pairs (commandname => simple lxdef)

Franklin.lxeFunction
lxe(n, k)
lxe(n, k, d)

Convenience function to create pairs (envdname => simple envdef)

Franklin.matchrangeMethod
matchrange(m)

Returns the string span of a regex match. Assumes there is no unicode in the match.

Example

julia> Franklin.matchrange(match(r"ell", "hello"))
2:4
Franklin.mathenvMethod
mathenv(s)

Convenience function to denote a string as being in a math context in a recursive parsing situation. These blocks will be processed as math blocks but without adding KaTeX elements to it given that they are part of a larger context that already has KaTeX elements. NOTE: this happens when resolving latex commands in a math environment. So for instance if you have $$ x \in \R $$ and \R is defined as a command that does \mathbb{R} well that would be an embedded math environment. These environments are marked as such so that we don't add additional KaTeX markers around them.

Franklin.md2htmlMethod
md2html(ss; stripp)

Convenience function to call the base markdown to html converter on "simple" strings (i.e. strings that don't need to be further considered and don't contain anything else than markdown tokens). The boolean stripp indicates whether to remove the inserted <p> and </p> by the base markdown processor, this is relevant for things that are parsed within latex commands etc.

Franklin.merge_blocksMethod
merge_blocks(lvb)

Merge vectors of blocks by order of appearance of the blocks.

Franklin.merge_indented_blocks!Method
merge_indented_blocks!(blocks, mds)

When two indented code blocks follow each other and there's nothing in between (empty line(s)), merge them into a super block.

Franklin.modulenameMethod
modulename(fpath)

Return a sandbox module name corresponding to the page at fpath, effectively FD_SANDBOX_* where * is a hash of the path.

Franklin.newmoduleMethod
newmodule(name)

Creates a new module with a given name, if the module exists, it is wiped. Discards the warning message that a module is replaced which may otherwise happen. Return a handle pointing to the module.

Franklin.ocbalanceMethod
ocbalance(τ, ocp)

Helper function to update the inbalance counter when looking for the closing token of a block with nesting. Adds 1 if the token corresponds to an opening token, removes 1 if it's a closing token and 0 otherwise.

Franklin.optimizeMethod
optimize(
;
    prepath,
    version,
    prerender,
    minify,
    sig,
    no_fail_prerender,
    on_write,
    suppress_errors,
    clear,
    cleanup,
    fail_on_warning
)

Does a full pass followed by a pre-rendering and minification step.

  • prepath="": set this to something like "project-name" if it's a project page (usually this is set via config.md)
  • version="": if "dev", the base url will be /{prepath}/dev/, if "xxx", the base url will be /{prepath}/stable/, a copy of the website will also be at /{prepath}/xxx/ an example would be version="v0.15.2". If left empty, the base url is just /{prepath}/.
  • is_preview=false: if true, then no matter what the version given is, it will not update /stable/ and /dev/.
  • prerender=true: whether to pre-render katex and highlight.js (requires node.js)
  • minify=true: whether to minify output (requires python3 and css_html_js_minify)
  • sig=false: whether to return an integer indicating success (see publish)
  • clear=false: whether to clear the output dir and thereby regenerate everything
  • no_fail_prerender=true: whether to ignore errors during the pre-rendering process
  • suppress_errors=true: whether to suppress errors
  • fail_on_warning=false: if true, warnings become fatal errors
  • cleanup=true: whether to empty environment dictionaries
  • on_write(pg, fd_vars): callback function after the page is rendered, passing as arguments the rendered page and the page variables

Note: if the prerendering is set to true, the minification will take longer as the HTML files will be larger (especially if you have lots of maths on pages).

Franklin.otokMethod
otok(ocb)

Convenience function to retrieve the opening token of an OCBlock.

Franklin.pagevarMethod
pagevar(rpath, name; default=nothing)

Convenience function to get the value associated with a var available to a page corresponding to rpath. So for instance if blog/index.md has @def var = 0 then this can be accessed with pagevar("blog/index", "var") or pagevar("blog/index.md", "var"). If rpath is not yet a key of ALL_PAGE_VARS then maybe the page hasn't been processed yet so force a pass over that page.

Return default (which is nothing if not specified) if the variable is not found.

Franklin.parse_codeMethod
parse_code(code)

Consumes a string with Julia code, returns a vector of expression(s).

Note: this function was adapted from the parse_input function from Weave.jl.

Franklin.parse_fenced_blockFunction
parse_fenced_block(ss)
parse_fenced_block(
    ss,
    scut;
    shortcut,
    repl,
    shell,
    pkg,
    help
)

Take a fenced code block and return a tuple with the language, the relative path (if any) and the code.

Franklin.parse_rpathMethod
parse_rpath(rpath; canonical, code)

Internal function to parse a relative path and return either a path relative to the website root folder or the website assets folder or a full system path. This doesn't check whether the path points to an existing asset (for that see resolve_rpath.

  • /[path]: this is a path relative to the website root folder, e.g.: /foo/figs/img1.png.
  • [path]: this is a path relative to the site assets folder, e.g.: /assets/foo.
  • ./[path]: this is a path relative to the assets folder with the same path as the calling page. For instance, ./im1.png in src/pages/pg1.md will point to /assets/pages/pg1/im1.png.

Otherwise, if in code mode, recurse with ./code/path.

Argument

  1. rpath: the relative path (always in Unix format)

Keywords

  • canonical=false: whether to return a full path on the system (true) or a unix-path relative to the website root folder (false).
  • code=false: whether we're in a code context or not (in which case an additional shortcut form is allowed).
Franklin.pastdefMethod

pastdef(λ)

Convenience function to return a copy of a definition indicated as having already been earlier in the context i.e.: earlier than any other definition appearing in the current chunk.

Franklin.pathMethod
path(s)

Return the paths corresponding to s e.g. path(:folder).

Franklin.postprocess_pageMethod
postprocess_page(pg)

Take a generated HTML string and apply prerendering and link fixing as appropriate.

Franklin.prepare_for_rssMethod
prepare_for_rss()

If there's an RSS feed to generate, check that the template files are there, if not then get them from FranklinTemplates. Also check that a few key variables are defined.

Franklin.prepare_output_dirMethod
prepare_output_dir()

Prepare the output directory PATHS[:pub]. If the environment variable CLEAR is true then the output folder is erased first (can be helpful to clean things and truly start from scratch).

Franklin.process_configMethod
process_config()

Checks for a config.md file and uses it to set the global variables referenced in GLOBAL_VARS it also sets the global latex commands via GLOBAL_LXDEFS. If the configuration file is not found a warning is shown. The keyword init is used internally to distinguish between the first call where only structural variables are considered (e.g. controlling folder structure).

Franklin.process_file_errFunction
process_file_err(case, fpair)
process_file_err(case, fpair, head)
process_file_err(case, fpair, head, pgfoot)
process_file_err(case, fpair, head, pgfoot, foot)
process_file_err(case, fpair, head, pgfoot, foot, t)

Considers a source file which, depending on case could be a HTML file or a file in Franklin-Markdown etc, located in a place described by fpair, processes it by converting it and adding appropriate header and footer and writes it to the appropriate place. It can throw an error which will be caught in process_file(args...).

Franklin.process_html_condMethod
process_html_cond(hs, qblocks, i)

Recursively process a conditional block from an opening HTMLCONDOPEN to a {{end}}.

Franklin.process_html_qblocksFunction
process_html_qblocks(hs, qblocks)
process_html_qblocks(hs, qblocks, head)
process_html_qblocks(hs, qblocks, head, tail)

Take a qualified html block stack and go through it, with recursive calling.

Franklin.process_mddefsFunction
process_mddefs(blocks, isconfig)
process_mddefs(blocks, isconfig, pagevar)
process_mddefs(blocks, isconfig, pagevar, isinternal)

Convenience function to process markdown definitions @def ... as appropriate. Depending on isconfig, will update GLOBAL_VARS or LOCAL_VARS.

Arguments

  • blocks: vector of active docs
  • isconfig: whether the file being processed is the config file (–> global page variables)
  • isinternal: whether the call is internal (e.g. within hfun). In that case skip tags.
Franklin.process_utilsMethod
process_utils()

Checks for a utils.jl file and uses it to set global computed variables, functions and html functions. Whatever is defined in utils.jl takes precedence over things defined internally in Franklin or in the global vars; in particular users can redefine the behaviour of hfuns though that's not recommended.

Franklin.publishMethod
publish(
;
    prerender,
    minify,
    nopass,
    prepath,
    message,
    cleanup,
    final,
    do_push
)

This is a simple wrapper doing a git commit and git push without much fanciness. It assumes the current directory is a git folder. It also fixes all links if you specify prepath (or if it's set in config.md).

Keyword arguments

  • prerender=true: prerender javascript before pushing see optimize
  • minify=true: minify output before pushing see optimize
  • nopass=false: set this to true if you have already run optimize manually.
  • prepath="": set this to something like "project-name" if it's a project page
  • message="franklin-update": add commit message.
  • cleanup=true: whether to cleanup environment dictionaries (should stay true).
  • final=nothing: a function ()->nothing to execute last, before doing the git push. It can be used to refresh a Lunr index, generate notebook files with Literate, etc, ... You might want to compose fdf_* functions that are exported by Franklin (or imitate those). It can access GLOBAL_VARS.
Franklin.qualify_html_hblocksMethod
qualify_html_hblocks(blocks)

Given {{ ... }} blocks, identify what kind of blocks they are and return a vector of qualified blocks of type AbstractBlock.

Franklin.refstringMethod
refstring(s)

Takes a string s and replace spaces by underscores so that that we can use it for hyper-references. So for instance "aa bb" will become aa_bb. It also defensively removes any non-word character so for instance "aa bb !" will be "aa_bb"

Franklin.reprocessMethod
reprocess(s, lxdefs; nostripp)

Convenience function to take a markdown string (e.g. produced by a latex command) and re-parse it.

Franklin.resolve_argsMethod
resolve_args(base, braces)

Resolve arguments for LxObj by interpolating #k appropriately.

Franklin.resolve_code_blockMethod
resolve_code_block(ss; shortcut, repl, pkg, shell, help)

Helper function to process the content of a code block. Return the html corresponding to the code block, possibly after having evaluated the code.

Franklin.resolve_lxobjMethod
resolve_lxobj(lxo, lxdefs; inmath)

Take a <: LxObj and try to resolve it by looking up the appropriate definition, applying it then reparsing the result.

Franklin.resolve_rpathFunction
resolve_rpath(rpath)
resolve_rpath(rpath, lang)

Internal function to resolve an input (usually a script in a given language) given a relative path (in unix format) and return a tuple with:

  • the full system path to the asset
  • the full system path to the directory containing the asset
  • the name of the asset without its extension

If an extension is not provided, Franklin will try to find something with an adequate extension or, failing that, will try to find anything that matches the file name.

Franklin.rprintMethod
rprint(s)

Print an overwriting line being aware of the display width.

Franklin.rss_generatorMethod
rss_generator()

Extract the entries from RSSITEMS and assemble the RSS. If RSSITEMS is empty, nothing is generated. If tags are associated with items, also create one feed per tag.

Note: if a file head_rtag.xml is available, where rtag is the refstring of a tag, it will take precedence for the corresponding tag feed; otherwise head.xml will be used.

Franklin.run_codeMethod
run_code(mod, code, out_path; warn_err, strip_code)

Run some code in a given module while redirecting stdout to a given path. Return the result of the evaluation or nothing if the code was empty or the evaluation failed. If the evaluation errors, the error is printed to output then a warning is shown.

Arguments

  1. mod: the module in which to evaluate the code,
  2. code: string corresponding to the code,
  3. out_path: path where stdout should be redirected

Keywords

  • warn_err=true: whether to show a warning in the REPL if there was an error running the code.
  • strip=false: whether to strip the code, this may already have been done.
Franklin.scan_input_dir!Method
scan_input_dir!(args; kw...)

Update the dictionaries referring to input files and their time of last change. The variable verb propagates verbosity.

Franklin.serveMethod
serve(
;
    clear,
    verb,
    port,
    single,
    prerender,
    nomess,
    is_final_pass,
    no_fail_prerender,
    eval_all,
    silent,
    cleanup,
    on_write,
    log,
    host,
    show_warnings,
    fail_on_warning,
    launch,
    no_set_paths,
    join_to_prepath
)

Runs Franklin in the current directory.

Keyword arguments:

  • clear=false: whether to remove any existing output directory
  • verb=false: whether to display messages
  • port=8000: the port to use for the local server (should pick a number between 8000 and 9000)
  • single=false: whether to run a single pass or run continuously
  • nomess=false: suppresses all messages (internal use).
  • is_final_pass=false: whether we're in a "final pass" (if so, links are fixed in case of a project website, see convert_and_write.
  • prerender=false: whether to pre-render javascript (KaTeX and highlight.js)
  • no_fail_prerender=true: whether, in a prerendering phase, ignore errors and try to produce an output
  • eval_all=false: whether to force re-evaluation of all code blocks
  • silent=false: switch this on to suppress all output (including eval statements).
  • cleanup=true: whether to clear environment dictionaries, see cleanup.
  • on_write(pg, fd_vars): callback function after the page is rendered, passing as arguments the rendered page and the page variables
  • host="127.0.0.1": the host to use for the local server
  • show_warnings=true: whether to show franklin warnings
  • launch=!single: whether to launch the browser when serving
Franklin.set_cur_rpathMethod
set_cur_rpath(fpath)

Takes the path to the current file and sets the fd_rpath local page variable as well as the FD_ENV[:CUR_PATH] variable (used for conditional blocks depending on URL for instance).

Franklin.set_paths!Method
set_paths!()

This assigns all the paths where files will be read and written with root the FOLDER_PATH which is assigned at runtime.

Franklin.set_var!Method
set_var!(vars, key, value; isglobal, check)

Take a var dictionary dict and update the corresponding pair. This should only be used internally as it does not check the validity of val. See convert_and_write where it is used to store a file's creation and last modification time.

Note: check can be false for DTAG, DTAGI which are considered as UnionAll types.

Franklin.set_vars!Method
set_vars!(vars, assignments; isglobal)

Given a set of definitions assignments, update the variables dictionary vars. Keys in assignments that do not match keys in vars are ignored (a warning message is displayed). The entries in assignments are of the form KEY => STR where KEY is a string key (e.g.: "hasmath") and STR is an assignment to evaluate (e.g.: "=false").

Franklin.should_evalMethod
should_eval(code, rpath)

Return true if the code should be reevaluated and false otherwise. The code should be reevaluated if any of following flags are true:

  1. global eval flag (eval_all)
  2. local eval flag (reeval)
  3. stale scope (due to a prior code block having been evaluated)
  4. the code is different than what's in the script
  5. the output is missings
Franklin.should_ignoreMethod
should_ignore(fpath, files2ignore, dirs2ignore)

Check if a file path should be ignored. This is a helper function for the scan_input_dir functions. A bit of a similar principle to match_url. The file argument is an absolute path, the list would be a list of relative paths. Rules:

  • '' or '/' -> ignore
  • 'path/fname' -> ignore exactly that
  • 'path/dir/' -> ignore everything starting with path/dir/
Franklin.simplify_psMethod
simplify_ps(s)

In some cases, an insertion might look like <p>INS</p> and the ps could be dropped. This is a helper function to check that (1) there is only one opening and closing p tag and (2) that they're at the beginning and end of the string in which case they're removed.

Franklin.stentFunction

Convenience function to strip the content of a block.

Franklin.strMethod
str(s)

Returns the string corresponding to s: s itself if it is a string, or the parent string if s is a substring. Do not confuse with String(s::SubString) which casts s into its own object.

Example

julia> a = SubString("hello Fraknlin", 3:8);
julia> Franklin.str(a)
"hello Franklin"
julia> String(a)
"llo Fr"
Franklin.subsMethod
subs(s, from, to)
subs(s, from)
subs(s, range)
subs(s)

Convenience functions to take a substring of a string.

Example

julia> Franklin.subs("hello", 2:4)
"ell"
Franklin.toMethod
to(ss)

Given a substring ss, returns the position in the parent string where the substring ends.

Example

julia> ss = SubString("hello", 2:4); Franklin.to(ss)
4
Franklin.trim_stacktraceMethod
trim_stacktrace(s)

Returns only the stack traces which are related to the user's code. This means removing stack traces pointing to Franklin's code. Return the string as-is if the format is unrecognized.

Franklin.unixifyMethod
unixify(rpath; allow_noext)

Internal function to take a relative path and return a unix version of the path (if it isn't already). Used in resolve_rpath.

Franklin.url_curpageMethod
url_curpage

Helper function to get the relative url of the current page.

Franklin.validate_and_store_link_defs!Method
validate_and_store_link_defs!(blocks)

Keep track of link defs. Deactivate any blocks that is within the span of a link definition (see issue #314).

Franklin.validate_footnotes!Method
validate_footnotes!(tokens)

Find footnotes refs and defs and eliminate the ones that don't verify the appropriate regex. For a footnote ref: \[\^[\p{L}0-0]+\] and \[\^[\p{L}0-0]+\]: for the def.

Franklin.validate_start_of_line!Method
validate_start_of_line!(tokens, names)

Given a candidate header block, check that the opening # is at the start of a line, otherwise ignore the block.

Franklin.verify_links_pageMethod
verify_links_page(path, online)

Take a page (in HTML) and check all href on it to see if they lead somewhere.

Franklin.write_default_tag_layoutMethod
write_default_tag_layout()

If _layout/tag.html is not defined, input a basic default one indicating that the user has to modify it. This will help users transition when they may have used a template that did not define _layout/tag.html.

Franklin.write_pageMethod
write_page(output_path, content; head, pgfoot, foot)

Write a html page at the appropriate location and with the appropriate structure. This is usually called specifying the scaffolding but can be done without in which case the scaffolding is read from layout.

Franklin.write_tag_pageMethod
write_tag_page(tag)

Internal function to (re)write the tag pages corresponding to update_tags.

Franklin.αMethod
α(c)
α(c, ac)

Check whether c is a letter or is in a vector of character ac.

Franklin.αηMethod
αη(c)
αη(c, ac)

Check whether c is alpha numeric or in vector of character ac

Franklin.@OUTPUTMacro

This macro points to the /output/ folder associated with an eval block. So for instance, if an eval block generates a plot, you could save the plot with something like savefig(joinpath(@OUTPUT, "ex1.png")).