jensjeflensje / websk

Create websites using Skript!
MIT License
9 stars 4 forks source link

Basic expression parsing #13

Closed ItsTheSky closed 2 years ago

ItsTheSky commented 2 years ago

This pull request offer the way to parse expression directly in a template file:

define webserver:
    port: 8000
    on request:
        set {_version} to skript version
        return the template file "property.html"

With template:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>
        Expression var example
    </h1>
    <p>{{version}}
    {{show avatar of bot named "bot"}}
    {{show size of members of guild with id "818182471140114432"}}</p>
</body>
</html>

Show: image

I currently set the special mark as show, but you can change it at any time as you like ^^ Moreover, it should parse expression according to the current event, which means the local variables and the event values will be set and usable.

ItsTheSky commented 2 years ago

This new commit brings a lot of new things, as the commit mention:

ItsTheSky commented 2 years ago

This new commit completely reworks the parser and is currently from our side only. Made it not static, to possibly make multiple instances of the parser, but you can change it if you want. Also changed the way to get file's content, more optimized one.

What can be done?

What can not be done (yet)?