diff --git a/monk/codeMarkDown/MD_Link.py b/monk/codeMarkDown/MD_Link.py index 1419aa9..ee481f7 100644 --- a/monk/codeMarkDown/MD_Link.py +++ b/monk/codeMarkDown/MD_Link.py @@ -3,7 +3,9 @@ from realog import debug import sys from monk import tools import re +import os +basic_link_path = "" ## ## @brief Transcode: @@ -15,44 +17,8 @@ import re ## @return Transformed string. ## def transcode(value, _base_path): - - """ - # named link : [[http://plop.html | link name]] - value = re.sub(r'\[\[http://(.*?) \| (.*?)\]\]', - r'\2', - value) - - # direct link : [[http://plop.html]] - value = re.sub(r'\[\[http://(.*?)\]\]', - r'http://\1', - value) - # named link : [[https://plop.html | link name]] - value = re.sub(r'\[\[https://(.*?) \| (.*?)\]\]', - r'\2', - value) - - # direct link : [[https://plop.html]] - value = re.sub(r'\[\[https://(.*?)\]\]', - r'http://\1', - value) - - # direct lib link : [lib[libname]] - value = re.sub(r'\[lib\[(.*?) \| (.*?)\]\]', - r'\2', - value) - - value = re.sub(r'\[doc\[(.*?) \| (.*?)\]\]', - r'\2', - value) - - value = re.sub(r'\[tutorial\[(.*?) \| (.*?)\]\]', - r'\2', - value) - - value = re.sub(r'\[(lib|class|methode)\[(.*?)\]\]', - replace_link_class, - value) - """ + global basic_link_path + basic_link_path = _base_path if len(_base_path) != 0: base_path = (_base_path + '/').replace('/','__') else: @@ -80,29 +46,24 @@ def transcode(value, _base_path): def replace_link(match): + global basic_link_path if match.group() == "": return "" - debug.verbose("plop: " + str(match.group())) + debug.warning("plop: " + str(match.group())) + debug.warning("plop: " + str(match.groups())) value = '' + if basic_link_path != "": + link = os.path.join(basic_link_path, match.groups()[1]); + debug.warning("BASIC path : " + link) + link = os.path.normpath(link) + debug.warning(" ==> " + link) + else: + link = match.groups()[1] + + value += link.replace("/", "__") + if match.groups()[0] != "": + value += '.html">' + match.groups()[0] + '' + else: + value += '.html">' + match.groups()[1] + '' return value - -def replace_link_class(match): - if match.group() == "": - return "" - #debug.info("plop: " + str(match.group())) - if match.groups()[0] == 'class': - className = match.groups()[1] - value = re.sub(':', '_', className) - return '' + className + '' - elif match.groups()[0] == 'lib': - return match.groups()[1] - elif match.groups()[0] == 'methode': - return match.groups()[1] - else: - return match.groups()[1] - - - diff --git a/monk/codeMarkDown/MD_Title.py b/monk/codeMarkDown/MD_Title.py index d1330da..b1f07a0 100644 --- a/monk/codeMarkDown/MD_Title.py +++ b/monk/codeMarkDown/MD_Title.py @@ -9,6 +9,7 @@ h3counter = 1 h4counter = 1 h5counter = 1 h6counter = 1 +indexation = "" ## ## @brief Transcode . @@ -24,7 +25,18 @@ h6counter = 1 def transcode(value, _base_path): value_start = "==Z==!!START!!==Z==" value = value_start + value - + global h2counter + global h3counter + global h4counter + global h5counter + global h6counter + global indexation + h2counter = 1 + h3counter = 1 + h4counter = 1 + h5counter = 1 + h6counter = 1 + indexation = "" value = re.sub(r'@tableofcontents', r'', @@ -34,60 +46,103 @@ def transcode(value, _base_path): value_start + r'

\1

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

\1

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

\1

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

\1

', + r'\n==Z==444==Z==\1', value) value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n~~~*', - r'\n
\1
', + r'\n==Z==555==Z==\1', value) value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})* ######', - r'\n
\1
', + r'\n==Z==666==Z==\1', value) value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})*', - r'\n
\1
', + r'\n==Z==666==Z==\1', value) value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})* #####', - r'\n
\1
', + r'\n==Z==555==Z==\1', value) value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})*', - r'\n
\1
', + r'\n==Z==555==Z==\1', value) value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})* ####', - r'\n

\1

', + r'\n==Z==444==Z==\1', value) value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})*', - r'\n

\1

', + r'\n==Z==444==Z==\1', value) value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})* ###', - r'\n

\1

', + r'\n==Z==333==Z==\1', value) value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})*', - r'\n

\1

', + r'\n==Z==333==Z==\1', value) value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})* ##', - r'\n

\1

', + r'\n==Z==222==Z==\1', value) value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})*', - r'\n

\1

', + r'\n==Z==222==Z==\1', value) value = re.sub(value_start, r'', value) + p = re.compile('==Z==(222|333|444|555|666)==Z==') + value = p.sub(replace_index_title, + value) return value +def replace_index_title(match): + global h2counter + global h3counter + global h4counter + global h5counter + global h6counter + global indexation + if match.groups()[0] == "222": + out = "

" + str(h2counter) + ". " + #indexation += "

" + h2counter + ". " + h2counter += 1 + h3counter = 1 + h4counter = 1 + h5counter = 1 + h6counter = 1 + return out + if match.groups()[0] == "333": + out = "

" + str(h2counter) + "." + str(h3counter) + ". " + h3counter += 1 + h4counter = 1 + h5counter = 1 + h6counter = 1 + return out + if match.groups()[0] == "444": + out = "

" + str(h2counter) + "." + str(h3counter) + "." + str(h4counter) + ". " + h4counter += 1 + h5counter = 1 + h6counter = 1 + return out + if match.groups()[0] == "555": + out = "

" + str(h2counter) + "." + str(h3counter) + "." + str(h4counter) + "." + str(h5counter) + ". " + h5counter += 1 + h6counter = 1 + return out + if match.groups()[0] == "666": + out = "
" + str(h2counter) + "." + str(h3counter) + "." + str(h4counter) + "." + str(h5counter) + "." + str(h6counter) + ". " + h6counter += 1 + return out + return match.group() + def transcode_clean_empty_line_after(value, _base_path): value = re.sub(r'
[\n \t]*
', diff --git a/monk/monkHtml.py b/monk/monkHtml.py index ae3af1e..cdd9bce 100644 --- a/monk/monkHtml.py +++ b/monk/monkHtml.py @@ -633,21 +633,33 @@ def generate_page(my_lutin_doc, out_folder, element, name_lib=""): - -def create_generic_header(my_lutin_doc, out_folder) : +def create_base_header(my_lutin_doc, out_folder, _to_print = False) : my_doc = my_lutin_doc.get_base_doc_node() tools.copy_file(tools.get_current_path(__file__)+"/theme/base.css", out_folder+"/base.css") tools.copy_file(tools.get_current_path(__file__)+"/theme/menu.css", out_folder+"/menu.css") # create common header - generic_header = '\n' - generic_header += '\n' - generic_header += '\n' - generic_header += ' \n' - generic_header += ' ' + my_doc.get_name() + ' Library\n' - generic_header += ' \n' - generic_header += ' \n' - generic_header += '\n' - generic_header += '\n' + base_header = '\n' + base_header += '\n' + base_header += '\n' + base_header += ' \n' + base_header += ' ' + my_doc.get_name() + ' Library\n' + if _to_print == False: + base_header += ' \n' + base_header += ' \n' + else: + base_header += ' \n' + + base_header += '\n' + #base_header += '
print
\n' + return base_header + +def create_generic_header(my_lutin_doc, out_folder) : + my_doc = my_lutin_doc.get_base_doc_node() + tools.copy_file(tools.get_current_path(__file__)+"/theme/base.css", out_folder+"/base.css") + tools.copy_file(tools.get_current_path(__file__)+"/theme/base_print.css", out_folder+"/base_print.css") + tools.copy_file(tools.get_current_path(__file__)+"/theme/menu.css", out_folder+"/menu.css") + # create common header + generic_header = create_base_header(my_lutin_doc, out_folder) generic_header += ' \n" - generic_header += "
\n" + generic_header += "
\n" return generic_header @@ -863,18 +875,22 @@ def generate(my_lutin_doc, out_folder) : base_path = os.path.dirname(outpath) output_file_name = out_folder + outpath.replace('/','__') + ".html" + output_file_name_print = out_folder + outpath.replace('/','__') + "____print.html" debug.debug("output file : " + output_file_name) tools.create_directory_of_file(output_file_name) inData = tools.file_read_data(doc_input_name) if inData == "": continue - outData = create_generic_header(my_lutin_doc, out_folder) + generic_header = create_generic_header(my_lutin_doc, out_folder) + base_header = create_base_header(my_lutin_doc, out_folder, _to_print = True) + outData = "" if doc_input_name[-2:] == "bb": outData += codeBB.transcode(inData, base_path) elif doc_input_name[-2:] == "md": outData += codeMarkDown.transcode(inData, base_path) outData += create_generic_footer(my_lutin_doc, out_folder) - tools.file_write_data(output_file_name, outData) + tools.file_write_data(output_file_name, generic_header + outData) + tools.file_write_data(output_file_name_print, base_header + outData) for image_input_name,outpath in my_lutin_doc.list_image_file: diff --git a/monk/theme/base.css b/monk/theme/base.css index 332ef42..25ffc5b 100644 --- a/monk/theme/base.css +++ b/monk/theme/base.css @@ -24,37 +24,11 @@ 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; color: #ffffff; display: block; - background-image: url('entreprise.png'); - background-repeat: no-repeat; - background-attachment: fixed; - background-position: center; } .navbar div { @@ -78,7 +52,7 @@ h4::before { font-size: 15px; font-weight: 200; color: #ffffff; - text-shadow: 0 1px 0 #3b510c; + text-shadow: 1px 1px 0 #3b510c; padding: 10px 20px 10px; margin-left: -20px; overflow:scroll; @@ -91,7 +65,14 @@ h4::before { } -h1, h2, h3, h4, h5, h6 { +.container_data{ + //width:940px; + margin-right: auto; + margin-left: auto; + display: block; +}; + +.container_data h1, h2, h3, h4, h5, h6 { display: block; margin: 10px 0; font-family: inherit; @@ -102,22 +83,32 @@ h1, h2, h3, h4, h5, h6 { } -h1 { - margin: 20px 0px 10px 0; - font-size: 20px; +.container_data h1 { + margin: 0px 0px 10px 0; + font-size: 40px; + color: #7fac1e; + text-shadow: 1px 3px 0 #4c6812; + margin-left: auto; + margin-right: auto; } -h2 { +.container_data h2 { margin: 15px 0px 10px 0; - font-size: 18px; + font-size: 25px; + color: #7fac1e; + text-shadow: 1px 2px 0 #4c6812; } -h3 { +.container_data h3 { + font-size: 20px; + color: #7fac1e; + text-shadow: 1px 1px 0 #537114; +} + +.container_data h4, h5, h6 { font-size: 16px; -} - -h4, h5, h6 { - font-size: 14px; + color: #7fac1e; + text-shadow: 1px 1px 0 #273801; } diff --git a/monk/theme/base_print.css b/monk/theme/base_print.css new file mode 100644 index 0000000..abec0ec --- /dev/null +++ b/monk/theme/base_print.css @@ -0,0 +1,321 @@ + +html { + display: block; +} + +body { + font-family: 'Ubuntu',Tahoma,sans-serif; + padding-top: 40px; + padding-bottom: 40px; + font-size: 15px; + line-height: 150%; + margin: 0; + color: #333333; + background-color: #ffffff; + display: block; + margin-left: 50px; + margin-right: 50px; +}; + +.container{ + width:940px; + margin-right: auto; + margin-left: auto; + display: block; +}; + +.navbar { + z-index: 1; + overflow: visible; + color: #ffffff; + display: block; +} + +.navbar div { + display: block; + margin-left: 5px; + margin-right: 5px; +} + +.navbar-fixed-top { + width:210px; + display: block; + position: fixed; + padding-top: 0px; + top: 0; + height: 100%; + right: 0; + left: 0; + margin-bottom: 0; + background-color: #7fac1e; + border: 1px solid #7fac1e; + font-size: 15px; + font-weight: 200; + color: #ffffff; + text-shadow: 1px 1px 0 #3b510c; + padding: 10px 20px 10px; + margin-left: -20px; + overflow:scroll; + overflow-y:auto; + overflow-x:hidden; +} +.navbar-fixed-top a { + text-decoration: none; + color: #000000; +} + + +.container_data{ + //width:940px; + margin-right: auto; + margin-left: auto; + display: block; +}; + +.container_data h1, h2, h3, h4, h5, h6 { + display: block; + margin: 10px 0; + font-family: inherit; + font-weight: bold; + line-height: 1; + color: inherit; + text-rendering: optimizelegibility; +} + + +.container_data h1 { + margin: 0px 0px 10px 0; + font-size: 40px; + color: #7fac1e; + text-shadow: 1px 3px 0 #4c6812; + margin-left: auto; + margin-right: auto; +} + +.container_data h2 { + margin: 15px 0px 10px 0; + font-size: 25px; + color: #7fac1e; + text-shadow: 1px 2px 0 #4c6812; +} + +.container_data h3 { + font-size: 20px; + color: #7fac1e; + text-shadow: 1px 1px 0 #537114; +} + +.container_data h4, h5, h6 { + font-size: 16px; + color: #7fac1e; + text-shadow: 1px 1px 0 #273801; +} + + +p { + margin: 0 0 10px; + display: block; +} + +code { + background-color: rgb(251, 229, 225); + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + box-sizing: border-box; + color: rgb(192, 52, 29); + font-size: 13px; + font-weight: 400; + line-height: 18.9px; + margin-top: 0px; + overflow-wrap: normal; + padding-bottom: 2px; + padding-left: 4px; + padding-right: 4px; + padding-top: 2px; + text-align: start; + white-space: pre-wrap; + word-break: keep-all; +} + +pre { + #margin-left: 20px; + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 20px; + word-break: break-all; + word-wrap: break-word; + white-space: pre; + white-space: pre-wrap; + background-color: #f5f5f5; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 4px; +} + +.enumeration-list td { + padding-left:10px; + padding-right:10px; +} + +.parameter-list td { + padding-left:5px; + padding-right:5px; +} + +.code-function { + text-decoration:none; + color:#09857e; + font-weight:bold; +} + +.code-type { + text-decoration:none; + color:#376d0a; + font-weight:bold; +} + +.code-argument { + text-decoration:none; + color:#B80000; + font-weight:bold; +} + +.code-number { + text-decoration:none; + color:#007b00; +} + +.code-keyword { + text-decoration:none; + color:#215eb8; + font-weight:bold; +} +.code-storage-keyword { + text-decoration:none; + color:#466cb4; +} + +.code-doxygen { + text-decoration:none; + color:#bf3e00; + font-weight:bold; +} + +.code-comment { + text-decoration:none; + color:#b704b5; +} + +.code-preproc { + text-decoration:none; + color:#ac0000; +} + +.code-text-quote { + text-decoration:none; + color:#008e00; +} +.code-number { + text-decoration:none; + color:#007b00; +} +.code-member { + text-decoration:none; + color:#7c5406; +} +.code-input-function { + text-decoration:none; + color:#B80000; + font-weight:bold; +} +.code-function-name { + text-decoration:none; + color:#09857e; + font-weight:bold; +} +.code-function-system { + text-decoration:none; + color:#acaa00; +} +.code-generic-define { + text-decoration:none; + color:#3c850b; +} +.code-macro { + text-decoration:none; + color:#3c850b; +} +.code-operator { + text-decoration:none; + color:#1633a3; +} +.code-keyword { + text-decoration:none; + color:#466cb4; +} +.code-class { + text-decoration:none; + color:#006cb4; +} + +table { + border-collapse:collapse; +} +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; +} +#my-table td{ + width:2000px; + padding:4px; + border:1px solid #000; + vertical-align:top; +} + +.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"; +}