Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

razorleaf

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

razorleaf - npm Package Compare versions

Comparing version 2.3.1 to 2.4.0

LICENSE

4

compiler.js

@@ -12,3 +12,3 @@ "use strict";

function wrapExpression(expression) {
return POSSIBLE_COMMENT.test(expression) ? expression + '\n' : expression;
return POSSIBLE_COMMENT.test(expression) ? expression + "\n" : expression;
}

@@ -74,3 +74,3 @@

if (part.type === 'text') {
if (part.type === "text") {
part.value = part.value.substring(1);

@@ -77,0 +77,0 @@ break;

{
"name": "razorleaf",
"version": "2.3.1",
"version": "2.4.0",
"main": "razorleaf.js",

@@ -5,0 +5,0 @@ "files": [

@@ -384,6 +384,2 @@ "use strict";

function escapeState(parser, c) {
if (c === null) {
throw parser.error("Expected escape character");
}
if (c === "#" || c === '"') {

@@ -407,5 +403,3 @@ parser.string.addText(c);

// TODO: Allow LineTerminator to be escaped?
return stringState(parser, c);
throw parser.error("Expected escape sequence");
}

@@ -412,0 +406,0 @@

@@ -13,16 +13,20 @@ Razor Leaf is a template engine for JavaScript with a convenient

p
```
p
```
<!-- -->
```html
<p></p>
```
<p></p>
Void elements are recognized automatically.
meta
```
meta
```
<!-- -->
```html
<meta>
```
<meta>
### Strings

@@ -34,27 +38,33 @@

"--> A string <--\n" "A string containing \"double-quotes\""
```
"--> A string <--\n" "A string containing \"double-quotes\""
```
<!-- -->
```html
--&gt; A string &lt;--
A string containing "double-quotes"
```
--&gt; A string &lt;--
A string containing "double-quotes"
Strings can also contain interpolated sections, delimited by `#{` and `}`.
`#{` can be escaped with a leading backslash; `}` doesn’t require escaping.
"#{6 * 7}"
```
"#{6 * 7}"
```
<!-- -->
```html
42
```
42
If an exclamation mark precedes the string, it and any of its interpolated
sections will not be escaped.
!"<!-- A significant comment -->"
```
!"<!-- A significant comment -->"
```
<!-- -->
```html
<!-- A significant comment -->
```
<!-- A significant comment -->
### Attributes

@@ -68,8 +78,10 @@

meta charset: "utf-8"
```
meta charset: "utf-8"
```
<!-- -->
```html
<meta charset="utf-8">
```
<meta charset="utf-8">
### Classes

@@ -79,9 +91,11 @@

fieldset .upload-meta
input.required
```
fieldset .upload-meta
input.required
```
<!-- -->
```html
<fieldset class="upload-meta"><input class="required"></fieldset>
```
<fieldset class="upload-meta"><input class="required"></fieldset>
### Hierarchy

@@ -91,20 +105,24 @@

html
head
meta charset: "utf-8"
```
doctype
title "Example"
html
head
meta charset: "utf-8"
link
rel: "stylesheet"
type: "text/css"
href: "stylesheets/example.css"
title "Example"
body
p id: "introduction"
"This template is a brief example of hierarchy."
link
rel: "stylesheet"
type: "text/css"
href: "stylesheets/example.css"
<!-- -->
body
p id: "introduction"
"This template is a brief example of hierarchy."
```
<html><head><meta charset="utf-8"><title>Example</title><link rel="stylesheet" type="text/css" href="stylesheets/example.css"></head><body><p id="introduction">This template is a brief example of hierarchy.</p></body></html>
```html
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Example</title><link rel="stylesheet" type="text/css" href="stylesheets/example.css"></head><body><p id="introduction">This template is a brief example of hierarchy.</p></body></html>
```

@@ -128,17 +146,21 @@ Content found after an element on the same line will also be considered that

% function countTo(n)
% for (var i = 1; i <= n; i++)
"#{i}"
```
% function countTo(n)
% for (var i = 1; i <= n; i++)
"#{i}"
% countTo(5);
% countTo(5);
```
might compile to this JavaScript:
function countTo(n) {
for (var i = 1; i <= n; i++) {
output += i;
}
```javascript
function countTo(n) {
for (var i = 1; i <= n; i++) {
output += i;
}
}
countTo(5);
countTo(5);
```

@@ -145,0 +167,0 @@ ### Special blocks

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc