diff --git a/codeBB/BB_Code.py b/codeBB/BB_Code.py
index 349e43c..49c311e 100644
--- a/codeBB/BB_Code.py
+++ b/codeBB/BB_Code.py
@@ -16,11 +16,13 @@ import re
## @return Transformed string.
##
def transcode(value):
+ #value = re.sub(r'\[code(( |\t|\n|\r)+style=(.*))?\](.*?)\[/code\]',
+ value = re.sub(r'\[code(( |\t|\n|\r)+style=(.*?))?\](.*?)\[/code\]',
+ r'
\4
',
+ value,
+ flags=re.DOTALL)
- value = re.sub(r'\[code=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]',
- r'\2',
- value)
-
+ # TODO : remove the basic indentation of the element (to have a better display in the text tutorial ...
return value
diff --git a/codeBB/BB_IndentAndDot.py b/codeBB/BB_IndentAndDot.py
index ab2e3c7..a4de40b 100644
--- a/codeBB/BB_IndentAndDot.py
+++ b/codeBB/BB_IndentAndDot.py
@@ -47,13 +47,15 @@ def transcode(value):
value = re.sub(r'\n:',
r'\n:INDENT:',
value)
- p = re.compile('((\:INDENT\:(.*?)\n)*)')
+ p = re.compile('((\:INDENT\:(.*?)\n)*)',
+ flags=re.DOTALL)
value = p.sub(replace_wiki_identation,
value)
value = re.sub(r'\*\*(.*?)\n',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
return value
@@ -61,7 +63,7 @@ def transcode(value):
def replace_wiki_identation(match):
if match.group() == "":
return ""
- debug.info("plop: " + str(match.group()))
+ #debug.verbose("plop: " + str(match.group()))
value = ""
value += re.sub(r':INDENT:',
r'',
diff --git a/codeBB/BB_Link.py b/codeBB/BB_Link.py
index 1a63505..d3a8bc8 100644
--- a/codeBB/BB_Link.py
+++ b/codeBB/BB_Link.py
@@ -8,14 +8,46 @@ import re
##
## @brief Transcode:
## [http://votre_site.con] => http://votre_site.con
-## [http://votre_site.con | texte affiché] => texte affiché
-## [http://votre_site.con texte affiché] => texte affiché.
+## [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'\2',
+ value)
+
+ # direct link : [[http://plop.html]]
+ value = re.sub(r'\[\[http://(.*?)\]\]',
+ r'http://\1',
+ value)
+
+ # direct lib link : [lib[libname]]
+ value = re.sub(r'\[lib\[(.*?) \| (.*?)\]\]',
+ r'\2',
+ 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 = ""
+ value += re.sub(r':INDENT:',
+ r'',
+ match.group())
+ value += "
"
+ return transcode(value)
+"""
diff --git a/codeBB/BB_Text.py b/codeBB/BB_Text.py
index 02f5b03..fe0365a 100644
--- a/codeBB/BB_Text.py
+++ b/codeBB/BB_Text.py
@@ -24,55 +24,67 @@ import re
def transcode(value):
value = re.sub(r'\[b\](.*?)\[/b\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[i\](.*?)\[/i\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[u\](.*?)\[/u\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[sup\](.*?)\[/sup\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[sub\](.*?)\[/sub\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]',
r'\2',
- value)
+ value,
+ flags=re.DOTALL)
- value = re.sub(r'\[center\](.*?)\[/center\]',
+ value = re.sub(r'\[center\](.*)\[/center\]',
r'\1
',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[right\](.*?)\[/right\]',
r'\1
',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[left\](.*?)\[/left\]',
r'\1
',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[strike\](.*?)\[/strike\]',
r'\1',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[size=(.*?)\](.*?)\[/size\]',
r'\2',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'\[cadre\](.*?)\[/cadre\]',
r'',
- value)
+ value,
+ flags=re.DOTALL)
value = re.sub(r'____(.*?)\n',
r'
',
- value)
-
+ value,
+ flags=re.DOTALL)
return value
diff --git a/codeBB/BB_Title.py b/codeBB/BB_Title.py
index 3b1365e..b52362e 100644
--- a/codeBB/BB_Title.py
+++ b/codeBB/BB_Title.py
@@ -18,23 +18,23 @@ import re
def transcode(value):
value = re.sub(r'\n======(.*?)======',
- r'\1
',
+ r'\n\1
',
value)
value = re.sub(r'\n=====(.*?)=====',
- r'\1
',
+ r'\n\1
',
value)
value = re.sub(r'\n====(.*?)====',
- r'\1
',
+ r'\n\1
',
value)
value = re.sub(r'\n===(.*?)===',
- r'\1
',
+ r'\n\1
',
value)
value = re.sub(r'\n==(.*?)==',
- r'\1
',
+ r'\n\1
',
'\n' + value)
# todo : remove \n at the start of the file ...
diff --git a/codeBB/BB_comment.py b/codeBB/BB_comment.py
index 9e9fbda..4ae35e3 100644
--- a/codeBB/BB_comment.py
+++ b/codeBB/BB_comment.py
@@ -15,12 +15,13 @@ def transcode(value):
value = re.sub(r'\/\*(.*?)\*\/',
r'',
- value)
-
+ value,
+ flags=re.DOTALL)
+ """
value = re.sub(r'\/\/(.*?)\n',
r'',
value)
-
+ """
return value
diff --git a/codeBB/BB_lineReturn.py b/codeBB/BB_lineReturn.py
index b1c7036..a29c7b9 100644
--- a/codeBB/BB_lineReturn.py
+++ b/codeBB/BB_lineReturn.py
@@ -17,10 +17,6 @@ def transcode(value):
r'\n',
value)
- value = re.sub(r'\n\n\n',
- r'
',
- value)
-
value = re.sub(r'\n\n',
r'
',
value)
diff --git a/codeBB/codeBB.py b/codeBB/codeBB.py
index 6c8055f..2ea0834 100644
--- a/codeBB/codeBB.py
+++ b/codeBB/codeBB.py
@@ -24,7 +24,7 @@ def transcode(value):
value = BB_Title.transcode(value)
value = BB_Text.transcode(value)
value = BB_IndentAndDot.transcode(value)
- #value = BB_Link.transcode(value)
+ value = BB_Link.transcode(value)
value = BB_Image.transcode(value)
value = BB_Table.transcode(value)
value = BB_Code.transcode(value)
diff --git a/lutinDoc.py b/lutinDoc.py
index 13febac..5efa5ec 100644
--- a/lutinDoc.py
+++ b/lutinDoc.py
@@ -20,6 +20,7 @@ class doc:
def __init__(self, moduleName):
self.moduleName = moduleName
self.listDocFile = []
+ self.listTutorialFile = []
self.listClass = dict()
self.listEnum = dict()
self.listVariable = dict()
@@ -94,17 +95,33 @@ class doc:
# Import the module :
for filename in tmpList:
fileCompleteName = os.path.join(root, filename)
- debug.debug(" Find a doc file : '" + fileCompleteName + "'")
- self.add_file_doc(fileCompleteName)
+ tutorialPath = os.path.join(self.pathGlobalDoc, "tutorial/")
+ debug.verbose(" Find a doc file : '" + fileCompleteName + "'")
+ pathBase = fileCompleteName[len(self.pathGlobalDoc):len(fileCompleteName)-3]
+ if fileCompleteName[:len(tutorialPath)] == tutorialPath:
+ self.add_file_doc(fileCompleteName, pathBase)
+ else:
+ self.add_tutorial_doc(fileCompleteName, pathBase)
##
## @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_file_doc(self, filename):
+ def add_file_doc(self, filename, outPath):
debug.debug("adding file in documantation : '" + filename + "'");
- self.listDocFile.append(filename)
+ self.listDocFile.append([filename, outPath])
+
+ ##
+ ## @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_tutorial_doc(self, filename, outPath):
+ debug.debug("adding file in documantation : '" + filename + "'");
+ self.listTutorialFile.append([filename, outPath])
##
## @brief Add a file at the parsing system
diff --git a/lutinDocHtml.py b/lutinDocHtml.py
index 10c0458..4e951d7 100644
--- a/lutinDocHtml.py
+++ b/lutinDocHtml.py
@@ -443,8 +443,27 @@ def generate(myDoc, outFolder) :
file.close()
- for docInputName in myDoc.listDocFile :
- codeBB.transcode_file(docInputName, docInputName+".html")
+ for docInputName,outpath in myDoc.listDocFile :
+ debug.printElement("doc", myDoc.moduleName, "<==", docInputName)
+ outputFileName = outFolder + "/" + outpath.replace('/','_') +".html"
+ debug.debug("output file : " + outputFileName)
+ lutinTools.CreateDirectoryOfFile(outputFileName)
+ inData = lutinTools.FileReadData(docInputName)
+ if inData == "":
+ continue
+ outData = genericHeader + codeBB.transcode(inData) + genericFooter
+ lutinTools.FileWriteData(outputFileName, outData)
+
+ for docInputName,outpath in myDoc.listTutorialFile :
+ debug.printElement("tutorial", myDoc.moduleName, "<==", docInputName)
+ outputFileName = outFolder + "/" + outpath+".html"
+ debug.debug("output file : " + outputFileName)
+ lutinTools.CreateDirectoryOfFile(outputFileName)
+ inData = lutinTools.FileReadData(docInputName)
+ if inData == "":
+ continue
+ outData = genericHeader + codeBB.transcode(inData) + genericFooter
+ lutinTools.FileWriteData(outputFileName, outData)