Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["-n", "1"]
}
]
}
Binary file added Compiler/__pycache__/WebCompiler.cpython-310.pyc
Binary file not shown.
Binary file added Compiler/__pycache__/WebCompiler.cpython-38.pyc
Binary file not shown.
Binary file added Compiler/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added Compiler/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions Compiler/classes/Compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ def __init__(self, dsl_mapping_file_path):
self.root = Node("body", None, self.content_holder)

def compile(self, input_file_path, output_file_path, rendering_function=None):
print('input_file_path ',input_file_path)
dsl_file = open(input_file_path)
current_parent = self.root

print(dsl_file)

i = 0
for token in dsl_file:
token = token.replace(" ", "").replace('\t','').replace("\n", "")
Expand All @@ -42,8 +46,13 @@ def compile(self, input_file_path, output_file_path, rendering_function=None):
element = Node(t, current_parent, self.content_holder, getID(i))
current_parent.add_child(element)
i += 1


output_html = '<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <meta name="theme-color" content="#000000" />\n <!-- Bootstrap core CSS -->\n <link href="../compiled-bootstrap/css/bootstrap.css" rel="stylesheet">\n \n <!-- Custom styles for this template -->\n <link href="../effect.css" rel="stylesheet">\n <link href="../page.css" rel="stylesheet">\n\n <title>Generated Page</title>\n </head>\n <body>\n'

output_html += self.root.render(self.dsl_mapping, rendering_function=rendering_function)


output_html += '\n\t<script>\n\t\tvar x = document.getElementsByClassName("list-group-item");\n\t\tfor(var i = 0; i < x.length; i++) x[i].style.width = (parseInt(x[i].parentElement.offsetWidth) - 24) + "px";\n\t\tvar z = document.getElementsByClassName("card-header");\n\t\tfor(var i = 0; i < z.length; i++) z[i].style.width = (parseInt(z[i].parentElement.offsetWidth) - 24) + "px";\n\t</script>\n\n <script src="../jquery/jquery.min.js"></script>\n <script src="../compiled-bootstrap/js/bootstrap.bundle.min.js"></script>\n </body>\n</html>\n'
with open(output_file_path, 'w') as output_file:
output_file.write(output_html)
12 changes: 11 additions & 1 deletion Compiler/classes/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,21 @@ def show(self):
child.show()

def render(self, mapping, rendering_function=None):


print(str(self.key))

if mapping[self.key] :
print(str(self.key))
# return ''

content = ""
for child in self.children:
content += child.render(mapping, rendering_function)

value = mapping[self.key]

value = mapping[self.key]


value = value.replace('$', 'id="'+self.id+'"')
value = value.replace('~', self.id)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added Compiler/classes/__pycache__/Node.cpython-310.pyc
Binary file not shown.
Binary file added Compiler/classes/__pycache__/Node.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added Compiler/classes/__pycache__/Utils.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added Compiler/classes/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion Generator/DSLNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def render(self, file, level):
file.write(self.key + '\n')

file.seek(0, os.SEEK_END)
file.seek(file.tell() - 2, os.SEEK_SET) # On Ubuntu: file.tell() - 1
file.seek(file.tell() - 1, os.SEEK_SET) # On Ubuntu: file.tell() - 1
file.write('{\n')
for child in self.children:
child.render(file, level + 1)
Expand Down
Binary file added Generator/__pycache__/DSLNode.cpython-310.pyc
Binary file not shown.
Binary file added Generator/__pycache__/DSLNode.cpython-38.pyc
Binary file not shown.
Binary file added Generator/__pycache__/DSL_GRAPH.cpython-310.pyc
Binary file not shown.
Binary file added Generator/__pycache__/DSL_GRAPH.cpython-38.pyc
Binary file not shown.
Binary file added Generator/__pycache__/Generator.cpython-310.pyc
Binary file not shown.
Binary file added Generator/__pycache__/Generator.cpython-38.pyc
Binary file not shown.
Binary file added Generator/__pycache__/Rules.cpython-310.pyc
Binary file not shown.
Binary file added Generator/__pycache__/Rules.cpython-38.pyc
Binary file not shown.
Binary file added Generator/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added Generator/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion HTMLRenderer/Render.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

