From 5ea83bfddea9a0c93f65170b73d3be07f8a100e0 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Wed, 11 Dec 2013 01:18:15 +0100 Subject: [PATCH] [DEV] work on the menu of documentation --- lutinDocHtml.py | 226 ++++++++++++++++++++++++++++++++++++++++-------- theme/base.css | 4 +- theme/menu.css | 146 +++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+), 38 deletions(-) create mode 100644 theme/menu.css diff --git a/lutinDocHtml.py b/lutinDocHtml.py index 4e951d7..2c5ee40 100644 --- a/lutinDocHtml.py +++ b/lutinDocHtml.py @@ -5,6 +5,7 @@ import lutinTools import CppHeaderParser import re import codeBB +import collections global_class_link = { "std::string" : "http://www.cplusplus.com/reference/string/string/", @@ -244,9 +245,75 @@ def class_name_to_file_name(className): className = className.replace(" ", "") className += ".html" return className +""" + +""" + +def addElement(elementList, tree): + if elementList[0] in tree.keys(): + tree[elementList[0]] == addElement(elementList[1:], tree[elementList[0]]) + else : + tree[elementList[0]] == elementList[0] + if len(elementList) != 1: + tree[elementList[0]] == addElement(elementList[1:], tree[elementList[0]]) + return tree + +def recursively_default_dict(): + return collections.defaultdict(recursively_default_dict) + +def createTree(list): + output = [] + myTree = recursively_default_dict() + #myTree['a']['b'] = 'c' + for className in sorted(list) : + list = className.split("::") + if len(list)==1: + myTree[list[0]] == className + elif len(list)==2: + myTree[list[0]][list[1]] == className + elif len(list)==3: + myTree[list[0]][list[1]][list[2]] == className + elif len(list)==4: + myTree[list[0]][list[1]][list[2]][list[3]] == className + elif len(list)==5: + myTree[list[0]][list[1]][list[2]][list[3]][list[4]] == className + else: + myTree[list[0]][list[1]][list[2]][list[3]][list[4]][list[5]] == className + + #output.append(className.split("::")) + #myTree = addElement(className.split("::"), myTree) + #debug.info("plop" + str(myTree)) + return myTree + +def addSub(tree, filterSubNamespace=False): + return "" def generate(myDoc, outFolder) : lutinTools.CopyFile(lutinTools.GetCurrentPath(__file__)+"/theme/base.css", outFolder+"/base.css") + lutinTools.CopyFile(lutinTools.GetCurrentPath(__file__)+"/theme/menu.css", outFolder+"/menu.css") # create common header genericHeader = "\n" genericHeader += "\n" @@ -254,54 +321,116 @@ def generate(myDoc, outFolder) : genericHeader += " \n" genericHeader += " " + myDoc.moduleName + " Library\n" genericHeader += " \n" + genericHeader += " \n" genericHeader += "\n" genericHeader += "\n" genericHeader += "
\n" genericHeader += "
\n" genericHeader += "

" + myDoc.moduleName + " Library

\n" - #genericHeader += "
    \n" - baseNamespace = "" - for className in sorted(myDoc.listClass.iterkeys()) : - pos = className.find("::") - if pos >= 0: - namespace = className[:pos] - rest = className[pos+2:] - else: - namespace = "" - rest = className - if baseNamespace != namespace: - if baseNamespace != "": - genericHeader += "
\n" - genericHeader += "
  • " + namespace + "
  • \n" - genericHeader += "
      \n" - baseNamespace = namespace - - genericHeader += "
    • " + rest + "
    • \n" - - if baseNamespace != "": - genericHeader += "
    \n" + genericHeader += ' \n' + """ + genericHeader += '

    \n' + genericHeader += '
    \n' + genericHeader += "
    \n" genericHeader += " \n" genericHeader += "
    \n" @@ -348,19 +477,44 @@ def generate(myDoc, outFolder) : sizefunction = calsulateSizeFunction(function, sizefunction) sizeReturn = calsulateSizeReturn(function, sizeReturn) + file.write("

    Constructor and Destructor:

    \n") + file.write("
    \n");
    +		for function in localClass["methods"]["public"]:
    +			if    function['destructor'] \
    +			   or function['constructor'] :
    +				display_reduct_function(function, file, "+ ", sizeReturn, sizefunction, myDoc)
    +		for function in localClass["methods"]["protected"]:
    +			if    function['destructor'] \
    +			   or function['constructor'] :
    +				display_reduct_function(function, file, "# ", sizeReturn, sizefunction, myDoc)
    +		for function in localClass["methods"]["private"]:
    +			if    function['destructor'] \
    +			   or function['constructor'] :
    +				display_reduct_function(function, file, "- ", sizeReturn, sizefunction, myDoc)
    +		
    +		file.write("
    \n"); + file.write("

    Synopsis:

    \n") # display all functions : # TODO: ... file.write("
    \n");
     		for function in localClass["methods"]["public"]:
    -			display_reduct_function(function, file, "+ ", sizeReturn, sizefunction, myDoc)
    +			if     not function['destructor'] \
    +			   and not function['constructor'] :
    +				display_reduct_function(function, file, "+ ", sizeReturn, sizefunction, myDoc)
     		for function in localClass["methods"]["protected"]:
    -			display_reduct_function(function, file, "# ", sizeReturn, sizefunction, myDoc)
    +			if     not function['destructor'] \
    +			   and not function['constructor'] :
    +				display_reduct_function(function, file, "# ", sizeReturn, sizefunction, myDoc)
     		for function in localClass["methods"]["private"]:
    -			display_reduct_function(function, file, "- ", sizeReturn, sizefunction, myDoc)
    +			if     not function['destructor'] \
    +			   and not function['constructor'] :
    +				display_reduct_function(function, file, "- ", sizeReturn, sizefunction, myDoc)
     		file.write("
    \n"); file.write("\n") file.write("\n") + + heritage = myDoc.get_heritage_list(className) heritageDown = myDoc.get_down_heritage_list(className) if len(heritage) > 1 \ diff --git a/theme/base.css b/theme/base.css index 502c71e..22c4ee2 100644 --- a/theme/base.css +++ b/theme/base.css @@ -55,8 +55,8 @@ body { text-shadow: 0 1px 0 #ce4213; padding: 10px 20px 10px; margin-left: -20px; - overflow:scroll; - overflow-x:hidden; + //overflow:scroll; + //overflow-x:hidden; } /* .navbar ul { diff --git a/theme/menu.css b/theme/menu.css new file mode 100644 index 0000000..26ed389 --- /dev/null +++ b/theme/menu.css @@ -0,0 +1,146 @@ +/* CSS Document */ + +/*----------------MENU-----------------*/ +div#menu div{ + margin-top: 0px; + background: #6699FF; +} +/* permet l'affichage du haut du menu*/ +div#menu h2{ + color: #000000; + FONT-FAMILY: Arial; + FONT-SIZE: 9pt; + text-align:left; + margin: 0; + padding: 3px; + padding-left: 6px; + background: #1a62db; +} +div#menu h3{ + margin: 0; + padding: 6px; + background: #6699FF; +} + +div#menu a{ + color: #000000; + bgcolor=#6699FF; + FONT-FAMILY: Arial; + FONT-SIZE: 9pt; +} +div#menu li { + position: relative; + list-style:none; + margin:0px; + border-bottom: 1px solid #0008ab; +} +div#menu li.sousmenu { + background: url(sous_menu.gif) 95% 50% no-repeat; +} +div#menu li:hover { + background: #0008ab; +} +div#menu li.sousmenu:hover { + background: #0008ab; +} +div#menu ul ul { + position: absolute; + top: 0px; +} + +/*TAILLE PREMIERE COLONNE*/ +div#menu { + float: center; + width: 200px; + text-align:left; +} +div#menu ul { + margin: 0; + padding: 0; + width: 200px; + background: #6699FF; + border: 0px solid; +} +div#menu ul ul { + left: 199px; + display:none; + background: #FFFFFF; +} +div#menu li a { + display: block; + padding: 2px 0px 2px 4px; + text-decoration: none; + width: 191px; + border-left: 3px solid #6699FF; +} +div#menu form { + border-left: 8px solid #6699FF; + background: #6699FF; + FONT-FAMILY: Arial; + margin:0px; + FONT-SIZE: 8pt; +} +div#menu texte { + border-left: 8px solid #6699FF; + FONT-FAMILY: Arial; + FONT-SIZE: 9pt; + font-weight:bold; + border-bottom: 1px solid #6699FF; +} + +/*TAILLE DEUXIEME COLONE*/ + +div#menu ul.niveau1 ul { + left: 200px; + height: 500px; + border: 1px solid #0008ab; + background: #1a62db; + /* + overflow:scroll; + overflow-y:auto; + overflow-x:hidden; + */ +} +div#menu ul.niveau1 li { + background: #6699FF; +} +div#menu ul.niveau1 li.sousmenu:hover ul.niveau2 { + width:219px; + display:block; +} + + + +/*TAILLE TROISIEME COLONNE*/ +div#menu ul.niveau2 ul { + left: 219px; + height: 500px; +} +div#menu ul.niveau2 li a { + width: 200px; +} +div#menu ul.niveau2 li.sousmenu:hover ul.niveau3 { + width:10em; + display:block; +} + +/*TAILLE Quatrieme COLONNE*/ +div#menu ul.niveau3 ul { + left: 369px; + height: 500px; +} +div#menu ul.niveau3 li a { + width: 200px; +} +div#menu ul.niveau3 li.sousmenu:hover ul.niveau4 { + width:10em; + display:block; +} +/*TAILLE DEUXIEME COLONE BIS????*/ + +/*COULEUR DES BORDURES*/ +div#menu li a:hover { + border-left-color: #000ADE; + background: #6699FF; + font-weight:bold; +} \ No newline at end of file