mirror of https://github.com/Malphaet/vkyweb.git
Compare commits
6 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
a5903b0420 | |
|
|
6abcb48238 | |
|
|
12c30fd62d | |
|
|
3c88753611 | |
|
|
3d6763ab30 | |
|
|
32f8bea6d1 |
|
|
@ -1,9 +1,29 @@
|
|||
# -*- coding: utf_8 -*-
|
||||
|
||||
import os
|
||||
import os,hashlib
|
||||
|
||||
def container(pagetitle="#_pagetitle_#",websitename="#_websitename_#",menu="\{menu\}",page="\{page\}",langswitch="\{langswitch\}",depth=""):
|
||||
"Return the global appearance of the website"
|
||||
script="""<script>
|
||||
function setIframeHeight(id) {
|
||||
var ifrm = document.getElementById(id);
|
||||
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
|
||||
ifrm.style.visibility = 'hidden';
|
||||
ifrm.style.height = "10px"; // reset to minimal height ...
|
||||
// IE opt. for bing/msn needs a bit added or scrollbar appears
|
||||
ifrm.style.height = getDocHeight( doc ) + 42 + "px";
|
||||
ifrm.style.visibility = 'visible';
|
||||
ifrm.style.verticalAlign='top';
|
||||
}
|
||||
function getDocHeight(doc) {
|
||||
doc = doc || document;
|
||||
// stackoverflow.com/questions/1145850/
|
||||
var body = doc.body, html = doc.documentElement;
|
||||
var height = Math.max( body.scrollHeight, body.offsetHeight,
|
||||
html.clientHeight, html.scrollHeight, html.offsetHeight );
|
||||
return height;
|
||||
}
|
||||
</script>"""
|
||||
return """<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
|
@ -18,6 +38,7 @@ def container(pagetitle="#_pagetitle_#",websitename="#_websitename_#",menu="\{me
|
|||
<link href="{depth}assets/css/custom.css" rel="stylesheet" />
|
||||
<!-- GOOGLE FONTS-->
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
|
||||
{script}
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
|
@ -61,7 +82,7 @@ def container(pagetitle="#_pagetitle_#",websitename="#_websitename_#",menu="\{me
|
|||
<!-- CUSTOM SCRIPTS -->
|
||||
<script src="{depth}assets/js/custom.js"></script>
|
||||
</body>
|
||||
</html>""".format(MENU=menu,PAGE=page,websitename=websitename,pagetitle=pagetitle,depth=depth,langs="",langswitch=langswitch)
|
||||
</html>""".format(MENU=menu,PAGE=page,websitename=websitename,pagetitle=pagetitle,depth=depth,langs="",langswitch=langswitch,script=script)
|
||||
|
||||
|
||||
def menu(previous="",menulist="\{menulist\}",articles="#_articles_#",depth=""):
|
||||
|
|
@ -91,14 +112,14 @@ def content(content="\{content\}",title="\{title\}"):
|
|||
{content}
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</div></body>""".format(content=content,title=title)
|
||||
|
||||
def iframe(list_of_pages):
|
||||
iframes=""
|
||||
percent=round(100/len(list_of_pages))
|
||||
for page in list_of_pages:
|
||||
iframes+="<iframe src={} width='{}%' height='500px'>Iframes not supported</iframe>".format(page,percent)
|
||||
pageid=hashlib.sha224(page).hexdigest()
|
||||
iframes+="""<iframe src={} width='{}%' id='{}' onload='setIframeHeight(this.id);' style="height='600px'" frameborder='0'>Iframes not supported</iframe>""".format(page,percent,pageid)
|
||||
return iframes
|
||||
|
||||
def assets():
|
||||
|
|
|
|||
|
|
@ -7,32 +7,35 @@
|
|||
|
||||
100% To use For Personal And Commercial Use.
|
||||
IN EXCHANGE JUST GIVE US CREDITS AND TELL YOUR FRIENDS ABOUT US
|
||||
|
||||
|
||||
======================================================== */
|
||||
/*==============================================
|
||||
GENERAL STYLES
|
||||
GENERAL STYLES
|
||||
=============================================*/
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
width: 100%;
|
||||
margin-top:50px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#page-wrapper {
|
||||
padding: 15px 15px;
|
||||
min-height: 600px;
|
||||
vertical-align: top;
|
||||
background:#F3F3F3;
|
||||
|
||||
height: 100%;
|
||||
}
|
||||
#page-inner {
|
||||
width:100%;
|
||||
margin:10px 20px 10px 0px;
|
||||
background-color:#fff!important;
|
||||
padding:10px;
|
||||
min-height:1200px;
|
||||
min-height:100%;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
|
|
@ -48,7 +51,7 @@ text-transform: uppercase;
|
|||
padding-bottom:20px;
|
||||
}
|
||||
/*==============================================
|
||||
MENU STYLES
|
||||
MENU STYLES
|
||||
=============================================*/
|
||||
|
||||
|
||||
|
|
@ -102,13 +105,13 @@ color:#0000FF;
|
|||
}
|
||||
.sidebar-collapse .nav > li > a:hover,
|
||||
.sidebar-collapse .nav > li > a:focus {
|
||||
|
||||
|
||||
background:#F3F3F3;
|
||||
outline:0;
|
||||
}
|
||||
.nav-second-level > li:last-child > a:after,
|
||||
.nav-third-level > li:last-child > a:after {
|
||||
height:50%;
|
||||
height:100%;
|
||||
}
|
||||
.nav-third-level > li > a:after,
|
||||
.nav-third-level > li > a:before {
|
||||
|
|
@ -117,7 +120,7 @@ color:#0000FF;
|
|||
.navbar-side {
|
||||
border:none;
|
||||
background-color: #202020;
|
||||
|
||||
|
||||
}
|
||||
.navbar-inverse {
|
||||
background-color: #f3f3f3;
|
||||
|
|
@ -127,7 +130,7 @@ border-color: #D3D3D3;
|
|||
|
||||
.navbar-default {
|
||||
border:0px solid #DDDDDD;
|
||||
|
||||
|
||||
}
|
||||
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
|
||||
background-color: #B40101;
|
||||
|
|
@ -167,7 +170,7 @@ background-color: #8B7BFF;
|
|||
}
|
||||
|
||||
/*==============================================
|
||||
DASHBOARD STYLES
|
||||
DASHBOARD STYLES
|
||||
=============================================*/
|
||||
|
||||
.bg-color-blue {
|
||||
|
|
@ -184,7 +187,7 @@ border-top: 0px solid #fff;
|
|||
}
|
||||
|
||||
/*==============================================
|
||||
BOOTSTRAP STYLE CHANGES
|
||||
BOOTSTRAP STYLE CHANGES
|
||||
=============================================*/
|
||||
.nav-tabs > li > a {
|
||||
-webkit-border-radius: 0px 0px 0px 0px;
|
||||
|
|
@ -203,8 +206,8 @@ border-radius: 0px;
|
|||
-moz-border-radius: 0px;
|
||||
}
|
||||
.panel-heading {
|
||||
border-top-left-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
border-top-left-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
}
|
||||
.btn {
|
||||
border-radius: 0px;
|
||||
|
|
@ -217,18 +220,18 @@ border-radius: 0px;
|
|||
-moz-border-radius: 0px;
|
||||
}
|
||||
/*==============================================
|
||||
MEDIA QUERIES
|
||||
MEDIA QUERIES
|
||||
=============================================*/
|
||||
|
||||
|
||||
@media(min-width:768px) {
|
||||
#page-wrapper{
|
||||
margin: 0 0 0 260px;
|
||||
padding: 15px 30px;
|
||||
min-height: 1200px;
|
||||
|
||||
min-height: 100%;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.navbar-side {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
|
|
@ -236,9 +239,7 @@ border-radius: 0px;
|
|||
}
|
||||
|
||||
.navbar {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
38
test.py
38
test.py
|
|
@ -1,20 +1,45 @@
|
|||
# Copyleft (c) 2016 Cocobug All Rights Reserved.
|
||||
# -*- coding: utf_8 -*-
|
||||
|
||||
import sys
|
||||
import sys,os
|
||||
try:
|
||||
from blessings import Terminal
|
||||
except:
|
||||
print ("You need to have blessings installed to run the test")
|
||||
sys.exit()
|
||||
print ("Usage of blessings is recomended to run the test")
|
||||
class Nope(object):
|
||||
def __init__(self,*args,**kwargs):
|
||||
pass
|
||||
def __getattribute__(self,attr):
|
||||
return Nope()
|
||||
def __str__(self):
|
||||
return ""
|
||||
def __call__(self,*args,**kargs):
|
||||
return "".join(args)
|
||||
def __repr__(self):
|
||||
return ""
|
||||
|
||||
class T(object):
|
||||
def __init__(self,*args,**kwargs):
|
||||
pass
|
||||
def __getattribute__(self,attr):
|
||||
return Nope()
|
||||
Terminal=T
|
||||
#sys.exit()
|
||||
|
||||
try:
|
||||
from minitest import minitest
|
||||
except:
|
||||
print ("You need to have minitest installed to run the test")
|
||||
print ("the latest version of minitest should have been included with the vkyweb package")
|
||||
print (" the latest version of minitest should have been included with the vkyweb package")
|
||||
print (" you can download it manually at https://github.com/Malphaet/minitest")
|
||||
sys.exit()
|
||||
import types
|
||||
|
||||
try:
|
||||
import markdown
|
||||
except:
|
||||
print ("You need markdown installed to parse the files")
|
||||
sys.exit()
|
||||
from generator import *
|
||||
|
||||
term=Terminal()
|
||||
|
|
@ -355,12 +380,11 @@ class testDual(simple):
|
|||
self.addFailure(" (got {})".format(dual_select))
|
||||
|
||||
self.currentTest("dual:iframe")
|
||||
if (dual.iframe(["page1.html","page2.html"])!="""<iframe src=page1.html width='50.0%' height='500px'>Iframes not supported</iframe><iframe src=page2.html width='50.0%' height='500px'>Iframes not supported</iframe>"""):
|
||||
self.addFailure("iframes generation incorrect")
|
||||
if (dual.iframe(["page1.html","page2.html"])!="""<iframe src=page1.html width='50.0%' id='a92a4d23fa8021c72774d45b474fbe034fd714cb21e422c499eb7f54' onload='setIframeHeight(this.id);' style="height='600px'" frameborder='0'>Iframes not supported</iframe><iframe src=page2.html width='50.0%' id='2eb2decff6c3e2f20da50e42064669b085057f981e316be8c1890afb' onload='setIframeHeight(this.id);' style="height='600px'" frameborder='0'>Iframes not supported</iframe>"""):
|
||||
self.addFailure("iframes generation incorrect (got {})".format(dual.iframe(["page1.html","page2.html"])))
|
||||
else:
|
||||
self.addSuccess()
|
||||
|
||||
import os
|
||||
self.currentTest("dual:pathAssets")
|
||||
if os.path.exists(dual.assets()):
|
||||
self.addSuccess()
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@ def iFrameFromNode(node):
|
|||
def gen_all_nodes_menu(tree,lang,previous_node,depth):
|
||||
#previous_node=tree.parent_node #maybe need to be sent via parameter, nonetheless very secondary
|
||||
# TODO: look for index in all nodes, create it if needed
|
||||
|
||||
for current_node in tree.get_next_nodes(lang):
|
||||
if (os.path.basename(current_node.name)[0]!="_"): #Likely add a visible: true/false tag in the future
|
||||
shortName=os.path.basename(current_node.name)
|
||||
|
||||
if (shortName[0]!="_"): #Likely add a visible: true/false tag in the future
|
||||
filename=htmlNamer[lang](current_node.name)
|
||||
if args.verbose:
|
||||
print("Generating {} menus".format(filename))
|
||||
|
|
@ -40,7 +43,7 @@ def gen_all_nodes_menu(tree,lang,previous_node,depth):
|
|||
|
||||
list_of_lang=[]
|
||||
for l in args.l:
|
||||
list_of_lang.append((l,htmlNamer[l](os.path.basename(current_node.name)),tree.get_variable(l,lang).capitalize()))
|
||||
list_of_lang.append((l,htmlNamer[l](shortName),tree.get_variable(l,lang).capitalize()))
|
||||
|
||||
langswitch=model.makeLangSwitch(choosen_model,list_of_lang,lang)
|
||||
menu=model.makeContainer(choosen_model,website,current_node,previous_node,lang,htmlNamer[lang],depth,langswitch)
|
||||
|
|
@ -48,6 +51,7 @@ def gen_all_nodes_menu(tree,lang,previous_node,depth):
|
|||
page=model.makePage(choosen_model,website,lang,menu,frames,depth,langswitch)
|
||||
|
||||
saveData(save,page)
|
||||
|
||||
depth="../"+depth
|
||||
for new in tree.get_next_subtree(lang):
|
||||
previous_node=new
|
||||
|
|
|
|||
Loading…
Reference in New Issue