Changeset 3188:e94ef8715cdf in livinglogic.python.xist

Show
Ignore:
Timestamp:
01/28/08 17:03:00 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

A base filename can now be passed to rest.fromstring() and friends. Drop system_message elements from converted source.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/ns/rest.py

    r3183 r3188  
    561561        class type(xsc.TextAttr): pass 
    562562 
     563    def convert(self, converter): 
     564        # A warning has already been issued by docutils, we don't have to do anything 
     565        return xsc.Null  
    563566 
    564567class raw(BaseElement): 
     
    920923 
    921924 
    922  
    923  
    924925class ReSTConversionWarning(Warning): 
    925926    pass 
     
    10031004 
    10041005 
    1005 def fromstring(string, **options): 
    1006     doc = core.publish_doctree(string, settings_overrides=options) 
     1006def fromstring(string, base=None, **options): 
     1007    doc = core.publish_doctree(string, source_path=base, settings_overrides=options) 
    10071008    elements = globals() 
    10081009 
     
    10251026 
    10261027 
    1027 def fromstream(stream, **options): 
    1028     return fromstring(stream.read(), **options) 
    1029  
    1030  
    1031 def fromfile(filename, **options): 
     1028def fromstream(stream, base=None, **options): 
     1029    return fromstring(stream.read(), base, **options) 
     1030 
     1031 
     1032def fromfile(filename, base=None, **options): 
    10321033        filename = os.path.expanduser(filename) 
     1034        if base is None: 
     1035            base = filename 
    10331036        with contextlib.closing(open(filename, "rb")) as stream: 
    1034             return fromstream(stream, **options) 
     1037            return fromstream(stream, base, **options)