diff --git a/README.md b/README.md index a7ffee3..6c32363 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ -# prettier-plugin-jinja-template - -Formatter plugin for jinja2 template files. +# prettier-plugin-askama-template +[prettier-plugin-jinja-template](https://github.com/davidodenwald/prettier-plugin-jinja-template) but with patches to work with Askama. ## Install ```bash -npm install --save-dev prettier prettier-plugin-jinja-template +npm install --save-dev prettier https://git.fetbuk.ru/WerySkok/prettier-plugin-askama-template.git ``` Add the plugin to your `.prettierrc`: ```json { - "plugins": ["prettier-plugin-jinja-template"] + "plugins": ["prettier-plugin-askama-template"] } ``` @@ -24,7 +23,7 @@ To format basic .html files, you'll have to override the used parser inside your { "files": ["*.html"], "options": { - "parser": "jinja-template" + "parser": "askama-template" } } ] @@ -38,5 +37,5 @@ npx prettier --write **/*.html If you don't have a prettier config you can run the plugin with this command: ```bash -npx prettier --write **/*.html --plugin=prettier-plugin-jinja-template +npx prettier --write **/*.html --plugin=prettier-plugin-askama-template ``` \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c33ba83..68f4419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "prettier-plugin-jinja-template", + "name": "prettier-plugin-askama-template", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "prettier-plugin-jinja-template", + "name": "prettier-plugin-askama-template", "version": "1.0.0", "license": "MIT", "devDependencies": { @@ -17,7 +17,7 @@ "typescript": "^5.1.6" }, "peerDependencies": { - "prettier": "^2.0.0" + "prettier": "^3.0.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index bd6e989..7019a78 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,23 @@ { - "name": "prettier-plugin-jinja-template", + "name": "prettier-plugin-askama-template", "version": "1.0.0", - "description": "Prettier plugin for formatting jinja templates.", + "description": "prettier-plugin-jinja-template but with patches to work with Askama.", "author": "David Odenwald", "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/davidodenwald/prettier-plugin-jinja-template.git" + "url": "git+https://git.fetbuk.ru/WerySkok/prettier-plugin-askama-template.git" }, "bugs": { - "url": "https://github.com/davidodenwald/prettier-plugin-jinja-template/issues" + "url": "https://git.fetbuk.ru/WerySkok/prettier-plugin-askama-template/issues" }, - "homepage": "https://github.com/davidodenwald/prettier-plugin-jinja-template#readme", + "homepage": "https://git.fetbuk.ru/WerySkok/prettier-plugin-askama-template#readme", "keywords": [ "prettier", "plugin", "template", "html", - "jinja", - "jinja2", - "flask" + "askama" ], "main": "lib/index.js", "scripts": { diff --git a/src/index.ts b/src/index.ts index 0fc00fb..26aa953 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,14 +3,14 @@ import { parse } from "./parser"; import { print, embed, getVisitorKeys } from "./printer"; import { Parser, Printer, SupportLanguage } from "prettier"; -const PLUGIN_KEY = "jinja-template"; +const PLUGIN_KEY = "askama-template"; export const languages: SupportLanguage[] = [ { - name: "JinjaTemplate", + name: "AskamaTemplate", parsers: [PLUGIN_KEY], - extensions: [".jinja", ".jinja2", ".j2", ".html"], - vscodeLanguageIds: ["jinja"], + extensions: [".jinja", ".jinja2", ".j2", ".html", "askama"], + vscodeLanguageIds: ["askama"], }, ]; diff --git a/src/jinja.ts b/src/jinja.ts index fce32ed..a971427 100644 --- a/src/jinja.ts +++ b/src/jinja.ts @@ -42,4 +42,5 @@ export const nonClosingStatements = [ "from", "extends", "pluralize", + "when" ];