pike.git / lib / modules / Tools.pmod / Markdown.pmod

version» Context lines:

pike.git/lib/modules/Tools.pmod/Markdown.pmod:121:    subject = replace(subject, from, to);    }    }       return subject;   }      //! HTML encode @tt{<>"'@}. If @[enc] is @tt{true@} @tt{&@} will also be encoded   protected string encode_html(string html, void|bool enc)   { -  return replace(REGX((!enc ? "&(?!#?\\w+;)" : "&"))->replace(html, "&amp;"), +  return replace(REGX((!enc ? "&(?!\\#?\\w+;)" : "&"))->replace(html, "&amp;"),    ([ "<" : "&lt;",    ">" : "&gt;",    "\"" : "&quot;",    "'" : "&#39;" ]));   }      protected string decode_html(string html)   { -  return REGX("&([#\\w]+);")->replace(html, lambda (string a, string b) { +  return REGX("&([\\#\\w]+);")->replace(html, lambda (string a, string b) {    b = lower_case(b);       if (b == "colon") return ":";    if (b[0] == '#') {    return b[1] == 'x'    ? sprintf("%x", (int)b[2..])    : sprintf("%c", (int)b[1..]);    }       return "";
pike.git/lib/modules/Tools.pmod/Markdown.pmod:249:   private RuleMap block_rules;   RuleMap get_block_rules()   {    if (block_rules)    return block_rules;       RuleMap block = ([    "newline" : R("^\\n+"),    "code" : R("^( {4}[^\\n]+\\n*)+"),    "hr" : R("^( *[-*_]){3,} *(?:\\n+|$)"), -  "heading" : R("^ *(#{1,6}) *([^\\n]+?) *#* *(?:\\n+|$)"), +  "heading" : R("^ *(\\#{1,6}) *([^\\n]+?) *\\#* *(?:\\n+|$)"),    "lheading" : R("^([^\\n]+)\\n *(=|-){2,} *(?:\\n+|$)"),    "blockquote" : R("^( *>[^\\n]+(\\n(?!def)[^\\n]+)*\\n*)+"),    "list" : R("^( *)(bull) [\\s\\S]+?(?:hr|def|\\n{2,}(?! )(?!\\1bull )\\n*|\\s*$)"),    "html" : R("^ *(?:comment *(?:\\n|\\s*$)|closed *(?:\\n{2,}|\\s*$)|closing *(?:\\n{2,}|\\s*$))"),    "def" : R("^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +[\"(]([^\\n]+)[\")])? *(?:\\n+|$)"),    "paragraph" : R("^((?:[^\\n]+\\n?(?!hr|heading|lheading|blockquote|tag|def))+)\\n*"),    "text" : R("^[^\\n]+"),    "table" : noop,    "fences" : noop,    "nptable" : noop,
pike.git/lib/modules/Tools.pmod/Markdown.pmod:307:    ("heading", block->heading)    ("blockquote", block->blockquote)    ("tag", "<" + (string)block->_tag, true)    ("def", block->def)    ();       block->normal = copy_value(block);    block->gfm = block->normal + ([    "fences" : R("^ *(`{3,}|~{3,})[ \\.]*(\\S+)? *\\n([\\s\\S]*?)\\s*\\1 *(?:\\n+|$)"),    "paragraph" : R("^"), -  "heading" : R("^ *(#{1,6}) +([^\\n]+?) *#* *(?:\\n+|$)") +  "heading" : R("^ *(\\#{1,6}) +([^\\n]+?) *\\#* *(?:\\n+|$)")    ]);       block->gfm->paragraph =    make_regexp(block->paragraph)    ("(?!", "(?!"    + replace1(block->gfm->fences->source, "\\1", "\\2")    + "|"    + replace1(block->list->source, "\\1", "\\3") + "|")    ();   
pike.git/lib/modules/Tools.pmod/Markdown.pmod:333:    return block_rules = block;   }      private RuleMap inline_rules;   RuleMap get_inline_rules()   {    if (inline_rules)    return inline_rules;       RuleMap inl = ([ -  "escape" : R("^\\\\([\\\\`*{}\\[\\]()#+\\-.!_>])"), +  "escape" : R("^\\\\([\\\\`*{}\\[\\]()\\#+\\-.!_>])"),    "autolink" : R("^<([^ >]+(@|:/)[^ >]+)>"),    "tag" : R("^<!--[\\s\\S]*?-->|^</?\\w+(?:\"[^\"]*\"|'[^']*'|[^'\">])*?>"),    "link" : R("^!?\\[(inside)\\]\\(href\\)"),    "reflink" : R("^!?\\[(inside)\\]\\s*\\[([^\\]]*)\\]"),    "nolink" : R("^!?\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\]"),    "strong" : R("^__([\\s\\S]+?)__(?!_)|^\\*\\*([\\s\\S]+?)\\*\\*(?!\\*)"),    "em" : R("^\\b_((?:[^_]|__)+?)_\\b|^\\*((?:\\*\\*|[\\s\\S])+?)\\*(?!\\*)"),    "code" : R("^(`+)\\s*([\\s\\S]*?[^`])\\s*\\1(?!`)"),    "br" : R("^ {2,}\\n(?!\\s*$)"),    "text" : R("^[\\s\\S]+?(?=[\\\\<!\\[_*`]| {2,}\\n|$)"),