develop
HerrHase 1 year ago
parent c4ba30213f
commit 443145063f

@ -5,6 +5,8 @@ date_published: "10.10.2022"
excerpt: "ddd" excerpt: "ddd"
meta: meta:
description: "DSA yes plz hot chicken green juice" description: "DSA yes plz hot chicken green juice"
tags:
- f
--- ---
## Normcore cold-pressed ramps DSA ## Normcore cold-pressed ramps DSA

@ -2,7 +2,7 @@
{% block main %} {% block main %}
{% set posts = pageQuery.find({ orderBy: [ '-date_published' ], limit: 2, filter: { view: { _eq: 'post.njk' } } }) %} {% set posts = pageQuery.find({ orderBy: [ '-date_published' ], limit: 2, filter: { tags: { _in: [ 'tok', 'xxx' ] } } }) %}
{% for post in posts %} {% for post in posts %}
<a class="post" href="{{ post.path }}"> <a class="post" href="{{ post.path }}">

@ -3,7 +3,8 @@
{% if (site.https) %} {% if (site.https) %}
{% set http = 'https' %} {% set http = 'https' %}
{% endif %} {% endif %}
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/"

@ -57,9 +57,8 @@ class Engine {
/** /**
* render * render
* *
* @param {string} view * @param {object} page
* @param {object} data * @param {function} done
* @return {string}
* *
*/ */
render(page, done) { render(page, done) {
@ -77,7 +76,7 @@ class Engine {
const options = configStore.get('options') const options = configStore.get('options')
// if options minifyHtml is set, minify html // if options minifyHtml is set, minify html, but only if page has type html
if (options.minifyHtml === true && data.page.type === 'html') { if (options.minifyHtml === true && data.page.type === 'html') {
response = minify(response, { response = minify(response, {
removeComments: true, removeComments: true,
@ -85,6 +84,8 @@ class Engine {
keepClosingSlash: true, keepClosingSlash: true,
removeOptionalTags: false removeOptionalTags: false
}) })
// remove empty lines
} else { } else {
response = response.replace(/^(?:[\t ]*(?:\r?\n|\r))+/gm, '') response = response.replace(/^(?:[\t ]*(?:\r?\n|\r))+/gm, '')
} }

@ -75,59 +75,69 @@ class Pages {
let isValid = true let isValid = true
for (const [key, value] of Object.entries(options.filter)) { for (const [key, value] of Object.entries(options.filter)) {
// equal
if (value['_eq'] && result[key] !== value['_eq']) { if (value['_eq'] && result[key] !== value['_eq']) {
isValid = false isValid = false
} }
if (value['_neq'] && result[key] === value['_eq']) { // not equal
if (value['_neq'] && result[key] === value['_neq']) {
isValid = false isValid = false
} }
/** // in
if (value['_in'] && Array.isArray(value['_in'])) {
if (value['_in'] && value['_in'].indexOf(result[key]) !== -1) { // if result no exists
if (!result[key]) {
isValid = false isValid = false
} }
if (value['_nin'] && value['_nin'].indexOf(result[key]) === -1) { if (Array.isArray(result[key])) {
isValid = false
}
if (value['_lt'] && result[key] < value['_lt']) { let found = false
isValid = false
result[key].forEach((v, index) => {
if (value['_in'].indexOf(v) !== -1) {
found = true
} }
})
if (value['_lte'] && result[key] <= value['_lte']) { if (!found) {
isValid = false isValid = false
} }
if (value['_gt'] && result[key] > value['_gt']) { } else {
if (value['_in'].indexOf(result[key]) === -1) {
isValid = false isValid = false
} }
}
}
if (value['_gte'] && result[key] >= value['_gt']) { if (value['_lt'] && result[key] < value['_lt']) {
isValid = false isValid = false
} }
if (value['_null'] && result[key]) { if (value['_lte'] && result[key] <= value['_lte']) {
isValid = false isValid = false
} }
if (value['_nnull'] && !result[key]) { if (value['_gt'] && result[key] > value['_gt']) {
isValid = false isValid = false
} }
if (value['_contains'] && !result[key]) { if (value['_gte'] && result[key] >= value['_gte']) {
isValid = false isValid = false
} }
if (value['_ncontains'] && !result[key]) { if (value['_null'] && result[key]) {
isValid = false isValid = false
} }
if (value['_regex'] && result[key].test(value['_regex'])) { if (value['_nnull'] && !result[key]) {
isValid = false isValid = false
}*/ }
} }
return isValid return isValid

@ -2,7 +2,7 @@ const Siteomat = require('./src/siteomat.js')
const siteomat = new Siteomat('./example/site', './example/views', { const siteomat = new Siteomat('./example/site', './example/views', {
'destination': './public', 'destination': './public',
'minifyHtml': true 'minifyHtml': false
}) })
siteomat.run() siteomat.run()
Loading…
Cancel
Save