Git Product home page Git Product logo

tagscript's Introduction

TagScript Logo

TagScript

A simple and safe template engine.

Continuous Integration codecov

Packages

npm npm-tagscript npm npm-tagscript-plugin-discord

Description

TagScript is a drop in easy to use string interpreter that lets you provide users with ways of customizing their profiles or chat rooms with interactive text.

Read Full Documentation here.

Features

  • Written In Typescript
  • Offers CJS, ESM and UMD builds
  • Full TypeScript & JavaScript support
  • Blazingly Fast ⚡
  • Simple, expressive and safe template engine.
  • Supports many plugins.

Usage


Note: While examples uses import, it maps 1:1 with CommonJS' require syntax. For example,

import { Interpreter } from 'tagscript';

is the same as

const { Interpreter } = require('tagscript');

import { Interpreter, RandomParser, RangeParser, FiftyFiftyParser, IfStatementParser, SliceParser } from 'tagscript';
const ts = new Interpreter(new SliceParser(), new FiftyFiftyParser(), new RandomParser(), new IfStatementParser());

const result = await ts.run(
	`
    {random: Parbez,Rkn,Priyansh} attempts to pick the lock!,
    I pick {if({5050:.}!=):heads|tails}
    `
); // Parbez attempts to pick the lock!, I pick heads

For more usage, check out the documentation here.

Buy me some doughnuts

If you want to support me by donating, you can do so by using any of the following methods. Thank you very much in advance!

Buy Me A Coffee Buy Me a Coffee at ko-fi.com

Contributors ✨

Thanks goes to these wonderful people:

tagscript's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tagscript's Issues

Improve test coverage

### TODO
- [ ] Need to improve test coverage. Also, there are some todo comments present in test files. So need to fix them
- [ ] add browser test

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): update codecov/codecov-action digest to 5ecb98a
  • chore(deps): update all non-major dependencies (@types/node, @vitest/coverage-v8, vitest, yarn)
  • chore(deps): update dependency typedoc-plugin-markdown to v4

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/auto-deprecate.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
.github/workflows/codeql-analysis.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • github/codeql-action v3@d39d31e687223d841ef683f52467bd88e9b21c14
  • github/codeql-action v3@d39d31e687223d841ef683f52467bd88e9b21c14
  • github/codeql-action v3@d39d31e687223d841ef683f52467bd88e9b21c14
.github/workflows/continuous-delivery.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
.github/workflows/continuous-integration.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
  • actions/upload-artifact v4@65462800fd760344b1a7b4382951275a0abb4808
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/download-artifact v4@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
.github/workflows/deprecate-on-merge.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • actions/setup-node v4@60edb5dd545a775178f52524783378180af0d1f8
.github/workflows/labelsync.yml
  • actions/checkout v4@0ad4b8fadaa221de15dcec353f45205ec38ea70b
  • crazy-max/ghaction-github-labeler v5@de749cf181958193cb7debf1a9c5bb28922f3e1b
.github/workflows/pr-triage.yml
  • actions/labeler v5@8558fd74291d67161a8a78ce36a881fa63b766a9
scripts/uploadCoverage/action.yml
  • codecov/codecov-action v4@84508663e988701840491b86de86b666e8a86bed
  • codecov/codecov-action v4@84508663e988701840491b86de86b666e8a86bed
scripts/yarnCache/action.yml
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/cache v4.0.2@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
npm
apps/website/package.json
  • @unocss/reset ^0.59.4
  • eslint-plugin-mdx ^3.1.5
  • framer-motion ^11.1.7
  • next ^14.2.3
  • nextra ^2.13.4
  • nextra-theme-docs ^2.13.4
  • react ^18.3.1
  • react-dom ^18.3.1
  • sharp ^0.33.3
  • @types/react ^18.3.1
  • @types/react-dom ^18.3.0
  • @types/sharp ^0.32.0
  • @unocss/cli ^0.59.4
  • concurrently ^8.2.2
  • unocss ^0.59.4
package.json
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @favware/cliff-jumper ^3.0.3
  • @favware/colorette-spinner ^1.0.1
  • @favware/npm-deprecate ^1.0.7
  • @types/node ^20.12.7
  • @types/prompts ^2.4.9
  • @vitest/coverage-v8 ^1.5.2
  • cz-conventional-changelog ^3.3.0
  • eslint ^8.57.0
  • eslint-config-mahir ^0.0.43
  • husky ^9.0.11
  • lint-staged ^15.2.2
  • prettier ^3.2.5
  • prompts ^2.4.2
  • replace-in-file ^7.1.0
  • tsup ^8.0.2
  • turbo ^1.13.3
  • typedoc ^0.25.13
  • typedoc-plugin-external-link ^2.1.2
  • typedoc-plugin-markdown 3.17.1
  • typedoc-plugin-mdn-links ^3.1.23
  • typescript ^5.4.5
  • unocss ^0.59.4
  • vitest ^1.5.2
  • ansi-regex ^5.0.1
  • minimist ^1.2.8
  • yarn 4.1.1
packages/tagscript-plugin-discord/package.json
  • @favware/cliff-jumper ^3.0.3
  • discord.js ^14.14.1
  • tsup ^8.0.2
  • typescript ^5.4.5
packages/tagscript/package.json
  • @favware/cliff-jumper ^3.0.3
  • tsup ^8.0.2
  • typescript ^5.4.5

  • Check this box to trigger a request for Renovate to run again on this repository

[`tagscript-plugin-discord`] Return `thumbnail` and `image` in object form

    https://github.com/imranbarbhuiya/TagScript/issues/119#issuecomment-1273972081

How do I fix this issue?

This definitely needs to be changed but it'll be a breaking change so create a new issue and I'll fix it in the next major release (not very soon tho) till then you can fix it like this

const embedData = result,actions.embed;
if (embedData) {
if(typeof embedData.thumbnail === 'string') embedData.thumbnail = {url: embedData.thumbnail};
// same for image
   embed = = new EmbedBuilder(embedData);
}

#119 (comment)

Originally posted by @imranbarbhuiya in #119 (comment)

EmbedParser doesn't work

Code:

const { Interpreter, StringTransformer } = require("tagscript")

const ts = new Interpreter();

let result = await ts.run('{args}', { args: new StringTransformer('Hi, How are you?') });

console.log(result)

Returns:

Response {
  raw: '{args}',
  body: '{args}',
  variables: {
    args: StringTransformer { str: 'Hi, How are you?', escape: false }
  },
  actions: {},
  keyValues: {}
}

Shouldn't the output be:

Response {
  raw: '{args}',
  body: 'Hi, How are you?',
  variables: {
    args: StringTransformer { str: 'Hi, How are you?', escape: false }
  },
  actions: {},
  keyValues: {}
}

Plugins such as tagscript-plugin-discord doesn't work as well, when using transformers.

Package Versions:

"discord.js": "^14.5.0",
"tagscript": "^1.2.11",
"tagscript-plugin-discord": "^2.0.4"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.