diff options
author | neodarz <neodarz@neodarz.net> | 2017-05-06 22:57:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2017-05-06 22:57:34 +0200 |
commit | e289e8a22f2767e217fd793789892bec4f56effe (patch) | |
tree | 721e4702a59221d437f6f16cfcbb9b7ca8f7b866 | |
parent | 0ebd987d74cd494ed49cc9590269ea57da2a4bf6 (diff) | |
download | my_new_personal_website-e289e8a22f2767e217fd793789892bec4f56effe.tar.xz my_new_personal_website-e289e8a22f2767e217fd793789892bec4f56effe.zip |
Add new right submenu
Diffstat (limited to '')
-rwxr-xr-x | pyblog | 51 | ||||
-rw-r--r-- | source/css/theme.css | 134 | ||||
-rw-r--r-- | source/website/Documents/stage-1.md | 8 | ||||
-rw-r--r-- | source/website/Documents/stage-2.md | 11 | ||||
-rw-r--r-- | source/website/bts-sio.md | 9 |
5 files changed, 149 insertions, 64 deletions
@@ -296,7 +296,7 @@ def generate_menu(): fd, tmppath = tempfile.mkstemp() os.close(fd) - # Get the list of all html file in the build folder + # Put in a list the pages where the menu will be written html_fileList = [] for root, dirs, files in os.walk(BUILDDIR): for name in files: @@ -306,13 +306,17 @@ def generate_menu(): except IndexError: html_fileList.append(name) - # Generate the a string who contain a list of file in website folder + # Generate the string who contain the links of the menu htmly_website_page = "<ul>" for name in os.listdir(os.path.join(BUILDDIR, "website")): - htmly_website_page += "<a href='/website/"+name+"' class='lia'><li><span class='left-lia'></span><span class='center-lia'>"+name.split('.html')[0]+"</span><span class='right-lia'></span></li></a>" + if name != "Documents": + htmly_website_page += "<a href='/website/"+name+"' class='lia'><li><span class='left-lia'></span><span class='center-lia'>"+name.split('.html')[0]+"</span><span class='right-lia'></span></li></a>" htmly_website_page += "</ul>" - # Write the menu in file, in place of the <generated_menu> + + print(htmly_website_page) + + # Writing the menu in all pages contained in the variable in place of the -- generate menu here -- for html_file in html_fileList: with open(tmppath, 'w', encoding='utf-8') as tmpfile: if os.path.exists("build/"+html_file): @@ -324,6 +328,44 @@ def generate_menu(): os.remove(tmppath) +def generate_submenu(): + """Generate submenu.""" + + sys.stderr.write("generating submenu\n") + + fd, tmppath = tempfile.mkstemp() + os.close(fd) + + # Put in a list the pages where the menu will be written + documents_fileList = [] + documents_fileList.append("/website/bts-sio.html") + for root, dirs, files in os.walk(BUILDDIR+"/website/Documents"): + for name in files: + if name.endswith(".html"): + try: + documents_fileList.append(os.path.join(root.split('build')[1], name)) + except IndexError: + documents_fileList.append(name) + + # Generate the string who contain the links of the menu + htmly_website_page = "<ul>" + htmly_website_page += "<a href='/website/bts-sio.html' class='sublia'><li><span class='subleft-lia'></span><span class='subcenter-lia'>bts-sio</span><span class='subright-lia'></span></li></a>" + for name in os.listdir(os.path.join(BUILDDIR, "website/Documents")): + htmly_website_page += "<a href='/website/Documents/"+name+"' class='sublia'><li><span class='subleft-lia'></span><span class='subcenter-lia'>"+name.split('.html')[0]+"</span><span class='subright-lia'></span></li></a>" + htmly_website_page += "</ul>" + + # Writing the menu in all pages contained in the variable in place of the -- generate submenu here -- + for document_file in documents_fileList: + with open(tmppath, 'w', encoding='utf-8') as tmpfile: + if os.path.exists("build"+document_file): + with open("build"+document_file, 'r', encoding='utf-8') as indexmd: + lines = indexmd.readlines() + with open("build"+document_file, 'w', encoding='utf-8') as indexmd: + for line in lines: + indexmd.write(re.sub(r'-- generate submenu here --', htmly_website_page, line)) + + os.remove(tmppath) + def generate_blog_list(feed): """"Generate blog list """ @@ -843,6 +885,7 @@ def generate_index_and_feed(): generate_index(feed) generate_menu() + generate_submenu() generate_blog_list(feed) generate_notes_list() rewrite_title() diff --git a/source/css/theme.css b/source/css/theme.css index ca4fe40b..ae2a5179 100644 --- a/source/css/theme.css +++ b/source/css/theme.css @@ -60,6 +60,15 @@ only screen and ( min-resolution: 1.25dppx) { color: red; } +li { + list-style: none; +} + +ul li:before { + content: "\25b6 \00a0"; +} + +/* Menu design */ .nav { position: fixed; left: 2.5%; @@ -68,116 +77,127 @@ only screen and ( min-resolution: 1.25dppx) { text-align: center; } -.nav-icon { - display: block; - margin: 2px auto; - width: 100px; - height: 100px; - border-radius: 50%; - background: #ddd; - line-height: 100px; - text-align: center; - text-decoration: none; - font-size: 0; +.lia li:before { + list-style: none; + content: "" !important; } -.nav-icon:before { - content: "ZW"; - display: inline-block; - position: relative; - left: 2px; - font-family: "monospace", - "helvetica", Arial, sans-serif; - font-size: 35px; - font-weight: normal; - letter-spacing: 2px; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: #fff; - transform: scale(1,0.95); - -webkit-transform: scale(1,0.95); - -moz-transform: scale(1,0.95); - -ms-transform: scale(1,0.95); - -o-transform: scale(1,0.95); +.nav li { + list-style: none; } -.nav-title { - font-size: 17px; - font-weight: bold; - margin: 2px 0 1px 0; - text-decoration: none; +.nav li a { + text-decoration: none; } -.nav-title:before { - content: "Why ?"; + +.left-lia { + float: left; } -.nav-author { - font-size: 13px; - text-decoration: none; +.left-lia::after { + content: "█▓▒░"; } -.nav-author:before { - content: "by neodarz"; +.right-lia { + float: right; } -li { - list-style: none; +.right-lia::after { + content: "░▒▓█"; } -ul li:before { - content: "\25b6 \00a0"; +.lia { + text-decoration: none; } -.lia li:before { +.lia-border { + border: 1px solid white; +} + +.lia-border ul { + padding: 0px; + margin: 0; +} + +.lia-border hr { + background-color: white; + margin: 0; + padding: 0; +} + +.lia:hover li{ + background-color: white; + color: black; +} + +/* subMenu design */ +.subnav { + position: fixed; + right: 2.5%; + height: 150px; + width: 200px; + text-align: center; +} + +.sublia li:before { list-style: none; content: "" !important; } -.nav li { +.subnav li { list-style: none; } -.nav li a { +.subnav li a { text-decoration: none; } -.left-lia { +.subleft-lia { float: left; } -.left-lia::after { +.subleft-lia::after { content: "█▓▒░"; } -.right-lia { +.subright-lia { float: right; } -.right-lia::after { +.subright-lia::after { content: "░▒▓█"; } -.lia { +.sublia { text-decoration: none; } -.lia-border { +.sublia-border { border: 1px solid white; } -.lia-border ul { +.sublia-border ul { padding: 0px; margin: 0; } -.lia-border hr { +.sublia-border hr { background-color: white; margin: 0; padding: 0; } -.lia:hover li{ +.sublia-border pre code ul, .sublia-border pre code, .sublia-border pre { + width: 100% !important; + margin: 0 !important; + padding: 0 !important; + font-family: monospace,monospace !important; + font-size: 12px !important; + white-space: normal; +} + +.sublia:hover li{ background-color: white; color: black; } diff --git a/source/website/Documents/stage-1.md b/source/website/Documents/stage-1.md index 7d1c39e0..985d68a9 100644 --- a/source/website/Documents/stage-1.md +++ b/source/website/Documents/stage-1.md @@ -1,5 +1,11 @@ +<nav class="subnav"> + <div class="sublia-border"> + -- generate submenu here -- + </div> +</nav> + --- -title: 'stage-1' +title: 'Stage année 1' --- Stage 1 !!!! diff --git a/source/website/Documents/stage-2.md b/source/website/Documents/stage-2.md new file mode 100644 index 00000000..44728eaa --- /dev/null +++ b/source/website/Documents/stage-2.md @@ -0,0 +1,11 @@ +<nav class="subnav"> + <div class="sublia-border"> + -- generate submenu here -- + </div> +</nav> + +--- +title: 'Stage année 2' +--- + +Stage 2 !!!! diff --git a/source/website/bts-sio.md b/source/website/bts-sio.md index b087cf46..3028693a 100644 --- a/source/website/bts-sio.md +++ b/source/website/bts-sio.md @@ -1,8 +1,13 @@ -<li>--- +<nav class="subnav"> + <div class="sublia-border"> + -- generate submenu here -- + </div> +</nav> + +--- title: "Bts SIO" --- - # Tableau de compétences <table> |