Merge pull request #158 from jayvdb/add-html-profile

Add html profile
This commit is contained in:
sur.la.route 2021-12-14 10:02:10 +01:00 committed by GitHub
commit cfcacee83f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 9708 additions and 2 deletions

3
.gitignore vendored
View file

@ -1,5 +1,6 @@
badtest.html
node_modules
source_django
report.xml
# Created by https://www.toptal.com/developers/gitignore/api/macos,python
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,python

View file

@ -1,3 +1,8 @@
exclude: >
(?x)(
docs/|
node_modules/
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1

7
docs/_assets/style.scss Normal file
View file

@ -0,0 +1,7 @@
@import "../node_modules/bulma/bulma";
a {
color:pink;
}

3
docs/_static/style.css vendored Normal file
View file

@ -0,0 +1,3 @@
@charset "UTF-8";
/*! bulma.io v0.9.3 | MIT License | github.com/jgthms/bulma */.breadcrumb{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.breadcrumb:not(:last-child){margin-bottom:1.5rem}
/*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */*,:after,:before{box-sizing:inherit}@-webkit-keyframes spinAround{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes spinAround{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}@-webkit-keyframes moveIndeterminate{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes moveIndeterminate{0%{background-position:200% 0}to{background-position:-200% 0}}.breadcrumb{font-size:1rem;white-space:nowrap}.breadcrumb a{align-items:center;color:#485fc7;display:flex;justify-content:center;padding:0 .75em}.breadcrumb a:hover{color:#363636}.breadcrumb li{align-items:center;display:flex}.breadcrumb li:first-child a{padding-left:0}.breadcrumb li.is-active a{color:#363636;cursor:default;pointer-events:none}.breadcrumb li+li:before{color:#b5b5b5;content:"/"}.breadcrumb ol,.breadcrumb ul{align-items:flex-start;display:flex;flex-wrap:wrap;justify-content:flex-start}.breadcrumb .icon:first-child{margin-right:.5em}.breadcrumb .icon:last-child{margin-left:.5em}.breadcrumb.is-centered ol,.breadcrumb.is-centered ul{justify-content:center}.breadcrumb.is-right ol,.breadcrumb.is-right ul{justify-content:flex-end}.breadcrumb.is-small{font-size:.75rem}.breadcrumb.is-medium{font-size:1.25rem}.breadcrumb.is-large{font-size:1.5rem}.breadcrumb.has-arrow-separator li+li:before{content:"→"}.breadcrumb.has-bullet-separator li+li:before{content:"•"}.breadcrumb.has-dot-separator li+li:before{content:"·"}.breadcrumb.has-succeeds-separator li+li:before{content:"≻"}

132
docs/_templates/home_layout.html vendored Normal file
View file

@ -0,0 +1,132 @@
{#
basic/layout.html
~~~~~~~~~~~~~~~~~
Master layout template for Sphinx themes.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- block doctype -%}{%- if html5_doctype %}
<!DOCTYPE html>
{%- else %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{%- endif %}{%- endblock %}
{%- set reldelim1 = reldelim1 is not defined and ' &#187;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and
(sidebars != []) %}
{# URL root should never be #, then all links are fragments #}
{%- if not embedded and docstitle %}
{%- set titlesuffix = " &#8212; "|safe + docstitle|e %}
{%- else %}
{%- set titlesuffix = "" %}
{%- endif %}
{%- if html_tag %}
{{ html_tag }}
{%- else %}
<html{% if not html5_doctype %} xmlns="http://www.w3.org/1999/xhtml"{% endif %}{% if language is not none %} lang="{{ language }}"{% endif %}>
{%- endif %}
<head>
{%- if not html5_doctype and not skip_ua_compatible %}
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
{%- endif %}
{%- if use_meta_charset or html5_doctype %}
<meta charset="{{ encoding }}" />
{%- else %}
<meta http-equiv="Content-Type" content="text/html; charset={{ encoding }}" />
{%- endif %}
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{- metatags }}
{%- block htmltitle %}
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{%- endblock %}
{%- if not embedded %}
{%- if pageurl %}
<link rel="canonical" href="{{ pageurl|e }}" />
{%- endif %}
{%- if use_opensearch %}
<link rel="search" type="application/opensearchdescription+xml"
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
{%- endif %}
{%- if favicon_url %}
<link rel="shortcut icon" href="{{ favicon_url|e }}"/>
{%- endif %}
{%- endif %}
{%- block linktags %}
{%- if hasdoc('about') %}
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
{%- endif %}
{%- if hasdoc('genindex') %}
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
{%- endif %}
{%- if hasdoc('search') %}
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
{%- endif %}
{%- if hasdoc('copyright') %}
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
{%- endif %}
{%- if next %}
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
{%- endif %}
{%- if prev %}
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
{%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
</head>
{%- block body_tag %}<body>{% endblock %}
{%- block header %}{% endblock %}
{%- block content %}
{%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
<div class="document">
{%- block document %}
<div class="documentwrapper">
{%- if render_sidebar %}
<div class="bodywrapper">
{%- endif %}
<div class="body" role="main">
{% block body %} {% endblock %}
<div class="clearer"></div>
</div>
{%- if render_sidebar %}
</div>
{%- endif %}
</div>
{%- endblock %}
<div class="clearer"></div>
</div>
{%- endblock %}
{%- block footer %}
<div class="footer" role="contentinfo">
{%- if show_copyright %}
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}&#169; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
{%- else %}
{% trans copyright=copyright|e %}&#169; Copyright {{ copyright }}.{% endtrans %}
{%- endif %}
{%- endif %}
{%- if last_updated %}
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
{%- endif %}
{%- if show_sphinx %}
{% trans sphinx_version=sphinx_version|e %}Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
{%- endif %}
</div>
{%- endblock %}
</body>
</html>

View file

@ -1,5 +1,7 @@
{% extends "!layout.html" %}
{%- block htmltitle %}
<meta {{pageurl}} >
<title>{{ docstitle|e }}{{ title|striptags|e }}</title>
{%- endblock %}
@ -10,6 +12,7 @@
{%- block extrahead %}
<meta {{pageurl}} >
{{ super() }}
{%- if meta is mapping and meta.get("description") %}
{% set description = meta.get("description") %}

View file

@ -21,7 +21,17 @@ extensions = ["myst_parser", "sphinx_copybutton", "sphinx_sitemap"]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = [
"_build",
"Thumbs.db",
".DS_Store",
"_assets",
"node_modules",
"gulpfile.js",
"package.json",
"package-lock.json",
"requirements.txt",
]
# -- Options for HTML output -------------------------------------------------
@ -57,6 +67,10 @@ source_suffix = [".rst", ".md"]
pygments_style = "sphinx"
html_css_files = [
"css/style.css",
]
# -- Sitemap -------------------------------------------------------------------
html_baseurl = "https://djlint.com/"

View file

@ -101,6 +101,7 @@ Set a default profile for the template language. The profile will disable linter
Options:
- html
- django
- jinja
- nunjucks

32
docs/gulpfile.js Normal file
View file

@ -0,0 +1,32 @@
var postcss = require('gulp-postcss');
var { gulp, series, src, dest, watch, paths } = require('gulp');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
var sass = require('gulp-sass')(require('sass'));
var sortMediaQueries = require('postcss-sort-media-queries');
var purgecss = require('gulp-purgecss');
function style() {
return src('./_assets/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(postcss([
sortMediaQueries(),
autoprefixer(),
cssnano(),
]))
.pipe(purgecss({
content: ['./**/*.html.dj'],
safelist: {
deep: [/breadcrumb/],
}
}))
.pipe(dest('./_static/css/'));
};
exports.default = series(style)
exports.watch = function() {
watch('./_assets/style.scss',{ ignoreInitial: false }, style)
}

9467
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

39
docs/package.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "djlint",
"version": "0.6.8",
"description": "djlint HTML Template Linter and Formatter",
"main": " ",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Riverside-Healthcare/djLint.git"
},
"keywords": [
"djlint",
"html",
"formatter",
"linter"
],
"author": "Christopher Pickering",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/Riverside-Healthcare/djLint/issues"
},
"homepage": "https://github.com/Riverside-Healthcare/djLint#readme",
"dependencies": {
"autoprefixer": "^10.4.0",
"bulma": "^0.9.3",
"cssnano": "^5.0.12",
"gulp": "^4.0.2",
"gulp-postcss": "^9.0.1",
"gulp-purgecss": "^4.1.3",
"gulp-sass": "^5.0.0",
"postcss-sort-media-queries": "^4.2.1",
"sass": "^1.44.0"
}
}

View file

@ -189,6 +189,7 @@ class Config:
# codes to exclude
profile_dict: Dict[str, List[str]] = {
"html": ["D", "J", "T", "N", "M"],
"django": ["J", "N", "M"],
"jinja": ["D", "N", "M"],
"nunjucks": ["D", "J", "M"],

View file

@ -72,6 +72,7 @@ def no_pragma(config: Config, this_file: Path) -> bool:
first_line = open_file.readline()
pragma_patterns = {
"html": html_patterns,
"django": django_jinja_patterns + html_patterns,
"jinja": django_jinja_patterns + html_patterns,
"nunjucks": nunjucks_patterns + html_patterns,