mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-09 12:30:51 +00:00
✏️ Updates content warning
This commit is contained in:
parent
909c90f776
commit
5acc7f9b0a
120
.eleventy.js
120
.eleventy.js
@ -1,42 +1,35 @@
|
|||||||
const definitionPermalink = require('./11ty/helpers/definitionPermalink');
|
const definitionPermalink = require('./11ty/helpers/definitionPermalink')
|
||||||
const renderDefinitionContentNextEntries = require('./11ty/shortcodes/renderDefinitionContentNextEntries');
|
const renderDefinitionContentNextEntries = require('./11ty/shortcodes/renderDefinitionContentNextEntries')
|
||||||
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition');
|
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition')
|
||||||
|
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
// Add a filter using the Config API
|
// Add a filter using the Config API
|
||||||
config.addFilter('linkTarget', definitionPermalink);
|
config.addFilter('linkTarget', definitionPermalink)
|
||||||
|
|
||||||
config.addFilter('linkIfExistsInCollection', (word, collection) => {
|
config.addFilter('linkIfExistsInCollection', (word, collection) => {
|
||||||
const existingDefinition = findExistingDefinition(word, collection);
|
const existingDefinition = findExistingDefinition(word, collection)
|
||||||
|
|
||||||
if (existingDefinition) {
|
if (existingDefinition) {
|
||||||
return `<a href="${definitionPermalink(
|
return `<a href="${definitionPermalink(existingDefinition.data.slug)}">${word}</a>`
|
||||||
existingDefinition.data.slug
|
|
||||||
)}">${word}</a>`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return `<span>${word}</span>`;
|
return `<span>${word}</span>`
|
||||||
});
|
})
|
||||||
|
|
||||||
config.addFilter('linkSubTermIfDefined', (subTermData, collection) => {
|
config.addFilter('linkSubTermIfDefined', (subTermData, collection) => {
|
||||||
const existingDefinition = findExistingDefinition(
|
const existingDefinition = findExistingDefinition(subTermData.full_title, collection)
|
||||||
subTermData.full_title,
|
|
||||||
collection
|
|
||||||
);
|
|
||||||
|
|
||||||
if (existingDefinition) {
|
if (existingDefinition) {
|
||||||
return `<a href="${definitionPermalink(
|
return `<a href="${definitionPermalink(existingDefinition.data.slug)}">${subTermData.text}</a>`
|
||||||
existingDefinition.data.slug
|
|
||||||
)}">${subTermData.text}</a>`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return `<span>${subTermData.text}</span>`;
|
return `<span>${subTermData.text}</span>`
|
||||||
});
|
})
|
||||||
|
|
||||||
// just a debug filter to lazily inspect the content of anything in a template
|
// just a debug filter to lazily inspect the content of anything in a template
|
||||||
config.addFilter('postInspect', function(post) {
|
config.addFilter('postInspect', function(post) {
|
||||||
console.log(post);
|
console.log(post)
|
||||||
});
|
})
|
||||||
|
|
||||||
config.addShortcode('definitionFlag', (flag) => {
|
config.addShortcode('definitionFlag', (flag) => {
|
||||||
const cleanText = new Map([
|
const cleanText = new Map([
|
||||||
@ -65,27 +58,24 @@ module.exports = function(config) {
|
|||||||
'warning',
|
'warning',
|
||||||
{
|
{
|
||||||
class: 'warning',
|
class: 'warning',
|
||||||
text: 'Content warning'
|
text: ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]);
|
])
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
const info = cleanText.get(flag.level.toLowerCase());
|
const info = cleanText.get(flag.level.toLowerCase())
|
||||||
|
|
||||||
const sep = flag.text && info.text ? '—' : '';
|
const sep = flag.text && info.text ? '—' : ''
|
||||||
const text = flag.text ? [info.text, flag.text].join(sep) : info.text;
|
const text = flag.text ? [ info.text, flag.text ].join(sep) : info.text
|
||||||
|
|
||||||
return `<p class="definition-content__signal definition-content__signal--${info.class}">${text}</p>`;
|
return `<p class="definition-content__signal definition-content__signal--${info.class}">${text}</p>`
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<p class="definition-content__signal"></p>';
|
return '<p class="definition-content__signal"></p>'
|
||||||
});
|
})
|
||||||
|
|
||||||
config.addShortcode(
|
config.addShortcode('renderDefinitionContentNextEntries', renderDefinitionContentNextEntries)
|
||||||
'renderDefinitionContentNextEntries',
|
|
||||||
renderDefinitionContentNextEntries
|
|
||||||
);
|
|
||||||
|
|
||||||
// NOTE (ovlb): this will not be remembered as the best code i’ve written. if anyone seeing this has a better solution then the following to achieve sub groups of the definitions: i am happy to get rid of it
|
// NOTE (ovlb): this will not be remembered as the best code i’ve written. if anyone seeing this has a better solution then the following to achieve sub groups of the definitions: i am happy to get rid of it
|
||||||
config.addCollection('tableOfContent', (collection) => {
|
config.addCollection('tableOfContent', (collection) => {
|
||||||
@ -93,14 +83,14 @@ module.exports = function(config) {
|
|||||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||||
.filter((word) => !word.data.skip_in_table_of_content)
|
.filter((word) => !word.data.skip_in_table_of_content)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const { title: firstTitle } = a.data;
|
const { title: firstTitle } = a.data
|
||||||
const { title: secondTitle } = b.data;
|
const { title: secondTitle } = b.data
|
||||||
const sortA = firstTitle.toLowerCase().replace(/^-/, '');
|
const sortA = firstTitle.toLowerCase().replace(/^-/, '')
|
||||||
const sortB = secondTitle.toLowerCase().replace(/^-/, '');
|
const sortB = secondTitle.toLowerCase().replace(/^-/, '')
|
||||||
|
|
||||||
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
||||||
return sortA.localeCompare(sortB);
|
return sortA.localeCompare(sortB)
|
||||||
});
|
})
|
||||||
|
|
||||||
const split = {
|
const split = {
|
||||||
notLetters: {
|
notLetters: {
|
||||||
@ -123,39 +113,39 @@ module.exports = function(config) {
|
|||||||
title: 'T–Z',
|
title: 'T–Z',
|
||||||
definitions: []
|
definitions: []
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
allItems.forEach((word) => {
|
allItems.forEach((word) => {
|
||||||
const { title } = word.data;
|
const { title } = word.data
|
||||||
const { notLetters, aToE, fToL, mToS, tToZ } = split;
|
const { notLetters, aToE, fToL, mToS, tToZ } = split
|
||||||
const sortableTitle = title.replace(/^-/, '');
|
const sortableTitle = title.replace(/^-/, '')
|
||||||
|
|
||||||
if (/^[a-e]/gim.test(sortableTitle)) {
|
if (/^[a-e]/gim.test(sortableTitle)) {
|
||||||
return aToE.definitions.push(word);
|
return aToE.definitions.push(word)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^[f-l]/i.test(sortableTitle)) {
|
if (/^[f-l]/i.test(sortableTitle)) {
|
||||||
return fToL.definitions.push(word);
|
return fToL.definitions.push(word)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^[m-s]/i.test(sortableTitle)) {
|
if (/^[m-s]/i.test(sortableTitle)) {
|
||||||
return mToS.definitions.push(word);
|
return mToS.definitions.push(word)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^[t-z]/i.test(sortableTitle)) {
|
if (/^[t-z]/i.test(sortableTitle)) {
|
||||||
return tToZ.definitions.push(word);
|
return tToZ.definitions.push(word)
|
||||||
}
|
}
|
||||||
|
|
||||||
// no reg ex as the fallback to avoid testing for emojis and numbers
|
// no reg ex as the fallback to avoid testing for emojis and numbers
|
||||||
notLetters.definitions.push(word);
|
notLetters.definitions.push(word)
|
||||||
});
|
})
|
||||||
|
|
||||||
return Object.keys(split).map((key) => {
|
return Object.keys(split).map((key) => {
|
||||||
const { title, definitions } = split[key];
|
const { title, definitions } = split[key]
|
||||||
|
|
||||||
return { title, definitions };
|
return { title, definitions }
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
config.addCollection('definedWords', (collection) => {
|
config.addCollection('definedWords', (collection) => {
|
||||||
return collection
|
return collection
|
||||||
@ -163,22 +153,20 @@ module.exports = function(config) {
|
|||||||
.filter((word) => word.data.defined)
|
.filter((word) => word.data.defined)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
||||||
return a.data.title
|
return a.data.title.toLowerCase().localeCompare(b.data.title.toLowerCase())
|
||||||
.toLowerCase()
|
})
|
||||||
.localeCompare(b.data.title.toLowerCase());
|
})
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const mdIt = require('markdown-it')({
|
const mdIt = require('markdown-it')({
|
||||||
html: true
|
html: true
|
||||||
});
|
})
|
||||||
const prism = require('markdown-it-prism');
|
const prism = require('markdown-it-prism')
|
||||||
const anchor = require('markdown-it-anchor');
|
const anchor = require('markdown-it-anchor')
|
||||||
|
|
||||||
mdIt.use(prism);
|
mdIt.use(prism)
|
||||||
mdIt.use(anchor);
|
mdIt.use(anchor)
|
||||||
|
|
||||||
config.setLibrary('md', mdIt);
|
config.setLibrary('md', mdIt)
|
||||||
|
|
||||||
// You can return your Config object (optional).
|
// You can return your Config object (optional).
|
||||||
return {
|
return {
|
||||||
@ -189,5 +177,5 @@ module.exports = function(config) {
|
|||||||
templateFormats: [ 'njk', 'md' ],
|
templateFormats: [ 'njk', 'md' ],
|
||||||
htmlTemplateEngine: 'njk',
|
htmlTemplateEngine: 'njk',
|
||||||
markdownTemplateEngine: 'njk'
|
markdownTemplateEngine: 'njk'
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
@ -3,8 +3,12 @@
|
|||||||
flag.text and
|
flag.text and
|
||||||
(flag.level == 'avoid') -%}
|
(flag.level == 'avoid') -%}
|
||||||
<div class="u-margin-bottom-double u-margin-top-double content-warning content-warning--avoid" id="content-warning-guide">
|
<div class="u-margin-bottom-double u-margin-top-double content-warning content-warning--avoid" id="content-warning-guide">
|
||||||
<p>You may want to add a content warning before discussing or showing imagery involving this topic, as it is a topic that can elicit negative feelings and visceral reactions like a panic attack or trauma.</p>
|
<p>You may want to add a content warning before discussing or showing imagery involving this topic, as it is a topic that can elicit unnecessary harm through inducing negative feelings, anxiety, or trauma.</p>
|
||||||
<p><strong>Content warnings usually take the form of "Content warning: {{ title }}" or "CW: {{ title }}. We recommend the former when possible.</strong></p>
|
<p>
|
||||||
|
<strong>Content warnings usually take the form of "Content warning:
|
||||||
|
{{ title }}" or "CW:
|
||||||
|
{{ title }}. We recommend the former when possible.</strong>
|
||||||
|
</p>
|
||||||
<p>Content warnings should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
<p>Content warnings should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
||||||
<ul class="list-default">
|
<ul class="list-default">
|
||||||
<li>Articles under the byline, before content</li>
|
<li>Articles under the byline, before content</li>
|
||||||
@ -22,8 +26,12 @@
|
|||||||
flag.text and
|
flag.text and
|
||||||
(flag.level == 'warning') -%}
|
(flag.level == 'warning') -%}
|
||||||
<div class="u-margin-bottom-double u-margin-top-double content-warning" id="content-warning-guide">
|
<div class="u-margin-bottom-double u-margin-top-double content-warning" id="content-warning-guide">
|
||||||
<p>You may want to add a content warning before discussing or showing imagery involving this topic, as it is a topic that can elicit negative feelings and visceral reactions like a panic attack or trauma.</p>
|
<p>You may want to add a content warning before discussing or showing imagery involving this topic, as it is a topic that can elicit unnecessary harm through inducing negative feelings, anxiety, or trauma.</p>
|
||||||
<p><strong>Content warnings usually take the form of "Content warning: [{{ title }}]" or "CW: [{{ title }}]. We recommend the former when possible.</strong></p>
|
<p>
|
||||||
|
<strong>Content warnings usually take the form of "Content warning:
|
||||||
|
{{ title }}" or "CW:
|
||||||
|
{{ title }}. We recommend the former when possible.</strong>
|
||||||
|
</p>
|
||||||
<p>This content warning should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
<p>This content warning should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
||||||
<ul class="list-default">
|
<ul class="list-default">
|
||||||
<li>Articles under the byline, before content</li>
|
<li>Articles under the byline, before content</li>
|
||||||
|
@ -34,4 +34,4 @@ Continuer d'utiliser le symbole avec ses connotations dénuées de haine pour "l
|
|||||||
|
|
||||||
## Autres Langues
|
## Autres Langues
|
||||||
|
|
||||||
[English](/definitions/ok-sign)
|
[English](/definitions/ok-hand)
|
||||||
|
@ -31,3 +31,7 @@ The uncertainty created by the 4chan-ers is a critical part of their strategy. T
|
|||||||
The people most vulnerable to the oppressive impact of White Supremacy will never know for certain if the symbol is being used in one of its non-violent manners or if it's being used in its racist violent manners. The oppressed must choose the option that protects them, which is typically erring on the side of caution.
|
The people most vulnerable to the oppressive impact of White Supremacy will never know for certain if the symbol is being used in one of its non-violent manners or if it's being used in its racist violent manners. The oppressed must choose the option that protects them, which is typically erring on the side of caution.
|
||||||
|
|
||||||
Continuing to use the symbol with its non-hateful connotations to "take it back," does not eliminate its pervasive new meaning associated with White Supremacy. Instead, continuing usage only perpetuates emotional and psychological harm upon the most vulnerable and susceptible populations.
|
Continuing to use the symbol with its non-hateful connotations to "take it back," does not eliminate its pervasive new meaning associated with White Supremacy. Instead, continuing usage only perpetuates emotional and psychological harm upon the most vulnerable and susceptible populations.
|
||||||
|
|
||||||
|
## Other Languages
|
||||||
|
|
||||||
|
[Français](/definitions/fr_FR/signe-ok)
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
title: suicide
|
title: suicide
|
||||||
slug: suicide
|
slug: suicide
|
||||||
defined: true
|
defined: true
|
||||||
|
speech: noun
|
||||||
flag:
|
flag:
|
||||||
level: warning
|
level: warning
|
||||||
text:
|
text: content warning
|
||||||
reading:
|
reading:
|
||||||
- text: "Mental Health Foundation: Suicide"
|
- text: "Mental Health Foundation: Suicide"
|
||||||
href: https://www.mentalhealth.org.uk/a-to-z/s/suicide
|
href: https://www.mentalhealth.org.uk/a-to-z/s/suicide
|
||||||
|
Loading…
x
Reference in New Issue
Block a user