Skip to content

Commit

Permalink
Code unweaving and generation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lacey committed Jan 30, 2013
1 parent 9ab3071 commit ee5f791
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions unweave.py
Expand Up @@ -11,10 +11,12 @@ def unweave(src_lines):
finish_output_doc = False

# A /** at the beginning of the line outputs documentation
m = re.match('\s*/\*\*\s*(.*)',line)
m = re.match('(\s*/\*\*\s*)(.*)',line)
if m:
output_doc = True
line = m.groups(0)[0]
indent = len(m.groups(0)[0])
line = ''.join([' ' for x in range(0,indent)]) + m.groups(0)[1]
line = line + "\n"

# A */ or **/ finishes outputing docs
m = re.match('(.*?)\*(\*?)/\s*',line)
Expand All @@ -30,6 +32,10 @@ def unweave(src_lines):
line += '\n'

if output_doc:
m = re.match('(\s*)[^\s].*',line)
if (m):
indent = min(indent,len(m.groups(0)[0]))
line = line[indent:]
rst_lines.append(line)
elif output_code:
rst_lines.append(" "+line)
Expand Down
8 changes: 4 additions & 4 deletions xdoc.py
Expand Up @@ -236,14 +236,14 @@ def doLatex(doc_dir,build_dir,config, master, xmoslatex=False):
os.environ['TEXINPUTS'] = os.path.join(config['XDOC_DIR'],'..','infr_docs','base')+listsep + os.path.join(config['XDOC_DIR'],'..','..','infr_docs','base')+listsep
os.environ['TEXINPUTS'] += os.path.join(config['XDOC_DIR'],'texinput')+listsep
texfile = os.path.join(doc_dir,master+".tex")
if not os.path.exists(os.path.join(build_dir,master+".tex")):
print "Cannot find latex file. Something must have gone wrong"
if not os.path.exists(os.path.join(build_dir,os.path.basename(master)+".tex")):
print "Cannot find latex file: %s\n. Something must have gone wrong" % os.path.join(build_dir,os.path.basename(master)+".tex")
exit(1)

#shutil.copy(os.path.join(build_dir,master+".tex"),texfile)
os.environ['TEXINPUTS'] += os.path.abspath(build_dir) + listsep + os.path.abspath(doc_dir) + listsep
filt = XSphinxFilter(sys.stdout, sys.stderr, os.path.join(build_dir,'latex.output'))
texfile = master+'.tex'
texfile = os.path.basename(master)+'.tex'
if xmoslatex:
import_xmos(config)
from xmossphinx.xmos_latex import make_xmos_latex
Expand All @@ -255,7 +255,7 @@ def doLatex(doc_dir,build_dir,config, master, xmoslatex=False):
outfile = texfile.replace('.tex','.pdf')
if xmoslatex:
shutil.copy(os.path.join(build_dir,outfile),
os.path.join(build_dir,master+'.pdf'))
os.path.join(build_dir,os.path.basename(master)+'.pdf'))
os.remove(os.path.join(build_dir,outfile))

for line in lines:
Expand Down

0 comments on commit ee5f791

Please sign in to comment.