Commits

Takeshi Komiya committed b9b0395

Use new blockdiag interface

  • Participants
  • Parent commits 9f6fef3

Comments (0)

Files changed (6)

actdiag/sphinxcontrib/actdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from actdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from actdiag_sphinxhelper import command, parser, builder, drawer
 from actdiag_sphinxhelper import collections, FontMap
 from actdiag_sphinxhelper import actdiag, ActdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Actdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
 
         for lane in screen.lanes:
                 node.href = resolve_reference(self, node.href, options)
 
         antialias = self.builder.config.actdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
     except Exception, e:
         raise ActdiagError('actdiag error:\n%s\n' % e)
 

blockdiag/sphinxcontrib/blockdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from blockdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from blockdiag_sphinxhelper import command, parser, builder, drawer
 from blockdiag_sphinxhelper import collections, FontMap
 from blockdiag_sphinxhelper import blockdiag, BlockdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Blockdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
         for node in screen.traverse_nodes():
             if node.href:
                 node.href = resolve_reference(self, node.href, options)
 
         antialias = self.builder.config.blockdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
 
     except Exception, e:
         raise BlockdiagError('blockdiag error:\n%s\n' % e)

nwdiag/sphinxcontrib/nwdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from nwdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from nwdiag_sphinxhelper import command, parser, builder, drawer
 from nwdiag_sphinxhelper import collections, FontMap
 from nwdiag_sphinxhelper import nwdiag, NwdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Nwdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
 
         antialias = self.builder.config.nwdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
     except Exception, e:
         raise NwdiagError('nwdiag error:\n%s\n' % e)
 

nwdiag/sphinxcontrib/packetdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from packetdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from packetdiag_sphinxhelper import command, parser, builder, drawer
 from packetdiag_sphinxhelper import collections, FontMap
 from packetdiag_sphinxhelper import packetdiag, PacketdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Packetdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
 
         antialias = self.builder.config.packetdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
     except Exception, e:
         raise PacketdiagError('packetdiag error:\n%s\n' % e)
 

nwdiag/sphinxcontrib/rackdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from rackdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from rackdiag_sphinxhelper import command, parser, builder, drawer
 from rackdiag_sphinxhelper import collections, FontMap
 from rackdiag_sphinxhelper import rackdiag, RackdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Rackdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
 
         antialias = self.builder.config.rackdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
     except Exception, e:
         raise RackdiagError('rackdiag error:\n%s\n' % e)
 

seqdiag/sphinxcontrib/seqdiag.py

 from sphinx.util.osutil import ensuredir, ENOENT, EPIPE
 from sphinx.util.compat import Directive
 
-from seqdiag_sphinxhelper import command, diagparser, builder, DiagramDraw
+from seqdiag_sphinxhelper import command, parser, builder, drawer
 from seqdiag_sphinxhelper import collections, FontMap
 from seqdiag_sphinxhelper import seqdiag, SeqdiagDirective
 namedtuple = collections.namedtuple
     def run(self):
         try:
             return super(Seqdiag, self).run()
-        except diagparser.ParseException, e:
+        except parser.ParseException, e:
             if self.content:
                 msg = '[%s] ParseError: %s\n%s' % (self.name, e, "\n".join(self.content))
             else:
     draw = None
     fontmap = get_fontmap(self)
     try:
-        tree = diagparser.parse(diagparser.tokenize(code))
+        tree = parser.parse_string(code)
         screen = builder.ScreenNodeBuilder.build(tree)
 
         antialias = self.builder.config.seqdiag_antialias
-        draw = DiagramDraw.DiagramDraw(format, screen, filename,
-                                       fontmap=fontmap, antialias=antialias)
+        draw = drawer.DiagramDraw(format, screen, filename,
+                                  fontmap=fontmap, antialias=antialias)
     except Exception, e:
         raise SeqdiagError('seqdiag error:\n%s\n' % e)