Skip to content

Releases: FlamesX-128/denoTag

Better Algorithm

20 Feb 20:49
Compare
Choose a tag to compare
import { render } from "https://deno.land/x/[email protected]/mod.ts";

const html = Deno.readTextFileSync(
    new URL("assets/main.html", import.meta.url)
);

console.log(
    await render(html, {
        params: {
            timestamp: Date.now()
        }
    })
)
<!-- You can use <deno>, <script type="application/typescript">, or a custom query by adjusting the configuration. -->
<body>
    <p>
        The value of the fibonacci sequence is:
        <script type="application/typescript">
            function fibonacci(n: number): number {
                if (n <= 1) {
                    return n;
                }
                return fibonacci(n - 1) + fibonacci(n - 2);
            }
    
            return fibonacci(20);
        </script>
    </p>

    <deno>
        return Date.now() - params.timestamp;
    </deno>
</body>
<!-- When evaluated, it becomes into this -->
<!DOCTYPE html>
<html lang="es">

<head>
    <title>denoTag</title>
</head>

<body>
    <p>
        The value of the fibonacci sequence is:
        6765
    </p>

    13
</body>

</html>

Server variables

10 Jan 16:51
b542d35
Compare
Choose a tag to compare

Deno Tag

A simple html preprocessor for deno.

ChangeLog

0.1.0 - Server variables:

  • Now you can use send variables.

Examples

Example One:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    // This is a standard function that adds something to the html.
    Write("Hello world");
  </deno>
</body>

Result:

<body>
  Hello world
</body>

Example Two:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html", {
    hello: "hello world!"
  });
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    for (const txt of ["orange", "apple"]) 
      write(txt);
    
    // Get sent variable.
    write(data.hello)
  </deno>
</body>

Result:

<body>
  orange
  apple
  hello world!
</body>

Information:

Deno tag only accepts JS, tested with:

  • deno 1.14.3 (release, x86_64-unknown-linux-gnu)

  • v8 9.4.146.19

  • typescript 4.4.2

Bug in await fixed

10 Nov 04:58
Compare
Choose a tag to compare

Deno Tag

A simple html preprocessor for deno.

ChangeLog

0.0.2 - Bug in await fixed:

  • Fixed a bug that did not allow use of await.

0.0.1 - First release:

  • This is the first version!

Examples

Example One:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    // This is a standard function that adds something to the html.
    Write("Hello world");
  </deno>
</body>

Result:

<body>
  Hello world
</body>

Example Two:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    for (const txt of ["orange", "apple"]) {
      write(txt);
    }
  </deno>
</body>

Result:

<body>
  orange
  apple
</body>

Information:

Deno tag only accepts JS, tested with:

  • deno 1.14.3 (release, x86_64-unknown-linux-gnu)

  • v8 9.4.146.19

  • typescript 4.4.2

First release

10 Nov 01:26
a44dca2
Compare
Choose a tag to compare

Deno Tag

A simple html preprocessor for deno.

Change Log:

This is the list of changes:

  • 0.0.1 - first release:
    • Deno tag:
        <deno>
          console.log("Hello Deno!");
        </deno>
    • write: This is a function that adds something to the html.

Examples:

Example One:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    // This is a standard function that adds something to the html.
    Write("Hello world");
  </deno>
</body>

Result:

<body>
  Hello world
</body>

Example Two:

// main.ts
import render from "https://deno.land/x/denotag/mod.ts";

(async function main() {
  const res = await render("./main.html");
  
  console.log(res);
})();
<!-- main.html -->
<body>
  <deno>
    for (const txt of ["orange", "apple"]) {
      write(txt);
    }
  </deno>
</body>

Result:

<body>
  orange
  apple
</body>

Information:

Deno tag only accepts JS, tested with:

  • deno 1.14.3 (release, x86_64-unknown-linux-gnu)

  • v8 9.4.146.19

  • typescript 4.4.2