Wait, wait, I'm confused


After years of working with HTML, coders know that hyperlinks are specified using an href attribute and images are specified using a src attribute, but c'mon who remembers what to use for objects, forms and blockquotes?

There are many places in HTML where external URLs are specified, but it's all too arbitrary how it's done. Consider all these HTML tags, and the attributes used for their external source files:

semantax attribute
a href
link href
area href
base href
img src
input src
source src
audio src
video src
embed src
track src
iframe src
img src
script src
object data
form action
blockquote cite
q cite

Sourceref syntax

BLUEPHRASE cleans this up by leveling the notation for URLs into sourceref notation: simply surround the path and file with grave accents ` ... `. When the BLUEPROCESSOR's smart technology encounters this notation, it uses the current semantic context to determine which HTML attribute to emit.

Here's a sample ...

h1 Quote of the Day
blockquote `Yogi Berra` When you come to a fork in the road take it!
img `yogi-berra.png`

h1 Heard any Good Ones Lately?
form `api-v1/submit-form` {
p Have a funny quote you'd like to share? Tell us!
input *type=text *name=user-submission
input *type=image `submit.gif`

h1 Enough to Make You Cry
a `https://onion.com/` the Onion

and it's equivalent HTML ...

<h1>Quote of the Day</h1>
<blockquote cite='Yogi Berra'>When you come to a fork in the road take it!</blockquote>
<img src='yogi-berra.png' />

<h1>Heard any Good Ones Lately?</h1>
<form action='api-v1/submit-form'>
<p>Have a funny quote you'd like to share? Tell us!</p>
<input type=text name=user-submission />
<input src='submit.gif' type=image />

<h1>Enough to Make You Cry</h2>
<a href='https://onion.com/'>the Onion</a>

Pragmas with sourcerefs

The BLUEPHRASE notation for sourcerefs extends to pragmas as well. The use, enclosure, and include pragmas all specify external files using sourcerefs.

!use `standard-vars.blue`
!enclosure `template.blue`
!include `menu.blue`

Using BLUEPHRASE for config files

Software developers who develop configuration files will really appreciate how this consistency and ease of use works. The notation acts as both a delimiter — especially important when filename have spaces or special characters; and a syntactic shorthand — there's no need to specify a keyword for your key-value pairs.

Here's a real life example of an RWSERVE configuration file:

server {
port 7443
cache-control {
`favicon.ico` *instructions='public, max-age=86400'
plugins {
rwserve-visitor-count {
location `/srv/rwserve-plugins/node_modules/rwserve-visitor-count/dist/index.js`
config {
save-as `/var/log/rwserve/localhost.daily-counts.txt`
router {
`/favicon.ico` *methods=GET *plugin=rwserve-visitor-count
`*.blue` *methods=GET,HEAD *plugin=rwserve-blue

host {
hostname example.com
document-root `/rwserve/test/fixtures/public`
encoding-cache `/rwserve/test/fixtures/encoding-cache`
dynamic-cache `/rwserve/test/fixtures/dynamic-cache`

tls {
private-key `/etc/letsencrypt/live/example.com/privkey.pem`
certificate `/etc/letsencrypt/live/example.com/fullchain.pem`

Wait, wait, I'm confused

🔗 🔎