diff --git a/codeBB/BB_Code.py b/codeBB/BB_Code.py
new file mode 100644
index 0000000..349e43c
--- /dev/null
+++ b/codeBB/BB_Code.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode balise :
+## [code language=cpp]
+## int main(void) {
+## return 0;
+## }
+## [/code]
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ value = re.sub(r'\[code=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]',
+ r'\2',
+ value)
+
+ return value
+
+
diff --git a/codeBB/BB_Image.py b/codeBB/BB_Image.py
new file mode 100644
index 0000000..7428cfb
--- /dev/null
+++ b/codeBB/BB_Image.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+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
+
+
diff --git a/codeBB/BB_IndentAndDot.py b/codeBB/BB_IndentAndDot.py
new file mode 100644
index 0000000..ab2e3c7
--- /dev/null
+++ b/codeBB/BB_IndentAndDot.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode
+## commencez les ligne par ":" comme:
+## : 1
+## : 2
+## ::2.1
+## ::2.2
+## :::2.2.1
+## ::::2.2.1.1
+## :::::2.2.1.1.1
+## ::2.3
+## :3
+## resultat:
+##
+## 1
+## 2
+## 2.1
+## 2.2
+## 2.2.1
+## 2.2.1.1
+## 2.3
+## 3
+##
+## note: lorsque vous sautez une ligne, la liste sarraite et en recommence une autre...
+##
+## Il est possible de mettre des ":" sans ligne appres ce qui genere une ligne vide..
+##
+## AND DOT
+## **Ma ligne2 star consecutives engendrent des points quelque soit la position dans la ligne...
+##
+## Resultat:
+##
+## * premiere ligne
+## * deusieme ligne
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ value = re.sub(r'\n:',
+ r'\n:INDENT:',
+ value)
+ p = re.compile('((\:INDENT\:(.*?)\n)*)')
+ value = p.sub(replace_wiki_identation,
+ value)
+
+ value = re.sub(r'\*\*(.*?)\n',
+ r'
\1',
+ value)
+
+ return value
+
+
+def replace_wiki_identation(match):
+ if match.group() == "":
+ return ""
+ debug.info("plop: " + str(match.group()))
+ value = ""
+ value += re.sub(r':INDENT:',
+ r'',
+ match.group())
+ value += "
"
+ return transcode(value)
diff --git a/codeBB/BB_Link.py b/codeBB/BB_Link.py
new file mode 100644
index 0000000..1a63505
--- /dev/null
+++ b/codeBB/BB_Link.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+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é.
+##
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ return value
+
+
diff --git a/codeBB/BB_Specification.py b/codeBB/BB_Specification.py
new file mode 100644
index 0000000..dcb6a61
--- /dev/null
+++ b/codeBB/BB_Specification.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode thales specification ...
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ return value
+
+
diff --git a/codeBB/BB_Table.py b/codeBB/BB_Table.py
new file mode 100644
index 0000000..97bb348
--- /dev/null
+++ b/codeBB/BB_Table.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+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
+
+
diff --git a/codeBB/BB_Text.py b/codeBB/BB_Text.py
new file mode 100644
index 0000000..02f5b03
--- /dev/null
+++ b/codeBB/BB_Text.py
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode .
+## [b]texte ici[/b]
+## [i]texte ici[/i]
+## [u]texte ici[/u]
+## [strike]texte ici[/strike]
+## [color=olive]texte ici[/color]
+## [color=#456FF33F]texte ici[/color]
+## Left : [left]texte ici[/left]
+## Center : [center]texte ici[/center]
+## Right : [right]texte ici[/right]
+## [size=22]sdfgsdfgsdgsfd[/size]
+## [cadre]mettre les code ici[/cadre]
+## @param[in] string String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+ value = re.sub(r'\[b\](.*?)\[/b\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[i\](.*?)\[/i\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[u\](.*?)\[/u\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[sup\](.*?)\[/sup\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[sub\](.*?)\[/sub\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[color=(\#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]',
+ r'\2',
+ value)
+
+ value = re.sub(r'\[center\](.*?)\[/center\]',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\[right\](.*?)\[/right\]',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\[left\](.*?)\[/left\]',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\[strike\](.*?)\[/strike\]',
+ r'\1',
+ value)
+
+ value = re.sub(r'\[size=(.*?)\](.*?)\[/size\]',
+ r'\2',
+ value)
+
+ value = re.sub(r'\[cadre\](.*?)\[/cadre\]',
+ r'',
+ value)
+
+ value = re.sub(r'____(.*?)\n',
+ r'
',
+ value)
+
+
+ return value
diff --git a/codeBB/BB_Title.py b/codeBB/BB_Title.py
new file mode 100644
index 0000000..3b1365e
--- /dev/null
+++ b/codeBB/BB_Title.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode .
+## ==Title 1==
+## ===Title 2===
+## ====Title 3====
+## =====Title 4=====
+## ======Title 5======
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ value = re.sub(r'\n======(.*?)======',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\n=====(.*?)=====',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\n====(.*?)====',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\n===(.*?)===',
+ r'\1
',
+ value)
+
+ value = re.sub(r'\n==(.*?)==',
+ r'\1
',
+ '\n' + value)
+ # todo : remove \n at the start of the file ...
+
+ return value
+
+
diff --git a/codeBB/BB_comment.py b/codeBB/BB_comment.py
new file mode 100644
index 0000000..9e9fbda
--- /dev/null
+++ b/codeBB/BB_comment.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode balise:
+## /* ... */
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ value = re.sub(r'\/\*(.*?)\*\/',
+ r'',
+ value)
+
+ value = re.sub(r'\/\/(.*?)\n',
+ r'',
+ value)
+
+ return value
+
+
diff --git a/codeBB/BB_lineReturn.py b/codeBB/BB_lineReturn.py
new file mode 100644
index 0000000..b1c7036
--- /dev/null
+++ b/codeBB/BB_lineReturn.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import re
+
+
+##
+## @brief Transcode balise:
+## \n\n ==>
+## @param[in] value String to transform.
+## @return Transformed string.
+##
+def transcode(value):
+
+ value = re.sub(r'\r\n',
+ r'\n',
+ value)
+
+ value = re.sub(r'\n\n\n',
+ r'
',
+ value)
+
+ value = re.sub(r'\n\n',
+ r'
',
+ value)
+
+ value = re.sub(r'
',
+ r'
\n',
+ value)
+
+ return value
+
+
diff --git a/codeBB/codeBB.py b/codeBB/codeBB.py
new file mode 100644
index 0000000..6c8055f
--- /dev/null
+++ b/codeBB/codeBB.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
+import BB_Title
+import BB_Text
+import BB_IndentAndDot
+import BB_Link
+import BB_Image
+import BB_Table
+
+import BB_comment
+import BB_lineReturn
+import BB_Code
+import BB_Specification
+
+##
+## @brief Transcode input data in the corect format.
+## @param[in] string String to transform.
+## @return Transformed string.
+##
+def transcode(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)
+ return value
+
+##
+## @brief transcode a BBcode file in a html file
+## @return True if the file is transformed
+##
+def transcode_file(inputFileName, outputFileName):
+ inData = lutinTools.FileReadData(inputFileName)
+ if inData == "":
+ return False
+ outData = transcode(inData)
+ debug.warning(" out: " + outputFileName)
+ lutinTools.FileWriteData(outputFileName, outData)
+ return True
+
+
diff --git a/codeHL/codeHL.py b/codeHL/codeHL.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHL.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLBBcode.py b/codeHL/codeHLBBcode.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLBBcode.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLJava.py b/codeHL/codeHLJava.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLJava.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLPython.py b/codeHL/codeHLPython.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLPython.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLXML.py b/codeHL/codeHLXML.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLXML.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLcpp.py b/codeHL/codeHLcpp.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLcpp.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/codeHL/codeHLjson.py b/codeHL/codeHLjson.py
new file mode 100644
index 0000000..6184971
--- /dev/null
+++ b/codeHL/codeHLjson.py
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+import lutinDebug as debug
+import sys
+import lutinTools
\ No newline at end of file
diff --git a/lutinDoc.py b/lutinDoc.py
index 952bc3c..13febac 100644
--- a/lutinDoc.py
+++ b/lutinDoc.py
@@ -5,6 +5,7 @@ import lutinTools
# TODO : Add try of generic input ...
sys.path.append(lutinTools.GetCurrentPath(__file__) + "/ply/ply/")
sys.path.append(lutinTools.GetCurrentPath(__file__) + "/cppParser/CppHeaderParser/")
+sys.path.append(lutinTools.GetCurrentPath(__file__) + "/codeBB/")
import CppHeaderParser
import lutinDocHtml
import lutinDocMd
@@ -18,6 +19,7 @@ import fnmatch
class doc:
def __init__(self, moduleName):
self.moduleName = moduleName
+ self.listDocFile = []
self.listClass = dict()
self.listEnum = dict()
self.listVariable = dict()
@@ -26,6 +28,7 @@ class doc:
self.target = None
self.webSite = ""
self.pathParsing = ""
+ self.pathGlobalDoc = ""
self.externalLink = []
self.title = moduleName + " Library"
self.styleHtml = ""
@@ -44,6 +47,13 @@ class doc:
def set_path(self, path):
self.pathParsing = path
+ ##
+ ## @brief set the glabal documentation parsing folder
+ ## @param[in] path New path to parse
+ ##
+ def set_path_general_doc(self, path):
+ self.pathGlobalDoc = path
+
##
## @brief List of validate external library link (disable otherwise)
## @param[in] availlable List of all module link availlable
@@ -65,22 +75,39 @@ class doc:
def set_html_css(self, cssFile):
self.styleHtml = cssFile
-
##
## @brief Create the module documentation:
## @param[in,out] target target that request generation of the documentation
##
def doc_parse_code(self):
- for root, dirnames, filenames in os.walk(self.pathParsing):
- tmpList = fnmatch.filter(filenames, "*.h")
- # Import the module :
- for filename in tmpList:
- fileCompleteName = os.path.join(root, filename)
- debug.debug(" Find a file : '" + fileCompleteName + "'")
- self.add_file(fileCompleteName)
+ if self.pathParsing != "":
+ for root, dirnames, filenames in os.walk(self.pathParsing):
+ tmpList = fnmatch.filter(filenames, "*.h")
+ # Import the module :
+ for filename in tmpList:
+ fileCompleteName = os.path.join(root, filename)
+ debug.debug(" Find a file : '" + fileCompleteName + "'")
+ self.add_file(fileCompleteName)
+ if self.pathGlobalDoc != "":
+ for root, dirnames, filenames in os.walk(self.pathGlobalDoc):
+ tmpList = fnmatch.filter(filenames, "*.bb")
+ # 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)
##
- ## @brief Add a File at the parsing system
+ ## @brief Add a documentation file at the parsing system
+ ## @param[in] filename File To add at the parsing element system.
+ ## @return True if no error occured, False otherwise
+ ##
+ def add_file_doc(self, filename):
+ debug.debug("adding file in documantation : '" + filename + "'");
+ self.listDocFile.append(filename)
+
+ ##
+ ## @brief Add a file at the parsing system
## @param[in] filename File To add at the parsing element system.
## @return True if no error occured, False otherwise
##
diff --git a/lutinDocHtml.py b/lutinDocHtml.py
index 5b3b794..10c0458 100644
--- a/lutinDocHtml.py
+++ b/lutinDocHtml.py
@@ -4,6 +4,7 @@ import sys
import lutinTools
import CppHeaderParser
import re
+import codeBB
global_class_link = {
"std::string" : "http://www.cplusplus.com/reference/string/string/",
@@ -251,13 +252,13 @@ def generate(myDoc, outFolder) :
genericHeader += "\n"
genericHeader += "\n"
genericHeader += " \n"
- genericHeader += " " + myDoc.moduleName+ " Library\n"
+ genericHeader += " " + myDoc.moduleName + " Library\n"
genericHeader += " \n"
genericHeader += "\n"
genericHeader += "\n"
genericHeader += " \n"
genericHeader += "
\n"
- genericHeader += "
" + myDoc.moduleName+ " Library
\n"
+ genericHeader += "
" + myDoc.moduleName + " Library
\n"
#genericHeader += "
\n"
baseNamespace = ""
for className in sorted(myDoc.listClass.iterkeys()) :
@@ -309,6 +310,16 @@ def generate(myDoc, outFolder) :
genericFooter += "\n"
genericFooter += "\n"
+ # create index.hml :
+ file = open(outFolder + "/index.html", "w")
+ file.write(genericHeader)
+ file.write("" + myDoc.moduleName + "
");
+ file.write("
");
+ file.write("TODO : Main page ...");
+ file.write("
");
+ file.write("
");
+ file.write(genericFooter)
+ file.close();
for className in sorted(myDoc.listClass.iterkeys()) :
localClass = myDoc.listClass[className]
@@ -432,6 +443,8 @@ def generate(myDoc, outFolder) :
file.close()
+ for docInputName in myDoc.listDocFile :
+ codeBB.transcode_file(docInputName, docInputName+".html")
diff --git a/lutinTools.py b/lutinTools.py
index d693d33..16d390a 100644
--- a/lutinTools.py
+++ b/lutinTools.py
@@ -49,6 +49,11 @@ def FileReadData(path):
file.close()
return data_file
+def FileWriteData(path, data):
+ file = open(path, "w")
+ file.write(data)
+ file.close()
+
def ListToStr(list):
if type(list) == type(str()):
return list + " "