Skip to content

Instantly share code, notes, and snippets.

@lepinekong
Last active October 18, 2017 22:52
Show Gist options
  • Save lepinekong/b267d7a3ce5b32f906858ff03fb3ee16 to your computer and use it in GitHub Desktop.
Save lepinekong/b267d7a3ce5b32f906858ff03fb3ee16 to your computer and use it in GitHub Desktop.
Html5 DSL
Red[]
to-rebol-file: :to-red-file
print "get-vars loaded"
get-vars: func[source-file][
vars: []
html-template: read to-rebol-file source-file
rules: [any [thru "<%" copy var to "%>" (append vars var)]]
parse html-template rules
return vars
]
<!DOCTYPE html>
<html lang="<%lang%>">
<head>
<title><%title%></title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<h1><%title%></h1>
</body>
</html>
@lepinekong
Copy link
Author

do %autoload.red
get-vars %bootstrap.r.tpl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment