-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/minirst.pyc


\,Tc@sWdZddlZddlZddlZddlmZddlZdZdZdZ	dZ
dZejd	Z
d
ZdZejdZejd
ZejdZejdZejdZdZdZdZdZdZejdZdZdZdZdZdZdZ ejddej!Z"dZ#i	ed d!6ed"d#6ed$d%6ed&d'6ed(d)6ed*d+6ed,d-6ed.d/6ed0d16Z$d2Z%d3Z&d4Z'd5dd6Z)d7Z*d8d5dd9d:Z+d;Z,d<Z-d5e.d=Z/dS(>ssimplified reStructuredText parser.

This parser knows just enough about reStructuredText to parse the
Mercurial docstrings.

It cheats in a major way: nested blocks are not really nested. They
are just indented blocks that look like they are nested. This relies
on the user to keep the right indentation for the blocks.

Remember to update http://mercurial.selenic.com/wiki/HelpStyleGuide
when adding support for new constructs.
iN(t_cCsd|dtj|fS(Ns%s
%s

s"(tencodingtcolwidth(ts((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytsectionscCsd|dtj|fS(Ns%s
%s

t=(RR(R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
subsectionscCsd|dtj|fS(Ns%s
%s

t-(RR(R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
subsubsection!scCsd|dtj|fS(Ns%s
%s

t.(RR(R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytsubsubsubsection$scCs]|jtj}x8|D]0\}}|j|jd|jd}qW|jtjS(s5
    Apply a list of (find, replace) pairs to a text.

    >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
    'Foo Bar'
    >>> encoding.encoding = 'latin1'
    >>> replace('\x81\\', [('\\', '/')])
    '\x81/'
    >>> encoding.encoding = 'shiftjis'
    >>> replace('\x81\\', [('\\', '/')])
    '\x81\\'
    tascii(tdecodeRtreplacetencode(ttexttsubststutexttftt((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyR
's(s\n(?:\s*\n)+cCsg}xtj|jdjD]i}|j}|r%td|D}g|D]}||^qZ}|ji|d6|d6q%q%W|S(sFind continuous blocks of lines in text.

    Returns a list of dictionaries representing the blocks. Each block
    has an 'indent' field and a 'lines' field.
    s
css+|]!}t|t|jVqdS(N(tlentlstrip(t.0tl((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>Jstindenttlines(t_blockretsplitRtrstript
splitlinestmintappend(RtblockstbRRR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
findblocks@s%"cCs?d}x2|t|kr:d||d<||ddjdr-|dt|kr-||d}||dd|}||ddgkr||=|d8}n||ddjd	r||ddd
 ||dd<nt||ddkr[||ddjdjdr[||ddjdd
dkr[|d7}q	n"||ddd ||dd<tj||dd}|r||j7}||j8}nxi|dt|kr)||dd|kr)d||dd<||ddc|8<|d7}qWn|d7}q	W|S(sFinds literal blocks and adds a 'type' field to the blocks.

    Literal blocks are given the type 'literal', all other blocks are
    given type the 'paragraph'.
    it	paragraphttypeRis::iRs ::it s.. itliteral(RtendswithRt
startswithtfindt	_bulletretmatchtend(R tiRt
adjustmenttm((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytfindliteralblocksOs6
1
%$$
"1s((-|[0-9A-Za-z]+\.|\(?[0-9A-Za-z]+\)|\|) s0^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)((.*)  +)(.*)$s:(?![: ])([^:]*)(?<! ):[ ]+(.*)s[^ ]s
(=+\s+)*=+cCsOdttfdttfdttfdttfg}d}d}x|t|krJ||ddkr=||d	}x|D]\}}}||d||rg}xqt|D]c\}	}
|||	||r|ji|d6gd	6||d
d
6n|dd	j|
qW||||d+PqqWn|d7}qHW|S(
sSplit paragraphs into lists.tbullettoptiontfieldt
definitioncSs||}|dt|kr.||dp1d}|j|sGtS|rv|dkpu|ddkpu|j|S|jdSdS(sDoes itemre match an item at line i?

        A list item can be followed by an indented line or another list
        item (but only if singleline is True).
        itiR%N(RR+tFalseR((RR-titemret
singlelinetline1tline2((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyR+s
*)iR$R#RRii(	R*tTruet	_optionret_fieldret
_definitionreR6Rt	enumerateR(R t	listtypesR+R-RR$R7R8titemstjtline((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytsplitparagraphss*	icCsd}x|t|kr||ddkr?|d7}q	n|}x|t|kr||ddkrtj||dd}|j\}}|||dd<|||d<|d7}qHW|d}q	W|S(sFind key for field lists.iR$R3iRtkey(RR=R+tgroups(R R-RBR/REtrest((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytupdatefieldlistss
)c
Csd}x|t|kr||ddkr?|d7}q	nd}|}x-|t|krz||ddkrztj||dd}|jd}|jd}|dj}|jdj}|jd	j}	|||dd<d
}
|sd}
nd|r!d
|p$d
d|
||	ff}|j}|||d<t|tj|}|d7}qNWx|||!D]}||d<qW|d}q	W|S(NiR$R2iRiiiiR5s   s%s%ss-%s s	%s--%s %stoptstrtoptstrwidth(	RR<R+tgrouptstripRtmaxRR(
R R-RJRBR/tshortoptiontgroup3t
longoptiontdesct
longoptionargt	noshortoptopttblock((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytupdateoptionlistss:
)		c	Cs=g}d}x$|dt|kr2||ddkr%||ddjdr%||d}||dd|}||ddd}||k}|r|j|n||=|}|d8}x[|t|kr!||d|kr!|r||=q||dc|8<|d7}qWn|d7}qW||fS(	sPrune unwanted containers.

    The blocks must have a 'type' field, i.e., they should have been
    run through findliteralblocks first.
    iiR$R#Rs.. container::Ri(RR(R(	R tkeeptprunedR-RR.t
containertypetpruneRB((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytprunecontainerss*
)
s^([-=`:.'"~^_*+#])\1+$c
Csx|D]}|ddkrt|ddkrtj|ddr|dd|ddkrd|d<t|d<|dd}gtt|D]<}||d	kr|dks||d
dkr|^q}g}x|dd
d!D]}||krt|d<qng}|d}xt|D]\}	}
|	d
t|kr||	d
|
}tj|||}|t|7}|j	|j
q4|j	||j
q4W|j	|qW||d<qqW|S(sQFind simple tables

       Only simple one-line table elements are supported
    R$R#RiiittabletheaderRiR%(Rt_tablereR+R6txrangeR;R?RtgetcolsRRL(
R RUtdivtxtcolumnstrowsRtrowtpostntstarttwidthtv((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
findtabless6
	

<

cCsx|D]}|ddkrt|ddkrtj|ddt|ddkrtj|ddr|ddd|d<d|d<|dd=qqW|S(	sFinds sections.

    The blocks must have a 'type' field, i.e., they should have been
    run through findliteralblocks first.
    R$R#Riiit	underlineR(RRRt
_sectionreR+(R RU((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytfindsectionsMs
+
cCs[dg}xK|D]C}|ddkrg|dD]}t||^q1|d<qqW|S(	Ns``t"R$R#RR(s``Ro(s	paragraphssection(R
(R RR!R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytinlineliteralscs
	
1cCs^d	d
g}xK|D]C}|ddkrg|dD]}t||^q4|d<qqW|S(Ns:hg:`s"hg t`RoR$R#RR(s:hg:`s"hg (RqRo(s	paragraphssection(R
(R RR!R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pythgrolejs

1cCsd}x|t|kr||d||ddkr\||ddkr\|d7}q	||dds{|d7}q	|j|idgd6dd	6d
d6|d7}q	W|S(
sAdds empty blocks for vertical spacing.

    This groups bullets, options, and definitions together with no vertical
    space between them, and adds an empty block between all other blocks.
    iR$R1R2R3RR5iRtmargini(sbulletsoptionsfield(Rtinsert(R R-((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
addmarginsus 

(cCsd}x|t|kr||}|ddkr|ddjds_|ddgkr||=|t|kr||ddkr||=qq	|d7}q	W|S(	sRemove comments.iR$R#Rs.. s..Rsi(RR((R R-R!((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
prunecommentss
'&
sR\.\. (admonition|attention|caution|danger|error|hint|important|note|tip|warning)::tflagscCsd}x|t|krtj||dd}|rd||d<||ddd|jd!j}||dd|jd}|r||djdd|n|||d	<||dd=n|d}q	W|S(
sj
    Makes the type of the block an admonition block if
    the first line is an admonition directive
    iRt
admonitionR$iiis   tadmonitiontitle(Rt
_admonitionreR+R,tlowerRt(R R-R/Ryt	firstline((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytfindadmonitionss) s
Attention:t	attentionsCaution:tcautions!Danger!tdangersError:terrorsHint:thints
Important:t	importantsNote:tnotesTip:ttipsWarning!twarningcCsdjttj|d}tj|d}|d}|d}d|dd||f}dtj|d}dtj||d|d	|S(
NR%RRIiRJs%s%s  s %s
t
initindentt
hangindent(tjointmaptstrRLRRtutiltwrap(RURiRQRtusablewidththangingRR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytformatoptions

c
Cs|dkrd}nd|d}|ddkrt|d}|dsW||d	St|dd
t|dd
j}||d}djttj|d}d||tj|d|d
|d|fS|ddkrd	S|ddkr(|d7}|d	|j|dd	S|ddkrst	j
|dd|d}d||dd||fS|ddkr|d}gt|D].}	tg|	D]}
t	j
|
^q^q}d}t
|t|d}d|d}dt|||d
}x|D]}
g}xEt||
D]4\}}d|t	j
|}|j||q;Wdj|}tj|d|d
|d|}|r|dr|d	|dt||d	}q||d	7}qW|S|ddkr||dd}t|dd
t|dd
j}||d}djttj|dd}d|tj|d|d
|d|fS|}|ddkr|ddjdr|ddd|dd<qtj|dd}||jd}n|ddkr|d}|td}t|dtkr`|j|}n|jt}||dd|dd<n|dd krt||Sdjttj|d}tj|d|d
|d|d	S(!s"Format a block according to width.iiNR%RR$RxRyRs
is%s
%s
RiRRRsR&s  RRls
%s%s
%s%s
R\R5iR]RR4R1s| iR3RER2(t_admonitiontitlesRRRRRRLRRRRtzipRMtsumRRR(R*R+R,t_fieldwidthtljustR(RURiRRxthangt	defindentRRlR\tctetwidthstspanReRtwRjtpadttermt	subindentR/RE((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytformatblocks	
,


A
!&,#

csgd}gd}fd}g|D]}|ddkr4|^q4}xvt|D]h\}}|d}|d}|d}|dkr|t|d	}	|d
jttj|}
jd|	|
fn8|dkrjd
|dj|n	|dkr&n|dkrUjd|dj|n|dkr|d}||kr||7}n|j|d}jd|||d|fnb|dkrq|d}jdx}|D]u}
jdxH|
D]@}jdj||jdjdqWjjdqWjdn|dkr|d|||d}|d
jttj|d}
jd||
fnG|d krX|dj	d
d\}}|d!kr|d"|n
|d#|jd$|d
j|g|dn|d%kr|d|||d&}|d
jttj|}
jd||
fnd|d'kr |d|||d(}|d
jttj|}jd||fnrcd)\}}|t
|dkrjjd*|jq||d}|d}||ks||kr|dd+krjd*|jqqcqcWdjS(,sFormat RST blocks as HTMLR5cSstj|tS(N(tcgitescapeR;(R((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyRscsFsdd|krBj||fjd|ndS(Niis<%s>
(R(Rhtlevel(tlistnesttout(s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytopenlistsR$RsRRRxRyR%s<p>
<b>%s</b> %s
</p>
R#s<p>
%s
</p>
s
R&s<pre>
%s
</pre>
RRlis<h%d>%s</h%d>
iR\s<table>
s<tr>s<td>s</td>s</tr>
s	</table>
R4tdls <dt>%s
 <dd>%s
R1Rtultols	 <li> %s
R3RER2RIis</%s>
sdefinition bullet field option(R?RRRRRLRtindextpopRR(R t
headernestRRR!RftbtypeRRRxRR-R\ReRjRR1theadRERTRQRhtnbtni((RRs5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt
formathtmls	)


!##

'








%
.
!
!

icCsg}t|}x|D]}|dc|7<qWt|}t|}t||pZg\}}t|}t|}t|}t|}t|}t	|}t
|}t|}t|}||fS(s Parse text into a list of blocksR(
R"R0RkR[RnRpRrRDRHRVR}RuRv(RRRWRXR R!((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytparseps"
cs#djfd|D}|S(NR5c3s|]}t|VqdS(N(R(RR!(Ri(s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>s(R(R RiR((Ris5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytformatblockssiPtplaincsvt|||pg\}}|dkr9t|}ndjfd|D}|dkrh|S||fSdS(s-Parse and format the text according to width.thtmlR5c3s|]}t|VqdS(N(R(RR!(Ri(s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>sN(RRRtNone(RRiRRWtstyleR RX((Ris5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytformatscCsd}d}g}x|D]}|ddkr|d}||krR||7}n|j|d}|| }|j|dd||gfq|sddgfg}n|dd	j|qW|S(
s=return a list of (section name, nesting level, blocks) tuplesR5iR$RRliRii(RR(R tnestRtsecsR!R-((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytgetsectionss



$cCsmg}x`t|D]R}|d}t|d|}|jg|jtD]}||f^qLqW|S(s=generate a list of (section name, line text) pairs for searchii(RRRRR;(R RiRRRRR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pytdecorateblockss
3cCsMgt|D]}td|D^q
}d|}|djd|Dd}|g}x|D]}g}xvt||D]e\}	}
d|
krdjd|
jdD}
nd|	tj|
}|j|
|qW|j|dj|dqjW|r<t|dkr<|jd|n|j||S(sAGenerate an RST table for the given table data as a list of linescss|]}tj|VqdS(N(RR(RR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>sR%css|]}d|VqdS(RN((RR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>ss
css|]}|jVqdS(N(R(RR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pys	<genexpr>sii(	RRMRRRRRRRt(tdataRR]RRRaRReRRRjR((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt	maketables /
!	
%"
(0t__doc__treRRti18nRRRRRR
R
tcompileRR"R0R*R<R=R>R^RDRRHRVR[RmRkRnRpRrRuRvt
IGNORECASERzR}RRRRRRRRRRR6R(((s5/usr/lib/python2.7/dist-packages/mercurial/minirst.pyt<module>sd							9	*		$	&	2						






		Q	[				

Copyright © 2017 || Recoded By Mr.Bumblebee