-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Joe7M/master
Syntax highlight for nano and tutorial for sbasicw
- Loading branch information
Showing
8 changed files
with
113 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SmallBASIC in nano | ||
|
||
> Using nano | ||
_"GNU nano is a text editor for Unix-like computing systems or operating environments using a command line interface. " ([Wikipedia](https://en.wikipedia.org/wiki/GNU_nano))_ | ||
|
||
|
||
![Example](https://raw.githubusercontent.com/Joe7M/smallbasic.nano.syntaxcoloring/main/screenshot.png) | ||
|
||
## Installation | ||
|
||
- Download the file `smallbasic.nanorc` from [github](https://github.com/Joe7M/smallbasic.nano.syntaxcoloring) | ||
- Create the folder `~/.config/nano/syntax` | ||
- Copy the file "smallbasic.nanorc" into that folder | ||
- Edit the nano configuration file -> `nano ~/.config/nano/nanorc` | ||
- In the section `## === Syntax coloring ===` add `include "~/.config/nano/syntax/*.nanorc"` | ||
|
||
## Tweaking nano | ||
|
||
Depending on your Linux distribution the default nano settings are a little bit disappointing. | ||
But fortunately you can tweak nano quite a bit by activating some settings in `nanorc`. | ||
Just remove the comments for: | ||
|
||
1. `set autoindent` | ||
2. `set indicator` | ||
3. `set linenumbers` | ||
4. `set minibar` | ||
5. `set mouse` | ||
6. Remove the comments in the section `### Paint the interface elements of nano` to make nano colorful. | ||
7. `include "/usr/share/nano/*.nanorc"` | ||
8. To get more common keyboard shortcuts like CTRL+C for copy uncomment all the commands in the section | ||
`## If you would like nano to have keybindings that are more "usual"` | ||
|
||
## A useful hint | ||
|
||
If you use nano in a console you can suspend it by pressing `CTRL-Z`. After pressing `CTRL-Z` you are on the | ||
console and you can i.e. start the console version of SmallBASIC to test your program. After testing | ||
you can switch back to the suspended nano by executing the command `fg` in the console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
SBASICW | ||
======= | ||
|
||
> `sbasicw` is a web server which can display the output of a SmallBASIC program in a browser. | ||
> It can also be used to dynamically generate websites using SmallBASIC commands. | ||
## Getting started | ||
|
||
### Render to canvas | ||
|
||
Launch `sbasicw` (Linux) or `sbasicw.exe` (Windows) in a folder containing the files of your website. | ||
It is quite helpful, if `sbasicw` is in the search path. After you started the web server you can open in | ||
your browser the URL `http://127.0.0.1:8080`. This will display the file `index.html`. You can also load | ||
`http://127.0.0.1:8080/myprogram.bas`. This will execute the SmallBASIC file `myprogram.bas`. The output | ||
(graphics and text) will be rendered to an HTML5 canvas and displayed as a bitmap in your browser. Only a | ||
snapshot of the output is displayed i.e., you would only see one frame of an animation in your web browser. | ||
|
||
### HTML text output | ||
|
||
Launch the web server in a folder containing the files of your website with the following command: | ||
|
||
``` | ||
sbasicw --graphic-text="0" | ||
``` | ||
|
||
If you call a SmallBASIC file, graphics output will still be rendered to an HTML5 canvas. But output of | ||
the `print` command is interpreted as text by the browser. You can print HTML and even Java script commands. | ||
|
||
## Transfer data | ||
|
||
`sbasicw` supports sending data using the get method. To send variables to a SmallBASIC program add `?var1=value1&var2=value2...&varN=valueN` to the URL of the website. You can then read the values of the | ||
variables using the `env()` function, for example `v = env("var1")`. | ||
|
||
## Tutorial | ||
|
||
[sbasicw_tutorial.zip](/assets/sbasicw_tutorial.zip) contains several HTML and SmallBASIC files. To start the | ||
tutorial extract the files to a folder of your choice and launch the web sever in this folder with: | ||
|
||
``` | ||
Linux: sbasicw --graphic-text="0" | ||
Windows: sbasicw.exe --graphic-text="0" | ||
``` | ||
|
||
Open a browser and start the tutorial with `http://127.0.0.1:8080`. You will learn how to link between HTML | ||
files, dynamically generate HTML files using SmallBASIC, create forms, process the input of the forms and | ||
draw graphics to an HTML canvas. | ||
|
||
![Page 7 of the tutorial](/images/sbasicw_screenshot.png) | ||
|
||
## Run the web server in the background | ||
|
||
If you want to start the web server in the background, use the following command: | ||
|
||
``` | ||
sbasicw & | ||
sbasicw --graphic-text="0" & | ||
``` | ||
|
||
If an error message like `[1] + suspended (tty input) sbasicw` is displayed, then start the server with: | ||
|
||
``` | ||
sbasicw < /dev/null & | ||
sbasicw --graphic-text="0" < /dev/null & | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.