From 43bd29537ce673810e2a9ed5c6c94e63f789ed52 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 11 Nov 2019 03:49:28 +0100 Subject: [PATCH] :art: Update --- .gitignore | 1 - .vale.ini | 30 +++++++++++++++++ Makefile | 3 ++ docs/Benchmarks.mdr | 2 +- docs/Contributing/ContributingTranslation.mdr | 31 +++++++++++------- docs/Overview/First_Steps/InstallingGwion.mdr | 3 +- docs/Overview/Testing.mdr | 3 -- docs/Overview/declaration.mdr | 2 +- docs/README.mdr | 6 ++-- docs/Reference/ControlFlow/Repeat.mdr | 5 ++- docs/Reference/ControlFlow/forloop.mdr | 5 ++- docs/Reference/Functions/Lambdas.mdr | 2 +- docs/Reference/Types/Enums.mdr | 15 +++++---- docs/config.mk.orig | 32 ------------------- scripts/mdr2mdbook.sh | 7 ++-- 15 files changed, 80 insertions(+), 67 deletions(-) create mode 100644 .vale.ini delete mode 100644 docs/config.mk.orig diff --git a/.gitignore b/.gitignore index 9a62405a..2919fc0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ book -src book.toml custom.css .d/ diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 00000000..f292b9ad --- /dev/null +++ b/.vale.ini @@ -0,0 +1,30 @@ +# Example Vale config file (`.vale.ini` or `_vale.ini`) + +# Core settings +StylesPath = ci/vale/styles + +# The minimum alert level to display (suggestion, warning, or error). +# +# CI builds will only fail on error-level alerts. +MinAlertLevel = warning + +# The "formats" section allows you to associate an "unknown" format +# with one of Vale's supported formats. +[formats] +mdr = md + +# Global settings (applied to every syntax) +[*] +# List of styles to load +BasedOnStyles = write-good, Joblint +# Style.Rule = {YES, NO} to enable or disable a specific rule +vale.Editorializing = YES +# You can also change the level associated with a rule +vale.Hedging = error + +# Syntax-specific settings +# These overwrite any conflicting global settings +[*.{md,txt,mdr}] +vale.Editorializing = YES + +BlockIgnores = (?s) *(@\x60\x60\x60.*?@\x60\x60\x60) diff --git a/Makefile b/Makefile index 8d9d273c..c81fd4df 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,9 @@ deploy: book ensure: @sh scripts/ensure.sh +lint: + vale docs + clean: @[ -d src ] && mdbook clean || true diff --git a/docs/Benchmarks.mdr b/docs/Benchmarks.mdr index 39a2e8cf..66173a82 100644 --- a/docs/Benchmarks.mdr +++ b/docs/Benchmarks.mdr @@ -1,3 +1,3 @@ # Benchmarks -@exec for a in benchmark_results/*.png; do echo "![${a:-4}]($a \"${a:-4}\")"; done +@exec for a in $(find benchmark/results -type f -name "*.png"); do echo "![$(basename $a)]($(sed 's/benchmark\/results/assets/' <<< $a) \"${a:-4}\")"; done diff --git a/docs/Contributing/ContributingTranslation.mdr b/docs/Contributing/ContributingTranslation.mdr index 2cd13df4..d730a8fc 100644 --- a/docs/Contributing/ContributingTranslation.mdr +++ b/docs/Contributing/ContributingTranslation.mdr @@ -4,12 +4,15 @@ First off, thank you for considering translating gwion. Thanks to the build system, you're gonna get on tracks fast. +
+ +Make your live easier + +use export TRANSLATION_TARGET=xxx +so you don't have to repeat it on the command line +
-> You might want to export TRANSLATION_TARGET, -so you don't have to set it on the command line for commands requiring it -`export TRANSLATION_TARGET="xxx"` - -## 1) Init the translation language +## Step 1: *Init the translation language* You have to make sure there is a directory for your target language (e.g.: fr, en, es_ES ...). @@ -20,7 +23,7 @@ make translation-init TRANSLATION_TARGET= Where `` is your language of choice. It will fail if your language already exists, but this is not a problem. -## 2) Edit +## Step 2: *Edit* Next, you should adjust the translations. What about using your favorite editor? @@ -29,18 +32,18 @@ What about using your favorite editor? make translation-edit TRANSLATION_TARGET= ``` -## 3) Update +## Step 3: *Update* -Maybe the sources changed, and there is more message to translate? +Maybe the sources changed, and there is more messages to translate? ``` sh make translation-update ``` -This will update all languages. -You can now get back to [step 2](#2-Edit). +This will update all languages. +You can now get back to [step 2](#step-2-Edit). -## Add to VCS +## Step 4: *Add to [VCS](https://en.wikipedia.org/wiki/Version_control)* It's now time to add your changes to the package @@ -48,4 +51,8 @@ It's now time to add your changes to the package make translation-commit TRANSLATION_TARGET= ``` -Now please submit a pull request. +> In [Gwion](:gwion:/Gwion)'s case, +the `vcs` is the well known [git](https://git-scm.com/), +but the `make` recipe makes things simple + +Now please submit a [pull request](:gwion:/Gwion/pulls). diff --git a/docs/Overview/First_Steps/InstallingGwion.mdr b/docs/Overview/First_Steps/InstallingGwion.mdr index b64f4273..057f8b81 100644 --- a/docs/Overview/First_Steps/InstallingGwion.mdr +++ b/docs/Overview/First_Steps/InstallingGwion.mdr @@ -22,7 +22,7 @@ You'll need the sources for all base module git submodule update --init util ast ``` -> At this point, you might want to configure the build. +> At this point, you may want to configure the build. In this case, have a look at the [configuration page](Configure.md) @@ -36,4 +36,5 @@ make ``` sh make install ``` + > You may need root privilege to do this. diff --git a/docs/Overview/Testing.mdr b/docs/Overview/Testing.mdr index 5dde62b4..45342eae 100644 --- a/docs/Overview/Testing.mdr +++ b/docs/Overview/Testing.mdr @@ -23,6 +23,3 @@ n=0 [ "$n" -eq 0 ] && n=1 source tests/sh/common.sh ``` - -## TODO - [ ] `bailout` system for early exit on failure diff --git a/docs/Overview/declaration.mdr b/docs/Overview/declaration.mdr index 349db007..c3cd7f82 100644 --- a/docs/Overview/declaration.mdr +++ b/docs/Overview/declaration.mdr @@ -11,7 +11,7 @@ Object o; @exec make -s decl0.test ## Declaring a reference -However ... + @``` decl1.gw Object @ref; <<< "Reference points to no object yet: ", ref >>>; diff --git a/docs/README.mdr b/docs/README.mdr index 7b15865a..670a1ff4 100644 --- a/docs/README.mdr +++ b/docs/README.mdr @@ -1,11 +1,11 @@ # Welcome to Gwion -gwion is a easy yet powerful, strongly-timed programming language, +:gwion: is a strongly timed programming language, +aiming to be easy, powerful and [fast](Benchmarks.html) strongly-timed programming language, ## And now for the hello world -So, as it is mandatory, here is the piece of code you're waiting -for: +Here is the piece of code you're waiting for :tada:: @``` helloworld.gw <<< "Hello, World!" >>>; diff --git a/docs/Reference/ControlFlow/Repeat.mdr b/docs/Reference/ControlFlow/Repeat.mdr index 37124bb6..26428c73 100644 --- a/docs/Reference/ControlFlow/Repeat.mdr +++ b/docs/Reference/ControlFlow/Repeat.mdr @@ -2,14 +2,17 @@ let start simple ;-) The easiest way to do an action repeatidly in Gwion is, ... the **repeat** keyword! -## Very basic example +## Basic example + @``` repeat.gw repeat(3) <<< "Hello, world!" >>>; @``` @exec make -s CONTAINS="Hello" repeat.test + ## Block example + of course this also works with a block code. @``` repeat2.gw diff --git a/docs/Reference/ControlFlow/forloop.mdr b/docs/Reference/ControlFlow/forloop.mdr index 52597f18..0337296c 100644 --- a/docs/Reference/ControlFlow/forloop.mdr +++ b/docs/Reference/ControlFlow/forloop.mdr @@ -8,7 +8,7 @@ for(int i; i < 3; ++i) @``` @exec make -s forloop0.test -Of course, it also works with a block of code. +It also works with a block of code. @``` forloop2.gw for(int i; i < 3; ++i) { @@ -45,8 +45,7 @@ for(auto a: array) { @exec make -s forloop4.test ### Auto Pointer loop -With the simple auto loop, you only get the value in the array. -If you want to change it, you need a pointer +If you want to change it the value in the array, you need a pointer @``` forloop5.gw int array[2][3]; diff --git a/docs/Reference/Functions/Lambdas.mdr b/docs/Reference/Functions/Lambdas.mdr index ce03cd8a..add84dd1 100644 --- a/docs/Reference/Functions/Lambdas.mdr +++ b/docs/Reference/Functions/Lambdas.mdr @@ -2,7 +2,7 @@ ## Overview -Simply put, *lambda*s are anonymous functions. +*lambda*s are anonymous functions. The syntax to create them is simple: ``` diff --git a/docs/Reference/Types/Enums.mdr b/docs/Reference/Types/Enums.mdr index 8759ae31..19cf9f7c 100644 --- a/docs/Reference/Types/Enums.mdr +++ b/docs/Reference/Types/Enums.mdr @@ -6,16 +6,19 @@ you can read about those [here](https://en.wikipedia.org/wiki/Enumerated_type) ## Enums in gwion -You simply use an enum like this -``` enum0.gw + +You use an enum like this + +@``` enum0.gw enum Optionnal_name { zero, one, two }; <<< zero, one, two >>>; -``` +@``` +@exec make -s enum0.test + +## Storage and access Specifiers When inside a class, -Enums are automatically declared **static**, +Enums are automatically declared **static**, and can't be **global** but they accept **private** or **protect** specifiers. - -When not in a class, they can be made `global` diff --git a/docs/config.mk.orig b/docs/config.mk.orig deleted file mode 100644 index 9cecde9e..00000000 --- a/docs/config.mk.orig +++ /dev/null @@ -1,32 +0,0 @@ -# tool to build the doc -DOCTOOL = mkdocs -q -DOCBUILD = build -DOCSERVE = serve - -# output box css -BACKGROUND = background-color:\#f2f2f2; -BORDER = border: 5px solid \#546e7a; -PADDING = padding: 10px; -MARGIN = margin-right: 20%; margin-left: 20%; -BORDER_RADIUS = -moz-border-radius: 15px; -webkit-border-radius: 15px; -CSS = "$(BACKGROUND) $(BORDER) $(PADDING) $(MARGIN) $(BORDER_RADIUS)" - -# output box status -NOTERM_OK= &\#10004; -NOTERM_NOT_OK= &\#10008; - -# terminal status -INTERM_OK = \033[32mOK\033[0m -INTERM_NOT_OK = \033[31mNOT OK\033[0m - -# valgrind -VALGRIND ?= valgrind -VALGRIND_LOG ?= vlog -VALGRIND_OPT += --leak-check=yes --log-file=${VALGRIND_LOG} - -## ensure no valgrind if requested -ifeq ($(VALGRIND), NO_VALGRIND) -VALGRIND = -VALGRIND_OPT = -endif - diff --git a/scripts/mdr2mdbook.sh b/scripts/mdr2mdbook.sh index c0a1e51b..968804b1 100644 --- a/scripts/mdr2mdbook.sh +++ b/scripts/mdr2mdbook.sh @@ -10,7 +10,10 @@ EOF } mk_target() { - sed 's/```\(.*\)gw/```\1cpp/' $1 + sed 's/```\(.*\)gw/```\1cpp/' $1 | + sed 's/:tada:/\😜/g' | + sed 's/:champagne:/\🍾/g' | + sed 's#:gwion:#[Gwion](https://github.com/fennecdjay/Gwion)#g' footer } @@ -19,6 +22,7 @@ ensure_dir() { } doc2src() { +echo $1 mdr $1 || return mdfile=${1::-1} target=$(sed 's/docs/src/' <<< $mdfile) @@ -37,6 +41,5 @@ runall() { if [ $1 ] #then [[ $1 == *".mdr" ]] && doc2src $1 then [ -f $1 ] && doc2src $1 -echo $1 else runall fi -- 2.43.0