From fa76b56c2fe38cc0e20d40fac655f0a6f51cd521 Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Thu, 7 May 2026 13:07:27 +0200 Subject: [PATCH 1/6] add(flake): basic but can open the document with nix run --- .gitignore | 2 ++ flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 47 +++++++++++++++++++++++++++++++++++++++++ main.typ | 0 4 files changed, 110 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 main.typ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ed399d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pdf +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ec07b13 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1777954456, + "narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..70234d1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "Build pipeline for the Skribi documentation"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + nixpkgs, + utils, + ... + }: + utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + doc = pkgs.stdenv.mkDerivation { + src = ./.; + name = "skribi_doc"; + nativeBuildInputs = with pkgs; [ + typst + ]; + buildPhase = '' + typst compile main.typ + ''; + installPhase = '' + mv main.pdf $out + ''; + }; + open = pkgs.writeShellScriptBin "open_doc" '' + xdg-open ${doc} + ''; + in + { + packages = rec { + skribi_doc = open; + default = skribi_doc; + }; + devShells.default = pkgs.mkShell { + inputsFrom = [ doc ]; + buildInputs = [ ]; + }; + } + ); +} diff --git a/main.typ b/main.typ new file mode 100644 index 0000000..e69de29 From c4dfeee40b0f785ba3d64cf29bf6ba788ba42e0f Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Thu, 7 May 2026 13:13:57 +0200 Subject: [PATCH 2/6] add(README): an introduction --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0c16707 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ + +# Skribi documentation (README) + +This documentation specifies how Skribi works and how to use it. +This new version is made in Typst so that we can have easily a good visual. +It may also be easy to share this document and to use it with PDF readers. + +To open the document, you can do : + +```sh +nix run github:Dibi-programming-language/skribi_doc +``` + +This will open the last official version of the document. + +A website may be made later. From 1d6073f287608873ef22dea0219ebf57ffbf874d Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Thu, 7 May 2026 23:20:38 +0200 Subject: [PATCH 3/6] fix(nix): we can now use typst packages --- README.md | 1 + flake.nix | 13 ++++++++++++- main.typ | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c16707..a97b8be 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,4 @@ nix run github:Dibi-programming-language/skribi_doc This will open the last official version of the document. A website may be made later. +Note that this is easy to create a website from a Typst document. diff --git a/flake.nix b/flake.nix index 70234d1..02cf70e 100644 --- a/flake.nix +++ b/flake.nix @@ -16,12 +16,23 @@ system: let pkgs = nixpkgs.legacyPackages.${system}; + typst = ( + pkgs.typst.withPackages ( + ps: with ps; [ + zebraw_0_6_1 + ] + ) + ); + path = "${typst}/lib/typst/packages"; doc = pkgs.stdenv.mkDerivation { src = ./.; name = "skribi_doc"; - nativeBuildInputs = with pkgs; [ + nativeBuildInputs = [ typst + pkgs.which ]; + TYPST_PACKAGE_CACHE_PATH=path; + TYPST_PACKAGE_PATH=path; buildPhase = '' typst compile main.typ ''; diff --git a/main.typ b/main.typ index e69de29..78f25ed 100644 --- a/main.typ +++ b/main.typ @@ -0,0 +1,4 @@ +#import "@preview/zebraw:0.6.1": * +#show: zebraw + + From e5e25587b086a1e508efbe61f712f622f83dabbd Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Thu, 7 May 2026 23:26:50 +0200 Subject: [PATCH 4/6] add(nix): command open doc un dev shell --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 02cf70e..d4798d8 100644 --- a/flake.nix +++ b/flake.nix @@ -51,7 +51,7 @@ }; devShells.default = pkgs.mkShell { inputsFrom = [ doc ]; - buildInputs = [ ]; + buildInputs = [ open ]; }; } ); From 96c50a39f8582f51e8d2060f199ad8f629edc2f7 Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Fri, 8 May 2026 20:06:56 +0200 Subject: [PATCH 5/6] add(typ): create the first section --- flake.nix | 2 +- main.typ | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d4798d8..3fc5a5c 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,7 @@ pkgs.typst.withPackages ( ps: with ps; [ zebraw_0_6_1 + vibrant-color_0_2_0 ] ) ); @@ -29,7 +30,6 @@ name = "skribi_doc"; nativeBuildInputs = [ typst - pkgs.which ]; TYPST_PACKAGE_CACHE_PATH=path; TYPST_PACKAGE_PATH=path; diff --git a/main.typ b/main.typ index 78f25ed..fd971c7 100644 --- a/main.typ +++ b/main.typ @@ -1,4 +1,63 @@ #import "@preview/zebraw:0.6.1": * +#import "@preview/vibrant-color:0.2.0": * #show: zebraw +#show: doc => vibrant-color( + theme: "green-theme", + title: "Documentation", + authors: ( + "Dev team", + ), + lang: "en", + sub-authors: "Skribi", + description: "An introduction to Skribi, with its specifications", + subject: "Skribi", + doc +) +#set document( + title: "An introduction on Skribi", +) + += Introduction + +This document is created for explaining how to use the Skribi, and having every +decision in the same place. You will find specifications about the language, +a tutorial that explains how to use it, and the basics of how it is made. + += A good start + +== Downloading Skribi + +All information about downloading Skribi can be found on #link( + "https://github.com/Dibi-programming-language/Skribi-langage-source" +)[this page]. For now, you will need to build the code yourself. + +The best way to use Skribi is to install it using nix: +```sh +nix profile install github:Dibi-programming-language/Skribi-langage-source +``` + +And run it using: +```sh +skribi [path to file] +``` + +#line() + +If you want to test Skribi, you can use: +```sh +nix run github:Dibi-programming-language/Skribi-langage-source +``` + +Skribi will not be kept on your system after this command. + +== Using skribi + +To use Skribi, you may want to provide a Skribi file. + +```sh +skribi your_file.skrb +``` + +Only `.skrb` and `.skribi` are accepted as valid files. From 8304d601b3200c5fc9b8f1d9c4c6efe23030d8a0 Mon Sep 17 00:00:00 2001 From: Alexis <> Date: Fri, 8 May 2026 21:37:08 +0200 Subject: [PATCH 6/6] add(syntax): skribi syntax definition and skribi native call --- main.typ | 37 +++++++++++++++++++++++++++++++++++++ skribi.sublime-syntax | 22 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 skribi.sublime-syntax diff --git a/main.typ b/main.typ index fd971c7..202bfc8 100644 --- a/main.typ +++ b/main.typ @@ -19,6 +19,8 @@ title: "An introduction on Skribi", ) +#set raw(syntaxes: "skribi.sublime-syntax") + = Introduction This document is created for explaining how to use the Skribi, and having every @@ -61,3 +63,38 @@ skribi your_file.skrb ``` Only `.skrb` and `.skribi` are accepted as valid files. + += Specifications + +You can write Skribi code anywhere in a Skribi file: you do not need a main +function to start coding. + +#warning("None of these specifications are implemented yet.") + +== Calling a function + +=== Native functions + +You can use native functions to communicate with the outside of your script. + +The syntax of a native function is: +```skribi +skr_app name(args) +``` + +This will call the function named ```skribi name```. +We need to specify the ```skribi skr_app``` as it would be considered as a user +defined function otherwise. + +#quote([ + Why do we need to make a difference between user defined functions and skribi + defined functions ? + + #line() + + This is an implementation choice: skribi defined functions are from a limited + list, and implemented in a totally different way. This allows to perform + limited checks on these functions. +]) + + diff --git a/skribi.sublime-syntax b/skribi.sublime-syntax new file mode 100644 index 0000000..d8028f7 --- /dev/null +++ b/skribi.sublime-syntax @@ -0,0 +1,22 @@ +%YAML 1.2 +--- +# https://www.sublimetext.com/docs/syntax.html + +name: skribi +file_extensions: [skrb] +scope: source.skrb + +contexts: + main: + - match: \b(skr_app|ij|sula|ci|ums)\b + scope: keyword.control.c + - match: '"' + push: skr + + skr: + - meta_scope: string.quoted.double.c + - match: \\. + scope: constant.character.escape.c + - match: '"' + pop: true +