Submit
Path:
~
/
/
lib
/
python2.7
/
site-packages
/
docutils
/
transforms
/
File Content:
frontmatter.pyc
� >��Xc @ s� d Z d Z d d l Z d d l m Z m Z d d l m Z m Z d e f d � � YZ d e f d � � YZ d e f d � � YZ d e f d � � YZ d S( s4 Transforms related to the front matter of a document or a section (information found before the main text): - `DocTitle`: Used to transform a lone top level section's title to the document title, promote a remaining lone top-level section's title to the document subtitle, and determine the document's title metadata (document['title']) based on the document title and/or the "title" setting. - `SectionSubTitle`: Used to transform a lone subsection into a subtitle. - `DocInfo`: Used to transform a bibliographic field list into docinfo elements. t reStructuredTexti����N( t nodest utils( t TransformErrort Transformt TitlePromoterc B s) e Z d Z d � Z d � Z d � Z RS( sJ Abstract base class for DocTitle and SectionSubTitle transforms. c C s� t | t j � s t d � n t | � o= t | d t j � sG t � | j | � \ } } | d k rl d S| j | t t � | d | | | d | (t | d t j � s� t � d S( s Transform the following tree:: <node> <section> <title> ... into :: <node> <title> ... `node` is normally a document. s% node must be of Element-derived type.i i N( t isinstanceR t Elementt TypeErrort lent titlet AssertionErrort candidate_indext Nonet update_all_atts_concatenatingt True( t selft nodet sectiont index( ( sA /tmp/pip-build-uEGWVr/docutils/docutils/transforms/frontmatter.pyt promote_title# s )c C s� t | t j � s t d � n | j | � \ } } | d k rC d St j � } | j | t t � | d | (| d | g | d | !| d | (d S( s Transform the following node tree:: <node> <title> <section> <title> ... into :: <node> <title> <subtitle> ... s% node must be of Element-derived type.i i N( R R R R R R t subtitleR R ( R R t subsectionR R ( ( sA /tmp/pip-build-uEGWVr/docutils/docutils/transforms/frontmatter.pyt promote_subtitleN s %c C sa | j t j � } | d k sK t | � | d k sK t | | t j � rO d S| | | f Sd S( s� Find and return the promotion candidate and its index. Return (None, None) if no valid candidate was found. i N( NN( t first_child_not_matching_classR t PreBibliographicR R R R ( R R R ( ( sA /tmp/pip-build-uEGWVr/docutils/docutils/transforms/frontmatter.pyR { s "( t __name__t __module__t __doc__R R R ( ( ( sA /tmp/pip-build-uEGWVr/docutils/docutils/transforms/frontmatter.pyR s + -t DocTitlec B s&