@@ -569,37 +569,37 @@ def block(self, text):
569569
570570 out = []
571571
572- anon = False
573572 for line in text :
574573 pattern = (r'^(?P<tag>{0})(?P<atts>{1}{2})\.(?P<ext>\.?)'
575574 r'(?::(?P<cite>\S+))? (?P<content>.*)$' .format (tre ,
576575 align_re_s , cls_re_s ))
577576 match = re .search (pattern , line , flags = re .S | re .U )
577+ # tag specified on this line.
578578 if match :
579579 tag , atts , ext , cite , content = match .groups ()
580580 (outer_tag , outer_atts , inner_tag , inner_atts , content ,
581581 eat ) = self .fBlock (** match .groupdict ())
582- # leave off c1 if this block is extended,
583- # we'll close it at the start of the next block
584582 inner_block = generate_tag (inner_tag , content , inner_atts )
583+ # code tags and raw text won't be indented inside outer_tag.
585584 if inner_tag != 'code' and not has_raw_text (inner_block ):
586585 inner_block = "\n \t \t {0}\n \t " .format (inner_block )
587586 if ext :
588587 line = content
589588 else :
590589 line = generate_tag (outer_tag , inner_block , outer_atts )
590+ # pre tags and raw text won't be indented.
591591 if outer_tag != 'pre' and not has_raw_text (line ):
592592 line = "\t {0}" .format (line )
593-
593+ # no tag specified
594594 else :
595+ # if we're inside an extended block, add the text from the
596+ # previous extension to the front
595597 if ext :
596598 line = '{0}\n {1}' .format (out .pop (), line )
597- anon = True
598- if ext or not re . search ( r'^\s' , line ) :
599+ whitespace = ' \t \n \r \f \v '
600+ if ext or not line [ 0 ] in whitespace :
599601 (outer_tag , outer_atts , inner_tag , inner_atts , content ,
600602 eat ) = self .fBlock (tag , atts , ext , cite , line )
601- # skip o1/c1 because this is part of a continuing extended
602- # block
603603 if tag == 'p' and not has_raw_text (content ):
604604 line = content
605605 else :
@@ -627,7 +627,6 @@ def block(self, text):
627627
628628 def fBlock (self , tag , atts , ext , cite , content ):
629629 att = atts
630- atts = pba (atts , include_id = not self .restricted )
631630 attributes = parse_attributes (att )
632631 output = {'outer_tag' : '' , 'inner_tag' : '' , 'outer_atts' : OrderedDict (),
633632 'inner_atts' : OrderedDict (), 'content' : content , 'eat' : False }
0 commit comments