Changeset 320


Ignore:
Timestamp:
26/04/15 17:13:27 (6 years ago)
Author:
mjuckes
Message:

class to parse vocab defn

Location:
CMIP6dreq/trunk/src/framework
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreq/trunk/src/framework/ptxt.py

    r319 r320  
    1 import string, re, collections 
     1''' Generate vocabulary definition document and sample vocabulary document. 
     2USAGE 
     3..... 
     4ptxt.py [samp|defn] 
     5''' 
     6import string, re, collections, sys 
     7 
     8if len(sys.argv) > 1: 
     9  mode = sys.argv[1] 
     10 
     11assert mode in ["defn", "samp"] 
    212 
    313re_it = re.compile( '{(.*)}' ) 
     
    1323 
    1424expl_Tmpl = '''<%(label)s class="vocab" title="%(title)s" id="%(id)s"> 
     25<info srcType="dummy" srcRef="ptxt.py">Dummy entries</info> 
    1526%(exampleItem)s 
    1627</%(label)s> 
    1728''' 
    18 item_Tmpl = '<item label="%(label)s" title="%(title)s"%(extras)s/>' 
     29item_Tmpl = '<item id="%(id)s" label="%(label)s" title="%(title)s"%(extras)s/>' 
    1930 
    2031class vocab(object): 
     
    2839     self.id = 'cmip.drv.%3.3i' % kk 
    2940     self.ilt = bits[3] 
     41     self.kk = kk 
    3042     print '[%s] %s {%s:%s}' % (self.label, self.title, self.id, self.ilt) 
    3143     self.itematts = [  nt__itematt( 'label','xs:string',None ), 
     
    7890 
    7991           extras += ' %s="%s"' % (i.name,value) 
     92       id = '001.%3.3i.%3.3i' % (self.kk,1) 
    8093       exampleItem = item_Tmpl % locals() 
    8194       label = self.label 
     
    115128kk= 0 
    116129this = None 
    117 mode = "samp" 
    118 mode = "defn" 
    119130fns = {'defn':'vocabDefn', 'samp':'vocabSample' } 
    120131fn = fns[mode] 
Note: See TracChangeset for help on using the changeset viewer.