Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@prettier/plugin-pug

Package Overview
Dependencies
Maintainers
12
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prettier/plugin-pug - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

dist/options/wrap-attributes.js

21

CHANGELOG.md
# Next
[diff](https://github.com/prettier/plugin-pug/compare/1.7.0...master)
[diff](https://github.com/prettier/plugin-pug/compare/1.8.0...master)
# 1.8.0
[diff](https://github.com/prettier/plugin-pug/compare/1.7.0...1.8.0)
- Implement `pugWrapAttributesThreshold` option ([#118])
- Implement `pugWrapAttributesPattern` option ([#126])
- Support `//- prettier-ignore` comments inside pug templates ([#125])
- Add middle attributes sorting ([#120])
- Fix counting of current line-length ([#121])
- Fix handling of literal attributes ([#130])
- Add [@lehni](https://github.com/lehni) and [@SkyaTura](https://github.com/SkyaTura) as contributors
[#118]: https://github.com/prettier/plugin-pug/issues/118
[#126]: https://github.com/prettier/plugin-pug/issues/126
[#125]: https://github.com/prettier/plugin-pug/pull/125
[#120]: https://github.com/prettier/plugin-pug/pull/120
[#121]: https://github.com/prettier/plugin-pug/pull/121
[#130]: https://github.com/prettier/plugin-pug/issues/130
# 1.7.0

@@ -6,0 +25,0 @@

2

dist/doctype-shortcut-registry.js

@@ -15,2 +15,2 @@ "use strict";

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9jdHlwZS1zaG9ydGN1dC1yZWdpc3RyeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9kb2N0eXBlLXNob3J0Y3V0LXJlZ2lzdHJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFhLFFBQUEseUJBQXlCLEdBQUc7SUFDeEMsaUJBQWlCLEVBQUUsY0FBYztJQUNqQyx5Q0FBeUMsRUFBRSxhQUFhO0lBQ3hELDJIQUEySCxFQUMxSCxzQkFBc0I7SUFDdkIsK0dBQStHLEVBQzlHLGdCQUFnQjtJQUNqQixtSEFBbUgsRUFDbEgsa0JBQWtCO0lBQ25CLG1HQUFtRyxFQUFFLGFBQWE7SUFDbEgsK0dBQStHLEVBQzlHLGVBQWU7SUFDaEIsZ0lBQWdJLEVBQy9ILGdCQUFnQjtJQUNqQix3R0FBd0csRUFDdkcsZUFBZTtDQUNoQixDQUFDIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9jdHlwZS1zaG9ydGN1dC1yZWdpc3RyeS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9kb2N0eXBlLXNob3J0Y3V0LXJlZ2lzdHJ5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQVlhLFFBQUEseUJBQXlCLEdBQUc7SUFDeEMsaUJBQWlCLEVBQUUsY0FBYztJQUNqQyx5Q0FBeUMsRUFBRSxhQUFhO0lBQ3hELDJIQUEySCxFQUMxSCxzQkFBc0I7SUFDdkIsK0dBQStHLEVBQzlHLGdCQUFnQjtJQUNqQixtSEFBbUgsRUFDbEgsa0JBQWtCO0lBQ25CLG1HQUFtRyxFQUFFLGFBQWE7SUFDbEgsK0dBQStHLEVBQzlHLGVBQWU7SUFDaEIsZ0lBQWdJLEVBQy9ILGdCQUFnQjtJQUNqQix3R0FBd0csRUFDdkcsZUFBZTtDQUNQLENBQUMifQ==

@@ -31,4 +31,5 @@ "use strict";

logger.debug('[parsers:pug:parse]:', { text });
const tokens = lex(text.trimLeft());
return tokens;
const content = text.trimLeft();
const tokens = lex(content);
return { content, tokens };
},

@@ -56,5 +57,6 @@ astFormat: 'pug-ast',

print(path, options, print) {
const tokens = path.stack[0];
const entry = path.stack[0];
const { content, tokens } = entry;
const pugOptions = converge_1.convergeOptions(options);
const printer = new printer_1.PugPrinter(tokens, pugOptions);
const printer = new printer_1.PugPrinter(content, tokens, pugOptions);
const result = printer.build();

@@ -80,2 +82,2 @@ logger.debug('[printers:pug-ast:print]:', result);

exports.defaultOptions = exports.plugin.defaultOptions;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQ0EsaUNBQWlDO0FBRWpDLHFDQUEwRDtBQUMxRCx1Q0FBb0U7QUFDcEUsaURBQXFEO0FBQ3JELHVDQUEwRDtBQUUxRCxNQUFNLE1BQU0sR0FBVyxxQkFBWSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQzdDLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLEtBQUssTUFBTSxFQUFFO0lBQ3BDLE1BQU0sQ0FBQyxXQUFXLENBQUMsaUJBQVEsQ0FBQyxLQUFLLENBQUMsQ0FBQztDQUNuQztBQUVZLFFBQUEsTUFBTSxHQUFXO0lBQzdCLFNBQVMsRUFBRTtRQUNWO1lBQ0MsSUFBSSxFQUFFLEtBQUs7WUFDWCxPQUFPLEVBQUUsQ0FBQyxLQUFLLENBQUM7WUFDaEIsT0FBTyxFQUFFLFdBQVc7WUFDcEIsT0FBTyxFQUFFLE1BQU07WUFDZixjQUFjLEVBQUUsS0FBSztZQUNyQixrQkFBa0IsRUFBRSxZQUFZO1lBQ2hDLFVBQVUsRUFBRSxDQUFDLE9BQU8sRUFBRSxNQUFNLENBQUM7WUFDN0Isa0JBQWtCLEVBQUUsR0FBRztZQUN2QixpQkFBaUIsRUFBRSxDQUFDLE1BQU0sQ0FBQztTQUMzQjtLQUNEO0lBQ0QsT0FBTyxFQUFFO1FBQ1IsR0FBRyxFQUFFO1lBQ0osS0FBSyxDQUFDLElBQVksRUFBRSxPQUF5QyxFQUFFLE9BQXNCO2dCQU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UFLLEVBQUUsUUFBUTtZQUNmLFdBQVcsRUFDVixzR0FBc0c7U0FDdkc7UUFDRDtZQUNDLEtBQUssRUFBRSxXQUFXO1lBQ2xCLFdBQVcsRUFDVixnSEFBZ0g7U0FDakg7UUFDRDtZQUNDLEtBQUssRUFBRSxNQUFNO1lBQ2IsV0FBVyxFQUNWLCtHQUErRztTQUNoSDtLQUNEO0NBQ0QsQ0FBQztBQUlGLFNBQWdCLCtCQUErQixDQUFDLGtCQUFzQztJQUNyRixRQUFRLGtCQUFrQixFQUFFO1FBQzNCLEtBQUssUUFBUSxDQUFDO1FBQ2QsS0FBSyxXQUFXLENBQUM7UUFDakIsS0FBSyxNQUFNO1lBQ1YsT0FBTyxrQkFBa0IsQ0FBQztLQUMzQjtJQUNELE1BQU0sSUFBSSxLQUFLLENBQ2QscURBQXFELGtCQUFrQixzREFBc0QsQ0FDN0gsQ0FBQztBQUNILENBQUM7QUFWRCwwRUFVQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PUG_SORT_ATTRIBUTES_END_OPTION = exports.PUG_SORT_ATTRIBUTES_BEGINNING_OPTION = void 0;
exports.PUG_SORT_ATTRIBUTES_OPTION = exports.PUG_SORT_ATTRIBUTES_END_OPTION = exports.PUG_SORT_ATTRIBUTES_BEGINNING_OPTION = void 0;
const __1 = require("..");

@@ -21,2 +21,14 @@ const pugSortAttributesOption = {

};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvb3B0aW9ucy9hdHRyaWJ1dGUtc29ydGluZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSwwQkFBa0M7QUFFbEMsTUFBTSx1QkFBdUIsR0FBRztJQUMvQixLQUFLLEVBQUUsT0FBTztJQUNkLFFBQVEsRUFBRSxnQkFBWTtJQUN0QixJQUFJLEVBQUUsTUFBTTtJQUNaLEtBQUssRUFBRSxJQUFJO0lBQ1gsT0FBTyxFQUFFLENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxFQUFFLENBQUM7SUFDeEIsV0FBVyxFQUFFLEVBQUU7Q0FDZixDQUFDO0FBRVcsUUFBQSxvQ0FBb0MsR0FBRztJQUNuRCxHQUFHLHVCQUF1QjtJQUMxQixXQUFXLEVBQUUsNEVBQTRFO0NBQ3pGLENBQUM7QUFFVyxRQUFBLDhCQUE4QixHQUFHO0lBQzdDLEdBQUcsdUJBQXVCO0lBQzFCLFdBQVcsRUFBRSxzRUFBc0U7Q0FDbkYsQ0FBQyJ9
exports.PUG_SORT_ATTRIBUTES_OPTION = {
since: '1.8.0',
category: __1.CATEGORY_PUG,
type: 'choice',
default: 'as-is',
description: 'Change how the attributes between _beginning_ and _end_ should be sorted.',
choices: [
{ value: 'asc', description: 'Sort middle attributes ascending.' },
{ value: 'desc', description: 'Sort middle attributes descending.' },
{ value: 'as-is', description: 'Middle attributes are leave untouched.' }
]
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvb3B0aW9ucy9hdHRyaWJ1dGUtc29ydGluZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwwQkFBa0M7QUFFbEMsTUFBTSx1QkFBdUIsR0FBRztJQUMvQixLQUFLLEVBQUUsT0FBTztJQUNkLFFBQVEsRUFBRSxnQkFBWTtJQUN0QixJQUFJLEVBQUUsTUFBTTtJQUNaLEtBQUssRUFBRSxJQUFJO0lBQ1gsT0FBTyxFQUFFLENBQUMsRUFBRSxLQUFLLEVBQUUsRUFBRSxFQUFFLENBQUM7SUFDeEIsV0FBVyxFQUFFLEVBQUU7Q0FDZixDQUFDO0FBRVcsUUFBQSxvQ0FBb0MsR0FBRztJQUNuRCxHQUFHLHVCQUF1QjtJQUMxQixXQUFXLEVBQUUsNEVBQTRFO0NBQ3pGLENBQUM7QUFFVyxRQUFBLDhCQUE4QixHQUFHO0lBQzdDLEdBQUcsdUJBQXVCO0lBQzFCLFdBQVcsRUFBRSxzRUFBc0U7Q0FDbkYsQ0FBQztBQUVXLFFBQUEsMEJBQTBCLEdBQUc7SUFDekMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUsZ0JBQVk7SUFDdEIsSUFBSSxFQUFFLFFBQVE7SUFDZCxPQUFPLEVBQUUsT0FBTztJQUNoQixXQUFXLEVBQUUsMkVBQTJFO0lBQ3hGLE9BQU8sRUFBRTtRQUNSLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxXQUFXLEVBQUUsbUNBQW1DLEVBQUU7UUFDbEUsRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLFdBQVcsRUFBRSxvQ0FBb0MsRUFBRTtRQUNwRSxFQUFFLEtBQUssRUFBRSxPQUFPLEVBQUUsV0FBVyxFQUFFLHdDQUF3QyxFQUFFO0tBQ3pFO0NBQ0QsQ0FBQyJ9
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.partialSort = exports.compareAttributeToken = void 0;
function compareByIndex(leftIndex, rightIndex) {
if (leftIndex !== -1 && rightIndex === -1) {
exports.partialSort = exports.stableSort = exports.compareAttributeToken = void 0;
function compareAttributeToken(a, b, sortAttributes, sortAttributesBeginning, sortAttributesEnd) {
const sortPatternsBeginning = sortAttributesBeginning.map((sort) => new RegExp(sort)).reverse();
const sortPatternsEnd = sortAttributesEnd.map((sort) => new RegExp(sort));
const aName = a.name;
const bName = b.name;
const aBeginningIndex = sortPatternsBeginning.findIndex((pattern) => pattern.test(aName));
const bBeginningIndex = sortPatternsBeginning.findIndex((pattern) => pattern.test(bName));
const beginning = aBeginningIndex - bBeginningIndex;
if (beginning > 0) {
return -1;
}
if (leftIndex === -1 && rightIndex !== -1) {
if (beginning < 0) {
return 1;
}
const result = leftIndex - rightIndex;
if (result <= -1) {
const aEndIndex = sortPatternsEnd.findIndex((pattern) => pattern.test(aName));
const bEndIndex = sortPatternsEnd.findIndex((pattern) => pattern.test(bName));
const end = aEndIndex - bEndIndex;
if (end > 0) {
return 1;
}
if (end < 0) {
return -1;
}
if (result >= 1) {
return 1;
}
return 0;
}
function compareAttributeToken(a, b, sortAttributes, moveToEnd = false) {
const sortPatterns = sortAttributes.map((sort) => new RegExp(sort));
const aName = a.name;
const bName = b.name;
let result = 0;
if (result === 0) {
let aIndex = moveToEnd ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
let bIndex = moveToEnd ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
let aFound = false;
let bFound = false;
for (let index = 0; index < sortPatterns.length; index++) {
const pattern = sortPatterns[index];
if (!aFound && pattern.test(aName)) {
aIndex = index;
aFound = true;
switch (sortAttributes) {
case 'asc': {
if (aName > bName) {
return 1;
}
if (!bFound && pattern.test(bName)) {
bIndex = index;
bFound = true;
if (aName < bName) {
return -1;
}
if (aFound && bFound) {
break;
break;
}
case 'desc': {
if (aName > bName) {
return -1;
}
if (aName < bName) {
return 1;
}
break;
}
result = compareByIndex(aIndex, bIndex);
}
return result;
return 0;
}
exports.compareAttributeToken = compareAttributeToken;
function stableSort(array, compare) {
const entries = array.map((value, index) => [value, index]);
entries.sort((a, b) => {
const order = compare(a[0], b[0]);
return order !== 0 ? order : a[1] - b[1];
});
return entries.map(([value]) => value);
}
exports.stableSort = stableSort;
function partialSort(arr, start, end, compareFn) {
const preSorted = arr.slice(0, start);
const postSorted = arr.slice(end);
const sorted = arr.slice(start, end).sort(compareFn);
arr.length = 0;
arr.push(...preSorted.concat(sorted).concat(postSorted));
return arr;
const preSort = arr.slice(0, start);
const postSort = arr.slice(end);
const attributes = arr.slice(start, end);
const sorted = stableSort(attributes, compareFn);
return [...preSort, ...sorted, ...postSort];
}
exports.partialSort = partialSort;
//# sourceMapping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k7WUFDWCxXQUFXLEVBQUUsbUJBQW1CO1NBQ2hDO1FBQ0Q7WUFFQyxLQUFLLEVBQUUsTUFBTTtZQUNiLFdBQVcsRUFBRSxtQkFBbUI7U0FDaEM7UUFDRDtZQUNDLEtBQUssRUFBRSxLQUFLO1lBQ1osV0FBVyxFQUFFLGdGQUFnRjtTQUM3RjtLQUNEO0NBQ0QsQ0FBQztBQUVXLFFBQUEsdUJBQXVCLEdBQUc7SUFDdEMsS0FBSyxFQUFFLE9BQU87SUFDZCxRQUFRLEVBQUUsZUFBWTtJQUN0QixJQUFJLEVBQUUsUUFBUTtJQUNkLE9BQU8sRUFBRSxJQUFJO0lBQ2IsV0FBVyxFQUFFLDZEQUE2RDtJQUMxRSxPQUFPLEVBQUU7UUFDUjtZQUNDLEtBQUssRUFBRSxJQUFJO1lBQ1gsV0FBVyxFQUFFLDBCQUEwQjtTQUN2QztRQUNEO1lBQ0MsS0FBSyxFQUFFLFFBQVE7WUFDZixXQUFXLEVBQUUsd0NBQXdDO1NBQ3JEO1FBQ0Q7WUFDQyxLQUFLLEVBQUUsT0FBTztZQUNkLFdBQVcsRUFBRSw4Q0FBOEM7U0FDM0Q7S0FDRDtDQUNELENBQUMifQ==

@@ -24,7 +24,10 @@ "use strict";

commentPreserveSpaces: (_h = options.pugCommentPreserveSpaces) !== null && _h !== void 0 ? _h : options.commentPreserveSpaces,
pugSortAttributes: options.pugSortAttributes,
pugSortAttributesBeginning: options.pugSortAttributesBeginning,
pugSortAttributesEnd: options.pugSortAttributesEnd
pugSortAttributesEnd: options.pugSortAttributesEnd,
pugWrapAttributesThreshold: options.pugWrapAttributesThreshold,
pugWrapAttributesPattern: options.pugWrapAttributesPattern
};
}
exports.convergeOptions = convergeOptions;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVyZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9jb252ZX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-attributes");
exports.CATEGORY_PUG = 'Pug';

@@ -25,5 +26,8 @@ exports.options = {

pugCommentPreserveSpaces: comment_preserve_spaces_1.PUG_COMMENT_PRESERVE_SPACES_OPTION,
pugSortAttributes: attribute_sorting_1.PUG_SORT_ATTRIBUTES_OPTION,
pugSortAttributesBeginning: attribute_sorting_1.PUG_SORT_ATTRIBUTES_BEGINNING_OPTION,
pugSortAttributesEnd: attribute_sorting_1.PUG_SORT_ATTRIBUTES_END_OPTION
pugSortAttributesEnd: attribute_sorting_1.PUG_SORT_ATTRIBUTES_END_OPTION,
pugWrapAttributesThreshold: wrap_attributes_1.WRAP_ATTRIBUTES_THRESHOLD,
pugWrapAttributesPattern: wrap_attributes_1.WRAP_ATTRIBUTES_PATTERN
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3B0aW9ucy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFDQSwrREFBdUg7QUFDdkgsMkRBQTJHO0FBQzNHLHlFQUlvQztBQUNwQyx1RUFJbUM7QUFDbkMscUNBU2tCO0FBRUwsUUFBQSxZQUFZLEdBQVcsS0FBSyxDQUFDO0FBOEI3QixRQUFBLE9BQU8sR0FBRztJQUN0QixhQUFhLEVBQUUsK0JBQXNCO0lBQ3JDLGNBQWMsRUFBRSxnQ0FBdUI7SUFDdkMsV0FBVyxFQUFFLDZCQUFvQjtJQUNqQyxVQUFVLEVBQUUsNEJBQW1CO0lBQy9CLGlCQUFpQixFQUFFLG1DQUEwQjtJQUM3QyxjQUFjLEVBQUUsZ0NBQXVCO0lBQ3ZDLE9BQU8sRUFBRSx3QkFBZTtJQUN4QixrQkFBa0IsRUFBRSxnREFBMEI7SUFDOUMscUJBQXFCLEVBQUUsb0RBQThCO0lBQ3JELHNCQUFzQixFQUFFLDBEQUErQjtJQUN2RC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ier Pug Plugin",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -36,19 +36,2 @@ <p align="center">

You can disable code formatting for a particular code block by adding <nobr>`<!-- prettier-ignore -->`</nobr> before ` ```pug `.
````markdown
Pug code with custom formatting:
<!-- prettier-ignore -->
```pug
div.text( color = "primary", disabled ="true" )
```
Prettified code:
```pug
.text(color="primary", disabled)
```
````
## Getting started

@@ -81,71 +64,70 @@

### Prettier Options
### Selectively ignoring automatic formatting
- `bracketSpacing`
If you want to configure different bracketSpacing for pug than for js code, you can use prettier's override.
```json
{
"bracketSpacing": true,
"overrides": [
{
"files": "*.pug",
"options": {
"parser": "pug",
"bracketSpacing": false
}
}
]
}
```
- `printWidth`
_Currently not very accurate, but works_
- `semi`
If you want to configure different semi for pug than for js code, you can use prettier's override.
```json
{
"semi": false,
"overrides": [
{
"files": "*.pug",
"options": {
"parser": "pug",
"semi": true
}
}
]
}
```
- `singleQuote`
If you want to configure different quotes for pug than for js code, you can use prettier's override.
```json
{
"singleQuote": true,
"overrides": [
{
"files": "*.pug",
"options": {
"parser": "pug",
"singleQuote": false
}
}
]
}
```
- `tabWidth`
Use spaces for indentation
- `useTabs`
Use tab for indentation
Overrides `tabWidth`
You can disable code formatting for a particular element by adding <nobr>`//- prettier-ignore`</nobr> comments in your pug templates:
> All these six Prettier options have an alias e.g. `pugSingleQuote`
> You can force override pug formatting with them e.g. when using `pug` embedded in `vue` files
```pug
div.text( color = "primary", disabled ="true" )
//- prettier-ignore
div.text( color = "primary", disabled ="true" )
//- prettier-ignore: because of reasons
div
div.text( color = "primary", disabled ="true" )
```
See [changelog 1.6.0](https://github.com/prettier/plugin-pug/blob/master/CHANGELOG.md#160) for more
Prettified output:
#### prettier-pug specific options
```pug
.text(color="primary", disabled)
//- prettier-ignore
div.text( color = "primary", disabled ="true" )
//- prettier-ignore: because of reasons
div
div.text( color = "primary", disabled ="true" )
```
These are specific options only for prettier-pug
They should be set via `Prettier`'s `overrides` option
You can also disable code formatting in Markdown for a particular ` ```pug ` block by adding <nobr>`<!-- prettier-ignore -->`</nobr> before the block:
- `attributeSeparator`
````markdown
Pug code with preserved custom formatting:
<!-- prettier-ignore -->
```pug
div.text( color = "primary", disabled ="true" )
```
Pug code with automatic formatting:
```pug
.text(color="primary", disabled)
```
````
### Pug versions of standard prettier options
By default, the same formatting options are used as configured through the standard prettier options.
By using versions of these standard options prefixed with `pug`, you can override pug formatting options even when using pug embedded in other files, e.g. vue single-file components:
- `pugBracketSpacing`
Print spaces between brackets in object literals.
- `pugPrintWidth`
Specify the line length that the printer will wrap on.
- `pugSemi`
Print semicolons at the ends of code statements.
- `pugSingleQuote`
Use single quotes instead of double quotes.
Please note that the opposite setting will be used automatically for inlined JavaScript.
- `pugTabWidth`
Use spaces for indentation and specify the number of spaces per indentation-level.
- `pugUseTabs`
Indent lines with tabs instead of spaces.
Overrides `pugTabWidth`
- `pugArrowParens`
Include parentheses around a sole arrow function parameter.
### Additional pug-specific options
These additional options are specific to pug templates and can be configured in your global `.prettierrc` file:
- `pugAttributeSeparator`
Change when attributes are separated by commas in tags.

@@ -163,3 +145,3 @@

- `closingBracketPosition`
- `pugClosingBracketPosition`
Position of closing bracket of attributes.

@@ -194,3 +176,3 @@

- `commentPreserveSpaces`
- `pugCommentPreserveSpaces`
Change behavior of spaces within comments.

@@ -207,3 +189,3 @@

- `pugSortAttributesBeginning` (and `pugSortAttributesEnd`)
- `pugSortAttributesBeginning` & `pugSortAttributesEnd`
Sort attributes by regex patterns to the beginning or the end.

@@ -214,4 +196,51 @@ [Example](https://github.com/prettier/plugin-pug/issues/22#issuecomment-699509995)

The definitions for these options can be found in [src/options/index.ts](https://github.com/prettier/plugin-pug/blob/master/src/options/index.ts)
- `pugSortAttributes`
Sort attributes that are not on _beginning_ and _end_ patterns.
Choices:
- `'as-is'` _default_ -> Keep the attributes untouched.
Example: `Foo(a c d b)`
- `'asc'` -> Sort attributes ascending.
Example: `Foo(a b c d)`
- `'desc'` -> Sort attributes descending.
Example: `Foo(d c b a)`
- `pugWrapAttributesThreshold`
Define the maximum amount of attributes that an element can appear with on one line before it gets wrapped.
- `pugWrapAttributesPattern`
Define a regex pattern to match attributes against that should always trigger wrapping.
Choices:
- `-1` _default_ -> Only wrap attributes as needed.
Example:
```pug
input(type="text")
input(type="text", value="my_value", name="my_name")
```
- `0` -> Always wrap attributes.
Example:
```pug
input(
type="text"
)
input(
type="text",
value="my_value",
name="my_name"
)
```
- `1` -> Allow one unwrapped attribute, wrap two and more.
Example:
```pug
input(type="text")
input(
type="text",
value="my_value",
name="my_name"
)
```
- `2 .. Infinity` -> Same as above, just with different thresholds.
## Some workarounds

@@ -298,1 +327,3 @@

Thanks to [@Peilonrayz](https://github.com/Peilonrayz), who gave me the [idea](https://codereview.stackexchange.com/a/236031/128216) to rewrite the printer into a [class](https://github.com/prettier/plugin-pug/commit/a6e3a4b776ce67f0d5d763aaf1f88c0c860c6ed3) and thus make the code a lot more maintainable.
Thanks to [@lehni](https://github.com/lehni) and [@SkyaTura](https://github.com/SkyaTura) for the massive contribution and the introduction of many new features into the project.

@@ -0,1 +1,13 @@

export type DoctypeShortcut =
| 'doctype html'
| 'doctype xml'
| 'doctype transitional'
| 'doctype strict'
| 'doctype frameset'
| 'doctype 1.1'
| 'doctype basic'
| 'doctype mobile'
| 'doctype plist';
// eslint-disable-next-line @typescript-eslint/typedef
export const DOCTYPE_SHORTCUT_REGISTRY = {

@@ -17,2 +29,2 @@ '<!doctype html>': 'doctype html',

'doctype plist'
};
} as const;

@@ -1,2 +0,13 @@

import { Doc, FastPath, Options, Parser, ParserOptions, Plugin } from 'prettier';
import {
Doc,
FastPath,
Options,
Parser,
ParserOptions,
Plugin,
Printer,
RequiredOptions,
SupportLanguage,
SupportOption
} from 'prettier';
import * as lex from 'pug-lexer';

@@ -14,2 +25,7 @@ import { Token } from 'pug-lexer';

type FastPathStackEntry = {
content: string;
tokens: Token[];
};
export const plugin: Plugin = {

@@ -31,9 +47,10 @@ languages: [

pug: {
parse(text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions): Token[] {
parse(text: string, parsers: { [parserName: string]: Parser }, options: ParserOptions): FastPathStackEntry {
logger.debug('[parsers:pug:parse]:', { text });
const tokens = lex(text.trimLeft());
const content: string = text.trimLeft();
const tokens: lex.Token[] = lex(content);
// logger.debug('[parsers:pug:parse]: tokens', JSON.stringify(tokens, undefined, 2));
// const ast: AST = parse(tokens, {});
// logger.debug('[parsers:pug:parse]: ast', JSON.stringify(ast, undefined, 2));
return tokens;
return { content, tokens };
},

@@ -61,6 +78,7 @@ astFormat: 'pug-ast',

print(path: FastPath, options: ParserOptions & PugParserOptions, print: (path: FastPath) => Doc): Doc {
const tokens: Token[] = path.stack[0];
const entry: FastPathStackEntry = path.stack[0];
const { content, tokens } = entry;
const pugOptions: PugPrinterOptions = convergeOptions(options);
const printer = new PugPrinter(tokens, pugOptions);
const result = printer.build();
const printer: PugPrinter = new PugPrinter(content, tokens, pugOptions);
const result: string = printer.build();
logger.debug('[printers:pug-ast:print]:', result);

@@ -83,10 +101,10 @@ return result;

},
options: pugOptions as any,
options: pugOptions,
defaultOptions: {}
};
export const languages = plugin.languages;
export const parsers = plugin.parsers;
export const printers = plugin.printers;
export const options = plugin.options;
export const defaultOptions = plugin.defaultOptions;
export const languages: SupportLanguage[] | undefined = plugin.languages;
export const parsers: { [parserName: string]: Parser } | undefined = plugin.parsers;
export const printers: { [astFormat: string]: Printer } | undefined = plugin.printers;
export const options: SupportOption[] | undefined = plugin.options;
export const defaultOptions: Partial<RequiredOptions> | undefined = plugin.defaultOptions;

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/typedef */
import { CATEGORY_PUG } from '.';

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/typedef */
import { CATEGORY_PUG } from '..';

@@ -21,1 +22,16 @@

};
export const PUG_SORT_ATTRIBUTES_OPTION = {
since: '1.8.0',
category: CATEGORY_PUG,
type: 'choice',
default: 'as-is',
description: 'Change how the attributes between _beginning_ and _end_ should be sorted.',
choices: [
{ value: 'asc', description: 'Sort middle attributes ascending.' },
{ value: 'desc', description: 'Sort middle attributes descending.' },
{ value: 'as-is', description: 'Middle attributes are leave untouched.' }
]
};
export type SortAttributes = 'asc' | 'desc' | 'as-is';
import { AttributeToken } from 'pug-lexer';
import { SortAttributes } from './index';
type CompareResult = -1 | 0 | 1;
type CompareFunction<T> = (a: T, b: T) => CompareResult;
function compareByIndex(leftIndex: number, rightIndex: number): CompareResult {
if (leftIndex !== -1 && rightIndex === -1) {
export function compareAttributeToken(
a: AttributeToken,
b: AttributeToken,
sortAttributes: SortAttributes,
sortAttributesBeginning: string[],
sortAttributesEnd: string[]
): CompareResult {
const sortPatternsBeginning: RegExp[] = sortAttributesBeginning.map((sort) => new RegExp(sort)).reverse();
const sortPatternsEnd: RegExp[] = sortAttributesEnd.map((sort) => new RegExp(sort));
const aName: string = a.name;
const bName: string = b.name;
const aBeginningIndex: number = sortPatternsBeginning.findIndex((pattern) => pattern.test(aName));
const bBeginningIndex: number = sortPatternsBeginning.findIndex((pattern) => pattern.test(bName));
const beginning: number = aBeginningIndex - bBeginningIndex;
if (beginning > 0) {
return -1;
}
if (leftIndex === -1 && rightIndex !== -1) {
if (beginning < 0) {
return 1;
}
const result = leftIndex - rightIndex;
if (result <= -1) {
const aEndIndex: number = sortPatternsEnd.findIndex((pattern) => pattern.test(aName));
const bEndIndex: number = sortPatternsEnd.findIndex((pattern) => pattern.test(bName));
const end: number = aEndIndex - bEndIndex;
if (end > 0) {
return 1;
}
if (end < 0) {
return -1;
}
if (result >= 1) {
return 1;
}
return 0;
}
export function compareAttributeToken(
a: AttributeToken,
b: AttributeToken,
sortAttributes: string[],
moveToEnd: boolean = false
): CompareResult {
const sortPatterns: RegExp[] = sortAttributes.map((sort) => new RegExp(sort));
const aName = a.name;
const bName = b.name;
let result: CompareResult = 0;
if (result === 0) {
let aIndex: number = moveToEnd ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
let bIndex: number = moveToEnd ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
let aFound = false;
let bFound = false;
for (let index = 0; index < sortPatterns.length; index++) {
const pattern = sortPatterns[index];
if (!aFound && pattern.test(aName)) {
aIndex = index;
aFound = true;
switch (sortAttributes) {
case 'asc': {
if (aName > bName) {
return 1;
}
if (!bFound && pattern.test(bName)) {
bIndex = index;
bFound = true;
if (aName < bName) {
return -1;
}
if (aFound && bFound) {
break;
break;
}
case 'desc': {
if (aName > bName) {
return -1;
}
if (aName < bName) {
return 1;
}
break;
}
result = compareByIndex(aIndex, bIndex);
}
return result;
return 0;
}
export function partialSort<T>(arr: T[], start: number, end: number, compareFn?: (a: T, b: T) => number): T[] {
const preSorted: T[] = arr.slice(0, start);
const postSorted: T[] = arr.slice(end);
const sorted: T[] = arr.slice(start, end).sort(compareFn);
arr.length = 0;
arr.push(...preSorted.concat(sorted).concat(postSorted));
return arr;
export function stableSort<T>(array: readonly T[], compare: CompareFunction<T>): T[] {
const entries: Array<[T, number]> = array.map((value, index) => [value, index]);
entries.sort((a, b) => {
const order: CompareResult = compare(a[0], b[0]);
// When order is 0, sort by index to make the sort stable
return order !== 0 ? order : a[1] - b[1];
});
return entries.map(([value]) => value);
}
export function partialSort<T>(arr: readonly T[], start: number, end: number, compareFn: CompareFunction<T>): T[] {
const preSort: T[] = arr.slice(0, start);
const postSort: T[] = arr.slice(end);
const attributes: T[] = arr.slice(start, end);
const sorted: T[] = stableSort(attributes, compareFn);
return [...preSort, ...sorted, ...postSort];
}

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/typedef */
import { CATEGORY_PUG } from '.';

@@ -2,0 +3,0 @@

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/typedef */
import { CATEGORY_PUG } from '.';

@@ -59,3 +60,3 @@

let result: string = '';
let firstNonSpace = 0;
let firstNonSpace: number = 0;
for (firstNonSpace; firstNonSpace < input.length && input[firstNonSpace] === ' '; firstNonSpace++) {

@@ -62,0 +63,0 @@ result += ' ';

@@ -0,1 +1,2 @@

/* eslint-disable @typescript-eslint/typedef */
import { CATEGORY_PUG } from '.';

@@ -2,0 +3,0 @@

@@ -5,2 +5,7 @@ import { ParserOptions } from 'prettier';

/**
* Convert and merge options from Prettier and `pug`-specific options into one option object with normalized default values.
*
* @param options Options passed into the plugin by Prettier
*/
export function convergeOptions(options: ParserOptions & PugParserOptions): PugPrinterOptions {

@@ -25,5 +30,8 @@ return {

commentPreserveSpaces: options.pugCommentPreserveSpaces ?? options.commentPreserveSpaces,
pugSortAttributes: options.pugSortAttributes,
pugSortAttributesBeginning: options.pugSortAttributesBeginning,
pugSortAttributesEnd: options.pugSortAttributesEnd
pugSortAttributesEnd: options.pugSortAttributesEnd,
pugWrapAttributesThreshold: options.pugWrapAttributesThreshold,
pugWrapAttributesPattern: options.pugWrapAttributesPattern
};
}
import { ParserOptions } from 'prettier';
import { AttributeSeparator, ATTRIBUTE_SEPARATOR_OPTION, PUG_ATTRIBUTE_SEPARATOR_OPTION } from './attribute-separator';
import { PUG_SORT_ATTRIBUTES_BEGINNING_OPTION, PUG_SORT_ATTRIBUTES_END_OPTION } from './attribute-sorting';
import {
PUG_SORT_ATTRIBUTES_BEGINNING_OPTION,
PUG_SORT_ATTRIBUTES_END_OPTION,
PUG_SORT_ATTRIBUTES_OPTION,
SortAttributes
} from './attribute-sorting';
import {
ClosingBracketPosition,

@@ -24,5 +29,12 @@ CLOSING_BRACKET_POSITION_OPTION,

} from './common';
import { WRAP_ATTRIBUTES_PATTERN, WRAP_ATTRIBUTES_THRESHOLD } from './wrap-attributes';
/**
* Category for Prettier's CLI
*/
export const CATEGORY_PUG: string = 'Pug';
/**
* Extended pug option object.
*/
export interface PugParserOptions

@@ -52,7 +64,11 @@ /* eslint-disable @typescript-eslint/indent */

pugSortAttributes: SortAttributes;
pugSortAttributesBeginning: string[];
pugSortAttributesEnd: string[];
pugWrapAttributesThreshold: number;
pugWrapAttributesPattern: string;
}
export const options = {
export const options: any = {
pugPrintWidth: PUG_PRINT_WIDTH_OPTION,

@@ -71,4 +87,7 @@ pugSingleQuote: PUG_SINGLE_QUOTE_OPTION,

pugCommentPreserveSpaces: PUG_COMMENT_PRESERVE_SPACES_OPTION,
pugSortAttributes: PUG_SORT_ATTRIBUTES_OPTION,
pugSortAttributesBeginning: PUG_SORT_ATTRIBUTES_BEGINNING_OPTION,
pugSortAttributesEnd: PUG_SORT_ATTRIBUTES_END_OPTION
pugSortAttributesEnd: PUG_SORT_ATTRIBUTES_END_OPTION,
pugWrapAttributesThreshold: WRAP_ATTRIBUTES_THRESHOLD,
pugWrapAttributesPattern: WRAP_ATTRIBUTES_PATTERN
};

@@ -50,5 +50,6 @@ import { format, RequiredOptions } from 'prettier';

} from 'pug-lexer';
import { DOCTYPE_SHORTCUT_REGISTRY } from './doctype-shortcut-registry';
import { DoctypeShortcut, DOCTYPE_SHORTCUT_REGISTRY } from './doctype-shortcut-registry';
import { createLogger, Logger, LogLevel } from './logger';
import { AttributeSeparator, resolveAttributeSeparatorOption } from './options/attribute-separator';
import { SortAttributes } from './options/attribute-sorting';
import { compareAttributeToken, partialSort } from './options/attribute-sorting/utils';

@@ -92,4 +93,7 @@ import { ClosingBracketPosition, resolveClosingBracketPositionOption } from './options/closing-bracket-position';

readonly commentPreserveSpaces: CommentPreserveSpaces;
readonly pugSortAttributes: SortAttributes;
readonly pugSortAttributesBeginning: string[];
readonly pugSortAttributesEnd: string[];
readonly pugWrapAttributesThreshold: number;
readonly pugWrapAttributesPattern: string;
}

@@ -100,3 +104,8 @@

private currentIndex: number = 0;
/**
* The index of the current token inside the `tokens` array
*/
// Start at -1, because `getNextToken()` increases it before retreval
private currentIndex: number = -1;
private currentLineLength: number = 0;

@@ -106,7 +115,2 @@ private readonly indentString: string;

/**
* The line length starts by 1, it's not an zero based index
*/
private currentLineLength = 1;
private readonly quotes: "'" | '"';

@@ -118,2 +122,3 @@ private readonly otherQuotes: "'" | '"';

private readonly closingBracketRemainsAtNewLine: boolean;
private readonly wrapAttributesPattern: RegExp | null;
/* eslint-disable @typescript-eslint/indent */

@@ -135,11 +140,17 @@ private readonly codeInterpolationOptions: Pick<

public constructor(private tokens: Token[], private readonly options: PugPrinterOptions) {
public constructor(
private readonly content: string,
private tokens: Token[],
private readonly options: PugPrinterOptions
) {
this.indentString = options.pugUseTabs ? '\t' : ' '.repeat(options.pugTabWidth);
this.quotes = this.options.pugSingleQuote ? "'" : '"';
this.otherQuotes = this.options.pugSingleQuote ? '"' : "'";
const attributeSeparator = resolveAttributeSeparatorOption(options.attributeSeparator);
const attributeSeparator: AttributeSeparator = resolveAttributeSeparatorOption(options.attributeSeparator);
this.alwaysUseAttributeSeparator = attributeSeparator === 'always';
this.neverUseAttributeSeparator = attributeSeparator === 'none';
this.closingBracketRemainsAtNewLine = resolveClosingBracketPositionOption(options.closingBracketPosition);
const codeSingleQuote = !options.pugSingleQuote;
const wrapAttributesPattern: string = options.pugWrapAttributesPattern;
this.wrapAttributesPattern = wrapAttributesPattern ? new RegExp(wrapAttributesPattern) : null;
const codeSingleQuote: boolean = !options.pugSingleQuote;
this.codeInterpolationOptions = {

@@ -154,10 +165,2 @@ singleQuote: codeSingleQuote,

private get previousToken(): Token | undefined {
return this.tokens[this.currentIndex - 1];
}
private get nextToken(): Token | undefined {
return this.tokens[this.currentIndex + 1];
}
public build(): string {

@@ -170,5 +173,4 @@ const results: string[] = [];

}
for (let index: number = 0; index < this.tokens.length; index++) {
this.currentIndex = index;
const token: Token = this.tokens[index];
let token: Token | null = this.getNextToken();
while (token) {
logger.debug('[PugPrinter]:', JSON.stringify(token));

@@ -205,2 +207,3 @@ try {

}
token = this.getNextToken();
}

@@ -218,2 +221,4 @@ return results.join('');

//#region Helpers
private get computedIndent(): string {

@@ -230,2 +235,15 @@ switch (this.previousToken?.type) {

private get previousToken(): Token | undefined {
return this.tokens[this.currentIndex - 1];
}
private get nextToken(): Token | undefined {
return this.tokens[this.currentIndex + 1];
}
private getNextToken(): Token | null {
this.currentIndex++;
return this.tokens[this.currentIndex] ?? null;
}
private quoteString(val: string): string {

@@ -239,2 +257,23 @@ return `${this.quotes}${val}${this.quotes}`;

private tokenNeedsSeparator(token: AttributeToken): boolean {
return this.neverUseAttributeSeparator
? false
: this.alwaysUseAttributeSeparator || /^(\(|\[|:).*/.test(token.name);
}
private getUnformattedContentLines(firstToken: Token, lastToken: Token): string[] {
const { start } = firstToken.loc;
const { end } = lastToken.loc;
const lines: string[] = this.content.split(/\r\n|\n|\r/);
const startLine: number = start.line - 1;
const endLine: number = end.line - 1;
const parts: string[] = [];
parts.push(lines[startLine].slice(start.column - 1));
for (let line: number = startLine + 1; line < endLine; line++) {
parts.push(lines[line]);
}
parts.push(lines[endLine].slice(0, end.column - 1));
return parts;
}
private formatDelegatePrettier(

@@ -254,16 +293,16 @@ val: string,

while (text) {
const start = text.indexOf('{{');
const start: number = text.indexOf('{{');
if (start !== -1) {
result += text.slice(0, start);
text = text.slice(start + 2);
const end = text.indexOf('}}');
const end: number = text.indexOf('}}');
if (end !== -1) {
let code = text.slice(0, end);
let code: string = text.slice(0, end);
try {
// Index of primary quote
const q1 = code.indexOf(this.quotes);
const q1: number = code.indexOf(this.quotes);
// Index of secondary (other) quote
const q2 = code.indexOf(this.otherQuotes);
const q2: number = code.indexOf(this.otherQuotes);
// Index of backtick
const qb = code.indexOf('`');
const qb: number = code.indexOf('`');
if (q1 >= 0 && q2 >= 0 && q2 > q1 && (qb < 0 || q1 < qb)) {

@@ -389,2 +428,4 @@ logger.log({

//#endregion
// ######## ####### ## ## ######## ## ## ######## ######## ####### ###### ######## ###### ###### ####### ######## ######

@@ -398,4 +439,6 @@ // ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

//#region Token Processors
private tag(token: TagToken): string {
let val = token.val;
let val: string = token.val;
if (val === 'div' && this.nextToken && (this.nextToken.type === 'class' || this.nextToken.type === 'id')) {

@@ -405,3 +448,3 @@ val = '';

this.currentLineLength += val.length;
const result = `${this.computedIndent}${val}`;
const result: string = `${this.computedIndent}${val}`;
logger.debug('tag', { result, val: token.val, length: token.val.length }, this.currentLineLength);

@@ -414,3 +457,3 @@ this.possibleIdPosition = this.result.length + result.length;

private ['start-attributes'](token: StartAttributesToken): string {
let result = '';
let result: string = '';
if (this.nextToken?.type === 'attribute') {

@@ -421,13 +464,21 @@ this.previousAttributeRemapped = false;

logger.debug(this.currentLineLength);
this.currentLineLength += 1;
let tempToken: AttributeToken | EndAttributesToken = this.nextToken;
let tempIndex: number = this.currentIndex + 1;
let nonPrefixAttributes = 0;
let hasPrefixAttribute = false;
// In pug, tags can have two kind of attributes: normal attributes that appear between parantheses,
// and literals for ids and classes, prefixing the paranthesis, e.g.: `#id.class(attribute="value")`
// https://pugjs.org/language/attributes.html#class-literal
// https://pugjs.org/language/attributes.html#id-literal
// In the stream of attribute tokens, distinguish those that can be converted to literals,
// and count those that cannot (normal attributes) to determine the resulting line length correctly.
let hasLiteralAttributes: boolean = false;
let numNormalAttributes: number = 0;
while (tempToken.type === 'attribute') {
if (!this.wrapAttributes && this.wrapAttributesPattern?.test(tempToken.name)) {
this.wrapAttributes = true;
}
switch (tempToken.name) {
case 'class':
case 'id': {
hasPrefixAttribute = true;
const val = tempToken.val.toString();
hasLiteralAttributes = true;
const val: string = tempToken.val.toString();
if (isQuoted(val)) {

@@ -444,4 +495,11 @@ this.currentLineLength -= 2;

default: {
nonPrefixAttributes += 1;
this.currentLineLength += tempToken.name.length;
if (numNormalAttributes > 0) {
// This isn't the first normal attribute that will appear between parantheses,
// add space and separator
this.currentLineLength += 1;
if (this.tokenNeedsSeparator(tempToken)) {
this.currentLineLength += 1;
}
}
logger.debug(

@@ -451,3 +509,3 @@ { tokenName: tempToken.name, length: tempToken.name.length },

);
const val = tempToken.val.toString();
const val: string = tempToken.val.toString();
if (val.length > 0 && val !== 'true') {

@@ -457,2 +515,3 @@ this.currentLineLength += 1 + val.length;

}
numNormalAttributes++;
break;

@@ -464,4 +523,4 @@ }

logger.debug('after token', this.currentLineLength);
if (hasPrefixAttribute) {
// Remove div
if (hasLiteralAttributes) {
// Remove div as it will be replaced with the literal for id and/or class
if (this.previousToken?.type === 'tag' && this.previousToken.val === 'div') {

@@ -471,19 +530,21 @@ this.currentLineLength -= 3;

}
const hasPrefixAttributes = nonPrefixAttributes > 0;
if (!hasPrefixAttributes) {
// Remove leading brace
this.currentLineLength -= 1;
} else {
// Attributes are separated by commas: ', '.length === 2
this.currentLineLength += 2 * (nonPrefixAttributes - 1);
// Add trailing brace
this.currentLineLength += 1;
if (numNormalAttributes > 0) {
// Add leading and trailing parantheses
this.currentLineLength += 2;
}
logger.debug(this.currentLineLength);
if (this.currentLineLength > this.options.pugPrintWidth) {
if (
!this.wrapAttributes &&
(this.currentLineLength > this.options.pugPrintWidth ||
(this.options.pugWrapAttributesThreshold >= 0 &&
numNormalAttributes > this.options.pugWrapAttributesThreshold))
) {
this.wrapAttributes = true;
}
if (this.options.pugSortAttributesEnd.length > 0) {
if (
this.options.pugSortAttributes !== 'as-is' ||
this.options.pugSortAttributesEnd.length > 0 ||
this.options.pugSortAttributesBeginning.length > 0
) {
const startAttributesIndex: number = this.tokens.indexOf(token);

@@ -496,4 +557,5 @@ const endAttributesIndex: number = tempIndex;

b as AttributeToken,
this.options.pugSortAttributesEnd,
true
this.options.pugSortAttributes,
this.options.pugSortAttributesBeginning,
this.options.pugSortAttributesEnd
)

@@ -503,16 +565,2 @@ );

}
if (this.options.pugSortAttributesBeginning.length > 0) {
const startAttributesIndex: number = this.tokens.indexOf(token);
const endAttributesIndex: number = tempIndex;
if (endAttributesIndex - startAttributesIndex > 2) {
this.tokens = partialSort(this.tokens, startAttributesIndex + 1, endAttributesIndex, (a, b) =>
compareAttributeToken(
a as AttributeToken,
b as AttributeToken,
this.options.pugSortAttributesBeginning
)
);
}
}
}

@@ -527,3 +575,3 @@ return result;

// Handle class attribute
let val = token.val;
let val: string = token.val;
val = val.slice(1, -1);

@@ -553,3 +601,10 @@ val = val.trim();

this.possibleClassPosition += 1 + normalClasses.join('.').length;
this.result = this.result.replace(/div\./, '.');
// See if `div` can be removed from the literal
const replaced: string = this.result.replace(/div\./, '.');
if (replaced !== this.result) {
this.result = replaced;
// `div` was removed, so reduce possible positions as well
this.possibleIdPosition -= 3;
this.possibleClassPosition -= 3;
}
}

@@ -565,3 +620,3 @@ if (specialClasses.length > 0) {

// Handle id attribute
let val = token.val;
let val: string = token.val;
val = val.slice(1, -1);

@@ -581,12 +636,14 @@ val = val.trim();

const position: number = this.possibleIdPosition;
this.result = [this.result.slice(0, position), `#${val}`, this.result.slice(position)].join('');
this.possibleClassPosition += 1 + val.length;
this.result = this.result.replace(/div#/, '#');
if (
this.previousToken &&
this.previousToken.type === 'attribute' &&
this.previousToken.name !== 'class'
) {
this.previousAttributeRemapped = true;
const literal: string = `#${val}`;
this.result = [this.result.slice(0, position), literal, this.result.slice(position)].join('');
this.possibleClassPosition += literal.length;
// See if `div` can be removed from the literal
const replaced: string = this.result.replace(/div#/, '#');
if (replaced !== this.result) {
this.result = replaced;
// `div` was removed, so reduce possible positions as well
this.possibleIdPosition -= 3;
this.possibleClassPosition -= 3;
}
this.previousAttributeRemapped = true;
return;

@@ -602,6 +659,3 @@ }

if (this.previousToken?.type === 'attribute' && (!this.previousAttributeRemapped || hasNormalPreviousToken)) {
if (
!this.neverUseAttributeSeparator &&
(this.alwaysUseAttributeSeparator || /^(\(|\[|:).*/.test(token.name))
) {
if (this.tokenNeedsSeparator(token)) {
this.result += ',';

@@ -626,3 +680,3 @@ }

} else {
let val = token.val;
let val: string = token.val;
if (isMultilineInterpolation(val)) {

@@ -653,7 +707,7 @@ // do not reformat multiline strings surrounded by `

const lines = val.split('\n');
const codeIndentLevel = this.wrapAttributes ? this.indentLevel + 1 : this.indentLevel;
const lines: string[] = val.split('\n');
const codeIndentLevel: number = this.wrapAttributes ? this.indentLevel + 1 : this.indentLevel;
if (lines.length > 1) {
val = lines[0];
for (let index = 1; index < lines.length; index++) {
for (let index: number = 1; index < lines.length; index++) {
val += '\n';

@@ -704,3 +758,3 @@ val += this.indentString.repeat(codeIndentLevel);

private indent(token: IndentToken): string {
const result = `\n${this.indentString.repeat(this.indentLevel)}`;
const result: string = `\n${this.indentString.repeat(this.indentLevel)}`;
this.currentLineLength = result.length - 1 + 1 + this.indentString.length; // -1 for \n, +1 for non zero based

@@ -713,3 +767,3 @@ logger.debug('indent', { result, indentLevel: this.indentLevel }, this.currentLineLength);

private outdent(token: OutdentToken): string {
let result = '';
let result: string = '';
if (this.previousToken && this.previousToken.type !== 'outdent') {

@@ -729,3 +783,3 @@ if (token.loc.start.line - this.previousToken.loc.end.line > 1) {

private class(token: ClassToken): void {
const val = `.${token.val}`;
const val: string = `.${token.val}`;
this.currentLineLength += val.length;

@@ -738,3 +792,3 @@ logger.debug('class', { val, length: val.length }, this.currentLineLength);

this.possibleIdPosition = this.result.length + this.computedIndent.length;
const result = `${this.computedIndent}${val}`;
const result: string = `${this.computedIndent}${val}`;
this.result += result;

@@ -745,3 +799,3 @@ this.possibleClassPosition = this.result.length;

default: {
const prefix = this.result.slice(0, this.possibleClassPosition);
const prefix: string = this.result.slice(0, this.possibleClassPosition);
this.result = [prefix, val, this.result.slice(this.possibleClassPosition)].join('');

@@ -767,15 +821,56 @@ this.possibleClassPosition += val.length;

private comment(token: CommentToken): string {
let result = this.computedIndent;
if (this.checkTokenType(this.previousToken, ['newline', 'indent', 'outdent'], true)) {
result += ' ';
private comment(commentToken: CommentToken): string {
let result: string = this.computedIndent;
// See if this is a `//- prettier-ignore` comment, which would indicate that the part of the template
// that follows should be left unformatted. Support the same format as typescript-eslint is using for descriptons:
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md#allow-with-description
if (/^ prettier-ignore($|[: ])/.test(commentToken.val)) {
// Use a separate token processing loop to find the end of the stream of tokens to be ignored by formatting,
// and uses their `loc` properties to retrieve the original pug code to be used instead.
let token: Token | null = this.getNextToken();
if (token) {
let skipNewline: boolean = token.type === 'newline';
let ignoreLevel: number = 0;
while (token) {
const { type } = token;
if (type === 'newline' && ignoreLevel === 0) {
// Skip first newline after `prettier-ignore` comment
if (skipNewline) {
skipNewline = false;
} else {
break;
}
} else if (type === 'indent') {
ignoreLevel++;
} else if (type === 'outdent') {
ignoreLevel--;
if (ignoreLevel === 0) {
break;
}
}
token = this.getNextToken();
}
if (token) {
const lines: string[] = this.getUnformattedContentLines(commentToken, token);
// Trim the last line, since indentation of formatted pug is handled separately.
const lastLine: string | undefined = lines.pop();
if (lastLine !== undefined) {
lines.push(lastLine.trimRight());
}
result += lines.join('\n');
}
}
} else {
if (this.checkTokenType(this.previousToken, ['newline', 'indent', 'outdent'], true)) {
result += ' ';
}
result += '//';
if (!commentToken.buffer) {
result += '-';
}
result += formatCommentPreserveSpaces(commentToken.val, this.options.commentPreserveSpaces);
if (this.nextToken?.type === 'start-pipeless-text') {
this.pipelessComment = true;
}
}
result += '//';
if (!token.buffer) {
result += '-';
}
result += formatCommentPreserveSpaces(token.val, this.options.commentPreserveSpaces);
if (this.nextToken?.type === 'start-pipeless-text') {
this.pipelessComment = true;
}
return result;

@@ -785,3 +880,3 @@ }

private newline(token: NewlineToken): string {
let result = '';
let result: string = '';
if (this.previousToken && token.loc.start.line - this.previousToken.loc.end.line > 1) {

@@ -798,4 +893,4 @@ // Insert one extra blank line

private text(token: TextToken): string {
let result = '';
let val = token.val;
let result: string = '';
let val: string = token.val;
let needsTrailingWhitespace: boolean = false;

@@ -879,3 +974,3 @@

private ['interpolated-code'](token: InterpolatedCodeToken): string {
let result = '';
let result: string = '';
switch (this.previousToken?.type) {

@@ -904,3 +999,3 @@ case 'tag':

private code(token: CodeToken): string {
let result = this.computedIndent;
let result: string = this.computedIndent;
if (!token.mustEscape && token.buffer) {

@@ -910,9 +1005,9 @@ result += '!';

result += token.buffer ? '=' : '-';
let useSemi = this.options.pugSemi;
let useSemi: boolean = this.options.pugSemi;
if (useSemi && (token.mustEscape || token.buffer)) {
useSemi = false;
}
let val = token.val;
let val: string = token.val;
try {
const valBackup = val;
const valBackup: string = val;
val = format(val, {

@@ -922,2 +1017,3 @@ parser: 'babel',

semi: useSemi,
// Always pass endOfLine 'lf' here to be sure that the next `val.slice(0, -1)` call is always working
endOfLine: 'lf'

@@ -940,3 +1036,3 @@ });

private id(token: IdToken): void {
const val = `#${token.val}`;
const val: string = `#${token.val}`;
this.currentLineLength += val.length;

@@ -947,3 +1043,3 @@ switch (this.previousToken?.type) {

case 'indent': {
const result = `${this.computedIndent}${val}`;
const result: string = `${this.computedIndent}${val}`;
this.result += result;

@@ -954,3 +1050,3 @@ this.possibleClassPosition = this.result.length;

default: {
const prefix = this.result.slice(0, this.possibleIdPosition);
const prefix: string = this.result.slice(0, this.possibleIdPosition);
this.possibleClassPosition += val.length;

@@ -975,3 +1071,3 @@ this.result = [prefix, val, this.result.slice(this.possibleIdPosition)].join('');

private doctype(token: DoctypeToken): string {
let result = `${this.computedIndent}doctype`;
let result: string = `${this.computedIndent}doctype`;
if (token.val) {

@@ -988,3 +1084,3 @@ result += ` ${token.val}`;

private block(token: BlockToken): string {
let result = `${this.computedIndent}block `;
let result: string = `${this.computedIndent}block `;
if (token.mode !== 'replace') {

@@ -1002,3 +1098,3 @@ result += `${token.mode} `;

private path(token: PathToken): string {
let result = '';
let result: string = '';
if (this.checkTokenType(this.previousToken, ['include', 'filter'])) {

@@ -1012,3 +1108,3 @@ result += ' ';

private ['start-pug-interpolation'](token: StartPugInterpolationToken): string {
let result = '';
let result: string = '';
if (

@@ -1030,3 +1126,3 @@ this.tokens[this.currentIndex - 2]?.type === 'newline' &&

private interpolation(token: InterpolationToken): string {
const result = `${this.computedIndent}#{${token.val}}`;
const result: string = `${this.computedIndent}#{${token.val}}`;
this.currentLineLength += result.length;

@@ -1047,3 +1143,3 @@ this.possibleIdPosition = this.result.length + result.length;

private call(token: CallToken): string {
let result = `${this.computedIndent}+${token.val}`;
let result: string = `${this.computedIndent}+${token.val}`;
let args: string | null = token.args;

@@ -1062,3 +1158,3 @@ if (args) {

private mixin(token: MixinToken): string {
let result = `${this.computedIndent}mixin ${token.val}`;
let result: string = `${this.computedIndent}mixin ${token.val}`;
let args: string | null = token.args;

@@ -1074,4 +1170,4 @@ if (args) {

private if(token: IfToken): string {
let result = this.computedIndent;
const match = /^!\((.*)\)$/.exec(token.val);
let result: string = this.computedIndent;
const match: RegExpExecArray | null = /^!\((.*)\)$/.exec(token.val);
logger.debug('[PugPrinter]:', match);

@@ -1091,3 +1187,3 @@ result += !match ? `if ${token.val}` : `unless ${match[1]}`;

private ['&attributes'](token: AndAttributesToken): string {
const result = `&attributes(${token.val})`;
const result: string = `&attributes(${token.val})`;
this.currentLineLength += result.length;

@@ -1103,3 +1199,5 @@ return result;

}
const entry = Object.entries(DOCTYPE_SHORTCUT_REGISTRY).find(([key]) => key === token.val.toLowerCase());
const entry: [string, DoctypeShortcut] | undefined = Object.entries(DOCTYPE_SHORTCUT_REGISTRY).find(
([key]) => key === token.val.toLowerCase()
);
if (entry) {

@@ -1112,3 +1210,3 @@ return `${this.computedIndent}${entry[1]}`;

private each(token: EachToken): string {
let result = `${this.computedIndent}each ${token.val}`;
let result: string = `${this.computedIndent}each ${token.val}`;
if (token.key !== null) {

@@ -1122,3 +1220,3 @@ result += `, ${token.key}`;

private eachOf(token: EachOfToken): string {
let value = token.value.trim();
let value: string = token.value.trim();
value = format(value, {

@@ -1133,3 +1231,3 @@ parser: 'babel',

value = unwrapLineFeeds(value);
const code = token.code.trim();
const code: string = token.code.trim();
return `${this.computedIndent}each ${value} of ${code}`;

@@ -1175,2 +1273,4 @@ }

}
//#endregion
}

@@ -88,18 +88,21 @@ import { AttributeToken, Token } from 'pug-lexer';

): string {
const otherQuote = enclosingQuote === '"' ? "'" : '"';
const newContent = rawContent.replace(/\\([\s\S])|(['"])/g, (match, escaped: "'" | '"', quote: "'" | '"') => {
if (escaped === otherQuote) {
return escaped;
const otherQuote: "'" | '"' = enclosingQuote === '"' ? "'" : '"';
const newContent: string = rawContent.replace(
/\\([\s\S])|(['"])/g,
(match, escaped: "'" | '"', quote: "'" | '"') => {
if (escaped === otherQuote) {
return escaped;
}
if (quote === enclosingQuote) {
return `\\${quote}`;
}
if (quote) {
return quote;
}
return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped)
? escaped
: `\\${escaped}`;
}
if (quote === enclosingQuote) {
return `\\${quote}`;
}
if (quote) {
return quote;
}
return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped)
? escaped
: `\\${escaped}`;
});
);
return enclosingQuote + newContent + enclosingQuote;
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc