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

Diff of /navidoc/navidoc/directives/pegboard.py

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

revision 1.5 by humppake, Fri Mar 21 13:23:36 2003 UTC revision 1.6 by humppake, Fri Mar 21 14:35:53 2003 UTC
# Line 46  def pegcmp(a, b): Line 46  def pegcmp(a, b):
46      Sorts pegs primarily in descending priority order of status      Sorts pegs primarily in descending priority order of status
47      and secondarily in descending time stamp.      and secondarily in descending time stamp.
48      """      """
49      if priority.has_key(a['status'].capitalize().split()[0]) \      if config.pegboard_priorities.has_key(a['status'].capitalize().split()[0]) \
50             and priority.has_key(b['status'].capitalize().split()[0]) \             and config.pegboard_priorities.has_key(b['status'].capitalize().split()[0]) \
51             and not a['status'].lower().split() == b['status'].lower().split():             and not a['status'].lower().split() == b['status'].lower().split():
52          return priority[a['status'].capitalize().split()[0]] \          return config.pegboard_priorities[a['status'].capitalize().split()[0]] \
53                 > priority[b['status'].capitalize().split()[0]] or -1                 > config.pegboard_priorities[b['status'].capitalize().split()[0]] or -1
54            
55      as = a['last-modified'].split('-')      as = a['last-modified'].split('-')
56      bs = b['last-modified'].split('-')      bs = b['last-modified'].split('-')
# Line 119  def build_pegtable(): Line 119  def build_pegtable():
119          dbg('processing PEG ' + pegdir)          dbg('processing PEG ' + pegdir)
120          config.working_directory = _slashify(init_working_directory)+pegdir          config.working_directory = _slashify(init_working_directory)+pegdir
121                    
122          peg = {'authors': [], 'status': undefined, 'topic': pegdir, 'stakeholders': [],          peg = {'authors': [], 'status': config.pegboard_undefined, 'topic': pegdir,
123                 'last-modified': '', 'dir': pegdir, 'files': '', 'html': '', 'rst': '',                 'stakeholders': [], 'last-modified': '', 'dir': pegdir, 'files': '',
124                 'rstfiles': [], 'cvsignore': [] }                 'html': '', 'rst': '', 'rstfiles': [], 'cvsignore': [] }
125                    
126          peg['files'] = [f for f in os.list(config.working_directory) \          peg['files'] = [f for f in os.listdir(config.working_directory) \
127                          if os.path.isfile(_slashify(config.working_directory)+f)                          if os.path.isfile(_slashify(config.working_directory)+f)
128                          and not f.startswith('.') and '#' not in f and '~' not in f]                          and not f.startswith('.') and '#' not in f and '~' not in f]
129    
130          if peg['files'].find('peg.rst') != -1: peg['rst'] = 'peg.rst'          try:
131          else:              index = peg['files'].index('peg.rst')
132                peg['rst'] = peg['files'][index]
133            except ValueError:
134              for pegfile in peg['files']:              for pegfile in peg['files']:
135                  if pegfile.endswith('.rst'):                  if pegfile.endswith('.rst'):
136                      peg['rst'] = pegfile                      peg['rst'] = pegfile
# Line 139  def build_pegtable(): Line 141  def build_pegtable():
141              pub = Publisher()              pub = Publisher()
142              pub.set_reader('standalone', None, 'restructuredtext')              pub.set_reader('standalone', None, 'restructuredtext')
143              filename = _slashify(config.working_directory)+rstfile              filename = _slashify(config.working_directory)+rstfile
144              pub.process_command_line(argv="--config "+config.docutils+" "+filename+"".split())              #" tmp" at the end of the next line is for jython to avoid negative arraylength :)
145                pub.process_command_line(argv=("--config "+config.docutils+" "+filename+" tmp").split())
146                            
147              #conversion may fail because of bad restructuredtext              #conversion may fail because of bad restructuredtext
148              try:              try:
# Line 158  def build_pegtable(): Line 161  def build_pegtable():
161                      #we may have got 'rawsource', which needs some tidying                      #we may have got 'rawsource', which needs some tidying
162                      if peg['last-modified'].startswith('$Date'):                      if peg['last-modified'].startswith('$Date'):
163                          peg['last-modified'] = peg['last-modified'][7:len(peg['last-modified'])-11].replace('/', '-')                          peg['last-modified'] = peg['last-modified'][7:len(peg['last-modified'])-11].replace('/', '-')
164                      peg['status'] = getTagValue(document, 'status') or undefined                      peg['status'] = getTagValue(document, 'status') or config.pegboard_undefined
165                      stakeholders = getFieldTagValue(document, 'stakeholder')                      stakeholders = getFieldTagValue(document, 'stakeholder')
166                      if not stakeholders:                      if not stakeholders:
167                          stakeholders = getFieldTagValue(document, 'stakeholders')                          stakeholders = getFieldTagValue(document, 'stakeholders')
# Line 184  def build_pegtable(): Line 187  def build_pegtable():
187                    
188      #finally adds peg's metadata into pegtable      #finally adds peg's metadata into pegtable
189      pegtable.append(peg)      pegtable.append(peg)
190        return pegtable
191    
192  #create the ``.. pegboard::`` directive  #create the ``.. pegboard::`` directive
193  def pegboard_directive(*args):  def pegboard_directive(*args):
# Line 227  def pegboard_directive(*args): Line 231  def pegboard_directive(*args):
231          tbody += row          tbody += row
232    
233          def get_author(s):          def get_author(s):
234              if authors.has_key(s): return authors[s]              if config.pegboard_authors.has_key(s):
235                    return config.pegboard_authors[s]
236              else: return s              else: return s
237    
238          _authors = [get_author(s) for s in peg['authors']]          _authors = [get_author(s) for s in peg['authors']]
# Line 294  def td(__node, **args): Line 299  def td(__node, **args):
299                    
300      para += __node      para += __node
301      return entry      return entry
       
302    
303  def make_files(peg):  def make_files(peg):
304      # again, cpython and 'class'      # again, cpython and 'class'

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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