/[navidoc]/navidoc/navidoc/directives/mp.py
ViewVC logotype

Diff of /navidoc/navidoc/directives/mp.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by humppake, Wed Mar 26 15:36:17 2003 UTC revision 1.2 by humppake, Fri Mar 28 13:08:57 2003 UTC
# Line 32  from docutils.parsers.rst import directi Line 32  from docutils.parsers.rst import directi
32    
33  import config  import config
34    
35  from navidoc.utils.path import _slashify, relative_path  from navidoc.utils.path import *
36  from navidoc.mp.core import mp2png, uml  from navidoc.mp import mp2png, create_uml
37    
38  dbg = config.dbg.shorthand('mp')  dbg = config.dbg.shorthand('mp')
39  dbg_fail = config.dbg.shorthand('mp.fail')  dbg_fail = config.dbg.shorthand('mp.fail')
# Line 49  def mp_directive(name, arguments, option Line 49  def mp_directive(name, arguments, option
49      eps_only = config.mp_eps_only # should no png files be generated      eps_only = config.mp_eps_only # should no png files be generated
50    
51      attributes = {'name': arguments[0]}      attributes = {'name': arguments[0]}
52      options['uri'] = _slashify(to_tmpdir)+attributes['name']      options['uri'] = slashify(to_tmpdir)+attributes['name']
53      if not eps_only: options['uri'] += '.gen.png'      if not eps_only: options['uri'] += '.gen.png'
54      else: options['uri'] += '_gen.eps'      else: options['uri'] += '_gen.eps'
55      options['alt'] = attributes['name']      options['alt'] = attributes['name']
# Line 63  def mp_directive(name, arguments, option Line 63  def mp_directive(name, arguments, option
63          # XXX fatal error should be made if a diagram with the same name          # XXX fatal error should be made if a diagram with the same name
64          # already exists.          # already exists.
65    
66          mp_filename = _slashify(config.mp_directory)+attributes['name']          mp_filename = slashify(config.mp_directory)+attributes['name']
67          if not eps_only: mp = open(mp_filename+'.gen.mp.3', 'w')          if not eps_only: mp = open(mp_filename+'.gen.mp.3', 'w')
68          else: mp = open(mp_filename+'_gen.eps', 'w')          else: mp = open(mp_filename+'_gen.eps', 'w')
69          mp.write(temp)          mp.write(temp)
# Line 89  def uml_directive(name, arguments, optio Line 89  def uml_directive(name, arguments, optio
89      eps_only = config.mp_eps_only # should no png files be generated      eps_only = config.mp_eps_only # should no png files be generated
90    
91      attributes = {'name': arguments[0]}      attributes = {'name': arguments[0]}
92      src = _slashify(to_tmpdir)+attributes['name']      src = slashify(to_tmpdir)+attributes['name']
93      if not eps_only: src += '.gen.png'      if not eps_only: src += '.gen.png'
94      else: src += '_gen.eps'      else: src += '_gen.eps'
95    
# Line 123  def uml_directive(name, arguments, optio Line 123  def uml_directive(name, arguments, optio
123          # already exists.          # already exists.
124    
125          # writes uml and mp sourcefiles and converts them into png and html          # writes uml and mp sourcefiles and converts them into png and html
126          dir = _slashify(config.mp_directory)          dir = slashify(config.mp_directory)
127          diagram = attributes['name']          diagram = attributes['name']
128    
129          uml_file = open(dir+diagram+'.gen.uml', 'w')          uml_file = open(dir+diagram+'.gen.uml', 'w')
# Line 159  def uml_refer_directive(name, arguments, Line 159  def uml_refer_directive(name, arguments,
159      eps_only = config.mp_eps_only # should no png files be generated      eps_only = config.mp_eps_only # should no png files be generated
160    
161      attributes = {'name': arguments[0]}      attributes = {'name': arguments[0]}
162      src = _slashify(to_tmpdir)+attributes['name']      src = slashify(to_tmpdir)+attributes['name']
163      if not eps_only: src += '.gen.png'      if not eps_only: src += '.gen.png'
164      else: src += '_gen.eps'      else: src += '_gen.eps'
165    
# Line 180  def add_refer(diagram, to_top = 0): Line 180  def add_refer(diagram, to_top = 0):
180      """      """
181      Add reference information for a spesific diagram.      Add reference information for a spesific diagram.
182      """      """
183      refers_filepath = _slashify(config.working_directory)+diagram+".gen.refers"      refers_filepath = slashify(config.working_directory)+diagram+".gen.refers"
184      if (os.path.isfile(refers_filepath)):      if (os.path.isfile(refers_filepath)):
185          old_refers = open(refers_filepath, "r").read()          old_refers = open(refers_filepath, "r").read()
186          if old_refers.find(config.output_filename) == -1:          if old_refers.find(config.output_filename) == -1:

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26