[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] navidoc ./TODO-navidoc ./config.py ./docutils.c...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] navidoc ./TODO-navidoc ./config.py ./docutils.c... |
Date: |
Wed, 04 Jun 2003 08:19:19 -0400 |
CVSROOT: /cvsroot/navidoc
Module name: navidoc
Changes by: Asko Soukka <address@hidden> 03/06/04 08:19:19
Modified files:
. : TODO-navidoc config.py docutils.conf rst2any.py
navidoc/directives: mp.py
navidoc/link : __init__.py
navidoc/modules: imagemap.py
navidoc/mp : __init__.py
Added files:
. : himalia.conf navidoc.conf
Log message:
config upgrade
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/himalia.conf?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc.conf?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/TODO-navidoc.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/config.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/docutils.conf.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/rst2any.py.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/directives/mp.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/link/__init__.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/modules/imagemap.py.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/navidoc/navidoc/navidoc/mp/__init__.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
Patches:
Index: navidoc/TODO-navidoc
diff -u navidoc/TODO-navidoc:1.19 navidoc/TODO-navidoc:1.20
--- navidoc/TODO-navidoc:1.19 Fri May 30 08:26:30 2003
+++ navidoc/TODO-navidoc Wed Jun 4 08:19:18 2003
@@ -13,13 +13,6 @@
* scandinavian characters won't work, that's probably
again that jython problem
- - context_menu option should be in diagrams, how to implement?
-
- - better way to handle differen config.py:s
-
- - better way to get config-params, should not crash if param
- not found?
-
- syntax to follow Fenfire coding standards
* or is this necessary?
@@ -30,8 +23,6 @@
- document docutils.conf:datestamp -additions (CVS_DATE,
CVS_VERSION, SSI_LASTMOD) somewhere
- more?
-
- - [jvk] zoom a reduced image by clicking the encircled part
0.2alpha1:
==========
Index: navidoc/config.py
diff -u navidoc/config.py:1.35 navidoc/config.py:1.36
--- navidoc/config.py:1.35 Mon May 26 06:58:02 2003
+++ navidoc/config.py Wed Jun 4 08:19:18 2003
@@ -19,30 +19,23 @@
# MA 02111-1307 USA
#
-# $Id: config.py,v 1.35 2003/05/26 10:58:02 humppake Exp $
+# $Id: config.py,v 1.36 2003/06/04 12:19:18 humppake Exp $
__docformat__ = 'reStructuredText'
dbg = None
-import os, navidoc.util.debug
+import os, navidoc.util.debug, ConfigParser
-#Environmental variable MPINPUTS should be relative to tmpdir,
-#or be an absolute path.
-os.putenv("MPINPUTS", "../navidoc/mp/")
-
-# base_url
-base_rul = 'http://fenfire.org/'
-
-# midfix for generated files
-# don't change this, if you don't know what you are doing :)
-midfix = ".gen"
+# general debug filter
+dbg = navidoc.util.debug.DebugFilter()
-# global settings needed all around
-mp_directory = 'diagrams'
-mp_generate = 1
-mp_eps_only = 0
-mp_context_menu = 1
+# system calls
+metapost = 'mpost'
+pnmscale = 'pnmscale'
+pstopnm = 'pstopnm'
+pnmtopng = 'pnmtopng'
+stderr = '/dev/null'
# initializing dynamic settings
# should be kept up-to-date in code
@@ -52,65 +45,36 @@
output_filename = ''
link_base_directory = None # if different than working_directory
-# settings for linking javadoc
-# the search order is ascending, sudden death
-linkpackages = {} # holder of packagenames, will members will be cleaned after
every diagram
-javadoc_directories = ['../libvob/doc/javadoc',
- '../storm/doc/javadoc',
- '../alph/doc/javadoc',
- '../fenfire/docs/javadoc',
- '../loom/doc/javadoc',
- '../navidoc/doc/javadoc'
- ]
-link_redirection = {'navidoc': '../navidoc/doc',
- 'libvob': '../libvob/doc',
- 'storm': '../storm/doc',
- 'alph': '../alph/doc',
- 'fenfire': '../fenfire/docs',
- 'loom': '../loom/doc',
- }
-docxx_directories = ['../libvob/doc/docxx',
- '../storm/doc/docxx',
- '../alph/doc/docxx',
- '../fenfire/docs/docxx',
- '../loom/doc/docxx',
- '../navidoc/doc/docxx',
- ]
+# set the default docutils.conf
+docutils_conf = "./docutils.conf"
-# general debug filter
-dbg = navidoc.util.debug.DebugFilter()
+# set the default navidoc.conf
+navidoc_conf = "./navidoc.conf"
-# set the default docutils.conf
-docutils = "./docutils.conf"
+# holder of packagenames when linking diagrams
+# will be cleaned after every diagram
+linkpackages = {}
+
+# should linked parts of the diagram be emphasized
+# using colors and rough edge
+link_emphasize = 0
+
+# should diagrams be generated at all
+# this is altered to halt image generation
+# temporarily
+mp_generate = 1
-# pegs will be sorted after their priority
-pegboard_priorities = {'Current': 1,
- 'Revising': 2,
- 'Incomplete': 3,
- 'Undefined': 4,
- 'Accepted': 5,
- 'Implemented': 6,
- 'Rejected': 7,
- 'Irrelevant': 8,
- }
-
-# authors and stakeholders to replace with nicknames
-pegboard_authors = {'Tuomas Lukka': 'tjl',
- 'Tuomas J. Lukka': 'tjl',
- 'Benja Fallenstein': 'benja',
- 'Benja': 'benja',
- 'Asko Soukka': 'humppake',
- 'Matti Katila': 'mudyc',
- 'Anton Feldmann': 'anton',
- 'Tero Mäyränen': 'deetsay',
- 'Marc Schiereck': 'dreevich',
- 'Hermanni Hyytiälä': 'hemppah',
- 'Antti_Juhani Kaijanaho': 'ibid',
- 'Janne V. Kujala': 'jvk',
- 'Janne Kujala': 'jvk',
- 'Tuukka Hastrup': 'tuukkah',
- 'Vesa Kaihlavirta': 'vegai',
- }
+# generate only eps-versions of diagrams
+# usable, when compiling reSTs into LaTeX
+mp_eps_only = 0
-# status for pegs without rst or with failing rst
-pegboard_undefined = 'Undefined'
+# should context menu be added into diagrams
+# this is latered as UML diagram option
+mp_context_menu = 0
+
+def read_config(module, filepath):
+ cp = ConfigParser.ConfigParser()
+ cp.read(filepath)
+ for section in cp.sections():
+ for option in cp.options(section):
+ setattr(module, option, eval(cp.get(section, option)))
Index: navidoc/docutils.conf
diff -u navidoc/docutils.conf:1.9 navidoc/docutils.conf:1.10
--- navidoc/docutils.conf:1.9 Fri May 9 05:57:29 2003
+++ navidoc/docutils.conf Wed Jun 4 08:19:18 2003
@@ -1,19 +1,19 @@
-#$Id: docutils.conf,v 1.9 2003/05/09 09:57:29 humppake Exp $
+#$Id: docutils.conf,v 1.10 2003/06/04 12:19:18 humppake Exp $
[options]
# These entries affect all processing:
-input-encoding: iso-8859-1
-output-encoding: iso-8859-1
-source-link: 1
-language-code: en
-datestamp: %c
-generator: 1
+input-encoding = iso-8859-1
+output-encoding = iso-8859-1
+source-link = 1
+language-code = en
+datestamp = %c
+generator = 1
# These entries affect HTML output:
-stylesheet-path: gzz.css
+stylesheet-path = gzz.css
# These entries affect LaTeX output:
-documentclass: book
-documentclass-options: 12pt,a4
-use-latex-toc: 1
+documentclass = book
+documentclass-options = 12pt,a4
+use-latex-toc = 1
Index: navidoc/navidoc/directives/mp.py
diff -u navidoc/navidoc/directives/mp.py:1.8
navidoc/navidoc/directives/mp.py:1.9
--- navidoc/navidoc/directives/mp.py:1.8 Thu May 22 06:52:20 2003
+++ navidoc/navidoc/directives/mp.py Wed Jun 4 08:19:18 2003
@@ -19,7 +19,7 @@
# MA 02111-1307 USA
#
-# $Id: mp.py,v 1.8 2003/05/22 10:52:20 humppake Exp $
+# $Id: mp.py,v 1.9 2003/06/04 12:19:18 humppake Exp $
#
# Written by Asko Soukka, Benja Fallenstein
@@ -104,6 +104,11 @@
caption = docutils.nodes.caption('', options['caption'],
label=attributes['name'])
uml_node += caption
+ # should context reference menu be embedded
+ if options.has_key('menu'):
+ context_menu = options['menu']
+ else: context_menu = 1
+
if content:
# splits content into uml and mp parts
files = ['', '']
@@ -127,6 +132,7 @@
uml_file = open(dir+diagram+config.midfix+'.uml', 'w')
uml_file.write(files[0])
+ if context_menu == 1: uml_file.write("\ncontextmenu\n")
uml_file.close()
mp = open(dir+diagram+config.midfix+'.mp', 'w')
@@ -144,6 +150,7 @@
'width': directives.unchanged,
'alt': directives.unchanged,
'label': directives.unchanged,
+ 'menu': directives.nonnegative_int,
}
uml_directive.content = 1
Index: navidoc/navidoc/link/__init__.py
diff -u navidoc/navidoc/link/__init__.py:1.20
navidoc/navidoc/link/__init__.py:1.21
--- navidoc/navidoc/link/__init__.py:1.20 Fri May 23 11:00:52 2003
+++ navidoc/navidoc/link/__init__.py Wed Jun 4 08:19:18 2003
@@ -19,7 +19,7 @@
# MA 02111-1307 USA
#
-#$Id: __init__.py,v 1.20 2003/05/23 15:00:52 humppake Exp $
+#$Id: __init__.py,v 1.21 2003/06/04 12:19:18 humppake Exp $
#
# Written by Tuomas Lukka, Asko Soukka
@@ -118,6 +118,9 @@
if not self.error and os.path.abspath(path) \
==
os.path.abspath(slashify(config.working_directory)+config.output_filename):
self.focus = 1
+ self.target = ''
+ self.title = ''
+
def setup_code(self): return ''
Index: navidoc/navidoc/modules/imagemap.py
diff -u navidoc/navidoc/modules/imagemap.py:1.8
navidoc/navidoc/modules/imagemap.py:1.9
--- navidoc/navidoc/modules/imagemap.py:1.8 Fri May 23 09:41:40 2003
+++ navidoc/navidoc/modules/imagemap.py Wed Jun 4 08:19:19 2003
@@ -19,7 +19,7 @@
# MA 02111-1307 USA
#
-#$Id: imagemap.py,v 1.8 2003/05/23 13:41:40 humppake Exp $
+#$Id: imagemap.py,v 1.9 2003/06/04 12:19:19 humppake Exp $
#
# Written by Asko Soukka
@@ -198,13 +198,13 @@
if len(links) > 0:
bbox = psbbox(bbox)
for link in links:
- if not link.target.startswith('http://'):
+ if not link.target.startswith('http://') and not link.target == '':
link.target = relative_path(config.working_directory,
link.target)
link.map_corners(bbox.map_point)
imgmap = '<a id="'+diagram+id_postfix+'"></a>' \
+'<map id="'+diagram+id_postfix+'_map"
name="'+diagram+id_postfix+'_map">'+"\n" \
- +"\n".join([link.imgmapanchor(scale) for link in links]) \
+ +"\n".join([link.imgmapanchor(scale=scale, diagram=diagram)
for link in links]) \
+'</map>'+"\n" \
+'<img
src="'+slashify(relative_path(config.working_directory, config.mp_directory)) \
+diagram+context+config.midfix+'.png"
usemap="#'+diagram+id_postfix+'_map" alt="'+diagram+id_postfix+'" />'+"\n"
Index: navidoc/navidoc/mp/__init__.py
diff -u navidoc/navidoc/mp/__init__.py:1.35 navidoc/navidoc/mp/__init__.py:1.36
--- navidoc/navidoc/mp/__init__.py:1.35 Fri May 23 11:00:52 2003
+++ navidoc/navidoc/mp/__init__.py Wed Jun 4 08:19:19 2003
@@ -19,7 +19,7 @@
# MA 02111-1307 USA
#
-# $Id: __init__.py,v 1.35 2003/05/23 15:00:52 humppake Exp $
+# $Id: __init__.py,v 1.36 2003/06/04 12:19:19 humppake Exp $
#
# Written by Tuomas Lukka, Asko Soukka
@@ -42,6 +42,7 @@
def link_draw_code(self):
if config.mp_eps_only: return ''
+ if not config.link_emphasize: return 'showlinksize("'+self.target+'",
"'+self.title+'", ('+self.bbox+'));'
if self.error: return 'showlinkerror("'+self.target+'", "'+self.title+'",
('+self.bbox+'));'
if not self.focus: return 'showlink("'+self.target+'", "'+self.title+'",
('+self.bbox+'));'
else:
@@ -108,6 +109,15 @@
"""
return self.repl(s)
+class mpContextMenu(MetapostElement):
+ key = 'contextmenu'
+ def __init__(self, var, s, list = []):
+ config.mp_context_menu = 1
+ def setup_code(self):
+ return ''
+ def draw_code(self):
+ return ''
+
def context_menu(diagram):
""" Creates the "menu" above the diagram. """
@@ -187,6 +197,7 @@
if len(context) > 0:
context = '_'+context
if config.mp_context_menu: draw_extra = context_menu(diagram);
+ config.mp_context_menu = 0
dir = slashify(config.mp_directory)
@@ -209,7 +220,7 @@
gen3 = open(dir+diagram+context+config.midfix+".mp.3", "w")
gen3.write("""
prologues := 1;
- input uml.mp
+ input """+slashify(relative_path(config.mp_directory,
'navidoc/mp/'))+"""uml.mp
beginfig(1)
input %(diagram)s%(context)s%(midfix)s.mp.1
@@ -227,9 +238,9 @@
"""
config.dbg.out('navidoc', 'Compiling diagram '+diagram)
- syscmd = 'mpost --file-line-error-style ' \
+ syscmd = config.metapost+' --file-line-error-style ' \
+ '--interaction nonstopmode ' \
- + diagram + config.midfix + '.mp.3 >/dev/null'
+ + diagram + config.midfix + '.mp.3 >'+config.stderr
dbg(syscmd)
os.system('cd '+config.mp_directory+';'+syscmd)
@@ -274,10 +285,10 @@
scaling = int(scaling / scale)
dbg("List: "+str(list))
- syscmd = ('pstopnm '+' '.join(list)+'
<'+slashify(config.mp_directory)+diagram+config.midfix \
- +""".mp.1 2>/dev/null | pnmscale -reduce %s 2>/dev/null |
"""%scaling \
- +'pnmtopng -transparent =white >'+slashify(config.mp_directory) \
- +diagram+config.midfix+'.png 2>/dev/null')#
+ syscmd = config.pstopnm+' '+' '.join(list)+'
<'+slashify(config.mp_directory)+diagram+config.midfix \
+ +'.mp.1 2>'+config.stderr+' | '+config.pnmscale+" -reduce
%s"%(scaling)+' 2>'+config.stderr+' | ' \
+ +config.pnmtopng+' -transparent =white
>'+slashify(config.mp_directory) \
+ +diagram+config.midfix+'.png 2>'+config.stderr
dbg(syscmd)
os.system(syscmd)
@@ -325,10 +336,19 @@
)]
dbg("Mapped corners: "+str(self.corners))
- def imgmapanchor(self, scale=1.0):
- return """<area href="%s" shape="rect" coords="%s" target="_top"
title="%s" alt="%s" />""" \
+ def imgmapanchor(self, scale=1.0, diagram=None):
+ #If we have a link with empty target and empty title, let's link
+ #it to the diagram itself, if diagram name provided.
+ if self.title == '' and diagram: self.title =
diagram+config.midfix+'.png'
+ if self.target == '' and diagram:
+ self.target = slashify(relative_path(config.working_directory,
config.mp_directory))+diagram+config.midfix+'.png'
+ if self.target.endswith('.png'): target = '_plain'
+ else: target = '_top'
+
+ return """<area href="%s" shape="rect" coords="%s" target="%s"
title="%s" alt="%s" />""" \
% (self.target,
",".join(["%s"%(int(c*scale)) for c in self.corners]),
+ target,
self.title,
self.title)
Index: navidoc/rst2any.py
diff -u navidoc/rst2any.py:1.27 navidoc/rst2any.py:1.28
--- navidoc/rst2any.py:1.27 Thu May 22 10:17:25 2003
+++ navidoc/rst2any.py Wed Jun 4 08:19:18 2003
@@ -21,7 +21,7 @@
# MA 02111-1307 USA
#
-#$Id: rst2any.py,v 1.27 2003/05/22 14:17:25 humppake Exp $
+#$Id: rst2any.py,v 1.28 2003/06/04 12:19:18 humppake Exp $
#
# Written by Asko Soukka
@@ -30,10 +30,12 @@
__docformat__ = 'reStructuredText'
import config
+config.read_config(config, config.navidoc_conf)
import sys, os, getopt
import docutils.core
+
import navidoc.directives
import navidoc.writers
import navidoc.languages
@@ -95,13 +97,14 @@
dbg_config('Working directory: '+config.working_directory)
dbg_config('Input file: '+config.input_filename)
+ config.read_config(config, config.navidoc_conf)
if html:
dbg('Compiling ReST '+input)
output = output+config.midfix+'.html'
config.output_filename = os.path.basename(output)
dbg_config('Output file: '+config.output_filename)
- args = '--config '+config.docutils+' '+input+' '+output
+ args = '--config '+config.docutils_conf+' '+input+' '+output
config.mp_eps_only = 0
docutils.core.publish_cmdline(writer_name='html', argv=args.split())
@@ -111,7 +114,7 @@
output = output+config.midfix+'.latex'
config.output_filename = os.path.basename(output)
dbg_config('Output file: '+config.output_filename)
- args = '--config '+config.docutils+' '+input+' '+output
+ args = '--config '+config.docutils_conf+' '+input+' '+output
config.mp_eps_only = 1
docutils.core.publish_cmdline(writer_name='latex', argv=args.split())
@@ -136,9 +139,11 @@
last_dot = path.replace("../", "__/").rfind('.')
if last_dot != -1: path = path[:last_dot]+config.midfix+'.html'
+ config.link_emphasize = 1
import navidoc.modules.imagemap
config.working_directory = os.path.normpath(os.path.dirname(path))
navidoc.modules.imagemap.postprocess(path)
+ config.link_emphasize = 0
if texture:
if os.path.isfile(path):
@@ -157,25 +162,31 @@
if os.path.isdir(path) and not os.path.islink(path):
dirlist = listdir(path,['rst'],dirs=1)
if os.path.isfile(slashify(path) + 'docutils.conf'):
- config.docutils = slashify(path) + 'docutils.conf'
+ config.docutils_conf = slashify(path) + 'docutils.conf'
+ if os.path.isfile(slashify(path) + 'navidoc.conf'):
+ config.navidoc_conf = slashify(path) + 'navidoc.conf'
for entry in dirlist:
run_docutils(slashify(path)+entry)
elif os.path.isfile(path):
config.working_directory = os.path.normpath(os.path.dirname(path))
if os.path.isfile(slashify(config.working_directory) +
'docutils.conf'):
- config.docutils = slashify(config.working_directory) +
'docutils.conf'
+ config.docutils_conf = slashify(config.working_directory) +
'docutils.conf'
+ if os.path.isfile(slashify(config.working_directory) + 'navidoc.conf'):
+ config.navidoc_conf = slashify(config.working_directory) +
'navidoc.conf'
config.input_filename = os.path.basename(path)
rst2any(path)
elif os.path.isfile(path+'.rst'):
config.working_directory = os.path.normpath(os.path.dirname(path))
if os.path.isfile(slashify(config.working_directory) +
'docutils.conf'):
- config.docutils = slashify(config.working_directory) +
'docutils.conf'
+ config.docutils_conf = slashify(config.working_directory) +
'docutils.conf'
+ if os.path.isfile(slashify(config.working_directory) + 'navidoc.conf'):
+ config.navidoc_conf = slashify(config.working_directory) +
'navidoc.conf'
config.input_filename = os.path.basename(path+'.rst')
rst2any(path+'.rst')
config.input_filename = ''
-
+
# catching loop parameters from the command line
try: sys.argv.remove('--loop'); loop = 1
except ValueError: loop = 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] navidoc ./TODO-navidoc ./config.py ./docutils.c...,
Asko Soukka <=