Issue #1861 Improve Javadoc documentation fixed. Multiline code segments added to Javadoc.

This commit is contained in:
Alexander Smorkalov 2012-10-11 19:20:20 +04:00
parent a2088d0c52
commit 5a524bdfd7

View File

@ -172,6 +172,7 @@ class RstParser(object):
capturing_seealso = False
skip_code_lines = False
expected_brief = True
was_code_line = False
fdecl = DeclarationParser()
pdecl = ParamParser()
@ -201,17 +202,21 @@ class RstParser(object):
# skip lines if line-skipping mode is activated
if skip_code_lines:
if not l or l.startswith(" "):
if not l:
continue
if l.startswith(" "):
None
else:
skip_code_lines = False
if ll.startswith(".. code-block::") or ll.startswith(".. image::"):
skip_code_lines = True
continue
# todo: parse structure members; skip them for now
if ll.startswith(".. ocv:member::"):
#print ll
skip_code_lines = True
continue
@ -223,6 +228,7 @@ class RstParser(object):
expected_brief = False
elif ll.endswith("::"):
# turn on line-skipping mode for code fragments
#print ll
skip_code_lines = True
ll = ll[:len(ll)-2]
@ -286,9 +292,20 @@ class RstParser(object):
continue
# record other lines as long description
if (skip_code_lines):
ll = ll.replace("/*", "/ *")
ll = ll.replace("*/", "* /")
if (was_code_line):
func["long"] = func.get("long", "") + "\n" + ll + "\n"
else:
was_code_line = True;
func["long"] = func.get("long", "") + ll +"\n<code>\n\n // C++ code:\n\n"
else:
if (was_code_line):
func["long"] = func.get("long", "") + "\n" + ll + "\n</code>\n";
was_code_line = False;
else:
func["long"] = func.get("long", "") + "\n" + ll
if skip_code_lines:
func["long"] = func.get("long", "") + "\n"
# endfor l in lines
if fdecl.balance != 0: