From a611d01a71c1ef57d8ecd19e2a057a315f06eb02 Mon Sep 17 00:00:00 2001 From: Lazy Hippopotamus Date: Sat, 23 Mar 2024 10:16:59 -0400 Subject: [PATCH] finally update the site --- site/config.stx | 2 +- site/index.html | 7 ++++--- site/pages/noteboard.html | 7 +++++++ site/pages/todo.html | 5 +---- site/pages/usage.html | 35 ++++++++++++++++++++++++----------- site/templates/default.html | 4 ++-- 6 files changed, 39 insertions(+), 21 deletions(-) diff --git a/site/config.stx b/site/config.stx index 49da82b..9781af3 100644 --- a/site/config.stx +++ b/site/config.stx @@ -1,5 +1,5 @@ [?][@on minify] [=baseurl http://localhost:8080] -[i config production] +[i production] [=baseurl https://swaous.asuscomm.com/sitix] [/] \ No newline at end of file diff --git a/site/index.html b/site/index.html index f3f4172..987c2af 100644 --- a/site/index.html +++ b/site/index.html @@ -28,13 +28,14 @@ model with efficient file includes, conditional branching, looping, and command-line configuration to make stunning websites without the mess. [=textimage_text-] - Template all the things. Any Sitix file can be a template; the \[?] opening phrase indicates that (for whatever reason) the file shouldn't be rendered normally, + Template all the things. Any Sitix file can be a template; the \[?\] opening phrase indicates that (for whatever reason) the file shouldn't be rendered normally, but still may be included in other files - for configuration, templating, or even modular elements! -[/][=textimage_source-][^baseurl]/res/default.html.png[/][^textimage] +[/] +[=textimage_source-] [^baseurl]/res/default.html.png [/] [^textimage] [=textimage_text-] Sitix is a universal preprocessor. HTML? Of course. CSS? Yep! JavaScript? Certainly! Sitix will template anything, whether it be a nice simple HTML file or a hand-edited GIF from 1998. Say goodbye to annoying configuration discrepancies between CSS and HTML and JavaScript - just throw your shared variables in a config.stx file and let Sitix do the rest! -[/][=textimage_source-][^baseurl]/res/lato.css.png[/][^textimage] +[/] [=textimage_source-] [^baseurl]/res/lato.css.png[/] [^textimage]
No more restrictive project structures, irritating configuration files, or magic. Goodbye Ruby, "blog-awareness", difficult configuration, and bulky outputs. Sayonara obtuse frameworks, inefficient CSR, and annoying build pipelines. diff --git a/site/pages/noteboard.html b/site/pages/noteboard.html index 295c491..614cf08 100644 --- a/site/pages/noteboard.html +++ b/site/pages/noteboard.html @@ -7,6 +7,13 @@ periodically for information on new releases, design considerations, known bugs, etc. You can think of it as a miniblog.
+ 2024-3-23: Added Evals. It's a simple evaluated stack-based language designed specifically for Sitix. At the moment, all it does is compare things, but it's + a damn sight better than how if statements used to work. Eventually I'll add vscript to inline object (\[=name content]) directives; for now, + it's present in if statements and the \[v] directive.
+ In other news, the program is a LOT cleaner now. Much of the processing effort has been moved into constructors and a lot of things have been simplified and + abstracted. Memory maps are now automatically unmapped and have a very pleasant buffer-like interface, and all the mapping code has been moved to a single function.
+ The project is now ready for MarkDown! +

2024-3-11: Model updates, and now this site can actually be built by the latest sitix updates :D.
As of today, Sitix now leaks no memory when building this site! It took a lot of effort to trim down but it was worth it. We shall see if the luck persists.

diff --git a/site/pages/todo.html b/site/pages/todo.html index c2ef8ce..64183ec 100644 --- a/site/pages/todo.html +++ b/site/pages/todo.html @@ -9,11 +9,8 @@
  • Markdown support with an @-directive
  • -
  • Code cleaning (use smart pointers and std::strings as much as possible rather than... this)
  • -
  • Make config less hack (move from \[i config] to \[i exists], and create empty objects on global with -c)
  • -
  • Add an unpack/ghost operator so setting objects to other objects works (something like \[=ghostingName-] \[%ghostedObject] \[/])
  • Safety: Sitix should not delete your entire codebase if you accidentally mistype the command.
  • -
  • Get rid of that stupid "something has gone terribly wrong" warning. It's not a problem, it's just an artefact of an old debugging marathon.
  • +
  • Use Evals more widely and implement string manipulation.
[/] diff --git a/site/pages/usage.html b/site/pages/usage.html index 199c907..a89b31d 100644 --- a/site/pages/usage.html +++ b/site/pages/usage.html @@ -10,7 +10,10 @@ your site directory, creating appropriate subdirectories and directly copying over any file that doesn't have an opening phrase - \[!], for a Sitix page, or \[?] for a data page (which will not be rendered itself, but may be used for templating or configuration). The opening phrase MUST be the first three bytes of the file; if there are any whitespaces before it, the file will be treated as plain data. If you want - it to render to a different directory, pass the -o location flag. + it to render to a different directory, pass the -o location flag.

+ Configuration can be managed with the -c command line directive, which directly inserts a Sitix object to the virtual root scope. For instance, + this site uses the -c production argument to enable the production endpoint as opposed to the local development endpoint. It could also be + something like -c endpoint https://swaous.asuscomm.com/sitix, directly inserting the endpoint.
WARNING: -o is very dangerous! If you tell Sitix to render to a directory with important information in it, that directory is as good as gone. @@ -29,16 +32,8 @@ Variables at the dereferencing position will NOT be replaced.
  • \[#filename]: Dereferences a Sitix file (or plain file, which would just copy over content without processing it) at this position. The filename must be relative to the root directory (usually the site directory), rather than the directory the including file is stored in. This is very useful for templating.
  • -
  • \[i request <...>]\[e]\[/]: This is an if condition. If in Sitix contains an object (between the \[i] and either \[/] or \[e]) that will - be rendered if the condition evaluates to "true", and, optionally (between \[e] and \[/]), an object that will be rendered if the condition is false.
    - Requests can be, -
      -
    • config configName: Check whether or not a command-line config switch is enabled (you can enable them with -c configName).
    • -
    • equals variable1 variable2: Check whether two variables are the same (the check is flawed, but pretty good. See the relevant section in main.cpp - for information on this.)
    • -
    • exists variable: Check whether a variable exists. Good for simple boolean flags.
    • -
    -
  • +
  • \[i <...>]main section\[e]else section\[/]: This is an if condition. The content of the condition is an Evals directive. If it's truthy, the main section of the + if statement will be rendered. If it's not truthy, the else section will be rendered. You can put whatever you want in either section. For more information on Evals, see below.
  • \[f array iterator]: For loop that iterates over an array (note: in Sitix, every subdirectory of the root dir can be treated as an array of objects, each object being a file! This allows things like generating blog links). The iterator variable will be, for every item, the referenced array element. Note: When iterating over a directory, every file will be given a filename property! This can be used like @@ -53,6 +48,24 @@ except in very niche situations, because of the unclear rules behind it; I will document those on a later date. __file__ is always the root object of the current file, - you can most likely guess why that's useful.
  • +
    + Evals is a very simple stack-based language meant for evaluating string statements. When data is entered in the Evals program, it's immediately pushed + to the stack (like "hello", 3.14, true, or some.sitix.variable). At the end of Evals rendering, whatever is left on the stack + is considered the result (if there is more than one thing on the stack, Evals will give you a Bad Syntax error and return an ErrorObject). To manipulate data, + there are a number of commands that work on the top of the stack: + + Truthyness in Evals is not dissimilar to JavaScript. Empty strings are falsey, and all other strings are truthy; 0 is falsey and all other numbers are truthy, and booleans are truthy or falsey based on their value. + Sitix variables are considered truthy if the lookup is successful, and falsey otherwise; this allows for a replacement to the old \[i exists] and \[i config], + like \[i conf/prod] would check if the conf/prod variable exists in scope (which could be set by -c conf/prod, for instance). + Evals will render Sitix variables as strings to run comparisons on them. This means you must be careful - if rendering that object would change a variable you don't want changed, for instance, + you'll end up with some very odd behavior. Rendering objects to strings is also dangerous because of the sheer size of some Sitix objects - you can store many gigabytes of data safely in + a PlainText object, which would be forced into main memory by an Evals comparison (Evals will not render Sitix objects unless they're used in a comparison with a string; comparing + two Sitix objects is safe). Be careful. +
    And that's it! To see how these are used creatively in the wild, check out the source code for this website.
    diff --git a/site/templates/default.html b/site/templates/default.html index 124db69..e0134ce 100644 --- a/site/templates/default.html +++ b/site/templates/default.html @@ -9,7 +9,7 @@ Sitix | - [i exists title] + [i title] [^title] [e] Untitled Page @@ -26,7 +26,7 @@ </div> </div> <div id="main" class="scrolly-container"> - [i exists isSimple] + [i isSimple] <h2>[^title]</h2> [/] [^content]