diff --git a/monk/__init__.py b/monk/__init__.py index 43bbc45..7953782 100755 --- a/monk/__init__.py +++ b/monk/__init__.py @@ -14,13 +14,13 @@ from realog import debug my_args = arguments.Arguments() my_args.add("h", "help", desc="display this help") my_args.add_section("option", "Can be set one time in all case") -my_args.add("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="Display makefile debug level (verbose) default =2") +my_args.add("v", "verbose", haveParam=True, list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="Display makefile debug level (verbose) default =2") my_args.add("C", "color", desc="Display makefile output in color") my_args.add_section("cible", "generate in order set") local_argument = my_args.parse() -debug.set_level(6) +#debug.set_level(6) ## ## @brief Display the help of this makefile diff --git a/monk/codeBB/BB_IndentAndDot.py b/monk/codeBB/BB_IndentAndDot.py index 5a1fca0..d50f94e 100644 --- a/monk/codeBB/BB_IndentAndDot.py +++ b/monk/codeBB/BB_IndentAndDot.py @@ -42,7 +42,7 @@ import re ## @param[in] value String to transform. ## @return Transformed string. ## -def transcode(value, _base_path): +def transcode(value, _base_path = ""): value = re.sub(r'\n:', r'\n:INDENT:', diff --git a/monk/codeMarkDown/MD_Image.py b/monk/codeMarkDown/MD_Image.py index e8ad189..0e00cd6 100644 --- a/monk/codeMarkDown/MD_Image.py +++ b/monk/codeMarkDown/MD_Image.py @@ -24,21 +24,38 @@ def transcode(value, _base_path): value = re.sub(r'!\[https://(.*?)\][ \t]*\((.*?)\)', r'\1', value) - value = re.sub(r'!\[(.*?)\][ \t]*\((.*?)\?w=([0-9]+)%\)', - r'\1', - value) - value = re.sub(r'!\[(.*?)\][ \t]*\((.*?)\?w=([0-9]+)px\)', - r'\1', - value) - value = re.sub(r'!\[(.*?)\][ \t]*\((.*?)\?h=([0-9]+)px\)', - r'\1', - value) - value = re.sub(r'!\[(.*?)\][ \t]*\((.*?)\?w=([0-9]+)px&h=([0-9]+)px\)', - r'\1', - value) - value = re.sub(r'!\[(.*?)\][ \t]*\((.*?)\)', - r'\1', + + p = re.compile('!\[(.*?)\][ \t]*\((.*?)\)') + value = p.sub(replace_image, + value) + value = re.sub(r':BASE_PATH:', + r'' + base_path, value) return value + +def replace_image(match): + if match.group() == "": + return "" + debug.verbose("Image parse: " + str(match.group())) + value = 'False\1', + r'
  • \1
  • ', + value, + flags=re.DOTALL) + value = re.sub(r'\[SHARP\](.*?)\n', + r'
  • \1
  • ', + value, + flags=re.DOTALL) + value = re.sub(r'\[TICK\](.*?)\n', + r'
  • \1
  • ', + value, + flags=re.DOTALL) + value = re.sub(r'\[NUMBER\](.*?)\n', + r'
  • \1
  • ', + value, + flags=re.DOTALL) + value = re.sub(r'\[CHECK_BOX_2\](.*?)\n', + #r'
  • \1
  • ', + r'
  • \1
  • ', value, flags=re.DOTALL) value = re.sub(r'\[CHECK_BOX_1\](.*?)\n', - r'
  • \1
  • ', + #r'
  • \1
  • ', + r'
  • \1
  • ', value, flags=re.DOTALL) value = re.sub(r'\[CHECK_BOX_0\](.*?)\n', - r'
  • \1
  • ', + #r'
  • \1
  • ', + r'
  • \1
  • ', value, flags=re.DOTALL) diff --git a/monk/codeMarkDown/MD_Table.py b/monk/codeMarkDown/MD_Table.py index f641628..2642e4b 100644 --- a/monk/codeMarkDown/MD_Table.py +++ b/monk/codeMarkDown/MD_Table.py @@ -15,13 +15,10 @@ import re ## En bref sa tend a marcher comme sur un Wiki... ## ## result: -## +-------------------------------------+ -## | colone 1 | -## +------------------+------------------+ +## | colone 1 | | +## | ---------------- | ---------------- | ## | ligne 1 | colone 2 ligne 1 | -## +------------------+------------------+ ## | colone 1 ligne 1 | colone 2 ligne 2 | -## +------------------+------------------+ ## ## @param[in] value String to transform. ## @return Transformed string. @@ -34,29 +31,41 @@ def transcode(value, _base_path): value) return value - +table_index = 0 def replace_table(match): + global table_index + table_index = 0 if match.group() == "": return "" - #debug.verbose("plop: " + str(match.group())) - value = "" + debug.warning("=============================: " + str(match.group())) + value = '
    ' + value_global = re.sub(r'\n\|([\t -]*\|)+', + r'', + match.group()) + #value_global = match.group() + debug.warning("=============================: " + str(value_global)) p = re.compile('\n(.*)') value += p.sub(replace_table_line, - match.group()) + value_global) value += "
    " return value def replace_table_line(match): + global table_index if match.group() == "": return "" - debug.warning("parse LINE ... : '" + str(match.group()) + "'") + debug.warning("parse LINE ... : '" + str(match.group()) + "' ==> " + str(table_index)) value = "" tmpppp = match.group().replace("\n", "").split('|') for elem in tmpppp: if len(elem) == 0: continue - value += "" + elem + "" + if table_index == 0: + value += "" + elem + "" + else: + value += "" + elem + "" value += "" + table_index += 1 debug.warning(" ==> out " + value) return value diff --git a/monk/codeMarkDown/MD_Title.py b/monk/codeMarkDown/MD_Title.py index 53a9074..d1330da 100644 --- a/monk/codeMarkDown/MD_Title.py +++ b/monk/codeMarkDown/MD_Title.py @@ -4,6 +4,11 @@ import sys from monk import tools import re +h2counter = 1 +h3counter = 1 +h4counter = 1 +h5counter = 1 +h6counter = 1 ## ## @brief Transcode . @@ -17,18 +22,28 @@ import re ## @return Transformed string. ## def transcode(value, _base_path): - value = "\n" + value + value_start = "==Z==!!START!!==Z==" + value = value_start + value value = re.sub(r'@tableofcontents', r'', value) - value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n====*', - r'\n

    \1

    ', + value = re.sub(value_start + r'(.*?)(( |\t)*\{.*\})*\n====*', + value_start + r'

    \1

    ', + value) + value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n===*', + r'\n

    \1

    ', value) value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n---*', - r'\n

    \1

    ', + r'\n

    \1

    ', + value) + value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n\+\+\+*', + r'\n

    \1

    ', + value) + value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n~~~*', + r'\n
    \1
    ', value) value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})* ######', @@ -66,8 +81,31 @@ def transcode(value, _base_path): r'\n

    \1

    ', value) - value = value[1:] + value = re.sub(value_start, + r'', + value) return value + +def transcode_clean_empty_line_after(value, _base_path): + value = re.sub(r'[\n \t]*
    ', + r'', + value) + value = re.sub(r'[\n \t]*
    ', + r'', + value) + value = re.sub(r'[\n \t]*
    ', + r'', + value) + value = re.sub(r'[\n \t]*
    ', + r'', + value) + value = re.sub(r'[\n \t]*
    ', + r'', + value) + value = re.sub(r'[\n \t]*
    ', + r'', + value) + return value \ No newline at end of file diff --git a/monk/codeMarkDown/__init__.py b/monk/codeMarkDown/__init__.py index 3fa67c2..f050028 100644 --- a/monk/codeMarkDown/__init__.py +++ b/monk/codeMarkDown/__init__.py @@ -38,6 +38,7 @@ def transcode(value, _base_path = ""): value = MD_IndentAndDot.transcode(value, _base_path) value = MD_Code.transcode(value, _base_path) value = MD_lineReturn.transcode(value, _base_path) + value = MD_Title.transcode_clean_empty_line_after(value, _base_path) value = MD_Text.transcode(value, _base_path) """ value = BB_Text.transcode(value, _base_path) diff --git a/monk/monkHtml.py b/monk/monkHtml.py index b150cb9..ae3af1e 100644 --- a/monk/monkHtml.py +++ b/monk/monkHtml.py @@ -338,7 +338,7 @@ def generate_page(my_lutin_doc, out_folder, element, name_lib=""): if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union', 'using']: listBase = element.get_all_sub_type(['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union', 'using']) for elem in listBase: - generate_page(out_folder, header, footer, elem['node'], name_lib) + generate_page(my_lutin_doc, out_folder, elem['node'], name_lib) filename = out_folder + '/' + generate_html_page_name(element) tools.create_directory_of_file(filename); file = open(filename, "w") @@ -728,7 +728,7 @@ def create_generic_header(my_lutin_doc, out_folder) : if name == "index": continue tutorialList += '' if tutorialList != "": generic_header += '

    Tutorials:

    ' @@ -855,7 +855,7 @@ def generate(my_lutin_doc, out_folder) : outData += codeBB.transcode(inData) elif doc_input_name[-2:] == "md": outData += codeMarkDown.transcode(inData) - outData += genericFooter + outData += create_generic_footer(my_lutin_doc, out_folder) tools.file_write_data(output_file_name, outData) for list_value in [my_lutin_doc.list_doc_file, my_lutin_doc.list_test_file, my_lutin_doc.list_manual_file]: for doc_input_name,outpath in list_value : diff --git a/monk/monkParse.py b/monk/monkParse.py index 04db8ba..a5e3312 100644 --- a/monk/monkParse.py +++ b/monk/monkParse.py @@ -354,6 +354,7 @@ class parse_file(): if tok.type == 'COMMENT_SINGLELINE_DOC': self.last_comment.append(tok.value) if tok.type == 'OPEN_BRACE': + debug.verbose("OPEN_BRACE ==> start") if self.count_pthese >= 1: # special case of lamba declaration inside initialisation of constructor self.name_stack.append(tok.value) @@ -372,6 +373,8 @@ class parse_file(): debug.verbose("openBrace *** " + str(self.name_stack)) elif 'namespace' in self.name_stack: self.brace_type_push('namespace', self.name_stack) + elif 'enum' in self.name_stack and 'class' in self.name_stack: + self.brace_type_push('enum', self.name_stack) elif 'class' in self.name_stack: self.brace_type_push('class', self.name_stack) elif 'enum' in self.name_stack: @@ -389,6 +392,7 @@ class parse_file(): self.stack = [] self.name_stack = [] self.last_comment = [] + debug.verbose("OPEN_BRACE ==> END") elif tok.type == 'CLOSE_BRACE': if self.count_pthese >= 1: debug.info("plop 2 " +str(self.count_pthese)) @@ -454,7 +458,7 @@ class parse_file(): self.name_stack.append(tok.value) elif tok.type == 'SEMI_COLON': if self.count_pthese >= 1: - debug.info("plop 3 " +str(self.count_pthese)) + debug.info("plop 3 " + str(self.count_pthese)) # special case of lamba declaration inside initialisation of constructor self.name_stack.append(tok.value) else: diff --git a/monk/theme/base.css b/monk/theme/base.css index 622020f..332ef42 100644 --- a/monk/theme/base.css +++ b/monk/theme/base.css @@ -24,6 +24,28 @@ body { display: block; }; +/* +body::before { + counter-reset: hhindexer; +} + +h2::before { + content: counter(hhindexer) ".\0000a0\0000a0"; + counter-increment: hhindexer; + counter-reset: hhhindexer; +} +h3::before { + content: counter(hhindexer) "." counter(hhhindexer) ".\0000a0\0000a0"; + counter-increment: hhhindexer; + counter-reset: hhhhindexer; +} +h4::before { + content: counter(hhindexer) "." counter(hhhindexer) "." counter(hhhhindexer) ".\0000a0\0000a0"; + counter-increment: hhhhindexer; +} + +*/ + .navbar { z-index: 1; overflow: visible; @@ -68,6 +90,7 @@ body { color: #000000; } + h1, h2, h3, h4, h5, h6 { display: block; margin: 10px 0; @@ -78,6 +101,26 @@ h1, h2, h3, h4, h5, h6 { text-rendering: optimizelegibility; } + +h1 { + margin: 20px 0px 10px 0; + font-size: 20px; +} + +h2 { + margin: 15px 0px 10px 0; + font-size: 18px; +} + +h3 { + font-size: 16px; +} + +h4, h5, h6 { + font-size: 14px; +} + + p { margin: 0 0 10px; display: block; @@ -231,12 +274,19 @@ pre { table { border-collapse:collapse; } -td { +table.doc_table td { padding:4px; border:1px solid #000; vertical-align:top; } +table.doc_table th { + padding:4px; + border:1px solid #000; + background: #7fac1e; + vertical-align:top; +} + #my-table { width:30%; border-collapse:collapse; @@ -246,4 +296,35 @@ td { padding:4px; border:1px solid #000; vertical-align:top; -} \ No newline at end of file +} + +.list-star { + list-style-type: circle; +} + +.list-tick { + //list-style-type: '- '; + list-style-type: disc; +} + +.list-sharp { + list-style-type: square; +} + + +.list-number { + list-style-type: decimal; +} + + +.list-check-box { + list-style-type: "\2610\0020"; +} + +.list-check-box-check { + list-style-type: "\2612\0020"; +} + +.list-check-box-tick { + list-style-type: "\2611\0020"; +} diff --git a/monk/tools.py b/monk/tools.py index 3d11e97..5285767 100644 --- a/monk/tools.py +++ b/monk/tools.py @@ -22,7 +22,7 @@ def create_directory_of_file(file): def remove_folder_and_sub_folder(path): if os.path.isdir(path): - debug.verbose("remove folder : '" + path + "'") + debug.verbose("remove folder: '" + path + "'") shutil.rmtree(path) def remove_file(path):