0
[ \t]* # trailing spaces/tabs
0
(?=\n+|\Z) # followed by a newline or end of document
0
- ((r findAllInString:str) each
:
0
+ ((r findAllInString:str) each
InReverse:
0
($g_html_blocks setObject:(m group) forKey:-"!!#{(m hash)}!!")
0
- (str replace
OccurrencesOfString:(m group) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
+ (str replace
CharactersInRange:(m range) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
[ \t]* # trailing spaces/tabs
0
(?=\n+|\Z) # followed by a newline or end of document
0
- ((r findAllInString:str) each
:
0
+ ((r findAllInString:str) each
InReverse:
0
($g_html_blocks setObject:(m group) forKey:-"!!#{(m hash)}!!")
0
- (str replace
OccurrencesOfString:(m group) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
+ (str replace
CharactersInRange:(m range) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
; Special case just for <hr />. It was easier to make a special case than
0
; to make the other regex more complicated
0
/?> # the matching end tag
0
(?=\n{2,}|\Z) # followed by a blank line or end of document
0
- )END -"mx") findAllInString:str) each
:
0
+ )END -"mx") findAllInString:str) each
InReverse:
0
($g_html_blocks setObject:(m group) forKey:-"!!#{(m hash)}!!")
0
- (str replace
OccurrencesOfString:(m group) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
+ (str replace
CharactersInRange:(m range) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
; Special case for standalone HTML comments
0
(?=\n{2,}|\Z) # followed by a blank line or end of document
0
- )END -"mx") findAllInString:str) each:(do (m)
0
- ($g_html_blocks setObject:(m group) forKey:-"!!#{(m hash)}!!")
0
- (str replaceOccurrencesOfString:(m group) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
+ )END -"mx") findAllInString:str) eachInReverse:
0
+ ($g_html_blocks setObject:(m group) forKey:-"!!#{(m hash)}!!")
0
+ (str replaceCharactersInRange:(m range) withString:"\n\n!!#{(m hash)}!!\n\n")))
0
(function markdown_EncodeAmpsAndAngles (str)
0
- (?:\n+|\Z)END -"mx") findAllInString:str) each:(do (m)
0
- ($g_urls setObject:(markdown_EncodeAmpsAndAngles (m groupAtIndex:2)) forKey:(m groupAtIndex:1))
0
- (if (!= (m groupAtIndex:3) nil)
0
- ($g_titles setObject:(m groupAtIndex:3) forKey:(m groupAtIndex:1)))
0
- (str replaceOccurrencesOfString:(m group) withString:-"")))
0
+ (?:\n+|\Z)END -"mx") findAllInString:str) each:
0
+ ($g_urls setObject:(markdown_EncodeAmpsAndAngles (m groupAtIndex:2)) forKey:(m groupAtIndex:1))
0
+ (if (!= (m groupAtIndex:3) nil)
0
+ ($g_titles setObject:(m groupAtIndex:3) forKey:(m groupAtIndex:1)))
0
+ (str replaceOccurrencesOfString:(m group) withString:-"")))
0
(function markdown_EncodeCode (str)
0
(.+?) # $2 = The code block
0
- (?!`)END -"sx") findAllInString:str) each
:
0
+ (?!`)END -"sx") findAllInString:str) each
InReverse:
0
(set temp (/^[ \t]*/ replaceWithString:"" inString:(m groupAtIndex:2)))
0
(set temp (/[ \t]*$/ replaceWithString:"" inString:temp))
0
- (str replace
OccurrencesOfString:(m group) withString:-"<code>#{(markdown_EncodeCode temp)}</code>")))
0
+ (str replace
CharactersInRange:(m range) withString:-"<code>#{(markdown_EncodeCode temp)}</code>")))
0
(function markdown_EncodeItalicsAndBolds (str)
0
(function markdown_Detab (str)
0
- ((/(.*?)\t/ findAllInString:str) each
:
0
+ ((/(.*?)\t/ findAllInString:str) each
InReverse:
0
- (str replace
OccurrencesOfString:(m group)
0
+ (str replace
CharactersInRange:(m range)
0
withString:"#{(m groupAtIndex:1)}#{(NSString spaces:(- 4 (NuMath integerMod:((m groupAtIndex:1) length) by:4)))}")))
0
(set str (markdown_Detab str))
0
;; Strip any lines consisting only of spaces and tabs.
0
(set str (/^[ \t]+$/m replaceWithString:"" inString:str))
0
;; Turn block-level HTML blocks into hash entries
0
- (set str (markdown_HashHTMLBlocks str))
0
+ (set str (markdown_HashHTMLBlocks str))
0
;; Strip link definitions, store in hashes.
0
(set str (markdown_StripLinkDefinitions str))
Comments
No one has commented yet.