Fc@sdZdZddkZddkZddkZddkZddkZed\ZZ Z Z e a dZ dZdZdZdZedZd d d d d ddddddddddddddgZdZdfdYZdfd YZd!fd"YZd#fd$YZd%fd&YZd'efd(YZeZd)efd*YZeZd+efd,YZeZd-efd.YZ e Z!d/efd0YZ"e"Z#d1Z$d2e$d3e$d4e$d5e$d4e$d6Z%d7Z&d8Z'd9Z(d:Z)d;Z*d<Z+eo d=Z,nd>Z,d?Z-d@Z.e%dAZ/e%dBZ0dCe%dAZ1e%dDZ2dCe%dDZ3dEZ4dFZ5dGZ6dHZ7dIZ8dJfdKYZ9e9Z:dLe9fdMYZ;dNe9fdOYZ<dPe9fdQYZ=dRe<fdSYZ>dTe9fdUYZ?dVe9fdWYZ@dXe9fdYYZAdZe9fd[YZBd\eBfd]YZCd^e9fd_YZDd`e9fdaYZEe;e(ZFe;e4ZGe=e&ZHe=e'ZIe<e*dbZJe<e-dbZKe<e)dcZLe<e,dcZMe>e+ddZNe>e.ddZOe@e/ZPe@e0ZQeAe1ZReCe3ZSeBe2ZTe?e7ZUe?e8ZVeDe5ZWeEe6ZXdefdfYZYdgfdhYZZdifdjYZ[dkZ\dlZ]dmfdnYZ^e^Z_dofdpYZ`eaeageae ebdqZcgeaebdrZddsfdtYZedueZfdvZgehdwjo0egZiei oeijdneceindS(xspython markdown.pyiiNicCs|tjo |GHndS(N(tMESSAGE_THRESHOLD(tlevelttext((s,/home/rbetts/public_html/cgi-bin/markdown.pytmessage-s itqaodmasdkwaspemass%dajkqlsmdqpakldnzsdflstptdivt blockquotetprettabletdltoltultscripttnoscripttformtfieldsettiframetmathtinstdelthrshr/tstylecCs,|tjp|ddjo|ddjS(Nithit 0123456789(tBLOCK_LEVEL_ELEMENTS(ttag((s,/home/rbetts/public_html/cgi-bin/markdown.pytis_block_levelDs tDocumentcBsSeZdZedZdZdZdZdZdZ dZ RS(cCs||_||_h|_dS(N(tdocumentElementtparenttentities(tselftchild((s,/home/rbetts/public_html/cgi-bin/markdown.pyt appendChildXs  cCs:t|}||_|o|i|i|n|S(N(tElementtdocR"tcreateTextNode(R RttextNodetel((s,/home/rbetts/public_html/cgi-bin/markdown.pyt createElement]s   cCst|}||_|S(N(tTextNodeR$(R Rtnode((s,/home/rbetts/public_html/cgi-bin/markdown.pyR%ds  cCs2||ijot||i|s>s"s"(R/s&(R0s<(R1s>(s"s"(treplace(R Rtpairstoldtnew((s,/home/rbetts/public_html/cgi-bin/markdown.pytnormalizeEntitiesqs  cCs|ii|S(N(Rtfind(R ttest((s,/home/rbetts/public_html/cgi-bin/markdown.pyR7}scCs|iid|_dS(N(RtunlinktNone(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyR9s ( t__name__t __module__R"R:R(R%R-R.R6R7R9(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRVs      R#cBskeZdZdZdZdZdZdZdZdZ dZ d d Z d Z RS( telementcCs(||_g|_h|_g|_dS(N(tnodeNamet attributestattribute_valuest childNodes(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyt__init__s   cCs?x/|iD]$}|idjo|iq q Wd|_dS(NR=(RAttypeR9R:(R R!((s,/home/rbetts/public_html/cgi-bin/markdown.pyR9s  cCs5||ijo|ii|n||i|s/>R R (RURVRWRX(sli(s blockquote(RslisulR RURVRWRX( tENABLE_ATTRIBUTESRARQR>R?R@R$R6R.(R R!tbufferRERF((s,/home/rbetts/public_html/cgi-bin/markdown.pyR.s<       ( R;R<RCRBR9RGRJRLRPR"RQR7R.(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR#s         R)cBsAeZdZeidZdZdZdZdZ RS(Rs\{@([^\}]*)=([^\}]*)}cCs ||_dS(N(RF(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyRBscCs)|ii|id|iddS(Nii(RRGtgroup(R tmatch((s,/home/rbetts/public_html/cgi-bin/markdown.pytattributeCallbackscCs"|ii|i|i|_dS(N(t attrRegExptsubR^RF(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyRQscCs|i}|itpq|iidjo|idd}q|iidjo1|iid|jod|idd}qn|ii|}|S(NRs s RYis ( RFt startswithtHTML_PLACEHOLDER_PREFIXRR>R2RAR$R6(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyR.s ( R;R<RCtretcompileR_RBR^RQR.(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR)s    R+cBs)eZdZdZdZdZRS(t entity_refcCs ||_dS(N(R,(R R,((s,/home/rbetts/public_html/cgi-bin/markdown.pyRBscCsdS(N((R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyRQscCsd|idS(NR/t;(R,(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyR.s(R;R<RCRBRQR.(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR+s  t PreprocessorcBseZRS((R;R<(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRgstHeaderPreprocessorcBseZdZdZRS(sj Replaces underlined headers with hashed headers to avoid the nead for lookahead later. cCsPd}xC|dt|jo+|d}||ipq n||ido|i|ddn|dt|jo||do||ddd jo||di}|dt|jo*d||i||Deals with HR lines (needs to be done before processing lists)cCsCx<tt|D](}|i||od||(trangeRlt_isLine(R RnRo((s,/home/rbetts/public_html/cgi-bin/markdown.pyRq?s cCs|idodSndig}|D]}|ip ||q)q)~}t|djodSnxPdddgD];}ti|i|}|o|idodSq~q~WdSd S( s5Determines if a block should be replaced with an
s iRTitisline1tisline2tisline3iN(RatjointisspaceRltREtregExpR]R\(R tblockt_[1]txRtpatterntm((s,/home/rbetts/public_html/cgi-bin/markdown.pyRuEs; (R;R<RrRqRu(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs<s tLineBreaksPreprocessorcBseZdZdZRS(s;Replaces double spaces at the end of the lines with
.cCsex^tt|D]J}||ido0tidi|| o||cd7(RtRltendswithR{R|R](R RnRo((s,/home/rbetts/public_html/cgi-bin/markdown.pyRqXs (R;R<RrRq(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRUstHtmlBlockPreprocessorcBs;eZdZdZdZdZdZdZRS(s#Removes html blocks from self.linescCs'|didddidiS(NiR1t i(R2tsplittlower(R R}((s,/home/rbetts/public_html/cgi-bin/markdown.pyt _get_left_tagescCs"|it| dd!iS(Nii(trstripRlR(R tleft_tagR}((s,/home/rbetts/public_html/cgi-bin/markdown.pyt_get_right_tagiscCs`|djotSnd||jotSn/||djo|ddjotSntSdS( Nt?s?phpRt/iiR0(Rs?phpsdiv(tTruetFalse(R Rt right_tag((s,/home/rbetts/public_html/cgi-bin/markdown.pyt _equal_tagsls cCs |djS(NRshr/(Rshr/((R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyt _is_onelinerwsc CsAg}di|}|id}g}d}d}t}x|D]}|ido|d}n|pO|ido.|i|}|i||}t|p|dd jp|i|qCn|i|o|i|i qCn|ddjod }|i||}n|i i d o9|i ||o&|i|i i|i qCq|ddjp |i|i t}qCqn|i|qC|i|i |i||}|i ||o2t}|i|i idi|g}qCqCWdi|idS( Ns s RTiR0t!Rt@t%s--R1(RRRR(RyRRRaRRRRDRRmRRRtstashtstoreR( R Rnt new_blocksRtitemsRRtin_tagR}((s,/home/rbetts/public_html/cgi-bin/markdown.pyRq{sV   (R;R<RrRRRRRq(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRbs    tReferencePreprocessorcBseZdZRS(cCsUg}xH|D]@}tidi|}|o|idii}|idi}|p |id|f|i|\)s\!s\s*\[([^\]]*)\]s( \* )s<(http://[^>]*)>s<([^> \!]*@[^> ]*)>s(\<[a-zA-Z/][^\>]*\>)s(&[\#a-zA-Z0-9]*;)tPatterncBseZdZdZRS(cCs)||_tid|ti|_dS(Ns ^(.*)%s(.*)$(RRcRdtDOTALLt compiled_re(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyRB&s cCs|iS(N(R(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pytgetCompiledRegExp*s(R;R<RBR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR$s tSimpleTextPatterncBseZdZRS(cCs|i|idS(Ni(R%R\(R RR$((s,/home/rbetts/public_html/cgi-bin/markdown.pyt handleMatch1s(R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR/stSimpleTagPatterncBseZdZdZRS(cCsti||||_dS(N(RRBR(R RR((s,/home/rbetts/public_html/cgi-bin/markdown.pyRB6scCs5|i|i}|i|i|id|S(Ni(R(RR"R%R\(R RR$R'((s,/home/rbetts/public_html/cgi-bin/markdown.pyR:s(R;R<RBR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR4s tBacktickPatterncBseZdZdZRS(cCsti||d|_dS(Ntcode(RRBR(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyRBAscCsA|i|i}|idi}|i|i||S(Ni(R(RR\RmR"R%(R RR$R'R((s,/home/rbetts/public_html/cgi-bin/markdown.pyREs(R;R<RBR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR?s tDoubleTagPatterncBseZdZRS(cCsf|iid\}}|i|}|i|}|i||i|i|id|S(Nt,i(RRR(R"R%R\(R RR$ttag1ttag2tel1tel2((s,/home/rbetts/public_html/cgi-bin/markdown.pyROs  (R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRMst HtmlPatterncBseZdZRS(cCs(|ii|id}|i|S(Ni(RRR\R%(R RR$t place_holder((s,/home/rbetts/public_html/cgi-bin/markdown.pyRZs(R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRXst LinkPatterncBseZdZRS(cCs|id}|i|i|id|idi}|o|id|dn|iddt|djo9di|di}t |}|id |n|S( Ntaii threfiRTiRttitle( R(R"R%R\RRGRlRyRmtdequote(R RR$R'tpartsR((s,/home/rbetts/public_html/cgi-bin/markdown.pyRas (R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyR_st ImagePatterncBseZdZRS(cCs|id}|idi}|id|dt|djo'|idtdi|dntoL|i|id}|i ||i |i }|i i |n|id}|id ||S( Ntimgi tsrciiRRitalt(R(R\RRGRlRRyRZR%R"RQRFRARK(R RR$R't src_partsRttruealt((s,/home/rbetts/public_html/cgi-bin/markdown.pyRts'   (R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRrstReferencePatterncBseZdZdZRS(cCs|ido|idi}n|idi}|ii|pdSn|i|\}}|id}|i||||S(Ni i(R\RRthas_keyR:tmakeTag(R RR$RRRR((s,/home/rbetts/public_html/cgi-bin/markdown.pyRscCsT|id}|id||o|id|n|i|i||S(NRRR(R(RGR"R%(R RRRR$R'((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs (R;R<RR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs tImageReferencePatterncBseZdZRS(cCsN|id}|id||o|id|n|id||S(NRRRR(R(RG(R RRRR$R'((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs (R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRstAutolinkPatterncBseZdZRS(cCsK|id}|id|id|i|i|id|S(NRRi(R(RGR\R"R%(R RR$R'((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs(R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRstAutomailPatterncBseZdZRS(c Cs|id}|id}|ido|td}nx4|D],}|idt|}|i|qIWd|}dig}|D]}|dt|q~}|id||S(NRismailto:s#%dRTs&#%d;R( R(R\RaRlR-tordR"RyRG( R RR$R'temailtletterR,tmailtoR~((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs 4(R;R<R(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRststrongtems strong,emt PostprocessorcBseZRS((R;R<(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRst HtmlStashcBs eZdZdZdZRS(suThis class is used for stashing HTML objects that we extract in the beginning and replace with place-holders.cCsd|_g|_dS(Ni(t html_countert rawHtmlBlocks(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyRBs cCs0|ii|t|i}|id7_|S(sSaves an HTML segment for later reinsertion. Returns a placeholder string that needs to be inserted into the document. @param html: an html segment @returns : a placeholder string i(RRDtHTML_PLACEHOLDERR(R thtmlt placeholder((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs (R;R<RrRBR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs t BlockGurucBs&eZddZdZdZRS(ic Cs.g}d}d}x |D]}|i o| o|||fSn|i o~|ow|d7}x>t|t|D]&}||io||} Pq|q|WP|| } | o|idqqPn||} | o|i| |d7}qq|||fSqW|d7}|||fS(sFunctional magic to help determine boundaries of indented blocks. @param lines: an array of strings @param fn: a function that returns a substring of a string if the string matches the necessary criteria @param allowBlank: specifies whether it's ok to have blank lines between matching functions @returns: a list of post processes items and the unused remainder of the original listiiiRT(RmRtRlRD( R Rntfnt allowBlankRtitemRoRtjtnexttpart((s,/home/rbetts/public_html/cgi-bin/markdown.pyt _findHead s8          cCs6tidi|}|o|idSndSdS(s/ An auxiliary method to be passed to _findHead RiN(R{R|R]R\R:(R RR((s,/home/rbetts/public_html/cgi-bin/markdown.pyt detabbed_fnFscCs|i||iddS(NRi(RR(R Rn((s,/home/rbetts/public_html/cgi-bin/markdown.pyt detectTabbedOs(R;R<RRR(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs < cCstii|ddS(sPrint an error string to stderrs N(tsyststderrtwrite(tstring((s,/home/rbetts/public_html/cgi-bin/markdown.pyt print_errorUscCsW|ido|idp |ido|ido|dd!Sn|SdS(s% Removes quotes from around a string t"t'iiN(RaR(R((s,/home/rbetts/public_html/cgi-bin/markdown.pyRZs  t CorePatternscBsweZdZhdd<dd<dd<dd<d d <d d <d d<dd<dd<dd ?(.*)tquotedcCsjh|_x>|iiD]-}tid|i|ti|i|. iRTt extensionstconfigsN('tsafeModetencodingtsourceRt blockGurutregisteredExtensionststripTopLevelTagstdocTypetHEADER_PREPROCESSORtLINE_PREPROCESSORtHTML_BLOCK_PREPROCESSORtLINE_BREAKS_PREPROCESSORtREFERENCE_PREPROCESSORt preprocessorstpostprocessorsttextPostprocessorst prePatternstDOUBLE_BACKTICK_PATTERNtBACKTICK_PATTERNtESCAPE_PATTERNtIMAGE_LINK_PATTERNtIMAGE_REFERENCE_PATTERNtREFERENCE_PATTERNtLINK_ANGLED_PATTERNt LINK_PATTERNtAUTOLINK_PATTERNtAUTOMAIL_PATTERNt HTML_PATTERNtENTITY_PATTERNtNOT_STRONG_PATTERNtSTRONG_EM_PATTERNtSTRONG_EM_PATTERN_2tSTRONG_PATTERNtSTRONG_PATTERN_2tEMPHASIS_PATTERNtEMPHASIS_PATTERN_2tinlinePatternstregisterExtensionstreset(R RRtextension_configsRt safe_mode((s,/home/rbetts/public_html/cgi-bin/markdown.pyRBsJ            cCs|p h}nx|D]}d|}yt|}Wnttd||fqX|i|o||}ng}|i|}|i|tqWdS(Ntmdx_s2couldn't load extension %s (looking for %s module)(t __import__RtCRITICALRt makeExtensiontextendMarkdowntglobals(R RRtexttextension_module_nametmoduletconfigs_for_extt extension((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs   cCs|ii|dS(s# This gets called by the extension N(RRD(R R"((s,/home/rbetts/public_html/cgi-bin/markdown.pytregisterExtensionscCsh|_t|_|it_|it_|it_|it_|it_|it _x|i D]}|i qgWdS(sLResets all state variables so that we can start with a new text.N( RRt htmlStashRRRR R RRRR(R R"((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs         cCst|_|iid|_|ii|iid|iidd|ii|i|ii}|i ddi dd}|d7}|i t }|i d|_ x&|iD]}|i|i |_ qWg}xN|i D]C}|ido |i|i||g}q|i|qW|i|i||ii|iidx!|iD]}|i|iqtW|iS( saTransforms the Markdown text into a XHTML body document @returns: A NanoDom Document tspans tclasstmarkdowns s s Ri(RR$R(t top_elementR"R%RGRRmR2t expandtabst TAB_LENGTHRRnRRqRat_processSectionRDR(R RtprepR[Rt postprocessor((s,/home/rbetts/public_html/cgi-bin/markdown.pyt _transforms4      ic Cs|pdSnh|id<|id<|id<|id<}xWddddgD]C}ti|i|d}|o|||||dSqXqXW|oY|i|d\}} |i|||dd ||i|| |dd |n|i|d \} } t | o| di d otid i| d}|ort |i d} |i i d | } |i| xD|i|i diD]} | i| qWqkttdn| o|idi| }|idjo|p|i o |}n |i i d}|i|x|D]} |i| qPWn| o| d} n|i|| |dS(sProcess a section of a source document, looking for high level structural elements like lists, block quotes, code segments, html blocks, etc. Some those then get stripped of their high level markup (e.g. get unindented) and the lower-level markup is processed recursively. @param parent_elem: A NanoDom element to which the content will be added @param lines: a list of lines @param inList: a level @returns: NoneNR R RRicSs9tidi|p"tidi|p |i S(R R (R{R|R]Rm(R((s,/home/rbetts/public_html/cgi-bin/markdown.pytesit looseListcSs |i S((Rm(R((s,/home/rbetts/public_html/cgi-bin/markdown.pyR/rsRiRsh%disWe've got a problem header!s RYR(t _processUListt _processOListt _processQuotet_processCodeBlockR{R|R]t _linesUntilR+RlRaR\R$R(R"t_handleInlineWrapper2RmRRRyR>RA(R t parent_elemRntinListR0t processFntregexpRtstartttheRestt paragraphRRRtlistR'((s,/home/rbetts/public_html/cgi-bin/markdown.pyR+4sT     !   cCs#|i|||dddddS(NtlistexprR R(t _processList(R R7RnR8((s,/home/rbetts/public_html/cgi-bin/markdown.pyR1scCs#|i|||dddddS(NR?R R(R@(R R7RnR8((s,/home/rbetts/public_html/cgi-bin/markdown.pyR2sc Csg|ii|}|i|d}g}d} d} x|D]} d} | ip| d7} d} x>t| t|D]&} || io|| }Pq}q}WPtidi|p.tidi|ptidi|o+|| i | i| p|}q>qPnxdddgD]}ti|i| }|o|d jo;|i do'|i |i dg| d7} qn,|djo|| i |i dn| d7} Pq-q-W|| i | | d7} q>W| d7} xJ|D]B} |iid}|i||i || |dd |qW|i ||| |d S( s{Given a list of document lines starting with a list item, finds the end of the list, breaks it up, and recursively processes each list item and the remainder of the text file. @param parent_elem: A dom element to which the content will be added @param lines: a list of lines @param inList: a level @returns: NoneiiiR R RiRYR0N(sulsol( R$R(R"RmRtRlR{R|R]RDR\R+(R R7RnR8R?RR R0RRRoRtlooseRRtexprRRY((s,/home/rbetts/public_html/cgi-bin/markdown.pyR@s\             !cCsOd}x4|D]"}|d7}||oPq q W|d7}|| ||fS(s A utility function to break a list of lines upon the first line that satisfied a condition. The condition argument should be a predicate function. ii((R Rnt conditionRoR((s,/home/rbetts/public_html/cgi-bin/markdown.pyR5s  c Csg}d}xZ|D]H}tidi|}|o$|i|id|d7}qPqW|d7}|iid}|i||i||||i||||dS(sGiven a list of document lines starting with a quote finds the end of the quote, unindents it and recursively processes the body of the quote and the remainder of the text file. @param parent_elem: DOM element to which the content will be added @param lines: a list of lines @param inList: a level @returns: None iRiRN( R{R|R]RDR\R$R(R"R+( R R7RnR8tdequotedRoRRR((s,/home/rbetts/public_html/cgi-bin/markdown.pyR3s   c Cs|ii|\}}|iid}|iid}|i||i|di|id}|i|ii||i|||dS(sGiven a list of document lines starting with a code block finds the end of the block, puts it into the dom verbatim wrapped in ("
") and recursively processes the
           the remainder of the text file.

           @param parent_elem: DOM element to which the content will be added
           @param lines: a list of lines
           @param inList: a level
           @returns: NoneRRs
N(	RRR$R(R"RyRR%R+(	R R7RnR8tdetabbedR<RRR((s,/home/rbetts/public_html/cgi-bin/markdown.pyR4%s

cCs |g}x|iD]}d}x|t|jo||}t|ttfo]|i||}|o@|d8}|i|x&|D]}|i|d|qWqn|d7}q"WqWxTtt|D]@}||}t|ttfo|i	i
|||((s,/home/rbetts/public_html/cgi-bin/markdown.pyRLzs

cCsl|ii|}|pdSn|i||i}|o$|id||idfSndSdS(s Given a pattern name, this function checks if the line
        fits the pattern, creates the necessary elements, and returns
        back a list consisting of NanoDom elements and/or strings.
        
        @param line: the text to be processed
        @param pattern: the pattern to be checked

        @returns: the appropriate newly created NanoDom element if the
                  pattern matches, None otherwise.
        iiN(RR]R:RR$tgroupsR\(R RRRR*((s,/home/rbetts/public_html/cgi-bin/markdown.pyRIs
cCs|o
||_n|i}|i}xrt|iiD]^}|ii|}|io
d}n|idt	||d}|it	||}q?W|i
o|idd!d}nx |iD]}|i
|}qW|i|S(sPReturn the document in XHTML format.

        @returns: A serialized XHTML body.s[HTML_REMOVED]s

%s

s ii(RR.R.RtR$RRRR2RRRmRRqR(R RR$txmlRoRtpp((s,/home/rbetts/public_html/cgi-bin/markdown.pyt__str__s&          cCs t|S(sAReturn the document in XHTML format as a Unicode object. (RG(R ((s,/home/rbetts/public_html/cgi-bin/markdown.pyt __unicode__s(R;R<RrR:RRBRR#RR.R+R1R2R@R5R3R4R6RMRLRIRQttoStringRRt toUnicode(((s,/home/rbetts/public_html/cgi-bin/markdown.pyRs2 <    5f   S   *   & c Cs|attd||p d}nti|dddd}|i}|it|||d|}|o3ti|dd|} | i|| int i i|i |dS(Nsinput file: %ssutf-8tmodetrRRtw( RRtVERBOSEtcodecstopentreadtcloseR'RRtstdouttencode( tinputtoutputRRtmessage_thresholdtsafet input_fileRRt output_file((s,/home/rbetts/public_html/cgi-bin/markdown.pytmarkdownFromFiles    c Csttd|g}h}x|D]}|id}|djo|i|q$|| }|i|g} ||dd!idD]} | | idq~ } g} | D]%\} } | | i| ifq~ }|||9 t ExtensioncBs/eZhdZdZdZdZRS(cCs ||_dS(N(tconfig(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyRB scCs.|ii|o|i|dSndSdS(NiRT(RlR(R R((s,/home/rbetts/public_html/cgi-bin/markdown.pyt getConfig#scCs9g}|iiD]}|||i|dfq~S(Ni(RlR(R R~R((s,/home/rbetts/public_html/cgi-bin/markdown.pyt getConfigInfo*scCs||i|d OUTPUT_FILE cCs:ytd}WnkttidjoEhtidd<dd<td<td<gd<dd s<   /T%   W  /.                      M   [    :