Ticket #11263: trac_11263-doctests_link_all-SAGE.local.bin-fh.patch

File trac_11263-doctests_link_all-SAGE.local.bin-fh.patch, 1.6 KB (added by hivert, 10 years ago)
  • sage-doctest

    # HG changeset patch
    # User Florent Hivert <Florent.Hivert@univ-rouen.fr>
    # Date 1304445093 -7200
    # Node ID 98447c015c01b7f11731bcd369025b312601c796
    # Parent  e18b4ae3fcbe4afd1642b94e8646f8973fdf0716
    #11263: add ``.. linkall`` for doctests and fix devguide.
    
    diff --git a/sage-doctest b/sage-doctest
    a b def pythonify_rst(F): 
    524524                  verbatim examples in the ReST file.
    525525    """
    526526    import re
    527    
     527
     528    link_all = re.search(r'^\s*\.\.\s+linkall\s*$', F, re.M)
     529
    528530    def get_next_verbatim_block(s, pos):
    529531        while True:
    530532            # regular expression search in string s[pos:] for:
    def pythonify_rst(F): 
    533535
    534536            #Return -1 if we don't find anything.
    535537            if srch is None:
    536                return "", -1, False 
    537            
     538               return "", -1, False
     539
    538540            pos += srch.start()
    539541
    540542            prev_line = F.rfind("\n", 0, pos)
    def pythonify_rst(F): 
    549551
    550552            #Check to see if we need to link up with the previous
    551553            #block
    552             link_previous = True if '.. link' in options else False
     554            link_previous = link_all or ('.. link' in options)
    553555
    554556            #Find the first line that isn't indented as much as
    555557            #whatever followed the double colon.  The whitespace before
    def pythonify_rst(F): 
    577579
    578580        #Check to see if we have to link this block
    579581        #up with the previous block
    580         if link_previous:
     582        if link_previous and s != "":
    581583            #Get rid of the trailing quotes and newlines from the
    582584            #previous block
    583585            s = s[:-5]