mirror of
https://github.com/He4eT/xecut-site.git
synced 2026-05-04 17:37:26 +00:00
11ty: add custom filters
This commit is contained in:
parent
ee8a5c5607
commit
11f6e94f0c
1 changed files with 6 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
import { EleventyI18nPlugin } from '@11ty/eleventy'
|
import { EleventyI18nPlugin } from '@11ty/eleventy'
|
||||||
import { IdAttributePlugin } from '@11ty/eleventy'
|
import { IdAttributePlugin } from '@11ty/eleventy'
|
||||||
|
|
||||||
|
import { formatCurrency } from './src/_filters/formatCurrency.js'
|
||||||
|
import { sumObjectValues } from './src/_filters/sumObjectValues.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@11ty/eleventy').UserConfig} eleventyConfig
|
* @param {import('@11ty/eleventy').UserConfig} eleventyConfig
|
||||||
*/
|
*/
|
||||||
|
|
@ -19,6 +22,9 @@ export default function(eleventyConfig) {
|
||||||
defaultLanguage: 'ru',
|
defaultLanguage: 'ru',
|
||||||
})
|
})
|
||||||
eleventyConfig.addPlugin(IdAttributePlugin)
|
eleventyConfig.addPlugin(IdAttributePlugin)
|
||||||
|
/* Custom Filters */
|
||||||
|
eleventyConfig.addFilter('formatCurrency', formatCurrency)
|
||||||
|
eleventyConfig.addFilter('sumObjectValues', sumObjectValues)
|
||||||
/* Wrapper for Markdown Tables */
|
/* Wrapper for Markdown Tables */
|
||||||
eleventyConfig.addTransform('markdownTableWrapper', (content) => {
|
eleventyConfig.addTransform('markdownTableWrapper', (content) => {
|
||||||
return content.replace(/<table>.*?<\/table>/gs, (table) => {
|
return content.replace(/<table>.*?<\/table>/gs, (table) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue