Skip to content

Commit

Permalink
Added new function
Browse files Browse the repository at this point in the history
- added a new function , which provides simply the current date time
- fixed function parsing to support functions without parameters

- added generated time to footer
  • Loading branch information
Lycea committed Jun 23, 2024
1 parent 20fc962 commit b3cf7c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scripts/page_gen/grammers.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def get_function_parts(tokens):
param_list = []

next_allowed={
t.FUNCT_OPEN: [t.STRING_START_END,t.STRING,t.FUNCT_CLOSE],
t.COMMA: [t.STRING_START_END,t.STRING],
t.STRING: [t.COMMA, t.FUNCT_CLOSE],
t.STRING_START_END: [t.COMMA, t.FUNCT_CLOSE]
Expand All @@ -214,7 +215,7 @@ def get_function_parts(tokens):

continue_parsing = True
valid = True
prev_type = t.COMMA
prev_type = t.FUNCT_OPEN


while continue_parsing :
Expand Down Expand Up @@ -341,8 +342,10 @@ def match(self, token_list):
)
if res[0]:
print("IS A FUNCTION PROBABLY!")

parts = get_function_parts(token_list.t_list[2:])
print("PARTS",parts)

if parts[0]:
ret = nodes.cFunction()
ret.parameters = parts[1]
Expand Down
5 changes: 5 additions & 0 deletions scripts/page_gen/template_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ def null():

def getSize(self):
return len(self.value)
import datetime

class TemplateFunctions:
@staticmethod
def repeat(x, amount):
return str(x) * (amount)

@staticmethod
def gen_time():
return datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S")


depths_max = 10
Expand Down
2 changes: 1 addition & 1 deletion templates/content/base_footer
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

<div class="footer">some information</div>
<div class="footer">some information <b> Generated by scrappy gen at: {{gen_time( ) }} </b></div>

0 comments on commit b3cf7c4

Please sign in to comment.