Merge branch 'hunspell' of https://github.com/tkruse/CppCoreGuidelines into tkruse-hunspell

This commit is contained in:
Andrew Pardoe
2016-08-22 11:34:17 -07:00
4 changed files with 581 additions and 16 deletions

View File

@@ -63,7 +63,7 @@ def main():
code_block_index += 1
# reach here either line was not code, or was code
# and we dealt with n code lines
if not is_code(line, indent_depth):
if indent_depth < 4 or not is_code(line, indent_depth):
# store header id for codeblock
section_id = get_marker(line)
if section_id is not None:
@@ -79,7 +79,7 @@ def process_code(read_filehandle, text_filehandle, line, linenum, sourcefile, co
try:
line = read_filehandle.next()
linenum += 1
text_filehandle.write('')
text_filehandle.write('\n')
except StopIteration:
return ('', linenum)
start_linenum = linenum
@@ -93,18 +93,30 @@ def process_code(read_filehandle, text_filehandle, line, linenum, sourcefile, co
if comment_idx >= 0:
no_comment_line = line[:comment_idx]
text_filehandle.write(line[comment_idx + 2:])
<<<<<<< HEAD
if (not has_actual_code
and not line.strip().startswith('//')
and not line.strip().startswith('???')
and not line.strip() ==''):
has_actual_code = True
=======
if (not has_actual_code
and not line.strip().startswith('//')
and not line.strip().startswith('???')
and not line.strip() == ''):
has_actual_code = True
>>>>>>> 180cd89a1f3105a20e79b81964b4d388dca94040
else:
# write empty line so line numbers stay stable
text_filehandle.write('')
text_filehandle.write('\n')
if (not line.strip() == '```'):
<<<<<<< HEAD
if ('???' == no_comment_line or '...' == no_comment_line):
=======
if ('???' in no_comment_line or '...' in no_comment_line):
>>>>>>> 180cd89a1f3105a20e79b81964b4d388dca94040
has_question_marks = True
linebuffer.append(dedent(line) if not fenced else line)
try:
@@ -115,7 +127,12 @@ def process_code(read_filehandle, text_filehandle, line, linenum, sourcefile, co
break
codefile = os.path.join(codedir, '%s%s.cpp' % (name, index))
if fenced:
<<<<<<< HEAD
text_filehandle.write('')
=======
text_filehandle.write('\n')
>>>>>>> 180cd89a1f3105a20e79b81964b4d388dca94040
if (has_actual_code and not has_question_marks):
# add commonly used headers, so that lines can compile
with io.open(codefile, 'w') as code_filehandle:
@@ -136,8 +153,8 @@ using namespace std; // by md-split
// %s : %s
''' % (sourcefile, start_linenum))
# TODO: if not toplevel code, wrap inside class
for line in linebuffer:
code_filehandle.write(line)
for codeline in linebuffer:
code_filehandle.write(codeline)
return (line, linenum)