Skip to content

Commit 8542109

Browse files
committed
Fix single-file match when using full comp/instr - will open html file directly
1 parent 041264e commit 8542109

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/Python/mcdoc/mcdoc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,15 +1047,20 @@ def main(args):
10471047

10481048
instr = re.search(r'[\w0-9]+\.instr', args.searchterm)
10491049
comp = re.search(r'[\w0-9]+\.comp', args.searchterm)
1050+
docdir = mccode_config.directories["docdir"]
10501051

10511052
if instr:
1052-
f_html = os.path.splitext(f)[0] + ".html"
1053+
f_base = os.path.splitext(os.path.basename(f))[0]
1054+
f_class = os.path.basename(os.path.dirname(os.path.dirname(f)))
1055+
f_html = os.path.join(docdir,'examples',f_class,f_base,f_base + ".html")
10531056
info = InstrParser(f).parse()
10541057
info.filepath = os.path.abspath(f)
10551058
write_doc_files_or_continue([], [info], [], [f])
10561059
subprocess.Popen('%s %s' % (mccode_config.configuration['BROWSER'], f_html), shell=True)
10571060
elif comp:
1058-
f_html = os.path.splitext(f)[0] + ".html"
1061+
f_base = os.path.splitext(os.path.basename(f))[0] + ".html"
1062+
f_class = os.path.basename(os.path.dirname(f))
1063+
f_html = os.path.join(docdir,f_class,f_base)
10591064
info = CompParser(f).parse()
10601065
info.filepath = os.path.abspath(f)
10611066
write_doc_files_or_continue([info], [], [f], [])

0 commit comments

Comments
 (0)