From 7d217467dc265495236c087b11e369e3f4a8952c Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 27 Dec 2013 21:35:30 +0100 Subject: [PATCH] [DEV] generated code is now usable --- codeBB/BB_Text.py | 5 ++ codeHL/codeHLXML.py | 29 +++++++- monkHtml.py | 153 +++++++++++++++++++++++++++++++++-------- monkModule.py | 4 +- monkNode.py | 24 ++++++- theme/base.css | 20 ++++-- theme/menu.css | 121 +++++--------------------------- theme/menu_dynamic.css | 147 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 360 insertions(+), 143 deletions(-) create mode 100644 theme/menu_dynamic.css diff --git a/codeBB/BB_Text.py b/codeBB/BB_Text.py index a183f29..e2aa84f 100644 --- a/codeBB/BB_Text.py +++ b/codeBB/BB_Text.py @@ -83,6 +83,11 @@ def transcode(value): value, flags=re.DOTALL) + value = re.sub(r'\[note\](.*?)\[/note\]', + r'
Note:
\1
', + value, + flags=re.DOTALL) + value = re.sub(r'____(.*?)\n', r'
', value, diff --git a/codeHL/codeHLXML.py b/codeHL/codeHLXML.py index 6c8487b..263742f 100644 --- a/codeHL/codeHLXML.py +++ b/codeHL/codeHLXML.py @@ -4,6 +4,33 @@ import sys import monkTools import re +listRegExp = [ + [ r'<!\-\-!(.*?)\-\->', 'code-doxygen'], + [ r'<!\-\-(.*?)\-\->', 'code-comment'], + [ r'"((\\"|.)*?)"', 'code-text-quote'], + [ r"'(('|.)*?)'", 'code-text-quote'], + [ r'</[0-9a-zA-Z_]+|<[0-9a-zA-Z_]+|/>|>', + 'code-function-name'] +] def transcode(value): - return 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 += '' + outValue += result.group() + outValue += '' + + # change the input value + inValue = inValue[result.end():] + # Search again ... + result = re.search(reg1, inValue, re.DOTALL) + outValue += inValue + return outValue diff --git a/monkHtml.py b/monkHtml.py index b223efb..d46a55d 100644 --- a/monkHtml.py +++ b/monkHtml.py @@ -11,20 +11,27 @@ import monkNode as node def display_doxygen_param(comment, input, output): - data = "Parameter" + data = '' + data = '' + data += "Parameter" if input == True: data += " [input]" if output == True: data += " [output]" - data += ": " + data += ":" + data += '' #extract first element: val = comment.find(" ") var = comment[:val] endComment = comment[val:] + data += '' # TODO : Check if it exist in the parameter list ... - data += "" + var + " " + endComment - - data += "
" + data += "" + var + " " + data += '' + data += '' + data += codeBB.transcode(endComment) + data += '' + data += '\n' return data @@ -40,8 +47,8 @@ def parse_doxygen(data) : # nothing to do : Nomale case of the first \n None elif element[:6] == "brief ": - data2 += element[6:] - data2 += "
" + data2 += codeBB.transcode(element[6:]) + data2 += '
' for element in streams: if element[:1] == "\n" \ @@ -49,11 +56,12 @@ def parse_doxygen(data) : # nothing to do : Nomale case of the first \n None elif element[:5] == "note ": - data2 += "Notes: " - data2 += element[5:] - data2 += "
" + data2 += 'Note: ' + data2 += codeBB.transcode(element[5:]) + data2 += '
' data3 = '' + dataReturn = '' for element in streams: if element[:1] == "\n" \ or element[:2] == "\n\n": @@ -69,13 +77,22 @@ def parse_doxygen(data) : elif element[:6] == "param ": data3 += display_doxygen_param(element[6:], False, False) elif element[:7] == "return ": - data3 += "Return: " - data3 += element[7:] - data3 += "
" - if data3 != '': - data2 += "