The Origami dialect of JavaScript lets you use a URL directly in an expression.
site.ori
{
// Retrieve text from the network
sample = https://weborigami.org/samples/cli/sample.txt
}
$ ori site.ori/
sample: |
This is a text file.
$
Use a URL to inline an SVG from a server of design assets directly into an HTML page.
page.ori.html
<!DOCTYPE html>
<html>
<body>
<button style="align-items: center; display: grid; grid-auto-flow: column;">
${ https://weborigami.org/samples/help/home.svg }
<span>Home</span>
</button>
</body>
</html>
http://localhost:5000/
Origami supports file extensions, so you can download data with a URL and then extract the information you want.
$ ori https://weborigami.org/samples/help/pet.json
{
"name": "Fluffy",
"owner": "Alice"
}
$ ori "(https://weborigami.org/samples/help/pet.json).name"
Fluffy
$
You can even use network data in a map to render each item as HTML!
books.ori.html
<ul>
${ Tree.map(https://weborigami.org/samples/help/books.yaml, (book) => Tree.indent`
<li>${ book.title }</li>
`) }
</ul>
http://localhost:5000/books.html
- 1984
- Pride and Prejudice
- Jane Eyre
- Frankenstein
- The Time Traveler's Wife
Read more: URLs in Origami expressions