Cell list generator includes cell links in table
This commit is contained in:
parent
b3669825e4
commit
10c5e8f271
|
@ -50,7 +50,7 @@ rst_template ="""\
|
||||||
|
|
||||||
|
|
||||||
cell_template = """\
|
cell_template = """\
|
||||||
* - {cell_name}
|
* - :doc:`{cell_name} <{link}>`
|
||||||
- {description}
|
- {description}
|
||||||
- {type}
|
- {type}
|
||||||
- {verilog_name}
|
- {verilog_name}
|
||||||
|
@ -128,7 +128,9 @@ def generate_rst(library_dir, library_name, cells):
|
||||||
#description = cell_json['description'].replace("\n", "\n "),
|
#description = cell_json['description'].replace("\n", "\n "),
|
||||||
description = textwrap.indent(cell_json['description'], ' ').lstrip(),
|
description = textwrap.indent(cell_json['description'], ' ').lstrip(),
|
||||||
type = cell_json['type'],
|
type = cell_json['type'],
|
||||||
verilog_name = cell_json['verilog_name']
|
verilog_name = cell_json['verilog_name'],
|
||||||
|
#link = str(cell.resolve()).rpartition('/')[0] + '/README'
|
||||||
|
link = 'cells/' + str(cell).rpartition('/')[0].rpartition('/')[2] + '/README'
|
||||||
)
|
)
|
||||||
|
|
||||||
header = rst_header.format(libname = library_name)
|
header = rst_header.format(libname = library_name)
|
||||||
|
@ -141,7 +143,7 @@ def generate_rst(library_dir, library_name, cells):
|
||||||
|
|
||||||
|
|
||||||
def AppendToReadme (celllistfile):
|
def AppendToReadme (celllistfile):
|
||||||
''' Prototype od lebrary README builder '''
|
''' Prototype of library README builder '''
|
||||||
readmefile = pathlib.Path(celllistfile.parents[0], 'README.rst')
|
readmefile = pathlib.Path(celllistfile.parents[0], 'README.rst')
|
||||||
old = ''
|
old = ''
|
||||||
if readmefile.exists():
|
if readmefile.exists():
|
||||||
|
@ -149,24 +151,10 @@ def AppendToReadme (celllistfile):
|
||||||
for i, l in enumerate(f):
|
for i, l in enumerate(f):
|
||||||
if i<5: old += l
|
if i<5: old += l
|
||||||
|
|
||||||
# get cell readme list
|
|
||||||
lscmd = 'ls -1a ' + str(celllistfile.parents[0])+"/cells/*/README.rst 2>/dev/null"
|
|
||||||
cellrdm = os.popen(lscmd).read().strip().split('\n')
|
|
||||||
cellrdm = [c.replace(str(celllistfile.parents[0])+'/','') for c in cellrdm]
|
|
||||||
|
|
||||||
with open(str(readmefile), "w+") as f:
|
with open(str(readmefile), "w+") as f:
|
||||||
f.write(old)
|
f.write(old)
|
||||||
tableinc = f'.. include:: {celllistfile.name}\n'
|
tableinc = f'.. include:: {celllistfile.name}\n'
|
||||||
|
|
||||||
if len(cellrdm):
|
|
||||||
f.write('\n\n\n')
|
|
||||||
f.write('Cell descriptions\n')
|
|
||||||
f.write('-----------------\n\n')
|
|
||||||
f.write('.. toctree::\n\n')
|
|
||||||
for c in cellrdm:
|
|
||||||
f.write(f' {c}\n')
|
|
||||||
f.write('\n\n\n')
|
|
||||||
|
|
||||||
if not tableinc in old:
|
if not tableinc in old:
|
||||||
f.write(tableinc)
|
f.write(tableinc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue