Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8519fe0b95 | ||
|
15d2722381 | ||
|
4528de5235 | ||
04e7866da1 | |||
|
8b4bb1692d | ||
e2ca9ebddc | |||
|
b256a30b36 | ||
|
6746ff41bb | ||
47f6f00480 |
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@ -0,0 +1,2 @@
|
||||
include README.rst
|
||||
include bash-autocompletion/lutin
|
11
bin/monk
Executable file
11
bin/monk
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license MPL v2.0 (see license file)
|
||||
##
|
||||
|
||||
import monk
|
@ -1,10 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
def transcode(value):
|
||||
return value
|
||||
|
@ -1,19 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode balise:
|
||||
## [img w=125 h=45]dossier/image.jpg[/img]
|
||||
## [img w=125 h=45]http://plop.com/dossier/image.png[/img]
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
|
||||
return value
|
||||
|
||||
|
@ -1,60 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode
|
||||
## commencez les lignes par:
|
||||
## *
|
||||
## *
|
||||
##
|
||||
## +
|
||||
## +
|
||||
##
|
||||
## resultat:
|
||||
##
|
||||
## -
|
||||
## -
|
||||
## -
|
||||
##
|
||||
## commencez les lignes par:
|
||||
## -
|
||||
## -
|
||||
##
|
||||
## resultat:
|
||||
##
|
||||
## 1.
|
||||
## 2.
|
||||
## 3.
|
||||
##
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
value = re.sub(r'\n(( - )|( * )|( # ))',
|
||||
r'\n:INDENT:[STAR]',
|
||||
value)
|
||||
p = re.compile('((\:INDENT\:(.*?)\n)*)',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_wiki_identation,
|
||||
value)
|
||||
value = re.sub(r'\[STAR\](.*?)\n',
|
||||
r'<li>\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
return value
|
||||
|
||||
|
||||
def replace_wiki_identation(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
#debug.verbose("plop: " + str(match.group()))
|
||||
value = "<ul>"
|
||||
value += re.sub(r':INDENT:',
|
||||
r'',
|
||||
match.group())
|
||||
value += "</ul>"
|
||||
return transcode(value)
|
@ -1,84 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode:
|
||||
## [http://votre_site.con] => http://votre_site.con
|
||||
## [http://votre_site.con | text displayed] => text displayed
|
||||
## [http://votre_site.con text displayed] => text displayed.
|
||||
##
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
|
||||
|
||||
# named link : [[http://plop.html | link name]]
|
||||
value = re.sub(r'\[\[http://(.*?) \| (.*?)\]\]',
|
||||
r'<a href="http://\1">\2</a>',
|
||||
value)
|
||||
|
||||
# direct link : [[http://plop.html]]
|
||||
value = re.sub(r'\[\[http://(.*?)\]\]',
|
||||
r'<a href="http://\1">http://\1</a>',
|
||||
value)
|
||||
|
||||
# direct lib link : [lib[libname]]
|
||||
value = re.sub(r'\[lib\[(.*?) \| (.*?)\]\]',
|
||||
r'<a href="../\1">\2</a>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\[doc\[(.*?) \| (.*?)\]\]',
|
||||
r'<a href="\1.html">\2</a>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\[tutorial\[(.*?) \| (.*?)\]\]',
|
||||
r'<a href="tutorial_\1.html">\2</a>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\[(lib|class|methode)\[(.*?)\]\]',
|
||||
replace_link_class,
|
||||
value)
|
||||
|
||||
"""
|
||||
p = re.compile('\[\[(.*?)(|(.*?))\]\])',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_link,
|
||||
value)
|
||||
"""
|
||||
return value
|
||||
|
||||
"""
|
||||
def replace_link(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
#debug.verbose("plop: " + str(match.group()))
|
||||
value = "<ul>"
|
||||
value += re.sub(r':INDENT:',
|
||||
r'',
|
||||
match.group())
|
||||
value += "</ul>"
|
||||
return transcode(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 '<a href="class_' + value + '.html">' + className + '</a>'
|
||||
elif match.groups()[0] == 'lib':
|
||||
return match.groups()[1]
|
||||
elif match.groups()[0] == 'methode':
|
||||
return match.groups()[1]
|
||||
else:
|
||||
return match.groups()[1]
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode table:
|
||||
## { | tableau_type_1
|
||||
## | [b]colone 1[/b]
|
||||
## ligne 1
|
||||
## | colone 2 ligne 1
|
||||
## |---
|
||||
## | colone 1 ligne 1
|
||||
## | colone 2 ligne 2
|
||||
## |}
|
||||
## Avec autant de ligne et de colone que vous voullez..
|
||||
## Il est possible de faire des retour a la ligne dans une case du tableau...
|
||||
## En bref sa tend a marcher comme sur un Wiki...
|
||||
##
|
||||
## result:
|
||||
## +-------------------------------------+
|
||||
## | colone 1 |
|
||||
## +------------------+------------------+
|
||||
## | ligne 1 | colone 2 ligne 1 |
|
||||
## +------------------+------------------+
|
||||
## | colone 1 ligne 1 | colone 2 ligne 2 |
|
||||
## +------------------+------------------+
|
||||
##
|
||||
## TODO : Create simple table like :
|
||||
## | 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.
|
||||
##
|
||||
def transcode(value):
|
||||
|
||||
return value
|
||||
|
||||
|
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode .
|
||||
## =?=Page Title=?=
|
||||
## ==Title 1==
|
||||
## ===Title 2===
|
||||
## ====Title 3====
|
||||
## =====Title 4=====
|
||||
## ======Title 5======
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
value = "\n" + value
|
||||
|
||||
|
||||
value = re.sub(r'@tableofcontents',
|
||||
r'',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n====*',
|
||||
r'\n<h1>\1</h1>',
|
||||
value)
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n---*',
|
||||
r'\n<h2>\1</h2>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})* ######',
|
||||
r'\n<h6>\1</h6>',
|
||||
value)
|
||||
value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n<h6>\1</h6>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})* #####',
|
||||
r'\n<h5>\1</h5>',
|
||||
value)
|
||||
value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n<h5>\1</h5>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})* ####',
|
||||
r'\n<h4>\1</h4>',
|
||||
value)
|
||||
value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n<h4>\1</h4>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})* ###',
|
||||
r'\n<h3>\1</h3>',
|
||||
value)
|
||||
value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n<h3>\1</h3>',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})* ##',
|
||||
r'\n<h2>\1</h2>',
|
||||
value)
|
||||
value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n<h2>\1</h2>',
|
||||
value)
|
||||
|
||||
value = value[1:]
|
||||
|
||||
return value
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import sys
|
||||
import monkTools
|
||||
import re
|
||||
"""
|
||||
import BB_Link
|
||||
import BB_Image
|
||||
import BB_Table
|
||||
|
||||
import BB_Specification
|
||||
"""
|
||||
import MD_Text
|
||||
import MD_IndentAndDot
|
||||
import MD_Title
|
||||
import MD_comment
|
||||
import MD_lineReturn
|
||||
import MD_Code
|
||||
##
|
||||
## @brief Transcode input data in the corect format.
|
||||
## @param[in] string String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
# remove html property
|
||||
value = re.sub(r'&', r'&', value)
|
||||
value = re.sub(r'<', r'<', value)
|
||||
value = re.sub(r'>', r'>', value)
|
||||
value = re.sub(r'\r\n', r'\n', value)
|
||||
value = re.sub(r'\n\r', r'\n', value)
|
||||
value = re.sub(r'\r', r'\n', value)
|
||||
value = MD_comment.transcode(value)
|
||||
value = MD_Title.transcode(value)
|
||||
value = MD_IndentAndDot.transcode(value)
|
||||
value = MD_Code.transcode(value)
|
||||
value = MD_lineReturn.transcode(value)
|
||||
value = MD_Text.transcode(value)
|
||||
"""
|
||||
value = BB_Text.transcode(value)
|
||||
value = BB_Link.transcode(value)
|
||||
value = BB_Image.transcode(value)
|
||||
value = BB_Table.transcode(value)
|
||||
value = BB_Specification.transcode(value)
|
||||
"""
|
||||
value = MD_Code.transcode_part2(value)
|
||||
return value
|
||||
|
||||
##
|
||||
## @brief transcode a BBcode file in a html file
|
||||
## @return True if the file is transformed
|
||||
##
|
||||
def transcode_file(inputFileName, outputFileName):
|
||||
inData = monkTools.file_read_data(inputFileName)
|
||||
if inData == "":
|
||||
return False
|
||||
outData = transcode(inData)
|
||||
debug.warning(" out: " + outputFileName)
|
||||
monkTools.file_write_data(outputFileName, outData)
|
||||
return True
|
||||
|
||||
|
@ -4,33 +4,35 @@ import sys
|
||||
import os
|
||||
import inspect
|
||||
import fnmatch
|
||||
import monkDebug as debug
|
||||
import monkModule
|
||||
import monkArg
|
||||
import monkTools
|
||||
from . import module
|
||||
from . import tools
|
||||
import death.Arguments as arguments
|
||||
import death.ArgElement as arg_element
|
||||
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", 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")
|
||||
|
||||
myArg = monkArg.MonkArg()
|
||||
myArg.add(monkArg.ArgDefine("h", "help", desc="display this help"))
|
||||
myArg.add_section("option", "Can be set one time in all case")
|
||||
myArg.add(monkArg.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"]], desc="Display makefile debug level (verbose) default =2"))
|
||||
myArg.add(monkArg.ArgDefine("C", "color", desc="Display makefile output in color"))
|
||||
my_args.add_section("cible", "generate in order set")
|
||||
local_argument = my_args.parse()
|
||||
|
||||
myArg.add_section("cible", "generate in order set")
|
||||
localArgument = myArg.parse()
|
||||
#debug.set_level(6)
|
||||
|
||||
##
|
||||
## @brief Display the help of this makefile
|
||||
##
|
||||
def usage():
|
||||
# generic argument displayed :
|
||||
myArg.display()
|
||||
my_args.display()
|
||||
print(" all")
|
||||
print(" Build all (only for the current selected board) (bynary and packages)")
|
||||
print(" clean")
|
||||
print(" Clean all (same as previous)")
|
||||
listOfAllModule = monkModule.list_all_module_with_desc()
|
||||
listOfAllModule = module.list_all_module_with_desc()
|
||||
for mod in listOfAllModule:
|
||||
print(" " + mod[0] + " / " + mod[0] + "-clean")
|
||||
if mod[1] != "":
|
||||
@ -61,7 +63,7 @@ def parse_generic_arg(argument,active):
|
||||
## @brief Parse default unique argument:
|
||||
##
|
||||
if __name__ == "__main__":
|
||||
for argument in localArgument:
|
||||
for argument in local_argument:
|
||||
parse_generic_arg(argument, True)
|
||||
|
||||
##
|
||||
@ -70,40 +72,40 @@ if __name__ == "__main__":
|
||||
def start():
|
||||
actionDone=False
|
||||
# parse all argument
|
||||
for argument in localArgument:
|
||||
for argument in local_argument:
|
||||
if parse_generic_arg(argument, False) == True:
|
||||
continue
|
||||
if argument.get_option_name() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
|
||||
usage()
|
||||
else:
|
||||
module = monkModule.get_module(argument.get_arg())
|
||||
module.parse_code()
|
||||
module.generate()
|
||||
module_value = module.get_module(argument.get_arg())
|
||||
module_value.parse_code()
|
||||
module_value.generate()
|
||||
actionDone=True
|
||||
# if no action done : we do "all" ...
|
||||
if actionDone==False:
|
||||
#Must generate all docs :
|
||||
moduleElements = monkModule.get_all_module()
|
||||
for module in moduleElements:
|
||||
module.parse_code()
|
||||
for module in moduleElements:
|
||||
module.generate()
|
||||
moduleElements = module.get_all_module()
|
||||
for module_value in moduleElements:
|
||||
module_value.parse_code()
|
||||
for module_value in moduleElements:
|
||||
module_value.generate()
|
||||
|
||||
##
|
||||
## @brief When the user use with make.py we initialise ourself
|
||||
##
|
||||
if __name__ == '__main__':
|
||||
sys.path.append(monkTools.get_run_folder())
|
||||
# Import all sub path without out and archive
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder.lower()!="android" \
|
||||
and folder.lower()!="archive" \
|
||||
and folder.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + folder + "'")
|
||||
monkModule.import_path(folder)
|
||||
start()
|
||||
#if __name__ == '__main__':
|
||||
sys.path.append(tools.get_run_folder())
|
||||
# Import all sub path without out and archive
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder.lower()!="android" \
|
||||
and folder.lower()!="archive" \
|
||||
and folder.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + folder + "'")
|
||||
module.import_path(folder)
|
||||
start()
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import codeHL
|
||||
import re
|
||||
|
||||
@ -16,7 +16,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
#value = re.sub(r'\[code(( |\t|\n|\r)+style=(.*))?\](.*?)\[/code\]',
|
||||
value = re.sub(r'\[code(( |\t|\n|\r)+style=(.*?))?\](.*?)\[/code\]',
|
||||
replace_code, #r'<pre>\4</pre>',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
return value
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path = ""):
|
||||
|
||||
value = re.sub(r'\n:',
|
||||
r'\n:INDENT:',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
|
||||
# named link : [[http://plop.html | link name]]
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
return value
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
return value
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ import re
|
||||
## @param[in] string String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'\[b\](.*?)\[/b\]',
|
||||
r'<span style="font-weight: bold;">\1</span>',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'=\?=(.*?)=\?=',
|
||||
r'<h1><center>\1</center></h1>',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'\/\*(.*?)\*\/',
|
||||
r'',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'\r\n',
|
||||
r'\n',
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
import BB_Title
|
||||
import BB_Text
|
||||
@ -20,20 +20,20 @@ import BB_Specification
|
||||
## @param[in] string String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path = ""):
|
||||
# remove html property
|
||||
value = re.sub(r'<', r'<', value)
|
||||
value = re.sub(r'>', r'>', value)
|
||||
value = BB_comment.transcode(value)
|
||||
value = BB_Title.transcode(value)
|
||||
value = BB_Text.transcode(value)
|
||||
value = BB_IndentAndDot.transcode(value)
|
||||
value = BB_Link.transcode(value)
|
||||
value = BB_Image.transcode(value)
|
||||
value = BB_Table.transcode(value)
|
||||
value = BB_Code.transcode(value)
|
||||
value = BB_Specification.transcode(value)
|
||||
value = BB_lineReturn.transcode(value)
|
||||
value = BB_comment.transcode(value, _base_path)
|
||||
value = BB_Title.transcode(value, _base_path)
|
||||
value = BB_Text.transcode(value, _base_path)
|
||||
value = BB_IndentAndDot.transcode(value, _base_path)
|
||||
value = BB_Link.transcode(value, _base_path)
|
||||
value = BB_Image.transcode(value, _base_path)
|
||||
value = BB_Table.transcode(value, _base_path)
|
||||
value = BB_Code.transcode(value, _base_path)
|
||||
value = BB_Specification.transcode(value, _base_path)
|
||||
value = BB_lineReturn.transcode(value, _base_path)
|
||||
return value
|
||||
|
||||
##
|
||||
@ -41,12 +41,12 @@ def transcode(value):
|
||||
## @return True if the file is transformed
|
||||
##
|
||||
def transcode_file(inputFileName, outputFileName):
|
||||
inData = monkTools.file_read_data(inputFileName)
|
||||
inData = tools.file_read_data(inputFileName)
|
||||
if inData == "":
|
||||
return False
|
||||
outData = transcode(inData)
|
||||
debug.warning(" out: " + outputFileName)
|
||||
monkTools.file_write_data(outputFileName, outData)
|
||||
tools.file_write_data(outputFileName, outData)
|
||||
return True
|
||||
|
||||
|
0
monk/codeBB/codeBB.py
Normal file
0
monk/codeBB/codeBB.py
Normal file
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import codeHLcpp
|
||||
import codeHLBBcode
|
||||
import codeHLJava
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
listRegExp = [
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
listRegExp = [
|
37
monk/codeHL/codeHLjson.py
Normal file
37
monk/codeHL/codeHLjson.py
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
listRegExp = [
|
||||
[ r'"((\\"|.)*?)"', 'code-text-quote'],
|
||||
[ r"'(('|.)*?)'", 'code-text-quote'],
|
||||
[ r'(true|false|null)',
|
||||
'code-type'],
|
||||
[ r'(((0(x|X)[0-9a-fA-F]*)|(\d+\.?\d*|\.\d+)((e|E)(\+|\-)?\d+)?)(L|l|UL|ul|u|U|F|f)?)',
|
||||
'code-type']
|
||||
]
|
||||
|
||||
def transcode(value):
|
||||
inValue = value
|
||||
outValue = ""
|
||||
haveFindSomething = False;
|
||||
for reg1, color in listRegExp:
|
||||
result = re.search(reg1, inValue, re.DOTALL)
|
||||
while result != None:
|
||||
haveFindSomething = True
|
||||
# sub parse the start :
|
||||
outValue += transcode(inValue[:result.start()])
|
||||
# transform local
|
||||
outValue += '<span class="' + color + '">'
|
||||
outValue += result.group()
|
||||
outValue += '</span>'
|
||||
|
||||
# change the input value
|
||||
inValue = inValue[result.end():]
|
||||
# Search again ...
|
||||
result = re.search(reg1, inValue, re.DOTALL)
|
||||
outValue += inValue
|
||||
return outValue
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
listRegExp = [
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import codeHL
|
||||
import re
|
||||
|
||||
@ -16,7 +16,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
#value = re.sub(r'\[code(( |\t|\n|\r)+style=(.*))?\](.*?)\[/code\]',
|
||||
"""
|
||||
value = re.sub(r'```(( |\t|\n|\r){\.(.*?))?\}(.*?)\```',
|
||||
@ -24,6 +24,9 @@ def transcode(value):
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
"""
|
||||
value = re.sub(r'```(.*?)```',
|
||||
r'<code>\1</code>',
|
||||
value)
|
||||
value = re.sub(r'```(( |\t|\n|\r)*(\{\.(.*?)\}))?(.*?)\```',
|
||||
replace_code, #r'<pre>\4</pre>',
|
||||
value,
|
||||
@ -35,6 +38,8 @@ def transcode(value):
|
||||
def transcode_part2(value):
|
||||
value = value.replace(":CODE:UNDER:SCORE:", "_")
|
||||
value = value.replace(":CODE:STAR:", "*")
|
||||
value = value.replace(":CODE:BRACKET:START:", "[")
|
||||
value = value.replace(":CODE:BRACKET:STOP:", "]")
|
||||
return value
|
||||
|
||||
|
||||
@ -47,5 +52,7 @@ def replace_code(match):
|
||||
#value = value.replace("\n", "<br/>")
|
||||
value = value.replace("_", ":CODE:UNDER:SCORE:")
|
||||
value = value.replace("*", ":CODE:STAR:")
|
||||
value = value.replace("[", ":CODE:BRACKET:START:")
|
||||
value = value.replace("]", ":CODE:BRACKET:STOP:")
|
||||
return '<pre>' + str(value) + '</pre>'
|
||||
|
151
monk/codeMarkDown/MD_Image.py
Normal file
151
monk/codeMarkDown/MD_Image.py
Normal file
@ -0,0 +1,151 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
import os
|
||||
|
||||
image_base_path = ""
|
||||
|
||||
def simplify_path(aaa):
|
||||
#debug.warning("ploppppp " + str(aaa))
|
||||
st = []
|
||||
aaa = aaa.split("/")
|
||||
for i in aaa:
|
||||
if i == '..':
|
||||
if len(st) > 0:
|
||||
st.pop()
|
||||
else:
|
||||
continue
|
||||
elif i == '.':
|
||||
continue
|
||||
elif i != '':
|
||||
if len(st) > 0:
|
||||
st.append("/" + str(i))
|
||||
else:
|
||||
st.append(str(i))
|
||||
if len(st) == 1:
|
||||
return "/"
|
||||
#debug.error("ploppppp " + str(st))
|
||||
return "".join(st)
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode balise:
|
||||
## [img w=125 h=45]dossier/image.jpg[/img]
|
||||
## [img w=125 h=45]http://plop.com/dossier/image.png[/img]
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value, _base_path):
|
||||
global image_base_path
|
||||
if len(_base_path) != 0:
|
||||
base_path = (_base_path + '/').replace('/',':IMAGE:UNDER:SCORE::IMAGE:UNDER:SCORE:')
|
||||
image_base_path = _base_path
|
||||
else:
|
||||
image_base_path = ""
|
||||
base_path = ""
|
||||
# named image : ![hover Value](http://sdfsdf.svg)
|
||||
value = re.sub(r'!\[http://(.*?)\][ \t]*\((.*?)\)',
|
||||
r'<img src="http://\2" alt="\1"/>',
|
||||
value)
|
||||
value = re.sub(r'!\[https://(.*?)\][ \t]*\((.*?)\)',
|
||||
r'<img src="https://\2" alt="\1"/>',
|
||||
value)
|
||||
|
||||
p = re.compile('!\[(.*?)\][ \t]*\((.*?)\)')
|
||||
value = p.sub(replace_image,
|
||||
value)
|
||||
#value = re.sub(r':BASE_PATH:',
|
||||
# r'' + base_path,
|
||||
# value)
|
||||
return value
|
||||
|
||||
element_type_count={"Image":0}
|
||||
|
||||
def transcode_part2(value):
|
||||
value = value.replace(":IMAGE:UNDER:SCORE:", "_")
|
||||
value = value.replace(":IMAGE:STAR:", "*")
|
||||
value = value.replace(":IMAGE:BRACKET:START:", "[")
|
||||
value = value.replace(":IMAGE:BRACKET:STOP:", "]")
|
||||
value = value.replace(":IMAGE:SLASH:", "/")
|
||||
|
||||
|
||||
return value
|
||||
|
||||
|
||||
|
||||
|
||||
def replace_image(match):
|
||||
global image_base_path
|
||||
global element_type_count
|
||||
if match.group() == "":
|
||||
return ""
|
||||
debug.verbose("Image parse: " + str(match.group()))
|
||||
#value = '<img src=":BASE_PATH:'
|
||||
value = '<img src="'
|
||||
value += simplify_path(os.path.join(image_base_path, match.groups()[1])).replace("/", "__")
|
||||
value += '" '
|
||||
|
||||
alt_properties = match.groups()[0].split("|")
|
||||
alt = False
|
||||
center = False
|
||||
right = False
|
||||
left = False
|
||||
showTitle = False
|
||||
title = False
|
||||
type = "Image"
|
||||
for elem in alt_properties:
|
||||
if alt == False:
|
||||
alt = True
|
||||
value += 'alt="' + elem + '" '
|
||||
title = elem
|
||||
continue
|
||||
key_alt, value_alt = elem.split("=")
|
||||
if key_alt == "width":
|
||||
value += 'width="' + value_alt + '" '
|
||||
elif key_alt == "height":
|
||||
value += 'height="' + value_alt + '" '
|
||||
if key_alt == "align":
|
||||
if value_alt == "center":
|
||||
center = True
|
||||
if value_alt == "right":
|
||||
right = True
|
||||
if value_alt == "left":
|
||||
left = True
|
||||
if key_alt == "type":
|
||||
type = value_alt
|
||||
if key_alt == "titleShow":
|
||||
if elem == "false":
|
||||
showTitle = False
|
||||
else:
|
||||
showTitle = True
|
||||
else:
|
||||
debug.warning("not manage element '" + key_alt + "' in '" + str(match.group()) + "'")
|
||||
value += '/>'
|
||||
|
||||
if type in element_type_count.keys():
|
||||
element_type_count[type] += 1
|
||||
else:
|
||||
element_type_count[type] = 1
|
||||
|
||||
if showTitle == True:
|
||||
value = "<br/>" + value + "<br/>[" + str(element_type_count[type]) + "] <u><b>" + type + ": </b>" + title + "</u><br/>"
|
||||
|
||||
|
||||
if center == True:
|
||||
value = "<center>" + value + "</center>"
|
||||
elif right == True:
|
||||
value = "<right>" + value + "</right>"
|
||||
elif left == True:
|
||||
value = "<left>" + value + "</left>"
|
||||
|
||||
value = value.replace("_", ":IMAGE:UNDER:SCORE:")
|
||||
value = value.replace("*", ":IMAGE:STAR:")
|
||||
value = value.replace("[", ":IMAGE:BRACKET:START:")
|
||||
value = value.replace("]", ":IMAGE:BRACKET:STOP:")
|
||||
value = value.replace(":BASE:IMAGE:UNDER:SCORE:PATH:", ":BASE_PATH:")
|
||||
|
||||
return value
|
||||
|
||||
|
168
monk/codeMarkDown/MD_IndentAndDot.py
Normal file
168
monk/codeMarkDown/MD_IndentAndDot.py
Normal file
@ -0,0 +1,168 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode
|
||||
## commencez les lignes par:
|
||||
## *
|
||||
## *
|
||||
##
|
||||
## +
|
||||
## +
|
||||
##
|
||||
## resultat:
|
||||
##
|
||||
## -
|
||||
## -
|
||||
## -
|
||||
##
|
||||
## commencez les lignes par:
|
||||
## -
|
||||
## -
|
||||
##
|
||||
## resultat:
|
||||
##
|
||||
## 1.
|
||||
## 2.
|
||||
## 3.
|
||||
##
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value, _base_path = ""):
|
||||
value = re.sub(r'\n(( - \[ \] )|( \* \[ \] )|( # \[ \] )|(\* \[ \] ))',
|
||||
r'\n:INDENT_1:[CHECK_BOX_0]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - \[x\] )|( \* \[x\] )|( # \[x\] )|(\* \[x\] ))',
|
||||
r'\n:INDENT_1:[CHECK_BOX_1]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - \[X\] )|( \* \[X\] )|( # \[X\] )|(\* \[X\] ))',
|
||||
r'\n:INDENT_1:[CHECK_BOX_2]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1:[TICK]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1:[STAR]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1:[SHARP]',
|
||||
value)
|
||||
value = re.sub(r'\n(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1:[STAR]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t)(( - \[ \] )|( \* \[ \] )|( # \[ \] )|(\* \[ \] ))',
|
||||
r'\n:INDENT_1::INDENT_2:[CHECK_BOX_0]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t)(( - \[x\] )|( \* \[x\] )|( # \[x\] )|(\* \[x\] ))',
|
||||
r'\n:INDENT_1::INDENT_2:[CHECK_BOX_1]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t)(( - \[X\] )|( \* \[X\] )|( # \[x\] )|(\* \[x\] ))',
|
||||
r'\n:INDENT_1::INDENT_2:[CHECK_BOX_2]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t)(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1::INDENT_2:[STAR]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t\t)(( - \[ \] )|( \* \[ \] )|( # \[ \] )|(\* \[ \] ))',
|
||||
r'\n:INDENT_1::INDENT_2::INDENT_3:[CHECK_BOX_0]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t\t)(( - \[x\] )|( \* \[x\] )|( # \[x\] )|(\* \[x\] ))',
|
||||
r'\n:INDENT_1::INDENT_2::INDENT_3:[CHECK_BOX_1]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t\t)(( - \[X\] )|( \* \[X\] )|( # \[X\] )|(\* \[X\] ))',
|
||||
r'\n:INDENT_1::INDENT_2::INDENT_3:[CHECK_BOX_2]',
|
||||
value)
|
||||
value = re.sub(r'\n( |\t\t)(( - )|( \* )|( # )|(\* ))',
|
||||
r'\n:INDENT_1::INDENT_2::INDENT_3:[STAR]',
|
||||
value)
|
||||
p = re.compile('((\:INDENT_1\:(.*?)\n)*)',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_wiki_identation_1,
|
||||
value)
|
||||
|
||||
value = re.sub(r'\[STAR\](.*?)\n',
|
||||
r'<li class="list-star">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[SHARP\](.*?)\n',
|
||||
r'<li class="list-sharp">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[TICK\](.*?)\n',
|
||||
r'<li class="list-tick">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[NUMBER\](.*?)\n',
|
||||
r'<li class="list-number">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[CHECK_BOX_2\](.*?)\n',
|
||||
#r'<li class="list-check-box"><input type="checkbox" checked=""/>\1</li>',
|
||||
r'<li class="list-check-box-tick">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[CHECK_BOX_1\](.*?)\n',
|
||||
#r'<li class="list-check-box"><input type="checkbox" checked=""/>\1</li>',
|
||||
r'<li class="list-check-box-check">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
value = re.sub(r'\[CHECK_BOX_0\](.*?)\n',
|
||||
#r'<li class="list-check-box"><input type="checkbox"/>\1</li>',
|
||||
r'<li class="list-check-box">\1</li>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def replace_wiki_identation_1(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
#debug.verbose("plop: " + str(match.group()))
|
||||
value = "<ul>\n"
|
||||
value += re.sub(r':INDENT_1:',
|
||||
r'',
|
||||
match.group())
|
||||
value += "\n</ul>"
|
||||
|
||||
p = re.compile('((\:INDENT_2\:(.*?)\n)*)',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_wiki_identation_2,
|
||||
value)
|
||||
|
||||
return value
|
||||
|
||||
def replace_wiki_identation_2(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
#debug.verbose("plop: " + str(match.group()))
|
||||
value = "<ul>\n"
|
||||
value += re.sub(r':INDENT_2:',
|
||||
r'',
|
||||
match.group())
|
||||
value += "\n</ul>"
|
||||
|
||||
p = re.compile('((\:INDENT_3\:(.*?)\n)*)',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_wiki_identation_3,
|
||||
value)
|
||||
|
||||
return value
|
||||
|
||||
def replace_wiki_identation_3(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
#debug.verbose("plop: " + str(match.group()))
|
||||
value = "<ul>\n"
|
||||
value += re.sub(r':INDENT_3:',
|
||||
r'',
|
||||
match.group())
|
||||
value += "\n</ul>"
|
||||
return value
|
||||
|
||||
|
79
monk/codeMarkDown/MD_Link.py
Normal file
79
monk/codeMarkDown/MD_Link.py
Normal file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
import os
|
||||
|
||||
basic_link_path = ""
|
||||
|
||||
##
|
||||
## @brief Transcode:
|
||||
## [http://votre_site.con] => http://votre_site.con
|
||||
## [http://votre_site.con | text displayed] => text displayed
|
||||
## [http://votre_site.con text displayed] => text displayed.
|
||||
##
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value, _base_path):
|
||||
global basic_link_path
|
||||
basic_link_path = _base_path
|
||||
if len(_base_path) != 0:
|
||||
base_path = (_base_path + '/').replace('/','__')
|
||||
else:
|
||||
base_path = ""
|
||||
# named image : ![hover Value](http://sdfsdf.svg)
|
||||
value = re.sub(r'\[(.*?)\][ \t]*\(http://(.*?)\)',
|
||||
r'<a href="http://\2">\1</a>',
|
||||
value)
|
||||
value = re.sub(r'\[(.*?)\][ \t]*\(https://(.*?)\)',
|
||||
r'<a href="https://\2">\1</a>',
|
||||
value)
|
||||
"""
|
||||
value = re.sub(r'\[(.*?)\][ \t]*\((.*?)\.md\)',
|
||||
r'<a href="' + base_path + r'\2.html">\1</a>',
|
||||
value)
|
||||
"""
|
||||
p = re.compile('\[(.*?)\][ \t]*\((.*?)\.md\)')
|
||||
value = p.sub(replace_link,
|
||||
value)
|
||||
p = re.compile('\[(.*?)\][ \t]*\((.*?)\)')
|
||||
value = p.sub(replace_link,
|
||||
value)
|
||||
|
||||
return value
|
||||
|
||||
def transcode_part2(value):
|
||||
value = value.replace(":LINK:UNDER:SCORE:", "_")
|
||||
value = value.replace(":LINK:STAR:", "*")
|
||||
value = value.replace(":LINK:BRACKET:START:", "[")
|
||||
value = value.replace(":LINK:BRACKET:STOP:", "]")
|
||||
return value
|
||||
|
||||
def replace_link(match):
|
||||
global basic_link_path
|
||||
if match.group() == "":
|
||||
return ""
|
||||
debug.warning("plop: " + str(match.group()))
|
||||
debug.warning("plop: " + str(match.groups()))
|
||||
value = '<a href="'
|
||||
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] + '</a>'
|
||||
else:
|
||||
value += '.html">' + match.groups()[1] + '</a>'
|
||||
value = value.replace("_", ":LINK:UNDER:SCORE:")
|
||||
value = value.replace("*", ":LINK:STAR:")
|
||||
value = value.replace("[", ":LINK:BRACKET:START:")
|
||||
value = value.replace("]", ":LINK:BRACKET:STOP:")
|
||||
return value
|
||||
|
32
monk/codeMarkDown/MD_ResultSelection.py
Normal file
32
monk/codeMarkDown/MD_ResultSelection.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode
|
||||
## commencez les lignes par:
|
||||
##
|
||||
def transcode(value, _base_path = ""):
|
||||
p = re.compile('\[([a-zA-Z0-9_-\| ]*)\]',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_result_list,
|
||||
value)
|
||||
return value
|
||||
|
||||
|
||||
def replace_result_list(match):
|
||||
if match.group() == "":
|
||||
return ""
|
||||
debug.warning("parse RESULT ... : '" + str(match.group()) + "'")
|
||||
value = '<table id="my-table"><tr>'
|
||||
tmpppp = match.group().replace("]", "").replace("[", "").replace("\n", "").split('|')
|
||||
for elem in tmpppp:
|
||||
if len(elem) == 0:
|
||||
continue
|
||||
value += '<td>' + elem + "</td>"
|
||||
value += "</tr></table>"
|
||||
debug.warning(" ==> out " + value)
|
||||
return value
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
return value
|
||||
|
73
monk/codeMarkDown/MD_Table.py
Normal file
73
monk/codeMarkDown/MD_Table.py
Normal file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
##
|
||||
## @brief Transcode table:
|
||||
## | colone 1 ||
|
||||
## | ligne 1 | colone 2 ligne 1 |
|
||||
## | colone 1 ligne 1 | colone 2 ligne 2|
|
||||
## Avec autant de ligne et de colone que vous voullez..
|
||||
## Il est possible de faire des retour a la ligne dans une case du tableau...
|
||||
## En bref sa tend a marcher comme sur un Wiki...
|
||||
##
|
||||
## result:
|
||||
## | 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.
|
||||
##
|
||||
def transcode(value, _base_path):
|
||||
|
||||
p = re.compile('(\n(\|[^\n\|]*)*\|)*',
|
||||
flags=re.DOTALL)
|
||||
value = p.sub(replace_table,
|
||||
value)
|
||||
return value
|
||||
|
||||
table_index = 0
|
||||
|
||||
def replace_table(match):
|
||||
global table_index
|
||||
table_index = 0
|
||||
if match.group() == "":
|
||||
return ""
|
||||
debug.warning("=============================: Parse TABLE ...")
|
||||
debug.warning(str(match.group()))
|
||||
debug.warning("=============================: ")
|
||||
value = '<table class="doc_table">'
|
||||
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,
|
||||
value_global)
|
||||
value += "</table>"
|
||||
return value
|
||||
|
||||
def replace_table_line(match):
|
||||
global table_index
|
||||
if match.group() == "":
|
||||
return ""
|
||||
debug.warning("parse LINE ... : '" + str(match.group()) + "' ==> " + str(table_index))
|
||||
value = "<tr>"
|
||||
tmpppp = match.group().replace("\n", "").split('|')
|
||||
for elem in tmpppp:
|
||||
if len(elem) == 0:
|
||||
continue
|
||||
if table_index == 0:
|
||||
value += "<th>" + elem + "</th>"
|
||||
else:
|
||||
value += "<td>" + elem + "</td>"
|
||||
value += "</tr>"
|
||||
table_index += 1
|
||||
debug.warning(" ==> out " + value)
|
||||
return value
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ import re
|
||||
## @param[in] string String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'\*\*(.*?)\*\*',
|
||||
r'<strong>\1</strong>',
|
||||
@ -36,11 +36,12 @@ def transcode(value):
|
||||
r'<em>\1</em>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
"""
|
||||
value = re.sub(r'_(.*?)_',
|
||||
r'<em>\1</em>',
|
||||
value,
|
||||
flags=re.DOTALL)
|
||||
|
||||
"""
|
||||
value = re.sub(r'____(.*?)\n',
|
||||
r'<hr>',
|
||||
value,
|
175
monk/codeMarkDown/MD_Title.py
Normal file
175
monk/codeMarkDown/MD_Title.py
Normal file
@ -0,0 +1,175 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
h2counter = 1
|
||||
h3counter = 1
|
||||
h4counter = 1
|
||||
h5counter = 1
|
||||
h6counter = 1
|
||||
indexation = ""
|
||||
|
||||
##
|
||||
## @brief Transcode .
|
||||
## =?=Page Title=?=
|
||||
## ==Title 1==
|
||||
## ===Title 2===
|
||||
## ====Title 3====
|
||||
## =====Title 4=====
|
||||
## ======Title 5======
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
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'',
|
||||
value)
|
||||
|
||||
value = re.sub(value_start + r'(.*?)(( |\t)*\{.*\})*\n====*',
|
||||
value_start + r'<h1>\1</h1>',
|
||||
value)
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n===*',
|
||||
r'\n==Z==222==Z==\1</h2>',
|
||||
value)
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n---*',
|
||||
r'\n==Z==333==Z==\1</h3>',
|
||||
value)
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n\+\+\+*',
|
||||
r'\n==Z==444==Z==\1</h4>',
|
||||
value)
|
||||
value = re.sub(r'\n(.*?)(( |\t)*\{.*\})*\n~~~*',
|
||||
r'\n==Z==555==Z==\1</h5>',
|
||||
value)
|
||||
|
||||
"""
|
||||
value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})* ######',
|
||||
r'\n==Z==666==Z==\1</h6>',
|
||||
value)
|
||||
value = re.sub(r'\n###### (.*?)(( |\t)*\{.*\})*',
|
||||
r'\n==Z==666==Z==\1</h6>',
|
||||
value)
|
||||
"""
|
||||
|
||||
value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})* #####',
|
||||
r'\n==Z==666==Z==\1</h5>',
|
||||
value)
|
||||
value = re.sub(r'\n##### (.*?)(( |\t)*\{.*\})*\n',
|
||||
r'\n==Z==666==Z==\1</h5>\n',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})* ####',
|
||||
r'\n==Z==555==Z==\1</h4>',
|
||||
value)
|
||||
value = re.sub(r'\n#### (.*?)(( |\t)*\{.*\})*\n',
|
||||
r'\n==Z==555==Z==\1</h4>\n',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n### (.*?)(( |\t)*\{.*\})* ###',
|
||||
r'\n==Z==444==Z==\1</h3>',
|
||||
value)
|
||||
value = re.sub(r'\n### (.*)(( |\t)*\{.*\})*\n',
|
||||
r'\n==Z==444==Z==\1</h3>\n',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})* ##',
|
||||
r'\n==Z==333==Z==\1</h2>',
|
||||
value)
|
||||
value = re.sub(r'\n## (.*?)(( |\t)*\{.*\})*\n',
|
||||
r'\n==Z==333==Z==\1</h2>\n',
|
||||
value)
|
||||
|
||||
value = re.sub(r'\n# (.*?)(( |\t)*\{.*\})* #',
|
||||
r'\n==Z==333==Z==\1</h2>',
|
||||
value)
|
||||
value = re.sub(r'\n# (.*?)(( |\t)*\{.*\})*\n',
|
||||
r'\n==Z==333==Z==\1</h2>\n',
|
||||
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 = "<h2>" + str(h2counter) + ". "
|
||||
#indexation += "<h2>" + h2counter + ". "
|
||||
h2counter += 1
|
||||
h3counter = 1
|
||||
h4counter = 1
|
||||
h5counter = 1
|
||||
h6counter = 1
|
||||
return out
|
||||
if match.groups()[0] == "333":
|
||||
out = "<h3>" + str(h2counter) + "." + str(h3counter) + ". "
|
||||
h3counter += 1
|
||||
h4counter = 1
|
||||
h5counter = 1
|
||||
h6counter = 1
|
||||
return out
|
||||
if match.groups()[0] == "444":
|
||||
out = "<h4>" + str(h2counter) + "." + str(h3counter) + "." + str(h4counter) + ". "
|
||||
h4counter += 1
|
||||
h5counter = 1
|
||||
h6counter = 1
|
||||
return out
|
||||
if match.groups()[0] == "555":
|
||||
out = "<h5>" + str(h2counter) + "." + str(h3counter) + "." + str(h4counter) + "." + str(h5counter) + ". "
|
||||
h5counter += 1
|
||||
h6counter = 1
|
||||
return out
|
||||
if match.groups()[0] == "666":
|
||||
out = "<h6>" + 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'</h6>[\n \t]*<br/>',
|
||||
r'</h6>',
|
||||
value)
|
||||
value = re.sub(r'</h5>[\n \t]*<br/>',
|
||||
r'</h5>',
|
||||
value)
|
||||
value = re.sub(r'</h4>[\n \t]*<br/>',
|
||||
r'</h4>',
|
||||
value)
|
||||
value = re.sub(r'</h3>[\n \t]*<br/>',
|
||||
r'</h3>',
|
||||
value)
|
||||
value = re.sub(r'</h2>[\n \t]*<br/>',
|
||||
r'</h2>',
|
||||
value)
|
||||
value = re.sub(r'</h1>[\n \t]*<br/>',
|
||||
r'</h1>',
|
||||
value)
|
||||
return value
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
_comment_code = "[comment]:"
|
||||
@ -11,7 +11,7 @@ _comment_code = "[comment]:"
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
out = "";
|
||||
for elem in value.split("\n"):
|
||||
if len(elem) >= len(_comment_code) \
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools
|
||||
from monk import tools
|
||||
import re
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ import re
|
||||
## @param[in] value String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value):
|
||||
def transcode(value, _base_path):
|
||||
|
||||
value = re.sub(r'\r\n',
|
||||
r'\n',
|
78
monk/codeMarkDown/__init__.py
Normal file
78
monk/codeMarkDown/__init__.py
Normal file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/python
|
||||
from realog import debug
|
||||
import sys
|
||||
from monk import tools
|
||||
import re
|
||||
"""
|
||||
import BB_Link
|
||||
import BB_Image
|
||||
import BB_Table
|
||||
|
||||
import BB_Specification
|
||||
"""
|
||||
import MD_Text
|
||||
import MD_IndentAndDot
|
||||
import MD_Title
|
||||
import MD_comment
|
||||
import MD_lineReturn
|
||||
import MD_Image
|
||||
import MD_Code
|
||||
import MD_Link
|
||||
import MD_Table
|
||||
import MD_ResultSelection
|
||||
##
|
||||
## @brief Transcode input data in the corect format.
|
||||
## @param[in] string String to transform.
|
||||
## @return Transformed string.
|
||||
##
|
||||
def transcode(value, _base_path = ""):
|
||||
# remove html property
|
||||
value = re.sub(r'&', r'&', value)
|
||||
value = re.sub(r'<', r'<', value)
|
||||
value = re.sub(r'>', r'>', value)
|
||||
value = re.sub(r'\r\n', r'\n', value)
|
||||
value = re.sub(r'\n\r', r'\n', value)
|
||||
value = re.sub(r'\r', r'\n', value)
|
||||
value = MD_comment.transcode(value, _base_path)
|
||||
value = MD_Title.transcode(value, _base_path)
|
||||
value = MD_IndentAndDot.transcode(value, _base_path)
|
||||
value = MD_Code.transcode(value, _base_path)
|
||||
|
||||
value = MD_Table.transcode(value, _base_path)
|
||||
value = MD_lineReturn.transcode(value, _base_path)
|
||||
value = MD_Title.transcode_clean_empty_line_after(value, _base_path)
|
||||
"""
|
||||
value = BB_Text.transcode(value, _base_path)
|
||||
value = BB_Specification.transcode(value, _base_path)
|
||||
"""
|
||||
value = MD_Image.transcode(value, _base_path)
|
||||
value = MD_Link.transcode(value, _base_path)
|
||||
value = MD_ResultSelection.transcode(value, _base_path)
|
||||
|
||||
|
||||
|
||||
|
||||
value = MD_Text.transcode(value, _base_path)
|
||||
|
||||
|
||||
|
||||
|
||||
value = MD_Code.transcode_part2(value)
|
||||
value = MD_Image.transcode_part2(value)
|
||||
value = MD_Link.transcode_part2(value)
|
||||
return value
|
||||
|
||||
##
|
||||
## @brief transcode a BBcode file in a html file
|
||||
## @return True if the file is transformed
|
||||
##
|
||||
def transcode_file(inputFileName, outputFileName):
|
||||
inData = tools.file_read_data(inputFileName)
|
||||
if inData == "":
|
||||
return False
|
||||
outData = transcode(inData)
|
||||
debug.warning(" out: " + outputFileName)
|
||||
tools.file_write_data(outputFileName, outData)
|
||||
return True
|
||||
|
||||
|
@ -3,11 +3,11 @@ import sys
|
||||
import os
|
||||
import inspect
|
||||
import fnmatch
|
||||
import monkDebug as debug
|
||||
import monkTools as tools
|
||||
import monkNode as Node
|
||||
import monkParse as Parse
|
||||
import monkHtml
|
||||
from realog import debug
|
||||
from . import tools
|
||||
from . import monkNode as Node
|
||||
from . import monkParse as Parse
|
||||
from . import monkHtml
|
||||
import re
|
||||
import json
|
||||
|
||||
@ -30,7 +30,10 @@ class Module:
|
||||
# Name of the module
|
||||
self.name=moduleName
|
||||
self.list_doc_file = []
|
||||
self.list_image_file = []
|
||||
self.list_tutorial_file = []
|
||||
self.list_manual_file = []
|
||||
self.list_test_file = []
|
||||
self.web_site = ""
|
||||
self.web_source = ""
|
||||
self.path_parsing = ""
|
||||
@ -115,9 +118,9 @@ class Module:
|
||||
tmpList = fnmatch.filter(filenames, "*.hpp")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
fileCompleteName = os.path.join(root, filename)
|
||||
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
||||
self.add_file(fileCompleteName)
|
||||
file_complete_name = os.path.join(root, filename)
|
||||
debug.debug(" Find a file : '" + file_complete_name + "'")
|
||||
self.add_file(file_complete_name)
|
||||
# all file is parset ==> now we create the namespacing of all elements:
|
||||
self.structure_lib.set_namespace()
|
||||
self.structure_lib.set_module_link(self)
|
||||
@ -130,19 +133,36 @@ class Module:
|
||||
tmpList = fnmatch.filter(filenames, "*.md")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
fileCompleteName = os.path.join(root, filename)
|
||||
tutorialPath = os.path.join(self.path_global_doc, "tutorial/")
|
||||
pathBase = fileCompleteName[len(self.path_global_doc):len(fileCompleteName)-3]
|
||||
while len(pathBase) > 0 \
|
||||
and pathBase[0] == '/':
|
||||
pathBase = pathBase[1:]
|
||||
debug.verbose(" Find a doc file : fileCompleteName='" + fileCompleteName + "'")
|
||||
if fileCompleteName[:len(tutorialPath)] == tutorialPath:
|
||||
debug.warning("add_tutorial_doc : '" + fileCompleteName + "' ==> '" + pathBase + "'")
|
||||
self.add_tutorial_doc(fileCompleteName, pathBase)
|
||||
file_complete_name = os.path.join(root, filename)
|
||||
tutorial_path = os.path.join(self.path_global_doc, "tutorial/")
|
||||
test_path = os.path.join(self.path_global_doc, "test/")
|
||||
manual_path = os.path.join(self.path_global_doc, "manual/")
|
||||
path_base = file_complete_name[len(self.path_global_doc):len(file_complete_name)-3]
|
||||
while len(path_base) > 0 \
|
||||
and path_base[0] == '/':
|
||||
path_base = path_base[1:]
|
||||
debug.verbose(" Find a doc file : file_complete_name='" + file_complete_name + "'")
|
||||
if file_complete_name[:len(tutorial_path)] == tutorial_path:
|
||||
debug.warning("add_tutorial_doc : '" + file_complete_name + "' ==> '" + path_base + "'")
|
||||
self.add_tutorial_doc(file_complete_name, path_base)
|
||||
elif file_complete_name[:len(test_path)] == test_path:
|
||||
debug.warning("add_test_doc : '" + file_complete_name + "' ==> '" + path_base + "'")
|
||||
self.add_test_doc(file_complete_name, path_base)
|
||||
elif file_complete_name[:len(manual_path)] == manual_path:
|
||||
debug.warning("add_user_manual_doc : '" + file_complete_name + "' ==> '" + path_base + "'")
|
||||
self.add_user_manual_doc(file_complete_name, path_base)
|
||||
else:
|
||||
debug.warning("add_file_doc : '" + fileCompleteName + "' ==> '" + pathBase + "'")
|
||||
self.add_file_doc(fileCompleteName, pathBase)
|
||||
debug.warning("add_file_doc : '" + file_complete_name + "' ==> '" + path_base + "'")
|
||||
self.add_file_doc(file_complete_name, path_base)
|
||||
for root, dirnames, filenames in os.walk(self.path_global_doc):
|
||||
for filename in filenames:
|
||||
if not filename.endswith(('.jpg', '.JPG', '.jpeg', '.JPEG', '.png', '.PNG', '.svg', '.SVG', '.gif', '.GIF', '.tga', '.TGA')):
|
||||
continue
|
||||
file_complete_name = os.path.join(root, filename)
|
||||
path_base = file_complete_name[len(self.path_global_doc)+1:]
|
||||
debug.verbose(" Find a doc file : file_complete_name='" + file_complete_name + "'")
|
||||
debug.warning("add_image_doc: '" + file_complete_name + "' ==> '" + path_base + "'")
|
||||
self.add_image_doc(file_complete_name, path_base)
|
||||
|
||||
##
|
||||
## @brief Sort a list of n element containing a list of element (order with the first)
|
||||
@ -181,6 +201,24 @@ class Module:
|
||||
self.list_doc_file.append([filename, outPath])
|
||||
self.list_doc_file = self.sort_list_first_elem(self.list_doc_file)
|
||||
|
||||
##
|
||||
## @brief Add a documentation image file to copy to the output
|
||||
## @param[in] filename File To add in the output documentation.
|
||||
## @param[in] outPath output system file.
|
||||
## @return True if no error occured, False otherwise
|
||||
##
|
||||
def add_image_doc(self, filename, outPath):
|
||||
debug.debug("adding file in documantation : '" + filename + "'");
|
||||
done = False
|
||||
for iii in range(0,len(self.list_image_file)):
|
||||
if self.list_image_file[iii][0] > filename:
|
||||
self.list_image_file.insert(iii, [filename, outPath])
|
||||
done = True
|
||||
break
|
||||
if done == False:
|
||||
self.list_image_file.append([filename, outPath])
|
||||
self.list_image_file = self.sort_list_first_elem(self.list_image_file)
|
||||
|
||||
##
|
||||
## @brief Add a documentation file at the parsing system
|
||||
## @param[in] filename File To add at the parsing element system.
|
||||
@ -188,7 +226,7 @@ class Module:
|
||||
## @return True if no error occured, False otherwise
|
||||
##
|
||||
def add_tutorial_doc(self, filename, outPath):
|
||||
count = int(filename.split('/')[-1].split('_')[0])
|
||||
#count = int(filename.split('/')[-1].split('_')[0])
|
||||
debug.debug("adding file in documantation : '" + filename + "'");
|
||||
done = False
|
||||
for iii in range(0,len(self.list_tutorial_file)):
|
||||
@ -201,6 +239,45 @@ class Module:
|
||||
self.list_tutorial_file = self.sort_list_first_elem(self.list_tutorial_file)
|
||||
|
||||
|
||||
##
|
||||
## @brief Add a documentation file at the parsing system
|
||||
## @param[in] filename File To add at the parsing element system.
|
||||
## @param[in] outPath output system file.
|
||||
## @return True if no error occured, False otherwise
|
||||
##
|
||||
def add_user_manual_doc(self, filename, outPath):
|
||||
#count = int(filename.split('/')[-1].split('_')[0])
|
||||
debug.debug("adding file in user manual documantation : '" + filename + "'");
|
||||
done = False
|
||||
for iii in range(0,len(self.list_tutorial_file)):
|
||||
if self.list_manual_file[iii][0] > filename:
|
||||
self.list_manual_file.insert(iii, [filename, outPath])
|
||||
done = True
|
||||
break
|
||||
if done == False:
|
||||
self.list_manual_file.append([filename, outPath])
|
||||
self.list_manual_file = self.sort_list_first_elem(self.list_manual_file)
|
||||
|
||||
##
|
||||
## @brief Add a documentation file at the parsing system
|
||||
## @param[in] filename File To add at the parsing element system.
|
||||
## @param[in] outPath output system file.
|
||||
## @return True if no error occured, False otherwise
|
||||
##
|
||||
def add_test_doc(self, filename, outPath):
|
||||
#count = int(filename.split('/')[-1].split('_')[0])
|
||||
debug.debug("adding file in test documantation : '" + filename + "'");
|
||||
done = False
|
||||
for iii in range(0,len(self.list_tutorial_file)):
|
||||
if self.list_test_file[iii][0] > filename:
|
||||
self.list_test_file.insert(iii, [filename, outPath])
|
||||
done = True
|
||||
break
|
||||
if done == False:
|
||||
self.list_test_file.append([filename, outPath])
|
||||
self.list_test_file = self.sort_list_first_elem(self.list_test_file)
|
||||
|
||||
|
||||
##
|
||||
## @brief Add a file at the parsing system
|
||||
## @param[in] filename File To add at the parsing element system.
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
import monkModule as module
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
from . import module
|
||||
|
||||
|
||||
##
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
|
||||
class Enum(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,15 +1,15 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import sys
|
||||
import monkTools as tools
|
||||
from . import tools
|
||||
#import CppHeaderParser
|
||||
import os
|
||||
import re
|
||||
import codeBB
|
||||
import codeMarkDown
|
||||
from . import codeBB
|
||||
from . import codeMarkDown
|
||||
import collections
|
||||
import monkModule as module
|
||||
import monkNode as node
|
||||
from . import module
|
||||
from . import monkNode as node
|
||||
|
||||
htmlCodes = (
|
||||
('&', '&'),
|
||||
@ -310,9 +310,12 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
|
||||
ret += '<br/>'
|
||||
return ret
|
||||
|
||||
def generate_stupid_index_page(outFolder, header, footer, my_lutin_doc):
|
||||
def generate_stupid_index_page(my_lutin_doc, out_folder):
|
||||
header = create_generic_header(my_lutin_doc, out_folder)
|
||||
footer = create_generic_footer(my_lutin_doc, out_folder)
|
||||
|
||||
# create index.hml :
|
||||
filename = outFolder + "/index.html"
|
||||
filename = out_folder + "/index.html"
|
||||
tools.create_directory_of_file(filename);
|
||||
file = open(filename, "w")
|
||||
file.write(header)
|
||||
@ -324,15 +327,19 @@ def generate_stupid_index_page(outFolder, header, footer, my_lutin_doc):
|
||||
file.write(footer)
|
||||
file.close();
|
||||
|
||||
def generate_page(outFolder, header, footer, element, name_lib=""):
|
||||
def generate_page(my_lutin_doc, out_folder, element, name_lib=""):
|
||||
|
||||
header = create_generic_header(my_lutin_doc, out_folder)
|
||||
footer = create_generic_footer(my_lutin_doc, out_folder)
|
||||
|
||||
debug.print_element("code-doc", name_lib, "<==", element.name)
|
||||
currentPageSite = element.get_doc_website_page()
|
||||
namespaceStack = element.get_namespace()
|
||||
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(outFolder, header, footer, elem['node'], name_lib)
|
||||
filename = outFolder + '/' + generate_html_page_name(element)
|
||||
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")
|
||||
file.write(header)
|
||||
@ -626,22 +633,33 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def generate(my_lutin_doc, outFolder) :
|
||||
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", outFolder+"/base.css")
|
||||
tools.copy_file(tools.get_current_path(__file__)+"/theme/menu.css", outFolder+"/menu.css")
|
||||
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 = '<!DOCTYPE html>\n'
|
||||
generic_header += '<html>\n'
|
||||
generic_header += '<head>\n'
|
||||
generic_header += ' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">\n'
|
||||
generic_header += ' <title>' + my_doc.get_name() + ' Library</title>\n'
|
||||
generic_header += ' <link rel="stylesheet" href="base.css">\n'
|
||||
generic_header += ' <link rel="stylesheet" href="menu.css">\n'
|
||||
generic_header += '</head>\n'
|
||||
generic_header += '<body>\n'
|
||||
base_header = '<!DOCTYPE html>\n'
|
||||
base_header += '<html>\n'
|
||||
base_header += '<head>\n'
|
||||
base_header += ' <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">\n'
|
||||
base_header += ' <title>' + my_doc.get_name() + ' Library</title>\n'
|
||||
if _to_print == False:
|
||||
base_header += ' <link rel="stylesheet" href="base.css">\n'
|
||||
base_header += ' <link rel="stylesheet" href="menu.css">\n'
|
||||
else:
|
||||
base_header += ' <link rel="stylesheet" href="base_print.css">\n'
|
||||
|
||||
base_header += '</head>\n'
|
||||
#base_header += '<div class="button_print">print</div>\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 += ' <div class="navbar navbar-fixed-top">\n'
|
||||
generic_header += ' <div class="container">\n'
|
||||
if my_doc.get_node_type() == 'library':
|
||||
@ -650,40 +668,79 @@ def generate(my_lutin_doc, outFolder) :
|
||||
generic_header += ' <h1><a href="index.html">' + my_doc.get_name() + '</a></h1>\n'
|
||||
if my_lutin_doc.get_website_sources() != '':
|
||||
generic_header += ' <h4><a href="' + my_lutin_doc.get_website_sources() + '"> [ sources ]</a></h4>\n'
|
||||
generic_header += '<h3>API:</h3>'
|
||||
generic_header += ' <div id="menu">\n'
|
||||
#generic_header += ' <h2>' + my_doc.moduleName + '</h2>\n'
|
||||
generic_header += generate_menu(my_doc)
|
||||
#generic_header += ' <h3> </h3>\n'
|
||||
generic_header += ' </div>\n'
|
||||
|
||||
api_menu = generate_menu(my_doc)
|
||||
if len(api_menu) != 0:
|
||||
generic_header += '<h3>API:</h3>'
|
||||
generic_header += ' <div id="menu">\n'
|
||||
#generic_header += ' <h2>' + my_doc.moduleName + '</h2>\n'
|
||||
generic_header += api_menu
|
||||
#generic_header += ' <h3> </h3>\n'
|
||||
generic_header += ' </div>\n'
|
||||
|
||||
# TODO : add Generic doc main point.
|
||||
if len(my_lutin_doc.list_doc_file) > 0:
|
||||
docList = ""
|
||||
for docInputName,outpath in my_lutin_doc.list_doc_file:
|
||||
outputFileName = outFolder + "/" + outpath.replace('/','_') +".html"
|
||||
outputFileName = outputFileName.split('/')[-1]
|
||||
name = outputFileName.split('_')[-1][:-5]
|
||||
if len(my_lutin_doc.list_manual_file) > 0:
|
||||
manual_list = ""
|
||||
for doc_input_name,outpath in my_lutin_doc.list_manual_file:
|
||||
output_file_name = out_folder + "/" + outpath.replace('/','__') +".html"
|
||||
output_file_name = output_file_name.split('/')[-1]
|
||||
name = output_file_name.split('_')[-1][:-5]
|
||||
if name == "index":
|
||||
continue
|
||||
docList += '<ul class="niveau1">'
|
||||
docList += '<li><a href="' + outputFileName + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
docList += '</ul>'
|
||||
if docList != "":
|
||||
manual_list += '<ul class="niveau1">'
|
||||
manual_list += '<li><a href="' + output_file_name + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
manual_list += '</ul>'
|
||||
if manual_list != "":
|
||||
generic_header += '<h3>User manual:</h3>'
|
||||
generic_header += '<div id="menu">\n'
|
||||
generic_header += manual_list
|
||||
generic_header += '</div>\n'
|
||||
|
||||
# TODO : add Generic doc main point.
|
||||
if len(my_lutin_doc.list_doc_file) > 0:
|
||||
doc_list = ""
|
||||
for doc_input_name,outpath in my_lutin_doc.list_doc_file:
|
||||
output_file_name = out_folder + "/" + outpath.replace('/','__') +".html"
|
||||
output_file_name = output_file_name.split('/')[-1]
|
||||
base_name_rework = output_file_name.split('__')[-1]
|
||||
name_list = base_name_rework.split('_')
|
||||
debug.warning(str(name_list))
|
||||
if len(name_list) >= 2:
|
||||
name = base_name_rework[len(name_list[0])+1:].replace("_", " ")
|
||||
else:
|
||||
name = base_name_rework
|
||||
name = name[:-5]
|
||||
debug.warning(name)
|
||||
|
||||
if name == "index":
|
||||
continue
|
||||
doc_list += '<ul class="niveau1">'
|
||||
doc_list += '<li><a href="' + output_file_name + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
doc_list += '</ul>'
|
||||
if doc_list != "":
|
||||
generic_header += '<h3>Documentation:</h3>'
|
||||
generic_header += '<div id="menu">\n'
|
||||
generic_header += docList
|
||||
generic_header += doc_list
|
||||
generic_header += '</div>\n'
|
||||
|
||||
# TODO : add Tutorial doc main point.
|
||||
if len(my_lutin_doc.list_tutorial_file) > 0:
|
||||
tutorialList = ""
|
||||
for docInputName,outpath in my_lutin_doc.list_tutorial_file:
|
||||
outputFileName = outFolder + "/" + outpath+".html"
|
||||
outputFileName = outputFileName.split('/')[-1]
|
||||
name = outputFileName.split('_')[-1][:-5]
|
||||
for doc_input_name,outpath in my_lutin_doc.list_tutorial_file:
|
||||
output_file_name = out_folder + "/" + outpath+".html"
|
||||
output_file_name = output_file_name.split('/')[-1]
|
||||
base_name_rework = output_file_name.split('__')[-1]
|
||||
name_list = base_name_rework.split('_')
|
||||
#debug.warning(str(name_list))
|
||||
if len(name_list) >= 2:
|
||||
name = base_name_rework[len(name_list[0])+1:].replace("_", " ")
|
||||
else:
|
||||
name = base_name_rework
|
||||
name = name[:-5]
|
||||
if name == "index":
|
||||
continue
|
||||
tutorialList += '<ul class="niveau1">'
|
||||
tutorialList += '<li><a href="tutorial_' + outputFileName + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
tutorialList += '<li><a href="tutorial__' + output_file_name + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
tutorialList += '</ul>'
|
||||
if tutorialList != "":
|
||||
generic_header += '<h3>Tutorials:</h3>'
|
||||
@ -691,6 +748,30 @@ def generate(my_lutin_doc, outFolder) :
|
||||
generic_header += tutorialList
|
||||
generic_header += '</div>\n'
|
||||
|
||||
if len(my_lutin_doc.list_test_file) > 0:
|
||||
test_list = ""
|
||||
for doc_input_name,outpath in my_lutin_doc.list_test_file:
|
||||
output_file_name = out_folder + "/" + outpath.replace('/','__') +".html"
|
||||
output_file_name = output_file_name.split('/')[-1]
|
||||
base_name_rework = output_file_name.split('__')[-1]
|
||||
name_list = base_name_rework.split('_')
|
||||
#debug.warning(str(name_list))
|
||||
if len(name_list) >= 2:
|
||||
name = base_name_rework[len(name_list[0])+1:].replace("_", " ")
|
||||
else:
|
||||
name = base_name_rework
|
||||
name = name[:-5]
|
||||
#debug.error(str(name))
|
||||
if name == "index":
|
||||
continue
|
||||
test_list += '<ul class="niveau1">'
|
||||
test_list += '<li><a href="' + output_file_name + '">' + capitalise_first_letter(camel_case_decode(name)) + '</a></li>\n'
|
||||
test_list += '</ul>'
|
||||
if test_list != "":
|
||||
generic_header += '<h3>Tests process:</h3>'
|
||||
generic_header += '<div id="menu">\n'
|
||||
generic_header += test_list
|
||||
generic_header += '</div>\n'
|
||||
|
||||
localWebsite = my_lutin_doc.get_website()
|
||||
# add other libs entry point :
|
||||
@ -719,9 +800,18 @@ def generate(my_lutin_doc, outFolder) :
|
||||
generic_header += "<br/>\n"
|
||||
generic_header += "<br/>\n"
|
||||
generic_header += "<br/>\n"
|
||||
generic_header += '<image src="entreprise.png" width="200px" style="border:4px solid #FFFFFF;"/>\n'
|
||||
generic_header += " </div>\n"
|
||||
generic_header += " </div>\n"
|
||||
generic_header += " <div class=\"container\" id=\"content\">\n"
|
||||
generic_header += " <div class=\"container_data\" >\n"
|
||||
|
||||
return generic_header
|
||||
|
||||
def create_generic_footer(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/menu.css", out_folder+"/menu.css")
|
||||
|
||||
|
||||
generic_footer = " </div>\n"
|
||||
googleData = tools.file_read_data("google-analytics.txt")
|
||||
@ -731,63 +821,82 @@ def generate(my_lutin_doc, outFolder) :
|
||||
generic_footer += "</body>\n"
|
||||
generic_footer += "</html>\n"
|
||||
|
||||
return generic_footer
|
||||
|
||||
def generate(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/menu.css", out_folder+"/menu.css")
|
||||
|
||||
# create index.hml:
|
||||
generate_stupid_index_page(outFolder, generic_header, generic_footer, my_lutin_doc)
|
||||
generate_stupid_index_page(my_lutin_doc, out_folder)
|
||||
|
||||
# create the namespace index properties:
|
||||
generate_page(outFolder, generic_header, generic_footer, my_doc, name_lib=my_lutin_doc.name)
|
||||
generate_page(my_lutin_doc, out_folder, my_doc, name_lib=my_lutin_doc.name)
|
||||
|
||||
for iii in range(0, len(my_lutin_doc.list_tutorial_file)) :
|
||||
docInputName,outpath = my_lutin_doc.list_tutorial_file[iii]
|
||||
doc_input_name,outpath = my_lutin_doc.list_tutorial_file[iii]
|
||||
|
||||
debug.print_element("tutorial", my_lutin_doc.name, "<==", docInputName)
|
||||
debug.print_element("tutorial", my_lutin_doc.name, "<==", doc_input_name)
|
||||
if outpath[0] == '/':
|
||||
outpath = outpath[1:]
|
||||
outputFileName = os.path.join(outFolder, outpath.replace('/','_') + ".html")
|
||||
debug.debug("output file : " + outputFileName + " out path=" + outFolder + " baseName=" + outpath)
|
||||
tools.create_directory_of_file(outputFileName)
|
||||
name = outputFileName.split('_')[-1][:-5]
|
||||
inData = tools.file_read_data(docInputName)
|
||||
output_file_name = os.path.join(out_folder, outpath.replace('/','__') + ".html")
|
||||
debug.debug("output file : " + output_file_name + " out path=" + out_folder + " baseName=" + outpath)
|
||||
tools.create_directory_of_file(output_file_name)
|
||||
name = output_file_name.split('_')[-1][:-5]
|
||||
inData = tools.file_read_data(doc_input_name)
|
||||
if inData == "":
|
||||
continue
|
||||
outData = generic_header
|
||||
localHeader = ""
|
||||
localHeader += "=?=" + camel_case_decode(name) + "=?=\n___________________________\n"
|
||||
outData = create_generic_header(my_lutin_doc, out_folder)
|
||||
local_header = ""
|
||||
local_header += "=?=" + camel_case_decode(name) + "=?=\n___________________________\n"
|
||||
if iii != 0:
|
||||
previousName, previousOutpath = my_lutin_doc.list_tutorial_file[iii-1]
|
||||
previousName = previousName.split('_')[-1][:-3]
|
||||
previousOutpath = previousOutpath.split('/')[-1]
|
||||
localHeader += "[left][tutorial[" + previousOutpath + " | Previous: " + capitalise_first_letter(camel_case_decode(previousName)) + "]][/left] "
|
||||
previous_name, previous_out_path = my_lutin_doc.list_tutorial_file[iii-1]
|
||||
previous_name = previous_name.split('_')[-1][:-3]
|
||||
previous_out_path = previous_out_path.split('/')[-1]
|
||||
local_header += "[left][tutorial[" + previous_out_path + " | Previous: " + capitalise_first_letter(camel_case_decode(previous_name)) + "]][/left] "
|
||||
if iii != len(my_lutin_doc.list_tutorial_file)-1:
|
||||
nextName, nextOutpath = my_lutin_doc.list_tutorial_file[iii+1]
|
||||
nextName = nextName.split('_')[-1][:-3]
|
||||
nextOutpath = nextOutpath.split('/')[-1]
|
||||
localHeader += " [right][tutorial[" + nextOutpath + " | Next: " + capitalise_first_letter(camel_case_decode(nextName)) + "]][/right]"
|
||||
localHeader += "\n"
|
||||
outData += codeBB.transcode(localHeader)
|
||||
#debug.info(localHeader)
|
||||
if docInputName[-2:] == "bb":
|
||||
next_name, next_out_path = my_lutin_doc.list_tutorial_file[iii+1]
|
||||
next_name = next_name.split('_')[-1][:-3]
|
||||
next_out_path = next_out_path.split('/')[-1]
|
||||
local_header += " [right][tutorial[" + next_out_path + " | Next: " + capitalise_first_letter(camel_case_decode(next_name)) + "]][/right]"
|
||||
local_header += "\n"
|
||||
outData += codeBB.transcode(local_header)
|
||||
#debug.info(local_header)
|
||||
if doc_input_name[-2:] == "bb":
|
||||
outData += codeBB.transcode(inData)
|
||||
elif docInputName[-2:] == "md":
|
||||
elif doc_input_name[-2:] == "md":
|
||||
outData += codeMarkDown.transcode(inData)
|
||||
outData += genericFooter
|
||||
tools.file_write_data(outputFileName, outData)
|
||||
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 :
|
||||
debug.print_element("doc", my_lutin_doc.name, "<==", doc_input_name)
|
||||
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
|
||||
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, generic_header + outData)
|
||||
tools.file_write_data(output_file_name_print, base_header + outData)
|
||||
|
||||
for docInputName,outpath in my_lutin_doc.list_doc_file :
|
||||
debug.print_element("doc", my_lutin_doc.name, "<==", docInputName)
|
||||
outputFileName = outFolder + outpath + ".html"
|
||||
debug.debug("output file : " + outputFileName)
|
||||
tools.create_directory_of_file(outputFileName)
|
||||
inData = tools.file_read_data(docInputName)
|
||||
if inData == "":
|
||||
continue
|
||||
outData = generic_header
|
||||
if docInputName[-2:] == "bb":
|
||||
outData += codeBB.transcode(inData)
|
||||
elif docInputName[-2:] == "md":
|
||||
outData += codeMarkDown.transcode(inData)
|
||||
outData += generic_footer
|
||||
tools.file_write_data(outputFileName, outData)
|
||||
|
||||
for image_input_name,outpath in my_lutin_doc.list_image_file:
|
||||
debug.print_element("image", my_lutin_doc.name, "<==", image_input_name)
|
||||
output_file_name = out_folder + outpath.replace('/','__')
|
||||
tools.copy_file(image_input_name, output_file_name)
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
from realog import debug
|
||||
import os
|
||||
import sys
|
||||
import re
|
@ -1,8 +1,8 @@
|
||||
##!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
import monkType as Type
|
||||
import monkVariable as Variable
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
from . import monkType as Type
|
||||
from . import monkVariable as Variable
|
||||
|
||||
class Methode(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[], className = ""):
|
||||
@ -65,7 +65,7 @@ class Methode(Node.Node):
|
||||
while len(stack) > 0\
|
||||
and ( stack[0] == 'virtual'\
|
||||
or stack[0] == 'static'\
|
||||
or stack[0] == 'inline')::
|
||||
or stack[0] == 'inline'):
|
||||
if stack[0] == 'virtual':
|
||||
self.virtual = True
|
||||
stack = stack[1:]
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
|
||||
class Namespace(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkModule as module
|
||||
from realog import debug
|
||||
from . import module
|
||||
|
||||
access_list = ['private', 'protected', 'public']
|
||||
|
||||
@ -226,6 +226,8 @@ class Node():
|
||||
def get_doc_website_page(self):
|
||||
if self.module_link == None:
|
||||
return ""
|
||||
if self.module_link.get_website() == "":
|
||||
return ""
|
||||
ret = self.module_link.get_website()
|
||||
if ret[-1] != '/':
|
||||
ret += '/'
|
@ -4,7 +4,7 @@ import sys
|
||||
import re
|
||||
import copy
|
||||
|
||||
import monkTools as tools
|
||||
from . import tools
|
||||
|
||||
sys.path.append(tools.get_current_path(__file__) + "/ply/ply/")
|
||||
sys.path.append(tools.get_current_path(__file__) + "/codeBB/")
|
||||
@ -14,17 +14,17 @@ sys.path.append(tools.get_current_path(__file__) + "/codeHL/")
|
||||
import lex
|
||||
|
||||
import inspect
|
||||
import monkDebug as debug
|
||||
import monkClass as Class
|
||||
import monkNamespace as Namespace
|
||||
import monkStruct as Struct
|
||||
import monkUnion as Union
|
||||
import monkMethode as Methode
|
||||
import monkEnum as Enum
|
||||
import monkVariable as Variable
|
||||
import monkNode as Node
|
||||
import monkUsing as Using
|
||||
import monkTypedef as Typedef
|
||||
from realog import debug
|
||||
from . import monkClass as Class
|
||||
from . import monkNamespace as Namespace
|
||||
from . import monkStruct as Struct
|
||||
from . import monkUnion as Union
|
||||
from . import monkMethode as Methode
|
||||
from . import monkEnum as Enum
|
||||
from . import monkVariable as Variable
|
||||
from . import monkNode as Node
|
||||
from . import monkUsing as Using
|
||||
from . import monkTypedef as Typedef
|
||||
|
||||
tokens = [
|
||||
'NUMBER',
|
||||
@ -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:
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
|
||||
class Struct(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkType as Type
|
||||
import monkNode as node
|
||||
import monkModule as module
|
||||
from realog import debug
|
||||
from . import monkType as Type
|
||||
from . import monkNode as node
|
||||
from . import module
|
||||
import re
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
|
||||
class Typedef(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
|
||||
class Union(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkNode as Node
|
||||
import monkType as Type
|
||||
from realog import debug
|
||||
from . import monkNode as Node
|
||||
from . import monkType as Type
|
||||
|
||||
class Using(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
import monkDebug as debug
|
||||
import monkType as Type
|
||||
import monkNode as Node
|
||||
from realog import debug
|
||||
from . import monkType as Type
|
||||
from . import monkNode as Node
|
||||
|
||||
class Variable(Node.Node):
|
||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user