class WebDriver:
def __init__(self, w=1200, h=1200):
self.driver = webdriver.PhantomJS()
# self.driver = webdriver.PhantomJS()
self.driver = webdriver.Chrome()
self.driver.set_window_size(w, h)

def saveScreenshot(self, filePath, fileName, savePath):
Expand Down
Binary file added HTMLRenderer/__pycache__/Render.cpython-310.pyc
Binary file not shown.
Binary file added HTMLRenderer/__pycache__/Render.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Sketcher/__pycache__/Functions.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file added Sketcher/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions _Output_Pages/DSL/page_00000_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
container{
jumbotron{
text
text
button
button
}
}
38 changes: 38 additions & 0 deletions _Output_Pages/DSL/page_00001_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
navbar{
link-list
link-list
link-list
link-list
}
container{
jumbotron{
text
text
large-title
text
}
row{
div-3{
list-group{
list-group-item
list-group-item
list-group-item
}
large-title
}
div-6{
img
card-div{
card-header
card-body{
text
button
}
}
}
div-3{
button
text
}
}
}
35 changes: 35 additions & 0 deletions _Output_Pages/DSL/page_00002_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
navbar{
link-list
link-list
}
container{
row{
div-12{
carousel
button
}
}
row{
div-3{
list-group{
list-group-item
list-group-item
list-group-item
list-group-item
list-group-item
}
card-div{
card-header
img
card-body{
text
}
}
}
div-9{
card-div{
}
large-title
}
}
}
36 changes: 36 additions & 0 deletions _Output_Pages/DSL/page_00003_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
navbar{
link-list
link-list
link-list
}
container{
row{
div-3{
text
card-div{
img
card-body{
text
button
}
}
}
div-6{
text
list-group{
list-group-item
list-group-item
list-group-item
}
}
div-3{
card-div{
img
card-body{
text
}
}
large-title
}
}
}
22 changes: 22 additions & 0 deletions _Output_Pages/DSL/page_00004_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
navbar{
link-list
}
container{
jumbotron{
button
large-title
text
}
row{
div-12{
img
text
}
}
jumbotron{
text
large-title
large-title
button
}
}
41 changes: 41 additions & 0 deletions _Output_Pages/DSL/page_00005_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
navbar{
link-list
link-list
link-list
link-list
}
container{
jumbotron{
button
button
large-title
button
}
row{
div-3{
list-group{
list-group-item
list-group-item
list-group-item
list-group-item
list-group-item
}
img
}
div-3{
img
button
}
div-6{
img
carousel
}
}
row{
div-12{
carousel
large-title
}
}
}
footer
39 changes: 39 additions & 0 deletions _Output_Pages/DSL/page_00006_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
container{
jumbotron{
button
large-title
}
row{
div-3{
text
list-group{
list-group-item
list-group-item
list-group-item
list-group-item
list-group-item
}
}
div-9{
text
large-title
button
}
}
row{
div-3{
text
list-group{
list-group-item
list-group-item
list-group-item
list-group-item
}
}
div-9{
carousel
carousel
img
}
}
}
30 changes: 30 additions & 0 deletions _Output_Pages/DSL/page_00007_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
container{
jumbotron{
large-title
large-title
}
row{
div-3{
text
text
}
div-9{
card-div{
card-header
img
card-body{
text
button
}
}
button
button
}
}
jumbotron{
large-title
button
large-title
}
}
footer
37 changes: 37 additions & 0 deletions _Output_Pages/DSL/page_00008_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
container{
jumbotron{
large-title
text
}
row{
div-12{
button
img
}
}
row{
div-3{
list-group{
list-group-item
list-group-item
list-group-item
list-group-item
list-group-item
}
button
}
div-3{
text
text
}
div-6{
carousel
large-title
list-group{
list-group-item
list-group-item
}
}
}
}
footer
12 changes: 12 additions & 0 deletions _Output_Pages/DSL/page_00009_0.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
navbar{
link-list
link-list
}
container{
jumbotron{
button
button
large-title
large-title
}
}
Binary file added _Output_Sketches/page_00000_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00001_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00002_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00003_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00004_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00005_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00006_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00007_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00008_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _Output_Sketches/page_00009_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading