mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90abadfc39 | ||
|
|
f64f04c562 | ||
|
|
03a30e6dc4 |
@@ -11,6 +11,7 @@ coverage/
|
||||
node_modules/
|
||||
|
||||
# tmp
|
||||
.local/
|
||||
docs/themes/navy/source/js/liquid.browser.min.js
|
||||
docs/themes/navy/layout/partial/all-contributors.swig
|
||||
docs/themes/navy/layout/partial/financial-contributors.swig
|
||||
|
||||
@@ -6,6 +6,10 @@ title: strip_html
|
||||
|
||||
Removes any HTML tags from a string.
|
||||
|
||||
{% note warn Not safe for HTML output %}
|
||||
This filter removes tags by string scanning; it does not parse HTML5 the way a browser does, and it is not a sanitizer. The result may still be unsafe when inserted into HTML. Use [escape][escape], [escape_once][escape_once], or [`outputEscape: "escape"`][outputEscape] for untrusted output.
|
||||
{% endnote %}
|
||||
|
||||
Input
|
||||
```liquid
|
||||
{{ "Have <em>you</em> read <strong>Ulysses</strong>?" | strip_html }}
|
||||
@@ -15,3 +19,7 @@ Output
|
||||
```text
|
||||
Have you read Ulysses?
|
||||
```
|
||||
|
||||
[escape]: ./escape.html
|
||||
[escape_once]: ./escape.html
|
||||
[outputEscape]: ../tutorials/options.html#outputEscape
|
||||
|
||||
+1
-3
@@ -17,12 +17,10 @@ debug: false
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-GM713991QQ"></script>
|
||||
<script>
|
||||
<script type="text/plain" data-category="analytics">
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-GM713991QQ');
|
||||
</script>
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
{{__('footer.license')}}
|
||||
</div>
|
||||
<div id="footer-links">
|
||||
<button type="button" class="footer-link cookie-preferences" data-cc="show-consentModal" title="Manage cookie preferences"><i class="icon-shield"></i></button>
|
||||
<a href="https://twitter.com/{{ config.twitter }}" class="footer-link" target="_blank"><i class="icon-twitter"></i></a>
|
||||
<a href="https://opencollective.com/{{ config.oc }}" class="footer-link" target="_blank"><i class="icon-opencollective"></i></a>
|
||||
<a href="https://github.com/{{ config.github }}" class="footer-link" target="_blank"><i class="icon-github"></i></a>
|
||||
|
||||
+3
-8
@@ -32,12 +32,7 @@
|
||||
<meta name="msapplication-TileImage" content="{{ url_for('icon/mstile-144x144.png') }}">
|
||||
{{ css('css/navy') }}
|
||||
{{ feed_tag('atom.xml') }}
|
||||
<script src="https://cdn.cookiehub.eu/c2/e8e44c93.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') return;
|
||||
var cpm = {};
|
||||
window.cookiehub.load(cpm);
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.css">
|
||||
<script src="https://cdn.jsdelivr.net/gh/orestbida/[email protected]/dist/cookieconsent.umd.js"></script>
|
||||
{{ js('js/cookieconsent-config') }}
|
||||
</head>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#cc-main
|
||||
--cc-btn-primary-bg: var(--color-link)
|
||||
--cc-btn-primary-color: #fff
|
||||
--cc-btn-primary-border-color: var(--color-link)
|
||||
--cc-btn-primary-hover-bg: var(--color-link-hover)
|
||||
--cc-btn-primary-hover-border-color: var(--color-link-hover)
|
||||
--cc-btn-secondary-bg: #eaeff2
|
||||
--cc-btn-secondary-color: var(--color-default)
|
||||
--cc-btn-secondary-border-color: #eaeff2
|
||||
--cc-toggle-on-bg: var(--color-link)
|
||||
|
||||
.cc--darkmode #cc-main
|
||||
--cc-btn-secondary-bg: #3a4248
|
||||
--cc-btn-secondary-color: var(--color-default)
|
||||
--cc-btn-secondary-border-color: #3a4248
|
||||
@@ -42,6 +42,13 @@
|
||||
@media mq-normal
|
||||
font-size: 30px
|
||||
|
||||
.cookie-preferences
|
||||
background: none
|
||||
border: 0
|
||||
padding: 0
|
||||
cursor: pointer
|
||||
color: inherit
|
||||
|
||||
.icon-oc
|
||||
height: 36px
|
||||
width: 30px
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
@import "_partial/page"
|
||||
@import "_partial/mobile_nav"
|
||||
@import "_partial/footer"
|
||||
@import "_partial/cookieconsent"
|
||||
@import "_partial/highlight"
|
||||
@import "_partial/icomoon.css"
|
||||
@import "_partial/docsearch.min.css"
|
||||
@@ -0,0 +1,49 @@
|
||||
(function () {
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.documentElement.classList.add('cc--darkmode');
|
||||
}
|
||||
|
||||
var config = {
|
||||
guiOptions: {
|
||||
consentModal: {
|
||||
equalWeightButtons: false
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
necessary: {
|
||||
enabled: true,
|
||||
readOnly: true
|
||||
},
|
||||
analytics: {
|
||||
enabled: false
|
||||
}
|
||||
},
|
||||
language: {
|
||||
default: 'en',
|
||||
translations: {
|
||||
en: {
|
||||
consentModal: {
|
||||
title: 'We use cookies',
|
||||
description: 'This site uses cookies for analytics and to improve your experience.',
|
||||
acceptAllBtn: 'Accept',
|
||||
acceptNecessaryBtn: 'Reject'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (/^localhost$|^127\.0\.0\.1$/i.test(location.hostname)) {
|
||||
config.cookie = { secure: false };
|
||||
}
|
||||
|
||||
function run() {
|
||||
CookieConsent.run(config);
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', run);
|
||||
} else {
|
||||
run();
|
||||
}
|
||||
}());
|
||||
+1
-1
@@ -60,7 +60,7 @@ export function strip_html (this: FilterImpl, v: string) {
|
||||
if (e >= 0) { i = e + closer.length; break }
|
||||
blocks.delete(opener)
|
||||
}
|
||||
if (i === lt) return out + str.slice(lt)
|
||||
if (i <= lt) return out + str.slice(lt)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -85,5 +85,9 @@ describe('filters/html', function () {
|
||||
expect(liquid.parseAndRenderSync('{{"<img\rsrc=x\ronerror=alert(1)>" | strip_html}}')).toBe('')
|
||||
expect(liquid.parseAndRenderSync('{{"<svg\nonload=alert(1)>" | strip_html}}')).toBe('')
|
||||
})
|
||||
it('should not loop on unclosed openers (GHSA-m7fp-h3p4-hr49)', function () {
|
||||
expect(liquid.parseAndRenderSync('{{ "a<" | strip_html }}')).toBe('a<')
|
||||
expect(liquid.parseAndRenderSync('{{ "hello<world<again" | strip_html }}')).toBe('hello<world<again')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user