mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-22 14:04:47 +00:00
commit
0f976effe3
39 changed files with 1805 additions and 392 deletions
|
|
@ -3,7 +3,9 @@ const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
|||
const criticalCss = require("eleventy-critical-css");
|
||||
const slugify = require("slugify");
|
||||
const metagen = require("eleventy-plugin-metagen");
|
||||
|
||||
const i18n = require('eleventy-plugin-i18n');
|
||||
const translations = require('./src/_data/i18n');
|
||||
const locales = require('./src/_data/locales');
|
||||
const fs = require('fs');
|
||||
const outdent = require('outdent');
|
||||
const schema = require("@quasibit/eleventy-plugin-schema");
|
||||
|
|
@ -141,6 +143,8 @@ module.exports = function(eleventyConfig) {
|
|||
return JSON.stringify(text).replace(/(?:\\n\s*){2,}/g, "\\n");
|
||||
});
|
||||
|
||||
|
||||
|
||||
eleventyConfig.addFilter("niceDate", (value) => {
|
||||
try{
|
||||
const options = {year: 'numeric', month: 'short', day: 'numeric' };
|
||||
|
|
@ -151,6 +155,8 @@ module.exports = function(eleventyConfig) {
|
|||
|
||||
});
|
||||
|
||||
|
||||
|
||||
eleventyConfig.addFilter("algExcerpt", (text) => {
|
||||
return text
|
||||
.replace(/<code class="language-.*?">.*?<\/code>/gs, "")
|
||||
|
|
@ -188,9 +194,62 @@ module.exports = function(eleventyConfig) {
|
|||
fontawesomeSubset({
|
||||
brands:['discord', 'github'],
|
||||
regular:['envelope', 'life-ring'],
|
||||
solid: ['arrow-circle-right', 'pencil-alt', 'envelope', 'share', 'infinity', 'search', 'book', 'project-diagram', 'heart', 'address-card', 'server', 'database', 'ship', 'code', 'chart-bar', 'sitemap', 'tasks', 'lock', 'sliders-h', 'user', 'users', 'compass', 'download', 'sync-alt']
|
||||
solid: ['globe', 'arrow-circle-right', 'pencil-alt', 'envelope', 'share', 'infinity', 'search', 'book', 'project-diagram', 'heart', 'address-card', 'server', 'database', 'ship', 'code', 'chart-bar', 'sitemap', 'tasks', 'lock', 'sliders-h', 'user', 'users', 'compass', 'download', 'sync-alt']
|
||||
}, '_site/static/font/fontawesome/webfonts');
|
||||
|
||||
eleventyConfig.addPlugin(i18n, {
|
||||
translations,
|
||||
fallbackLocales: {
|
||||
'*': 'en-US'
|
||||
}
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("baseUrl", (text) => {
|
||||
return text.replace(/(?:ru)\//g, "");
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("i18n_locale", (current_locale, locale_list) => {
|
||||
|
||||
return locale_list.filter(x => {return x.code === (current_locale ?? "en-US")})[0].label;
|
||||
})
|
||||
|
||||
eleventyConfig.addFilter("i18n_urls", (page, all) => {
|
||||
console.log(page)
|
||||
var locale_urls = locales.map((x => { if (x.url != "") return x.url })).filter(x => {return x !== undefined});
|
||||
|
||||
var split_url = page.split('/').length > 1 ? page.split('/')[1] : "";
|
||||
|
||||
// find the current locale
|
||||
var active_local = "";
|
||||
|
||||
locale_urls.every(locale => {
|
||||
if(locale === split_url){
|
||||
active_local = locale
|
||||
return true;
|
||||
}
|
||||
})
|
||||
|
||||
// get remaining locales
|
||||
var remaining_locals = locales.map((x => { return x.url })).filter(x => {return x !== active_local});
|
||||
|
||||
var i18n_pages = []
|
||||
|
||||
var valid_urls = all.map(x => {return x.url})
|
||||
|
||||
remaining_locals.forEach(x => {
|
||||
var new_url = ("/" + page.replace(active_local,x)).replace(/\/{2,}/,"/");
|
||||
console.log(new_url)
|
||||
if (valid_urls.indexOf(new_url)){
|
||||
i18n_pages.push({
|
||||
"url": new_url,
|
||||
"meta": locales.filter(y => {return y.url === x})[0]
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return i18n_pages
|
||||
});
|
||||
|
||||
return {
|
||||
dir: {
|
||||
input: "src",
|
||||
|
|
|
|||
51
docs/package-lock.json
generated
51
docs/package-lock.json
generated
|
|
@ -16,7 +16,9 @@
|
|||
"@quasibit/eleventy-plugin-schema": "^1.7.0",
|
||||
"@sindresorhus/slugify": "^2.1.0",
|
||||
"animate-sass": "^0.8.2",
|
||||
"animate.css": "github:animate-css/animate.css",
|
||||
"eleventy-critical-css": "^1.1.0",
|
||||
"eleventy-plugin-i18n": "^0.1.3",
|
||||
"md5": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -1055,6 +1057,11 @@
|
|||
"resolved": "https://registry.npmjs.org/animate-sass/-/animate-sass-0.8.2.tgz",
|
||||
"integrity": "sha512-6sZ34dusqb1HdZLNpJUNaZc0CuuLgFI8SqlyaxbSSKE9zqfoNtOeO3IpVUCqvaSm/oMNH1VlEAsJlppjg+idKQ=="
|
||||
},
|
||||
"node_modules/animate.css": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "git+ssh://git@github.com/animate-css/animate.css.git#b07baf2a0785c2a3c649e39ae962de65a2012951",
|
||||
"license": "Hippocratic-2.1"
|
||||
},
|
||||
"node_modules/ansi-colors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
|
|
@ -3311,6 +3318,16 @@
|
|||
"critical": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eleventy-plugin-i18n": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/eleventy-plugin-i18n/-/eleventy-plugin-i18n-0.1.3.tgz",
|
||||
"integrity": "sha512-O4FtB4t7g0T3ujH3ciFGCyJ/r1CHzp33WYrDqgnX6s6KZ4R63CkN/RndRKU36ahWWUmF0BrLjQ+IDwj2ntsicw==",
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"templite": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eleventy-plugin-metagen": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/eleventy-plugin-metagen/-/eleventy-plugin-metagen-1.5.2.tgz",
|
||||
|
|
@ -6600,6 +6617,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
|
||||
"integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM="
|
||||
},
|
||||
"node_modules/lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||
},
|
||||
"node_modules/lodash.isfinite": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz",
|
||||
|
|
@ -10719,6 +10741,11 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/templite": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/templite/-/templite-1.2.0.tgz",
|
||||
"integrity": "sha512-O9BpPXF44a9Pg84Be6mjzlrqOtbP2I/B5PNLWu5hb1n9UQ1GTLsjdMg1z5ROCkF6NFXsO5LQfRXEpgTGrZ7Q0Q=="
|
||||
},
|
||||
"node_modules/tempy": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz",
|
||||
|
|
@ -12440,6 +12467,10 @@
|
|||
"resolved": "https://registry.npmjs.org/animate-sass/-/animate-sass-0.8.2.tgz",
|
||||
"integrity": "sha512-6sZ34dusqb1HdZLNpJUNaZc0CuuLgFI8SqlyaxbSSKE9zqfoNtOeO3IpVUCqvaSm/oMNH1VlEAsJlppjg+idKQ=="
|
||||
},
|
||||
"animate.css": {
|
||||
"version": "git+ssh://git@github.com/animate-css/animate.css.git#b07baf2a0785c2a3c649e39ae962de65a2012951",
|
||||
"from": "animate.css@git+https://github.com/animate-css/animate.css.git"
|
||||
},
|
||||
"ansi-colors": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
|
|
@ -14178,6 +14209,16 @@
|
|||
"critical": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"eleventy-plugin-i18n": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/eleventy-plugin-i18n/-/eleventy-plugin-i18n-0.1.3.tgz",
|
||||
"integrity": "sha512-O4FtB4t7g0T3ujH3ciFGCyJ/r1CHzp33WYrDqgnX6s6KZ4R63CkN/RndRKU36ahWWUmF0BrLjQ+IDwj2ntsicw==",
|
||||
"requires": {
|
||||
"chalk": "^4.1.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"templite": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"eleventy-plugin-metagen": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/eleventy-plugin-metagen/-/eleventy-plugin-metagen-1.5.2.tgz",
|
||||
|
|
@ -16600,6 +16641,11 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz",
|
||||
"integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM="
|
||||
},
|
||||
"lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
||||
},
|
||||
"lodash.isfinite": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz",
|
||||
|
|
@ -19750,6 +19796,11 @@
|
|||
"resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz",
|
||||
"integrity": "sha512-aoBAniQmmwtcKp/7BzsH8Cxzv8OL736p7v1ihGb5e9DJ9kTwGWHrQrVB5+lfVDzfGrdRzXch+ig7LHaY1JTOrg=="
|
||||
},
|
||||
"templite": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/templite/-/templite-1.2.0.tgz",
|
||||
"integrity": "sha512-O9BpPXF44a9Pg84Be6mjzlrqOtbP2I/B5PNLWu5hb1n9UQ1GTLsjdMg1z5ROCkF6NFXsO5LQfRXEpgTGrZ7Q0Q=="
|
||||
},
|
||||
"tempy": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/tempy/-/tempy-1.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@
|
|||
"@quasibit/eleventy-plugin-schema": "^1.7.0",
|
||||
"@sindresorhus/slugify": "^2.1.0",
|
||||
"animate-sass": "^0.8.2",
|
||||
"animate.css": "github:animate-css/animate.css",
|
||||
"eleventy-critical-css": "^1.1.0",
|
||||
"eleventy-plugin-i18n": "^0.1.3",
|
||||
"md5": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
98
docs/src/_data/i18n/index.js
Normal file
98
docs/src/_data/i18n/index.js
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
module.exports = {
|
||||
hello: {
|
||||
'en-US': 'Hello',
|
||||
'ru': 'Hola'
|
||||
},
|
||||
title: {
|
||||
'en-US': "HTML Template Linter and Formatter",
|
||||
ru: "Программа проверки и форматирования шаблонов HTML"
|
||||
},
|
||||
// lang_name: {
|
||||
// 'en-US': "English",
|
||||
// ru: "Русский"
|
||||
// },
|
||||
// lang_code: {
|
||||
// 'en-US': "en",
|
||||
// ru: "ru"
|
||||
// },
|
||||
lang_code_url: {
|
||||
'en-US': "",
|
||||
ru: "/ru"
|
||||
},
|
||||
getting_started: {
|
||||
'en-US': "Getting Started",
|
||||
ru: "Начало Работы"
|
||||
},
|
||||
formatter: {
|
||||
'en-US': "Formatter",
|
||||
ru: "Форматер"
|
||||
},
|
||||
linter: {
|
||||
'en-US': "Linter",
|
||||
ru: "Линтер"
|
||||
},
|
||||
configuration: {
|
||||
'en-US': "configuration",
|
||||
ru: "Конфигурация"
|
||||
},
|
||||
integrations: {
|
||||
'en-US': "Integrations",
|
||||
ru: "Интеграции"
|
||||
},
|
||||
best_practices: {
|
||||
'en-US': "Best Practices",
|
||||
ru: "Лучшие Практики"
|
||||
},
|
||||
description: {
|
||||
'en-US': "Find common syntax errors, reformat to make your HTML templates shine! Supports django, jinja, nunjucks, twig, handlebars, mustache, golang, and more!",
|
||||
ru: "Найдите распространенные синтаксические ошибки, переформатируйте, чтобы ваши HTML-шаблоны сияли! Поддерживает django, jinja, nunjucks, twig, handlebars, mustache, golang и многое другое!"
|
||||
},
|
||||
updated: {
|
||||
'en-US': "Updated",
|
||||
ru: "Обновлен"
|
||||
},
|
||||
changelog: {
|
||||
'en-US': "Changelog",
|
||||
ru: "Изменения"
|
||||
},
|
||||
documentation: {
|
||||
'en-US': "Documentation",
|
||||
ru: "Документация"
|
||||
},
|
||||
index_title: {
|
||||
'en-US': "Lint & Format HTML Templates",
|
||||
ru: "Проверка и форматирование html-шаблонов"
|
||||
},
|
||||
index_description: {
|
||||
'en-US': "Once upon a time all the other programming languages had a formatter and linter. Css, javascript, python, the c suite, typescript, ruby, php, go, swift, and you know the others. <i>The cool kids on the block.</i><br>HTML templates were left out there on their own, in the cold, unformatted and unlinted :( The dirty corner in your repository. <i>Something had to change.</i><br>Welcome djLint, the free cleaning service for html templates!<br>And the html templates lived happily ever after.</p>",
|
||||
ru: "Когда-то давно все другие языки программирования имели форматтер и линтер. Css, javascript, python, c suite, typescript, ruby, php, go, swift, и вы знаете другие. <i>Крутые ребята в квартале.</i><br>HTML-шаблоны остались там сами по себе, на холоде, неформатированные и нелинкованные :( Грязный угол в вашем репозитории. <i>Что-то должно было измениться.</i><br>Добро пожаловать djLint, бесплатный сервис очистки html-шаблонов!<br>И html-шаблоны жили долго и счастливо.</p>"
|
||||
},
|
||||
index_fav_lang: {
|
||||
'en-US': "find your favorite template language!",
|
||||
ru: "найдите свой любимый язык шаблонов!"
|
||||
},
|
||||
index_show_format: {
|
||||
'en-US': "Show your format!",
|
||||
ru: "Покажите свой формат!"
|
||||
},
|
||||
index_watch: {
|
||||
'en-US': "Watch it run!",
|
||||
ru: "Смотрите, как он идет!"
|
||||
},
|
||||
index_add_badge: {
|
||||
'en-US': "Add a badge to your projects",
|
||||
ru: "Добавьте значок к своим проектам"
|
||||
},
|
||||
index_looks_like: {
|
||||
'en-US': "Looks like this:",
|
||||
ru: "Выглядит вот так:"
|
||||
},
|
||||
contributing:{
|
||||
'en-US': "Contributing",
|
||||
ru: "Вклад"
|
||||
},
|
||||
contributing_message: {
|
||||
'en-US': 'Contributions are welcome. Send a pr with a new feature, or checkout the <a href="https://github.com/Riverside-Healthcare/djlint/issues">issue</a> list and help where you can.',
|
||||
ru: 'Вклад в работу сайта приветствуется. Пришлите письмо с новой функцией или ознакомьтесь со <a href="https://github.com/Riverside-Healthcare/djlint/issues">списком проблем</a> и помогите, чем можете.'
|
||||
}
|
||||
};
|
||||
12
docs/src/_data/locales.js
Normal file
12
docs/src/_data/locales.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
module.exports = [
|
||||
{
|
||||
label: 'English',
|
||||
code: 'en-US',
|
||||
url: ''
|
||||
},
|
||||
{
|
||||
label: 'Русский',
|
||||
code: 'ru',
|
||||
url: 'ru'
|
||||
}
|
||||
];
|
||||
|
|
@ -7,36 +7,19 @@ layout: layout.njk
|
|||
<div class="column is-narrow mr-5">
|
||||
|
||||
<aside class="menu is-sticky">
|
||||
<!--<div id="search-wrap">
|
||||
<form id="search-form"
|
||||
class="mb-3"
|
||||
style="position: relative;">
|
||||
<div class="control has-icons-left is-flex-grow-1">
|
||||
<span class="icon is-small is-left"><span class="icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</span></span>
|
||||
<input id="search"
|
||||
class="input"
|
||||
type="text"
|
||||
label="search"
|
||||
placeholder="search the docs ..."/>
|
||||
</div>
|
||||
<div id="search-results" class="panel has-background-white"></div>
|
||||
</form>
|
||||
|
||||
</div>-->
|
||||
<p class="menu-label">
|
||||
Documentation
|
||||
{{ "documentation" | i18n }}
|
||||
</p>
|
||||
<ul class="menu-list">
|
||||
|
||||
<li><a class="{% if page.url == "/docs/getting-started/" %}is-active{% endif %}" href="/docs/getting-started/">Getting Started</a></li>
|
||||
<li><a class="{% if page.url == "/docs/formatter/" %}is-active{% endif %}" href="/docs/formatter/">Formatter</a></li>
|
||||
<li><a class="{% if page.url == "/docs/linter/" %}is-active{% endif %}" href="/docs/linter">Linter</a></li>
|
||||
<li><a class="{% if page.url == "/docs/configuration/" %}is-active{% endif %}" href="/docs/configuration/">Configuration</a></li>
|
||||
<li><a class="{% if page.url == "/docs/integrations/" %}is-active{% endif %}" href="/docs/integrations">Integrations</a></li>
|
||||
<li><a class="{% if page.url == "/docs/best-practices/" %}is-active{% endif %}" href="/docs/best-practices/">Best Practices</a></li>
|
||||
<li><a class="{% if page.url == "/docs/changelog/" %}is-active{% endif %}" href="/docs/changelog">Changelog</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/getting-started/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/getting-started/">{{ "getting_started" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/formatter/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/formatter/">{{ "formatter" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/linter/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/linter">{{ "linter" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/configuration/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/configuration/">{{ "configuration" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/integrations/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/integrations">{{ "integrations" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/best-practices/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/best-practices/">{{ "best_practices" | i18n }}</a></li>
|
||||
<li><a class="{% if page.url == "lang_code_url" | i18n + "/docs/changelog/" %}is-active{% endif %}" href="{{ "lang_code_url" | i18n }}/docs/changelog">{{ "changelog" | i18n }}</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
{% image "./src/static/img/icon.png", "djlint icon", "(min-width:100px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<p class="my-4">
|
||||
{{ site.description }}
|
||||
{{ "description" | i18n }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="column"></div>
|
||||
<div class="column">
|
||||
<p class="copyright has-text-grey">
|
||||
djLint © 2021 Riverside Healthcare <br><br> Updated {{ page.date | niceDate }}
|
||||
djLint © 2021 Riverside Healthcare <br><br> {{ "updated" | i18n }} {{ page.date | niceDate }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
169
docs/src/_includes/index.njk
Normal file
169
docs/src/_includes/index.njk
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
---
|
||||
layout: layout.njk
|
||||
date: Last Modified
|
||||
|
||||
---
|
||||
{% block body %}
|
||||
<div class="section">
|
||||
<div class="container has-text-centered">
|
||||
<h1 class="title huge mt-5">dj<span class="has-text-weight-light"> Lint</span></h1>
|
||||
|
||||
<h2 class="title is-2">
|
||||
{{ "index_title" |i18n }}</h2>
|
||||
|
||||
<p class="story my-5 has-text-left">{{ "index_description" | i18n | safe }}
|
||||
|
||||
<h2 class="title is-2 has-text-centered mb-5">{{ "index_fav_lang" | i18n }}</h2>
|
||||
<div class="columns is-multiline">
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/django/">
|
||||
<div class="card-content" >
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/django.png", "django logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">Django</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/jinja/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/jinja.png", "jinja logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">jinja</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/nunjucks/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/nunjucks.png", "nunjucks logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">nunjucks</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/twig/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/twig.png", "twig logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">twig</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated animated" data-animate="fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/handlebars/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/handlebars.png", "handlebars logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">handlebars</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/mustache/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/mustache.png", "mustache logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">mustache</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/golang/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/golang.png", "golang logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">golang</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="{{ "lang_code_url" | i18n }}/docs/languages/angular/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/angular.png", "angular logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">angular</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container has-text-centered">
|
||||
<h2 class="title is-2">{{ "index_watch" | i18n }}</h2>
|
||||
|
||||
<figure class="image animated mx-auto is-framed" style="max-width:800px" data-animate="headShake">
|
||||
<video autoplay loop muted playsinline>
|
||||
<source src="/static/img/demo.webm" type="video/webm">
|
||||
<img src="/static/img/demo.gif" alt="djlint html template formater demo" loading="lazy" decoding="async">
|
||||
</video>
|
||||
</figure>
|
||||
|
||||
<h2 class="title is-2 mt-5">{{ "index_show_format" | i18n }}</h2>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
|
||||
{{ "index_add_badge" | i18n }} <code>readme.md</code>:
|
||||
|
||||
{% highlight "md" %}
|
||||
[](https://github.com/Riverside-Healthcare/djlint)
|
||||
{% endhighlight %}
|
||||
|
||||
{{ "index_add_badge" | i18n }} <code>readme.rst</code>:
|
||||
|
||||
{% highlight "md" %}
|
||||
|
||||
.. image:: https://img.shields.io/badge/html%20style-djLint-blue.svg
|
||||
:target: https://github.com/Riverside-Healthcare/djlint
|
||||
{% endhighlight %}
|
||||
|
||||
<p>{{ "index_looks_like" | i18n }}</p>
|
||||
|
||||
<figure class="image" style="max-width:120px;"><img src="https://img.shields.io/badge/html%20style-djLint-blue.svg" alt="https://github.com/Riverside-Healthcare/djlint" /></figure>
|
||||
|
||||
</div>
|
||||
<div class="container has-text-centered mb-5">
|
||||
<h2 class="title is-2 mt-5">{{ "contributing" | i18n }}</h2>
|
||||
<p class="has-text-left">
|
||||
{{ "contributing_message" | i18n | safe }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock body %}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="has-navbar-fixed-top">
|
||||
<html lang="{{ locale }}" dir="{{ dir }}" class="has-navbar-fixed-top">
|
||||
<head>
|
||||
{% block meta %}
|
||||
{% metagen
|
||||
title=(title or site.title) + " | " + site.name,
|
||||
desc=desc or description or site.description,
|
||||
title=(title or "title" | i18n or site.title) + " | " + site.name,
|
||||
desc=desc or description or "description" | i18n or site.description,
|
||||
url=site.url + page.url,
|
||||
img=image or site.url + site.image,
|
||||
img_alt=alt or "djlint logo",
|
||||
|
|
@ -31,6 +31,11 @@
|
|||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent">
|
||||
|
||||
<!-- languages -->
|
||||
<link rel="alternate" hreflang="en-US" href="{{site.url}}{{ page.url | baseUrl }}" />
|
||||
<link rel="alternate" hreflang="ru" href="{{site.url}}/ru{{ page.url | baseUrl }}" />
|
||||
|
||||
<!-- critical css is inlined, so we can async the rest -->
|
||||
<link rel="stylesheet preload"
|
||||
href="{{ css.stylesCss }}"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
aria-label="main navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a href="/">{% image "./src/static/img/icon.png", "djlint icon", "(min-width:600px) 50vw, 100vw" %}</a>
|
||||
<a href="{{ "lang_code_url" | i18n }}/">{% image "./src/static/img/icon.png", "djlint icon", "(min-width:600px) 50vw, 100vw" %}</a>
|
||||
<a role="button"
|
||||
class="navbar-burger"
|
||||
aria-label="menu"
|
||||
|
|
@ -14,59 +14,66 @@
|
|||
</a>
|
||||
</div>
|
||||
<div id="djlint-nav-menu" class="navbar-menu">
|
||||
<div class="navbar-start my-5 mx-0 is-justify-content-center is-flex-grow-1">
|
||||
<div class="navbar-start my-5 mx-0 is-justify-content-center is-flex-grow-1">
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/getting-started/">
|
||||
{{ "getting_started" | i18n }}
|
||||
</a>
|
||||
|
||||
<a class="navbar-item has-text-grey" href="/docs/getting-started/">
|
||||
Getting Started
|
||||
</a>
|
||||
|
||||
<a class="navbar-item has-text-grey" href="/docs/formatter/">
|
||||
Formatter
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="/docs/linter/">
|
||||
Linter
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="/docs/configuration">
|
||||
Configuration
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="/docs/integrations">
|
||||
Integrations
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="/docs/best-practices">
|
||||
Best Practices
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/formatter/">
|
||||
{{ "formatter" | i18n }}
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/linter/">
|
||||
{{ "linter" | i18n }}
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/configuration">
|
||||
{{ "configuration" | i18n }}
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/integrations">
|
||||
{{ "integrations" | i18n }}
|
||||
</a>
|
||||
<a class="navbar-item has-text-grey" href="{{ "lang_code_url" | i18n }}/docs/best-practices">
|
||||
{{ "best_practices" | i18n }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-end mx-0">
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://github.com/Riverside-Healthcare/djlint"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-github"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://discord.gg/taghAqebzU"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-discord"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://pypi.org/project/djlint/"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-download"></i>
|
||||
</span>
|
||||
</a>
|
||||
<div class="navbar-item has-dropdown has-text-grey is-hoverable">
|
||||
<a class="navbar-link has-text-grey is-transparent">
|
||||
<span class="icon is-large">
|
||||
<i class="fas fa-lg fa-globe"></i>
|
||||
</span>
|
||||
<span>{{ locale | i18n_locale(locales) }}
|
||||
</a>
|
||||
<div class="navbar-dropdown">
|
||||
{% for page in page.url | i18n_urls(collections.all) %}
|
||||
<a class="navbar-item" href="{{ page.url }}">{{ page.meta.label }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-end mx-0">
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://github.com/Riverside-Healthcare/djlint"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-github"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://discord.gg/taghAqebzU"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-discord"></i>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a class="navbar-item button is-white animated fadeIn"
|
||||
href="https://pypi.org/project/djlint/"
|
||||
target="_blank"
|
||||
rel="noopener">
|
||||
<span class="icon is-large has-text-grey is-nav-icon">
|
||||
<i class="fab fa-2x fa-download"></i>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@ module.exports = class {
|
|||
|
||||
async render() {
|
||||
await esbuild.build({
|
||||
entryPoints: ['src/static/js/search.js'],
|
||||
entryPoints: ['src/static/js/hamburger.js'],
|
||||
inject: [
|
||||
'./src/static/js/hamburger.js',
|
||||
'./src/static/js/animate.js',
|
||||
'./src/static/js/modal.js',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
|
|||
|
||||
::: content
|
||||
|
||||
- Bug fixes [#173](https://github.com/Riverside-Healthcare/djLint/issues/173), #174(https://github.com/Riverside-Healthcare/djLint/issues/174)
|
||||
- Bug fixes [#173](https://github.com/Riverside-Healthcare/djLint/issues/173), [#174](https://github.com/Riverside-Healthcare/djLint/issues/174)
|
||||
- Dropped Py3.6 from `pyproject.toml`.
|
||||
:::
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
|
|||
- Added formatting for template conditions inside attributes
|
||||
- Added srcset as possible url location in linter rules
|
||||
- Speed up formatting
|
||||
- Special thanks to `jayvdb <https://github.com/jayvdb>`\_
|
||||
- Special thanks to [jayvdb](https://github.com/jayvdb)
|
||||
:::
|
||||
|
||||
## 0.5.3
|
||||
|
|
@ -243,14 +243,14 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
|
|||
|
||||
::: content
|
||||
|
||||
- Fixed bug `#35 <https://github.com/Riverside-Healthcare/djLint/issues/35>`\_
|
||||
- Fixed bug [#35](https://github.com/Riverside-Healthcare/djLint/issues/35)
|
||||
:::
|
||||
|
||||
## 0.4.8
|
||||
|
||||
::: content
|
||||
|
||||
- Fixed bug `#34 <https://github.com/Riverside-Healthcare/djLint/issues/34>`\_
|
||||
- Fixed bug [#34](https://github.com/Riverside-Healthcare/djLint/issues/34)
|
||||
:::
|
||||
|
||||
## 0.4.7
|
||||
|
|
@ -264,7 +264,7 @@ keywords: template linter, template formatter, djLint, HTML, templates, formatte
|
|||
|
||||
::: content
|
||||
|
||||
- Fixed bug `#31 <https://github.com/Riverside-Healthcare/djLint/issues/31>`\_
|
||||
- Fixed bug [#31](https://github.com/Riverside-Healthcare/djLint/issues/31)
|
||||
:::
|
||||
|
||||
## 0.4.5
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ or as a javascript style comment -
|
|||
{{ /* djlint:off */ }} <bad html to ignore> {{ /* djlint:on */ }}</bad>
|
||||
```
|
||||
|
||||
or as a golan style comment -
|
||||
or as a golang style comment -
|
||||
|
||||
```html
|
||||
{{!-- djlint:off --}} <bad html to ignore> {{!-- djlint:on --}}</bad>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ The repo provides multiple pre-configured hooks for specific djLint profiles (it
|
|||
This will look for files matching `*.tmpl` and set `--profile=golang`.
|
||||
:::
|
||||
|
||||
Note that these predefined hooks are sometimes too conservative in the inputs they accept (your templates may be using a different extension) so pre-commit explicitly allows you to override any of these pre-defined options. See the `pre-commit docs <https://pre-commit.com/#pre-commit-configyaml---hooks>`\_ for additional configuration
|
||||
Note that these predefined hooks are sometimes too conservative in the inputs they accept (your templates may be using a different extension) so pre-commit explicitly allows you to override any of these pre-defined options. See the [pre-commit docs](https://pre-commit.com/#pre-commit-configyaml---hooks) for additional configuration
|
||||
|
||||
### Default Django example
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ djLint can be used as a SublimeText Linter plugin. It can be installed via [pack
|
|||
3. Install SublimeLinter-contrib-djlint
|
||||
:::
|
||||
|
||||
Ensure djLint is installed in your global python, or on yout `PATH`.
|
||||
Ensure djLint is installed in your global python, or on your `PATH`.
|
||||
|
||||
## Visual Studio Code
|
||||
|
||||
|
|
|
|||
|
|
@ -1,171 +1,4 @@
|
|||
---
|
||||
layout: layout.njk
|
||||
layout: index.njk
|
||||
date: Last Modified
|
||||
|
||||
---
|
||||
{% block body %}
|
||||
<div class="section">
|
||||
<div class="container has-text-centered">
|
||||
<h1 class="title huge mt-5">dj<span class="has-text-weight-light"> Lint</span></h1>
|
||||
|
||||
<h2 class="title is-2">
|
||||
Lint & Format HTML Templates</h2>
|
||||
|
||||
<p class="story my-5 has-text-left">Once upon a time all the other programming languages had a formatter and linter. Css, javascript, python, the c suite, typescript, ruby, php, go, swift, and you know the others. <i>The cool kids on the block.</i><br>
|
||||
HTML templates were left out there on their own, in the cold, unformatted and unlinted :( The dirty corner in your repository. <i>Something had to change.</i><br>
|
||||
Welcome djLint, the free cleaning service for html templates!<br>And the html templates lived happily ever after.</p>
|
||||
|
||||
<h2 class="title is-2 has-text-centered mb-5">find your favorite template language!</h2>
|
||||
<div class="columns is-multiline">
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="/docs/languages/django/">
|
||||
<div class="card-content" >
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/django.png", "django logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">Django</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="/docs/languages/jinja/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/jinja.png", "jinja logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">jinja</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="/docs/languages/nunjucks/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/nunjucks.png", "nunjucks logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">nunjucks</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated fadeInUp" href="/docs/languages/twig/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/twig.png", "twig logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">twig</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated animated" data-animate="fadeInUp" href="/docs/languages/handlebars/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/handlebars.png", "handlebars logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">handlebars</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="/docs/languages/mustache/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/mustache.png", "mustache logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">mustache</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="/docs/languages/golang/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/golang.png", "golang logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">golang</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="column is-one-quarter">
|
||||
<a class="is-block card animated" data-animate="fadeInUp" href="/docs/languages/angular/">
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
<figure class="image brand">
|
||||
{% image "./src/static/img/logos/angular.png", "angular logo", "(min-width:300px) 50vw, 100vw" %}
|
||||
</figure>
|
||||
<h3 class="title is-4 my-0 is-uppercase has-text-weight-light is-family-sans-serif has-text-grey">angular</h3>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container has-text-centered">
|
||||
<h2 class="title is-2">Watch it run!</h2>
|
||||
|
||||
<figure class="image animated mx-auto is-framed" style="max-width:800px" data-animate="headShake">
|
||||
<video autoplay loop muted playsinline>
|
||||
<source src="/static/img/demo.webm" type="video/webm">
|
||||
<img src="/static/img/demo.gif" alt="djlint html template formater demo" loading="lazy" decoding="async">
|
||||
</video>
|
||||
</figure>
|
||||
|
||||
<h2 class="title is-2 mt-5">Show your format!</h2>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
|
||||
Add a badge to your projects <code>readme.md</code>:
|
||||
|
||||
{% highlight "md" %}
|
||||
[](https://github.com/Riverside-Healthcare/djlint)
|
||||
{% endhighlight %}
|
||||
|
||||
Add a badge to your <code>readme.rst</code>:
|
||||
|
||||
{% highlight "md" %}
|
||||
|
||||
.. image:: https://img.shields.io/badge/html%20style-djLint-blue.svg
|
||||
:target: https://github.com/Riverside-Healthcare/djlint
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Looks like this:</p>
|
||||
|
||||
<figure class="image" style="max-width:120px;"><img src="https://img.shields.io/badge/html%20style-djLint-blue.svg" alt="https://github.com/Riverside-Healthcare/djlint" /></figure>
|
||||
|
||||
</div>
|
||||
<div class="container has-text-centered mb-5">
|
||||
<h2 class="title is-2 mt-5">Contributing</h2>
|
||||
<p class="has-text-left">
|
||||
Contributions are welcome. Send a pr with a new feature, or checkout the <a href="https://github.com/Riverside-Healthcare/djlint/issues">issue</a> list and help where you can.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock body %}
|
||||
---
|
||||
75
docs/src/ru/docs/best-practices.md
Normal file
75
docs/src/ru/docs/best-practices.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
description: Лучшие практики использования djLint для форматирования HTML-шаблонов.
|
||||
title: Лучшие практики
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование
|
||||
---
|
||||
|
||||
# {{ "best_practices" | i18n }}
|
||||
|
||||
## Пробелы вокруг условных атрибутов
|
||||
|
||||
Иногда условия используются для добавления классов в тег. djLint удаляет пробелы внутри условных операторов.
|
||||
|
||||
Этот шаблон рекомендуется:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<div class="class1 {% if condition -%}class2{%- endif %}">содержание</div>
|
||||
^ место здесь
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
Эта схема не рекомендуется:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<div class="class1{% if condition -%} class2{%- endif %}">содержание</div>
|
||||
^ место здесь
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## `format_attribute_template_tags` и беспространственные условные атрибуты
|
||||
|
||||
Если `format_attribute_template_tags` опция включена, условные атрибуты должны использовать теги без пробелов, например {% raw %}`{% if a -%}`{% endraw %} в nunjuck и jinja, чтобы удалить пробелы внутри.
|
||||
|
||||
djLint будет форматировать длинные атрибуты на несколько строк, и пробелы, сохраненные внутри атрибутов, могут сломать ваш код.
|
||||
|
||||
Рекомендуется использовать этот шаблон:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<input value="{% if database -%}{{ database.name }}{%- else -%}бла{%- endif %}"/>
|
||||
^ ^ ^ ^ -- беспространственные метки
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
Эта схема не рекомендуется:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<input value="{% if database %}{{ database.name }}{% else %}бла{% endif %}" />
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
После форматирования это может выглядеть следующим образом:
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<input value="{% if database %}
|
||||
{{ database.name }}
|
||||
{% else %}
|
||||
бла
|
||||
{% endif %}"
|
||||
/>
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
408
docs/src/ru/docs/changelog.md
Normal file
408
docs/src/ru/docs/changelog.md
Normal file
|
|
@ -0,0 +1,408 @@
|
|||
---
|
||||
description: djLint Изменения. Ознакомьтесь с обновлениями последних релизов и узнайте, какие функции вы можете ожидать при следующем обновлении.
|
||||
title: Изменения
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование, Изменения
|
||||
---
|
||||
|
||||
{% raw %}
|
||||
|
||||
# Изменения
|
||||
|
||||
## 0.7.4
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок [#177](https://github.com/Riverside-Healthcare/djLint/issues/177)
|
||||
:::
|
||||
|
||||
## 0.7.3
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок [#173](https://github.com/Riverside-Healthcare/djLint/issues/173), [#174](https://github.com/Riverside-Healthcare/djLint/issues/174)
|
||||
- Упал Py3.6 с сайта `pyproject.toml`.
|
||||
:::
|
||||
|
||||
## 0.7.2
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок [#167](https://github.com/Riverside-Healthcare/djLint/issues/167), [#166](https://github.com/Riverside-Healthcare/djLint/issues/166), [#171](https://github.com/Riverside-Healthcare/djLint/issues/171), [#169](https://github.com/Riverside-Healthcare/djLint/issues/169)
|
||||
:::
|
||||
|
||||
## 0.7.1
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок [#166](https://github.com/Riverside-Healthcare/djLint/issues/166)
|
||||
:::
|
||||
|
||||
## 0.7.0
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена настройка для пользовательских HTML-тегов
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.9
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлены профили HTML и Angular
|
||||
- Разрешены некоторые сущности в правиле #H023
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.8
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок
|
||||
- Обновленные документы
|
||||
:::
|
||||
|
||||
## 0.6.7
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена опция конфигурации `format_attribute_template_tags` как опция для форматирования тегов шаблонов внутри атрибутов
|
||||
- Добавлена опция конфигурации `linter_output_format` для настройки порядка переменных сообщений линтера
|
||||
- Добавлены правила H030 и H031 для проверки мета-тегов
|
||||
:::
|
||||
|
||||
## 0.6.6
|
||||
|
||||
::: content
|
||||
|
||||
- Большие исправления
|
||||
:::
|
||||
|
||||
## 0.6.5
|
||||
|
||||
::: content
|
||||
|
||||
- Обновлены пути вывода, чтобы они были относительными к корню проекта
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.4
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.3
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка тега django `blocktrans`.
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.2
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.6.1
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок
|
||||
- Сделать правило T028 более строгим с более четким посланием
|
||||
:::
|
||||
|
||||
## 0.6.0
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлено правило T027 для проверки наличия незакрытых тегов в синтаксисе шаблона
|
||||
- Добавлено правило T028 для проверки отсутствия пробельных тегов в атрибутах
|
||||
- Добавлено правило H029 для проверки метода формы в нижнем регистре
|
||||
- Игнорируются теги djagno blocktranslate, которые не имеют "trimmed" от форматера
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.5.9a
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка тестирования для python 3.10
|
||||
- Добавлен крючок предварительного коммита
|
||||
:::
|
||||
|
||||
## 0.5.9
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена опция `--use-gitignore` для расширения исключений
|
||||
- Изменено сопоставление исключений по умолчанию
|
||||
- Исправлены пути исключения окон
|
||||
- Исправлено форматирование тегов `{%...%}` в атрибутах
|
||||
- Исправлено форматирование циклов for и вложенных условий в атрибутах
|
||||
:::
|
||||
|
||||
## 0.5.8
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена опция require_pragma
|
||||
- Обновлен DJ018 для перехвата `data-src` и `action` на входах
|
||||
- Исправлен синтаксис игнорирования строк
|
||||
- Добавлена опция `--lint` в качестве заполнителя для использования по умолчанию
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.5.7
|
||||
|
||||
::: content
|
||||
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.5.6
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлено правило H026 для поиска пустых тегов id и class
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.5.5
|
||||
|
||||
::: content
|
||||
|
||||
- Консолидированные настройки и сокращенный код
|
||||
- Исправления ошибок
|
||||
:::
|
||||
|
||||
## 0.5.4
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлено правило H020 для поиска пустых пар тегов
|
||||
- Добавлено правило H021 для поиска инлайн-стилей
|
||||
- Добавлено правило H022 для поиска http-ссылок
|
||||
- Добавлено правило H023 для поиска ссылок на сущности
|
||||
- Добавлено правило H024 для поиска типов в скриптах и стилях
|
||||
- Добавлено правило H025 для проверки сиротских тегов. Благодаря https://stackoverflow.com/a/1736801/10265880
|
||||
- Улучшено форматирование атрибутов
|
||||
- Обновлена опция `blank_line_after_tag` для добавления новой строки независимо от местоположения
|
||||
- Исправлено форматирование тегов django `trans`
|
||||
- Добавлено форматирование для встроенных стилей
|
||||
- Добавлено форматирование для условий шаблона внутри атрибутов
|
||||
- Добавлен srcset как возможное местоположение url в правилах линтера
|
||||
- Ускорено форматирование
|
||||
- Особая благодарность [jayvdb](https://github.com/jayvdb>)
|
||||
:::
|
||||
|
||||
## 0.5.3
|
||||
|
||||
::: content
|
||||
|
||||
- Измените stdout для опций `--reformat/check`, чтобы выводить новый html только при использовании stdin в качестве входа
|
||||
:::
|
||||
|
||||
## 0.5.2
|
||||
|
||||
::: content
|
||||
|
||||
- Разделите требование `alt` с H006 на H013
|
||||
- Добавлен необязательный файл пользовательских правил
|
||||
- Добавлен `golang` в качестве опции профиля
|
||||
- Исправлено форматирование игнорируемых блоков, содержащих встроенные комментарии
|
||||
- Добавлен текст по умолчанию для опций `--indent` и `-e`
|
||||
- Обновлены правила url для принятия #
|
||||
- Исправлена кодировка файлов в ОС Windows
|
||||
- Исправлен регекс для однострочных тегов шаблонов
|
||||
- Исправление `blank_line_after_tag` для тегов с пробелами в начале строки
|
||||
|
||||
:::
|
||||
|
||||
## 0.5.1
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлено правило H019
|
||||
- Исправлены ошибки в DJ018 и H012
|
||||
:::
|
||||
|
||||
## 0.5.0
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлено несколько ошибок регекс-сопоставления в правилах linter
|
||||
- Запрещено возвращать ошибки в игнорируемых блоках
|
||||
- Добавлена возможность игнорировать блок кода из linter/formatter с тегами `{% djlint:off %}...{% djlint:on %}`.
|
||||
:::
|
||||
|
||||
## 0.4.9
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлена ошибка [#35](https://github.com/Riverside-Healthcare/djLint/issues/35)
|
||||
:::
|
||||
|
||||
## 0.4.8
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлена ошибка [#34](https://github.com/Riverside-Healthcare/djLint/issues/34)
|
||||
:::
|
||||
|
||||
## 0.4.7
|
||||
|
||||
::: content
|
||||
|
||||
- Перемещение тега `source` в однострочные теги
|
||||
:::
|
||||
|
||||
## 0.4.6
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлена ошибка [#31](https://github.com/Riverside-Healthcare/djLint/issues/31)
|
||||
:::
|
||||
|
||||
## 0.4.5
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлены лучшие практики в документацию
|
||||
- Добавлена опция `--profile` для установки правил linter/formatter по умолчанию
|
||||
- Добавлены правила linter для шаблонов jinja url
|
||||
:::
|
||||
|
||||
## 0.4.4
|
||||
|
||||
::: content
|
||||
|
||||
- Измените конфигурацию отступа со строки на int. `--indent 3`
|
||||
:::
|
||||
|
||||
## 0.4.3
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена опция cli для интервала между отступами. `--indent=" "`.
|
||||
:::
|
||||
|
||||
## 0.4.2
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка дополнительных пробелов после тегов с помощью опции `blank_line_after_tag`.
|
||||
:::
|
||||
|
||||
## 0.4.1
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка одновременной обработки нескольких файлов или папок
|
||||
:::
|
||||
|
||||
## 0.4.0
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлено форматирование тегов django `{# ... #}` тегов
|
||||
- Добавлена поддержка отступов для тегов figcaption, details и summary
|
||||
- Добавлена поддержка переопределения или расширения списка исключенных путей в `pyproject.toml`.
|
||||
:::
|
||||
|
||||
## 0.3.9
|
||||
|
||||
::: content
|
||||
|
||||
- Обновленная обработка атрибутов
|
||||
:::
|
||||
|
||||
## 0.3.8
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка stdin
|
||||
:::
|
||||
|
||||
## 0.3.7
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлено форматирование тегов `small`, `dt` и `dd`.
|
||||
:::
|
||||
|
||||
## 0.3.6
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка форматера для открывающих блоков Nunjucks `{%-`
|
||||
:::
|
||||
|
||||
## 0.3.5
|
||||
|
||||
::: content
|
||||
|
||||
- Добавлена поддержка большего количества блоков Django
|
||||
- Добавлена поддержка пользовательских блоков
|
||||
- Добавлена поддержка конфигурации в `pyproject.toml`
|
||||
:::
|
||||
|
||||
## 0.3.4
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлен тег Nunjucks без пробелов в формате `-%}`
|
||||
:::
|
||||
|
||||
## 0.3.3
|
||||
|
||||
::: content
|
||||
|
||||
- Позволяет коротким тегам `div` быть однострочными
|
||||
:::
|
||||
|
||||
## 0.3.2
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлено форматирование комментариев в Django
|
||||
- Игнорирование форматирования текстовой области
|
||||
:::
|
||||
|
||||
## 0.3.1
|
||||
|
||||
::: content
|
||||
|
||||
- Обновлен регекс форматирования атрибутов
|
||||
- Обновлено правило притирки W010
|
||||
:::
|
||||
|
||||
## 0.3.0
|
||||
|
||||
::: content
|
||||
|
||||
- Изменен код выхода на 1 в случае изменения форматирования
|
||||
- Добавлена поддержка тегов `asset` в Jinja
|
||||
:::
|
||||
|
||||
## 0.2.9
|
||||
|
||||
::: content
|
||||
|
||||
- Обновленный регекс W018
|
||||
- Удалены дублирующиеся сообщения lint
|
||||
- Обновлен E001 для Handlebars
|
||||
:::
|
||||
|
||||
## 0.2.8
|
||||
|
||||
::: content
|
||||
|
||||
- Исправлена ошибка прогресс-бара для старой версии Click
|
||||
:::
|
||||
|
||||
{% endraw %}
|
||||
205
docs/src/ru/docs/configuration.md
Normal file
205
docs/src/ru/docs/configuration.md
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
---
|
||||
description: Конфигурация djLint для линтинга и форматирования HTML-шаблонов. Воспользуйтесь многочисленными возможностями форматирования.
|
||||
title: Конфигурация
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование, configuration
|
||||
---
|
||||
|
||||
# {{ "configuration" | i18n }}
|
||||
|
||||
Конфигурация выполняется через файл `pyproject.toml` вашего проекта. Арги командной строки всегда будут переопределять любые настройки в `pyproject.toml`.
|
||||
|
||||
```ini
|
||||
[tool.djlint]
|
||||
<config options>
|
||||
```
|
||||
|
||||
## ignore
|
||||
|
||||
Игнорируйте коды линтера.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
ignore="H014,H015"
|
||||
```
|
||||
|
||||
## extension
|
||||
|
||||
Используется для поиска файлов только с определенным расширением.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
extension="html.dj"
|
||||
```
|
||||
|
||||
## custom_blocks
|
||||
|
||||
Используется для отступов в пользовательских блоках кода. Например, {% raw %}`{% toc %}...{% endtoc %}`{% endraw %}
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
custom_blocks="toc,example"
|
||||
```
|
||||
|
||||
## custom_html
|
||||
|
||||
Используется для отступа пользовательских HTML-тегов. Например, `<mjml>` или `<simple-greeting>` или `<mj-\w+>`.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
custom_html="mjml,simple-greeting,mj-\\w+"
|
||||
```
|
||||
|
||||
## indent
|
||||
|
||||
Используется для изменения отступа кода. По умолчанию - 4 (четыре пробела).
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
indent=3
|
||||
```
|
||||
|
||||
## exclude
|
||||
|
||||
Переопределите пути исключения по умолчанию.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
exclude=".venv,venv,.tox,.eggs,..."
|
||||
```
|
||||
|
||||
## extend_exclude
|
||||
|
||||
Добавьте дополнительные пути к исключаемым по умолчанию.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
extend_exclude=".custom"
|
||||
```
|
||||
|
||||
## blank_line_after_tag
|
||||
|
||||
Добавьте дополнительную пустую строку после групп тегов {% raw %}`{% <tag> ... %}`{% endraw %}.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
blank_line_after_tag="load,extends,include"
|
||||
```
|
||||
|
||||
## profile
|
||||
|
||||
Установите профиль по умолчанию для языка шаблона. Профиль отключает правила линтера, которые не применимы к языку шаблона, а также может изменить переформатирование. Например, в `handlebars` нет пробелов внутри тегов {% raw %}`{{#if}}`{% endraw %}.
|
||||
|
||||
Параметры:
|
||||
|
||||
:::content
|
||||
|
||||
- html
|
||||
- django
|
||||
- jinja
|
||||
- nunjucks (для nunjucks и twig)
|
||||
- handlebars (для handlebars и mustache)
|
||||
- golang
|
||||
- angular
|
||||
:::
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
profile="django"
|
||||
```
|
||||
|
||||
## require_pragma
|
||||
|
||||
Форматировать или линтовать только те файлы, которые начинаются с комментария, содержащего только текст 'djlint:on'. Комментарий может быть HTML-комментарием или комментарием на языке шаблонов, определенном настройкой профиля. Если профиль не указан, принимается комментарий на любом из языков шаблонов.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
require_pragma=true
|
||||
```
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
<!-- djlint:on -->
|
||||
или {# djlint:on #} или {% comment %} djlint:on {% endcomment %} или {{ /* djlint:on */ }} или {{!-- djlint:on --}}
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## max_line_length
|
||||
|
||||
Форматировщик попытается разместить некоторые html и шаблонные теги на одной строке вместо того, чтобы обернуть их, если длина строки не превышает этого значения.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
max_line_length=120
|
||||
```
|
||||
|
||||
## max_attribute_length
|
||||
|
||||
Форматировщик попытается обернуть атрибуты тега, если длина атрибута превышает это значение.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
max_attribute_length=10
|
||||
```
|
||||
|
||||
## use_gitignore
|
||||
|
||||
Добавьте исключения .gitignore к исключениям по умолчанию.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
use_gitignore=True
|
||||
```
|
||||
|
||||
## format_attribute_template_tags
|
||||
|
||||
Форматировщик будет пытаться форматировать синтаксис шаблона внутри атрибутов тега. По умолчанию отключен.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
format_attribute_template_tags=true
|
||||
```
|
||||
|
||||
Например, если эта опция включена, то допустимым будет следующий html:
|
||||
|
||||
```html
|
||||
<input
|
||||
class="{% if this %}
|
||||
then something neat
|
||||
{% else %}
|
||||
that is long stuff asdf and more even
|
||||
{% endif %}"
|
||||
/>
|
||||
```
|
||||
|
||||
## linter_output_format
|
||||
|
||||
Настройка порядка вывода сообщения. По умолчанию="{code} {line} {message} {match}". Если `{filename}` не включено в сообщение, то вывод будет сгруппирован по файлам и к каждой группе будет автоматически добавлен заголовок.
|
||||
|
||||
Использование:
|
||||
|
||||
```ini
|
||||
# необязательные переменные:
|
||||
# {filename}
|
||||
# {line}
|
||||
# {code}
|
||||
# {message}
|
||||
# {match}
|
||||
|
||||
linter_output_format="{filename}:{line}: {code} {message} {match}"
|
||||
```
|
||||
3
docs/src/ru/docs/docs.json
Normal file
3
docs/src/ru/docs/docs.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"layout": "docs_layout.njk"
|
||||
}
|
||||
119
docs/src/ru/docs/formatter.md
Normal file
119
docs/src/ru/docs/formatter.md
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
description: Форматируйте свои HTML-шаблоны с помощью djLint. Быстрый и точный вывод сделает ваши шаблоны блестящими.
|
||||
title: Использование форматера
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование, Использование форматера
|
||||
---
|
||||
|
||||
# Использование форматера
|
||||
|
||||
Форматировщик djLint возьмет неряшливые html-шаблоны и сделает форматирование последовательным и легким!
|
||||
|
||||
Форматировщик - это бета-версия инструмента. Прежде чем вносить изменения, проверьте результат.
|
||||
|
||||
Чтобы просмотреть, что может измениться в форматировании, выполните следующие действия:
|
||||
|
||||
```bash
|
||||
djlint . --check
|
||||
```
|
||||
|
||||
Для форматирования кода и обновления файлов выполните:
|
||||
|
||||
```bash
|
||||
djlint . --reformat
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
|
||||
{% admonition
|
||||
"note",
|
||||
"Note",
|
||||
"Переформатирование не работает с длинными json/html, встроенными в данные атрибутов."
|
||||
%}
|
||||
|
||||
{% admonition
|
||||
"note",
|
||||
"Note",
|
||||
"djLint не является парсером html или синтаксическим валидатором."
|
||||
%}
|
||||
|
||||
## Игнорирование кодекса
|
||||
|
||||
Код можно игнорировать, обернув его в теги `djlint`:
|
||||
|
||||
{% raw %}
|
||||
|
||||
Для простого старого html -
|
||||
|
||||
```html
|
||||
<!-- djlint:off -->
|
||||
<плохой html, который следует игнорировать> <!-- djlint:on --></bad>
|
||||
```
|
||||
|
||||
или как комментарий -
|
||||
|
||||
```html
|
||||
{# djlint:off #} <плохой html, который следует игнорировать> {# djlint:on #}</bad>
|
||||
```
|
||||
|
||||
или в виде длинного комментария
|
||||
|
||||
```html
|
||||
{% comment %} djlint:off {% endcomment %}
|
||||
<плохой html, который следует игнорировать> {% comment %} djlint:on {% endcomment %}</bad>
|
||||
```
|
||||
|
||||
или как комментарий в стиле javascript -
|
||||
|
||||
```html
|
||||
{{ /* djlint:off */ }} <плохой html, который следует игнорировать> {{ /* djlint:on */ }}</bad>
|
||||
```
|
||||
|
||||
или как комментарий в стиле golang -
|
||||
|
||||
```html
|
||||
{{!-- djlint:off --}} <плохой html, который следует игнорировать> {{!-- djlint:on --}}</bad>
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
## Вот пример!
|
||||
|
||||
### До
|
||||
|
||||
Вот кусок HTML, который отчаянно нуждается во внимании -
|
||||
{% raw %}
|
||||
|
||||
```
|
||||
{% load admin_list %}{% load i18n %}<p class="paginator">{% if pagination_required %}{% for i in page_range %}{% paginator_number cl i %}{% endfor %}{% endif %}{{ cl.result_count }}{% if cl.result_count == 1 %}{{ cl.opts.verbose_name }} {% else %}{{ cl.opts.verbose_name_plural }} {% endif %}{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% translate 'Show all' %} </a> {% endif %}{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">{% endif %} </p>
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
### После
|
||||
|
||||
Теперь он выглядит немного лучше... мы можем его прочитать :)
|
||||
|
||||
{% raw %}
|
||||
|
||||
```html
|
||||
{% load admin_list %} {% load i18n %}
|
||||
<p class="paginator">
|
||||
{% if pagination_required %} {% for i in page_range %} {% paginator_number cl
|
||||
i %} {% endfor %} {% endif %} {{ cl.result_count }} {% if cl.result_count == 1
|
||||
%} {{ cl.opts.verbose_name }} {% else %} {{ cl.opts.verbose_name_plural }} {%
|
||||
endif %} {% if show_all_url %}
|
||||
<a href="{{ show_all_url }}" class="showall"> {% translate 'Show all' %} </a>
|
||||
{% endif %} {% if cl.formset and cl.result_count %}
|
||||
<input
|
||||
type="submit"
|
||||
name="_save"
|
||||
class="default"
|
||||
value="{% translate 'Save' %}"
|
||||
/>
|
||||
{% endif %}
|
||||
</p>
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
81
docs/src/ru/docs/getting-started.md
Normal file
81
docs/src/ru/docs/getting-started.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
---
|
||||
description: Начало работы с djLint для линтинга и форматирования HTML-шаблонов. Воспользуйтесь простым интерфейсом cli и множеством опций форматирования.
|
||||
title: Начало работы
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование
|
||||
---
|
||||
|
||||
# {{ "getting_started" | i18n }}
|
||||
|
||||
## Установка от [Pypi](https://pypi.org/project/djlint/)
|
||||
|
||||
djLint собирается с [Python 3.7+](https://python.org), он может быть установлен простым запуском:
|
||||
|
||||
```bash
|
||||
pip install djlint
|
||||
```
|
||||
|
||||
## Использование CLI
|
||||
|
||||
djLint - это приложение командной строки. Для расширенной настройки смотрите `конфигурация`.
|
||||
|
||||
```bash
|
||||
Usage: python -m djlint [OPTIONS] SRC ...
|
||||
|
||||
djLint · lint and reformat HTML templates.
|
||||
|
||||
Options:
|
||||
--version Show the version and exit.
|
||||
-e, --extension TEXT File extension to check [default: html]
|
||||
-i, --ignore TEXT Codes to ignore. ex: "H014,H017"
|
||||
--reformat Reformat the file(s).
|
||||
--check Check formatting on the file(s).
|
||||
--indent INTEGER Indent spacing. [default: 4]
|
||||
--quiet Do not print diff when reformatting.
|
||||
--profile TEXT Enable defaults by template language. ops: django,
|
||||
jinja, nunjucks, handlebars, golang
|
||||
--require-pragma Only format or lint files that starts with a comment
|
||||
with the text 'djlint:on'
|
||||
--lint Lint for common issues. [default option]
|
||||
--use-gitignore Use .gitignore file to extend excludes.
|
||||
-h, --help Show this message and exit.
|
||||
```
|
||||
|
||||
{% admonition
|
||||
"note",
|
||||
"Note",
|
||||
"Если команда `djlint` не найдена, убедитесь, что Python находится [в вашем пути](https://www.geeksforgeeks.org/how-to-add-python-to-windows-path/)."
|
||||
%}
|
||||
|
||||
## Использование Path против Stdin
|
||||
|
||||
djLint работает с путем или stdin.
|
||||
|
||||
Бег с тропинкой -
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --lint
|
||||
```
|
||||
|
||||
Или конкретный файл -
|
||||
|
||||
```bash
|
||||
djlint /path/to/this.mustache --lint
|
||||
```
|
||||
|
||||
Или с помощью stdin -
|
||||
|
||||
```bash
|
||||
echo "<div></div>" | djlint -
|
||||
```
|
||||
|
||||
Stdin также может быть использован для переформатирования кода. На выходе будет только отформатированный код без сообщений.
|
||||
|
||||
```bash
|
||||
echo "<div></div>" | djlint - --reformat
|
||||
```
|
||||
|
||||
Выход -
|
||||
|
||||
```html
|
||||
<div></div>
|
||||
```
|
||||
77
docs/src/ru/docs/integrations.md
Normal file
77
docs/src/ru/docs/integrations.md
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
---
|
||||
description: Интегрируйте djLint с вашим любимым редактором. Автоматическое форматирование ваших шаблонов с помощью Pre-Commit или Visual Studio Code. Lint с SublimeText.
|
||||
title: Интеграции
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование, integrations
|
||||
---
|
||||
|
||||
# {{ "integrations" | i18n }}
|
||||
|
||||
Существует несколько интеграций редакторов для djLint.
|
||||
|
||||
## Pre-Commit
|
||||
|
||||
djLint можно использовать как [pre-commit](https://pre-commit.com) крючок.
|
||||
|
||||
Репозиторий предоставляет несколько предварительно настроенных хуков для определенных профилей djLint (он просто задает аргумент `--profile` и указывает pre-commit, какие расширения файлов искать):
|
||||
|
||||
::: content
|
||||
|
||||
- `djlint-django` для шаблонов Django:
|
||||
Это будет искать файлы, соответствующие `templates/**.html` и устанавливать `--profile=django`.
|
||||
- `djlint-jinja`.
|
||||
Это будет искать файлы, соответствующие `*.j2` и устанавливать `--профиль=jinja`.
|
||||
- `djlint-nunjucks`.
|
||||
Будет искать файлы, соответствующие `*.njk` и устанавливать `--profile=nunjucks`.
|
||||
- `djlint-handlebars`
|
||||
Будет искать файлы, соответствующие `*.hbs` и устанавливать `--profile=handlebars`.
|
||||
- `djlint-golang`
|
||||
Будет искать файлы, соответствующие `*.tmpl` и устанавливать `--profile=golang`.
|
||||
:::
|
||||
|
||||
Обратите внимание, что эти предопределенные хуки иногда слишком консервативны в принимаемых ими входных данных (ваши шаблоны могут использовать другое расширение), поэтому pre-commit явно позволяет вам переопределять любые из этих предопределенных опций. См. [pre-commit документы](https://pre-commit.com/#pre-commit-configyaml---hooks) для дополнительной настройки.
|
||||
|
||||
### Пример Django по умолчанию
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- repo: https://github.com/Riverside-Healthcare/djLint
|
||||
rev: 0.5.10 # grab latest tag from GitHub
|
||||
hooks:
|
||||
- id: djlint-django
|
||||
```
|
||||
|
||||
### Handlebars с расширением .html вместо .hbs
|
||||
|
||||
```yaml
|
||||
repos:
|
||||
- repo: https://github.com/Riverside-Healthcare/djLint
|
||||
rev: 0.5.10 # grab latest tag from GitHub
|
||||
hooks:
|
||||
- id: djlint-handlebars
|
||||
files: "\\.html"
|
||||
```
|
||||
|
||||
Вы можете использовать параметры `files` или `exclude`, чтобы ограничить каждый хук своим каталогом, что позволит вам поддерживать несколько языков шаблонов в одном репозитории.
|
||||
|
||||
## SublimeText Linter
|
||||
|
||||
djLint можно использовать в качестве плагина SublimeText Linter. Его можно установить через [package-control](https://packagecontrol.io/packages/SublimeLinter-contrib-djlint).
|
||||
|
||||
::: content
|
||||
|
||||
1. `cmd + shft + p`
|
||||
2. Install SublimeLinter
|
||||
3. Install SublimeLinter-contrib-djlint
|
||||
:::
|
||||
|
||||
Убедитесь, что djLint установлен в вашем глобальном python или в вашем `PATH`.
|
||||
|
||||
## Visual Studio Code
|
||||
|
||||
[Страница рынка](https://marketplace.visualstudio.com/items?itemName=monosans.djlint)
|
||||
|
||||
[GitHub репозиторий](https://github.com/monosans/djlint-vscode)
|
||||
|
||||
## coc.nvim
|
||||
|
||||
https://www.npmjs.com/package/coc-htmldjango
|
||||
29
docs/src/ru/docs/languages/angular.md
Normal file
29
docs/src/ru/docs/languages/angular.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Angular Template Linter
|
||||
keywords: angular, djlint, angular template linter, lint angular templates
|
||||
description: djLint - это ангулярный линтер шаблонов! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: angular
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/django.md
Normal file
29
docs/src/ru/docs/languages/django.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Django Template Linter и Formatter
|
||||
keywords: django, djlint, django template linter, django template formatter, format django templates
|
||||
description: djLint - это линтер шаблонов django и форматер шаблонов django! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: django
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/golang.md
Normal file
29
docs/src/ru/docs/languages/golang.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: GoLang Template Linter and Formatter
|
||||
keywords: GoLang, djlint, GoLang template linter, GoLang template formatter, format GoLang templates
|
||||
description: djLint - это линтер шаблонов GoLang и форматер шаблонов GoLang! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: golang
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/handlebars.md
Normal file
29
docs/src/ru/docs/languages/handlebars.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Handlebars Template Linter and Formatter
|
||||
keywords: handlebars, djlint, handlebars template linter, handlebars template formatter, format handlebars templates
|
||||
description: djLint - это линтеры и форматоры шаблонов для ручек! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: handlebars
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/jinja.md
Normal file
29
docs/src/ru/docs/languages/jinja.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Jinja Template Linter and Formatter
|
||||
keywords: jinja, djlint, jinja template linter, jinja template formatter, format jinja templates
|
||||
description: djLint - это линтер шаблонов jinja и форматер шаблонов jinja! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: jinja
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
3
docs/src/ru/docs/languages/languages.json
Normal file
3
docs/src/ru/docs/languages/languages.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"layout": "languages_layout.njk"
|
||||
}
|
||||
29
docs/src/ru/docs/languages/mustache.md
Normal file
29
docs/src/ru/docs/languages/mustache.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Mustache Template Linter and Formatter
|
||||
keywords: mustache, djlint, mustache template linter, mustache template formatter, format mustache templates
|
||||
description: djLint - это линтер шаблонов mustache и форматировщик шаблонов mustache! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: handlebars
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/nunjucks.md
Normal file
29
docs/src/ru/docs/languages/nunjucks.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Nunjucks Template Linter and Formatter
|
||||
keywords: nunjucks, djlint, nunjucks template linter, nunjucks template formatter, format nunjucks templates
|
||||
description: djLint - это линтер шаблонов nunjucks и форматер шаблонов nunjucks! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: nunjucks
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
29
docs/src/ru/docs/languages/twig.md
Normal file
29
docs/src/ru/docs/languages/twig.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: Twig Template Linter and Formatter
|
||||
keywords: twig, djlint, twig template linter, twig template formatter, format twig templates
|
||||
description: djLint - это линтер шаблонов twig и форматировщик шаблонов twig! Используйте преимущества профиля предварительной сборки при линтинге и форматировании ваших шаблонов с помощью djLint.
|
||||
tool: nunjucks
|
||||
---
|
||||
|
||||
# {{ title }}
|
||||
|
||||
{{ description }}
|
||||
|
||||
#### Использование командной строки
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --profile={{ tool }}
|
||||
```
|
||||
|
||||
#### Или используйте файл конфигурации
|
||||
|
||||
Настройте djLint в вашем проекте `pyproject.toml`.
|
||||
|
||||
```toml
|
||||
[tool.djlint]
|
||||
profile="{{ tool }}"
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
108
docs/src/ru/docs/linter.md
Normal file
108
docs/src/ru/docs/linter.md
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
---
|
||||
description: djLint HTML Template linter включает более 30 правил! Найти определения можно здесь. Легко расширить, включив пользовательские правила!
|
||||
title: Правила Линтера
|
||||
keywords: облицовка шаблонов, форматер шаблонов, djLint, HTML, шаблоны, форматер, линтер, использование, правила
|
||||
---
|
||||
|
||||
# Использование вкладышей
|
||||
|
||||
djLint включает в себя множество правил для проверки стиля и валидности ваших шаблонов. Используйте все преимущества линтера, настроив его на использование предустановленного профиля для выбранного вами языка шаблонов.
|
||||
|
||||
```bash
|
||||
djlint /path/to/templates --lint
|
||||
|
||||
# with custom extensions
|
||||
djlint /path/to/templates -e html.dj --profile=django
|
||||
|
||||
# or to file
|
||||
djlint /path/to/this.html.j2 --profile=jinja
|
||||
```
|
||||
|
||||
<div class="box notification is-info is-light">
|
||||
<span class="icon is-large"><i class="fas fa-2x fa-arrow-circle-right"></i></span><div class="my-auto ml-3 is-inline-block"><a href="/ru/docs/configuration/">Ознакомьтесь с руководством по настройке, чтобы узнать обо всех возможностях!</a></div>
|
||||
</div>
|
||||
|
||||
## Пользовательские правила
|
||||
|
||||
Создайте файл `.djlint_rules.yaml` рядом с вашим `pyproject.toml`. Правила могут быть добавлены в этот файл, и djLint подхватит их.
|
||||
|
||||
Хорошее правило выглядит следующим образом:
|
||||
|
||||
```yaml
|
||||
- rule:
|
||||
name: T001
|
||||
message: Найти трихотилломанию
|
||||
flags: re.DOTALL|re.I
|
||||
patterns:
|
||||
- трихотилломанию
|
||||
```
|
||||
|
||||
## Правила
|
||||
|
||||
| Код | Значение |
|
||||
| ---- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| T001 | Переменные должны быть заключены в один пробел. Например: {% raw %}`{{ this }}`{% endraw %} |
|
||||
| T002 | В тегах следует использовать двойные кавычки. Ex {% raw %}`{% extends "this.html" %}`{% endraw %} |
|
||||
| T003 | Конечный блок должен иметь имя. Например: {% raw %}`{% endblock body %}`{% endraw %}. |
|
||||
| D004 | (Django) Статические урлы должны следовать шаблону {% raw %}`{% static path/to/file %}`{% endraw %}. |
|
||||
| J004 | (Jinja) Статические урлы должны следовать шаблону {% raw %}`{{ url_for('static'...)}}`{% endraw %}. |
|
||||
| H005 | Html-тег должен иметь атрибут `lang`. |
|
||||
| H006 | Тег `img` должен иметь атрибуты `height` и `width`. |
|
||||
| H007 | `<!DOCTYPE ... >` должен присутствовать перед тегом html. |
|
||||
| H008 | Атрибуты должны быть заключены в двойные кавычки. |
|
||||
| H009 | Имена тегов должны быть в нижнем регистре. |
|
||||
| H010 | Имена атрибутов должны быть в нижнем регистре. |
|
||||
| H011 | Значения атрибутов должны быть заключены в кавычки. |
|
||||
| H012 | Вокруг атрибута `=` не должно быть пробелов. |
|
||||
| H013 | Тег `img` должен иметь атрибуты alt. |
|
||||
| H014 | Более 2 пустых строк. |
|
||||
| H015 | После тегов `h` следует перевод строки. |
|
||||
| H016 | Отсутствие тега `title` в html. |
|
||||
| H017 | Тег должен быть самозакрывающимся. |
|
||||
| D018 | (Django) Внутренние ссылки должны использовать шаблон {% raw %}`{% url ... %}`{% endraw %}. |
|
||||
| J018 | (Jinja) Внутренние ссылки должны использовать шаблон {% raw %}`{% url ... %}`{% endraw %}. |
|
||||
| H019 | Замените `javascript:abc()` на событие `on_` и реальный url. |
|
||||
| H020 | Найдена пустая пара тегов. Рассмотрите возможность удаления. |
|
||||
| H021 | Следует избегать инлайн-стилей. |
|
||||
| H022 | Используйте HTTPS для внешних ссылок. |
|
||||
| H023 | Не используйте ссылки на сущности. |
|
||||
| H024 | Опускайте тип в скриптах и стилях. |
|
||||
| H025 | Тег кажется бесхозным. |
|
||||
| H026 | Теги Emtpy id и class могут быть удалены. |
|
||||
| T027 | В синтаксисе шаблона найдена незакрытая строка. |
|
||||
| T028 | Рассмотрите возможность использования тегов без пробелов внутри значений атрибутов. {% raw %}`{%- if/for -%}`{% endraw %} |
|
||||
| H029 | Рассмотрите возможность использования строчных значений метода формы. |
|
||||
| H030 | Рассмотрите возможность добавления мета-описания. |
|
||||
| H031 | Рассмотрите возможность добавления мета-ключевых слов. |
|
||||
|
||||
### Добавление правил
|
||||
|
||||
Мы приветствуем запросы с новыми правилами!
|
||||
|
||||
Хорошее правило состоит из
|
||||
|
||||
::: content
|
||||
|
||||
- Name
|
||||
- Code
|
||||
- Message - Сообщение для отображения при обнаружении ошибки.
|
||||
- Flags - Флаги регекса. По умолчанию используется re.DOTALL. например: re.I|re.M
|
||||
- Patterns - regex-выражения, которые найдут ошибку.
|
||||
- Exclude - Необязательный список профилей, из которых нужно исключить правило.
|
||||
:::
|
||||
|
||||
Пожалуйста, включите тест для проверки правила.
|
||||
|
||||
### Кодовые шаблоны
|
||||
|
||||
Первая буква кода соответствует схеме:
|
||||
|
||||
::: content
|
||||
|
||||
- T: применяется в целом к шаблонам
|
||||
- H: применяется к html
|
||||
- D: применяется специально для Django
|
||||
- J: применяется специально для Jinja
|
||||
- N: применяется специально для Nunjucks
|
||||
- M: применяется специально для Handlebars
|
||||
:::
|
||||
4
docs/src/ru/index.njk
Normal file
4
docs/src/ru/index.njk
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
layout: index.njk
|
||||
date: Last Modified
|
||||
---
|
||||
4
docs/src/ru/ru.json
Normal file
4
docs/src/ru/ru.json
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"dir": "ltr",
|
||||
"locale": "ru"
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
permalink: search/all.json
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{%- set posts = collections.algolia -%}
|
||||
[
|
||||
{%- for post in posts -%}
|
||||
{
|
||||
"title": "{{ post.data.title | default(" ") }}",
|
||||
"date": "{{ page.date }}",
|
||||
"url": "{{ post.url }}",
|
||||
"content": {{ post.templateContent | algExcerpt | jsonify | safe }},
|
||||
"_tags": [{%- for tag in post.data.tags -%}"{{ tag }}"{%- if not loop.last -%},{% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
]
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
const algoliasearch = require('algoliasearch');
|
||||
|
||||
const objects = require('../../_site/search/all.json');
|
||||
|
||||
const client = algoliasearch('QFXNLHI6NP', process.env.ALGOLIA_SEARCH);
|
||||
|
||||
const index = client.initIndex('dev_atlas');
|
||||
|
||||
index
|
||||
.replaceAllObjects(objects, { autoGenerateObjectIDIfNotExist: true })
|
||||
.then(() => {
|
||||
console.log('updated');
|
||||
})
|
||||
.catch((error) => console.error('Failed to Algolia update index', error));
|
||||
|
|
@ -565,6 +565,9 @@ a.card:hover {
|
|||
width: 6rem;
|
||||
}
|
||||
|
||||
.is-transparent, .is-transparent:hover {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
/* purgecss end ignore */
|
||||
|
||||
.navbar-item.is-mega {
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ $icons: (
|
|||
life-ring: $fa-var-life-ring,
|
||||
pencil-alt: $fa-var-pencil-alt,
|
||||
arrow-circle-right: $fa-var-arrow-circle-right,
|
||||
globe: $fa-var-globe,
|
||||
);
|
||||
|
||||
@each $key, $value in $icons {
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
// var client = algoliasearch('QFXNLHI6NP', '6b5ccc86ead48e79e587963eeb2d83e8');
|
||||
// var searchIndex = client.initIndex("dev_atlas");
|
||||
|
||||
// var searchBox = document.getElementById("search");
|
||||
// var searchForm = document.getElementById("search-form");
|
||||
|
||||
// var runSearch = function(event) {
|
||||
// var searchResultsContainer = document.getElementById("search-results");
|
||||
// searchResultsContainer.textContent = "";
|
||||
|
||||
// var searchTerm = event.target.value;
|
||||
// if (searchTerm.length < 2) return;
|
||||
|
||||
// var toolToFilterBy = event.target.dataset.filter || false;
|
||||
|
||||
// var alogliaArgs = {
|
||||
// hitsPerPage: 10,
|
||||
// attributesToRetrieve: ["title", "url", "_tags"],
|
||||
// attributesToSnippet: ["content"],
|
||||
// snippetEllipsisText: "…",
|
||||
// };
|
||||
|
||||
// if (toolToFilterBy) alogliaArgs.filters = toolToFilterBy;
|
||||
|
||||
// searchIndex.search(searchTerm, alogliaArgs).then(function(e){
|
||||
// results = e["hits"]
|
||||
|
||||
// console.log(results);
|
||||
|
||||
// var formattedResults = results.map(function(result){
|
||||
// var toolName = extractToolName(result._tags);
|
||||
// console.log(toolName)
|
||||
// // Create elements
|
||||
// var link = document.createElement("a");
|
||||
// var title = document.createElement("strong");
|
||||
// var excerpt = document.createElement("p");
|
||||
// var tool = document.createElement("span");
|
||||
|
||||
// link.href = result.url;
|
||||
// link.classList.add(
|
||||
// "panel-block",
|
||||
// "p-3",
|
||||
// "is-block"
|
||||
// );
|
||||
|
||||
// excerpt.classList.add("search-snippet");
|
||||
// excerpt.innerHTML = result._snippetResult.content.value;
|
||||
|
||||
// title.classList.add("is-flex", "is-justify-content-space-between");
|
||||
// title.innerText = result.title;
|
||||
|
||||
// tool.innerText = toolName;
|
||||
// tool.classList.add(
|
||||
// "tag",
|
||||
// "is-info",
|
||||
// "is-light"
|
||||
|
||||
// );
|
||||
|
||||
// // Put all the elements together
|
||||
// title.appendChild(tool);
|
||||
// link.appendChild(title);
|
||||
// link.appendChild(excerpt);
|
||||
// return link;
|
||||
// });
|
||||
|
||||
// formattedResults.map(function(el){
|
||||
// searchResultsContainer.insertAdjacentElement("beforeend", el)
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
// var extractToolName = function(tags) {
|
||||
// return tags.filter(function(tag){ return tag === "BI Library" || tag === "Automation Hub" || tag === "Atlas"});
|
||||
// };
|
||||
|
||||
// Function.prototype.debounce = function (delay) {
|
||||
// var outter = this,
|
||||
// timer;
|
||||
|
||||
// return function () {
|
||||
// var inner = this,
|
||||
// args = [].slice.apply(arguments);
|
||||
|
||||
// clearTimeout(timer);
|
||||
// timer = setTimeout(function () {
|
||||
// outter.apply(inner, args);
|
||||
// }, delay);
|
||||
// };
|
||||
// };
|
||||
|
||||
// if(searchBox != undefined || searchForm != undefined){
|
||||
// searchBox.addEventListener("input", runSearch.debounce(250));
|
||||
// searchForm.addEventListener("submit", (e) => e.preventDefault());
|
||||
// }
|
||||
Loading…
Reference in a new issue