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/README.md b/README.md new file mode 100644 index 0000000..a97b8be --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ + +# 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. +Note that this is easy to create a website from a Typst document. 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..3fc5a5c --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + 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}; + typst = ( + pkgs.typst.withPackages ( + ps: with ps; [ + zebraw_0_6_1 + vibrant-color_0_2_0 + ] + ) + ); + path = "${typst}/lib/typst/packages"; + doc = pkgs.stdenv.mkDerivation { + src = ./.; + name = "skribi_doc"; + nativeBuildInputs = [ + typst + ]; + TYPST_PACKAGE_CACHE_PATH=path; + TYPST_PACKAGE_PATH=path; + 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 = [ open ]; + }; + } + ); +} diff --git a/main.typ b/main.typ new file mode 100644 index 0000000..202bfc8 --- /dev/null +++ b/main.typ @@ -0,0 +1,100 @@ +#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", +) + +#set raw(syntaxes: "skribi.sublime-syntax") + += 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. + += 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 +