Skip to content

Commit be786b1

Browse files
committed
Add template function: dont need overwriting index
1 parent 76a8d9a commit be786b1

File tree

9 files changed

+75
-23
lines changed

9 files changed

+75
-23
lines changed

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Docker: Python - General",
5+
"type": "docker",
6+
"request": "launch",
7+
"preLaunchTask": "docker-run: debug",
8+
"python": {
9+
"pathMappings": [
10+
{
11+
"localRoot": "${workspaceFolder}",
12+
"remoteRoot": "/app"
13+
}
14+
],
15+
"projectType": "general"
16+
}
17+
}
18+
]
19+
}

.vscode/tasks.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "docker-build",
6+
"label": "docker-build",
7+
"platform": "python",
8+
"dockerBuild": {
9+
"tag": "egg:latest",
10+
"dockerfile": "${workspaceFolder}/Dockerfile",
11+
"context": "${workspaceFolder}",
12+
"pull": true
13+
}
14+
},
15+
{
16+
"type": "docker-run",
17+
"label": "docker-run: debug",
18+
"dependsOn": [
19+
"docker-build"
20+
],
21+
"python": {
22+
"file": "egg\\app.py"
23+
}
24+
}
25+
]
26+
}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
### Pyfoch announces Egg Project
44
#### 07/13/2021 Santiago, Chile
55
##### Tags: [library](https://github.com/topics/library)
6-
Pyfoch announces Egg Project: the Pyfoch Egg-cosystem.
7-
6+
Pyfoch announces Egg Project: the Pyfoch Egg-cosystem.
98 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

egg/resources/extensions.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,31 @@ def writeLines(self,lines,name: str):
3636
for i in lines:
3737
self.append(i,name)
3838

39+
# Extensions
40+
py=Lang("py")
41+
txt=Lang("txt")
42+
nqa=Lang("nqa")
43+
pfcf=Lang("pfcf")
44+
html=Lang("html")
45+
3946
class Document():
40-
def __init__(self, name: str):
47+
def __init__(self, name: str, output: str ="index"):
4148
install("bs4")
4249
from bs4 import BeautifulSoup
43-
html=open(name+".html").read()
44-
self.soup=BeautifulSoup(html,features="html.parser")
4550
self.name=name
46-
def write(self, text: str, id: str):
51+
doc=open(self.name+".html").read()
52+
self.soup=BeautifulSoup(doc,features="html.parser")
53+
self.output=output
4754
lines=html.getLines(self.name)
55+
html.writeLines(lines, self.output)
56+
def write(self, text: str, id: str):
57+
lines=html.getLines(self.output)
4858
for i in range(0,len(lines)):
4959
l=lines[i]
5060
words=l.split()
5161
if words[0]=="$egg" and id==words[1]:
5262
lines[i]=text+"\n"
53-
html.writeLines(lines,self.name)
63+
html.writeLines(lines,self.output)
5464
return lines
5565
def addTag(self,tag: str, content: str, id: str):
5666
return self.write(makeTag(self,tag, content),id)
@@ -59,9 +69,3 @@ def makeTag(document,tag: str, content: str):
5969
new=document.soup.new_tag(tag)
6070
new.string=content
6171
return str(new)
62-
63-
py=Lang("py")
64-
txt=Lang("txt")
65-
nqa=Lang("nqa")
66-
pfcf=Lang("pfcf")
67-
html=Lang("html")

index.html

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<html>
2-
<script> var timer = null;
3-
function auto_reload(){
4-
top.location.href = 'index.html';
5-
}
6-
</script>
7-
<body onload="timer = setTimeout('auto_reload()',5000);">
8-
$egg aqui
2+
<body>
3+
<h1>Hi</h1>
94
<p>
10-
$egg 2
5+
xd
116
</p>
127
</body>
138
</html>

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
#eggConsole()
44

5-
"""
6-
document=Document("index")
5+
6+
document=Document("template")
77
document.addTag("h1","Hi","aqui")
88
document.write("xd","2")
99

10+
"""
1011
covid=Repo("CovidPlot")
1112
cp=covid.pull("covidplot","CovidData")
1213
#pull("CovidPlot")

template.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
<body>
3+
$egg aqui
4+
<p>
5+
$egg 2
6+
</p>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)