import type { AttributeToken, TagToken, Token } from 'pug-lexer'; import type { Logger } from '../logger'; /** * Returns the previous tag token if there was one. * * @param tokens The token array. * @param index The current index within the token array.. * @returns Previous tag token if there was one. */ export declare function previousTagToken(tokens: ReadonlyArray, index: number): TagToken | undefined; /** * Returns the previous attribute token between the current token and the last occurrence of a `start-attributes` token. * * @param tokens A reference to the whole token array. * @param index The current index on which the cursor is in the token array. * @returns Previous attribute token if there was one. */ export declare function previousNormalAttributeToken(tokens: ReadonlyArray, index: number): AttributeToken | undefined; /** * Returns the previous type attribute token or undefined if no attribute is present. * * @param tokens A reference to the whole token array. * @param index The current index on which the cursor is in the token array. * @returns Previous attribute token if there was one. */ export declare function previousTypeAttributeToken(tokens: ReadonlyArray, index: number): AttributeToken | undefined; /** * Unwraps line feeds from a given value. * * @param value The value to unwrap. * @returns The unwrapped result. */ export declare function unwrapLineFeeds(value: string): string; /** * Indicates whether the attribute is a `style` normal attribute. * * --- * * Example style tag: * ``` * span(style="color: red") * ``` * * In this case `name` is `style` and `val` is `"color: red"`. * * --- * * @param name Name of tag attribute. * @param val Value of `style` tag attribute. * @returns Whether it's a style attribute that is quoted or not. */ export declare function isStyleAttribute(name: string, val: string): boolean; /** * Indicates whether the value is surrounded by the `start` and `end` parameters. * * @param val Value of a tag attribute. * @param start The left hand side of the wrapping. * @param end The right hand side of the wrapping. * @param offset The offset from left and right where to search from. * @returns Whether the value is wrapped with start and end from the offset or not. */ export declare function isWrappedWith(val: string, start: string, end: string, offset?: number): boolean; /** * Indicates whether the value is surrounded by quotes. * * --- * * Example with double quotes: * ``` * a(href="#") * ``` * * In this case `val` is `"#"`. * * --- * * Example with single quotes: * ``` * a(href='#') * ``` * * In this case `val` is `'#'`. * * --- * * Example with no quotes: * ``` * - const route = '#'; * a(href=route) * ``` * * In this case `val` is `route`. * * --- * * Special cases: * ``` * a(href='/' + '#') * a(href="/" + "#") * ``` * * These cases should not be treated as quoted. * * --- * * @param val Value of tag attribute. * @returns Whether the value is quoted or not. */ export declare function isQuoted(val: string): boolean; /** * Detects whether the given value is a single line interpolation or not. * * @param val The value to check. * @returns `true` if it's a single line interpolation, otherwise `false`. */ export declare function isSingleLineWithInterpolation(val: string): boolean; /** * Detects whether the given value is a multiline interpolation or not. * * @param val The value to check. * @returns `true` if it's a multiline interpolation, otherwise `false`. */ export declare function isMultilineInterpolation(val: string): boolean; /** * Encloses code in brackets and possibly spaces. * * @param bracketSpacing Specifies whether or not to insert spaces before and after the code. * @param code Code that is enclosed in brackets. * @param param2 Brackets. * @param param2."0" Opening brackets. * @param param2."1" Closing brackets. * @returns The handled string. */ export declare function handleBracketSpacing(bracketSpacing: boolean, code: string, [opening, closing]?: [string, string]): string; /** * Bakes a string. * * @param rawContent The raw string. * @param enclosingQuote Enclosing quote. * @param unescapeUnnecessaryEscapes Whether to unescape unnecessary escapes or not. Default: `false`. * @returns The baked string. * @see [copied from Prettier common util](https://github.com/prettier/prettier/blob/master/src/common/util.js#L647) */ export declare function makeString(rawContent: string, enclosingQuote: "'" | '"', unescapeUnnecessaryEscapes?: boolean): string; /** * See [issue #9](https://github.com/prettier/plugin-pug/issues/9) for more details. * * @param code Code that is checked. * @param quotes Quotes. * @param otherQuotes Opposite of quotes. * @param logger A logger. * @returns Whether dangerous quote combinations where detected or not. */ export declare function detectDangerousQuoteCombination(code: string, quotes: "'" | '"', otherQuotes: "'" | '"', logger: Logger): boolean;