Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 829 Bytes

hello_javascript.md

File metadata and controls

48 lines (33 loc) · 829 Bytes

testing

To run this example run these commands in your shell:

cd
git clone https://github.com/rusthon/Rusthon.git
cd Rusthon/
./rusthon.py ./examples/hello_javascript.md

html

@index.html

<html>
<head>

<@myscript>

</head>
<body>
<button onclick="javascript:hello_world()">clickme</button>

</body>
</html>

Above a special syntax is used @myscript this tells Rusthon where to insert the output of scripts it translates using the javascript backend below.

rusthon javascript backend

Below @myscript is given on the line just before the fenced rusthon code block. This allows you to insert multiple scripts into your html, in the head or body.

@myscript

#backend:javascript
from runtime import *

def hello_world():
	window.alert("hi")