Closed ItsTheSky closed 2 years ago
Very nice! BTW, Maybe we'll do a new release now so that the next one will only have stuff related to this PR?
I will help with other things once you finish the basics of this.
Also, sorry for readme :-/
okay so, it's a long time since I haven't worked on WebSK so I'm a little bit rusty x)
I'll keep how the parser work currently, aka managing patterns with Regex.
Everything seems to be inside their own patterns I defined at the top of the class, so I'll only keep the code pattern & core end pattern.
There'll be two main patterns, for simple content (anything that's inside {{XXX}}}
) & closing tags ({{/XXXX}}
)
All good! Don't worry, I just fixed some typos Grammarly showed me, else I wouldn't be able to found them :')
okay so, it's a long time since I haven't worked on WebSK so I'm a little bit rusty x) I'll keep how the parser work currently, aka managing patterns with Regex. Everything seems to be inside their own patterns I defined at the top of the class, so I'll only keep the code pattern & core end pattern. There'll be two main patterns, for simple content (anything that's inside
{{XXX}}}
) & closing tags ({{/XXXX}}
)
Okay. I was wondering, maybe we can create things like in vue (data seccion). To make it more clear when variable should be used in templates... Example implementation:
return ABC.HTML with data {var a, list b|all}
Normally it would be all, but using that you can exclude something...
With the new statement system, I'm working on currently, adding something like that will be done easily.
So, after a long and tiring day;
The new system I offer is based on WebStatement, but it's completely different from the first class I committed to this morning.
When the parser will walk through every {{ }}
content, it will check if a registered statement matches this mustaches content, using the init
method of the web statement.
There are different sorts of return objects in that method, but all are based on LoadingResult
where errors & success states are stored.
I only was able to work on 4 basics statement, but these regroup everything that was possible with WebSK before, such as:
show
), ShowStatement.java#
and closing), ClosingStatement.java & CommentStatement.javaif
or loops
soon), IfStatement.javaThe only thing I'm not currently happy with is the section system, it's mainly using the same way as before (splitting, matching and replacing) and I'm sure there's definitely a better way to do it.
Waiting for your review about that :)
Woow! A huge amount of work! About code: Why in if statement this code is in comment? Is there anything wrong with it? But apart from that everything is SO GREAT! too much excitment.... This system will be so easy to use, I can't wait to work with it :)
Maybe we can:
{{ // }}
it closes last tag, no matter what type is it
Also, if you gonna work on loops, we need to create some system that will work with loops inside loops. IDK if it would work with this system now... The only thing I'm not currently happy with is the section system, it's mainly using the same way as before (splitting, matching and replacing) and I'm sure there's definitely a better way to do it.
Tomorrow I'll check other libraries and see how they fixed it.
Why in if statement this code is in comment? Is there anything wrong with it?
It was the whole old parser system that I kept in touch. I'll maybe use some parts of it once I'll start working on loops, but it's purely for helps and should now be completely used anywhere else.
{{ // }}
it closes last tag, no matter what type is it
I can try to implement that later, I need loops to be finished first & else conditions too. It will however be hard to work with that because the current system is made of splitting & regex, means regex may do shit sometimes because there's two or three times this pattern. (That's why we're using tag currently)
Also, if you gonna work on loops, we need to create some system that will work with loops inside loops. IDK if it would work with this system now...
The current version of the parser completely support loops within loops, since every statement are now independent of each other.
Ok
Great! So everything in this PR is done?
Mainly yeah, just some basics statement are still needed (like execute), but the parser rework is done.
Also, we need to create new docs. I was wondering - maybe we can create them at GitHub Wiki page, not at jederu's server?
It's as you like, I can also use my own system for DiSky (https://disky.tech/wiki) that work with markdown for the page content itself.
Also, I created ToDo list:
url of block
.{{ show ABC }}
and {{% ABC %}}
It's as you like, I can also use my own system for DiSky (https://disky.tech/wiki) that work with markdown for the page content itself.
Very nice idea! But still, we need ask @jensjeflensje what he thinks...
Good work
It's as you like, I can also use my own system for DiSky (https://disky.tech/wiki) that work with markdown for the page content itself.
👌
Great! So we are waiting just for @jensjeflensje
Great work :)
Information
Blocks system will let developers handle the website's components even more easily than before. It was requested by @Norbiros in #41, here's a quick recap of what it will look likes:
{% extends "base.html" %}
- this function override templatebase.html
.{% block "content" %}
- this creates a block, that can have content of other files using extends{{ block.super }}
- when you write after this, you add code to the previous block, not replace it{{ value|filter }}
- filter can be for examplelength
,default
Ideas are from https://docs.djangoproject.com/en/4.0/ref/templates/language/.
Development Path
I thought about a whole new parsing system. Skript statement will be boxed in a new class, like
WebStatement
, because this can be either Skript statement or WebSK Statement. WebSK statement is everything that can "handle" WebSK code, such as loops, and conditions, but also closing statement (such as for loops & conditions). Of course, these statements will also handle blocks as defined above.