mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-09 04:25:12 +00:00
✏️ Updates content warning
This commit is contained in:
parent
909c90f776
commit
5acc7f9b0a
312
.eleventy.js
312
.eleventy.js
@ -1,193 +1,181 @@
|
||||
const definitionPermalink = require('./11ty/helpers/definitionPermalink');
|
||||
const renderDefinitionContentNextEntries = require('./11ty/shortcodes/renderDefinitionContentNextEntries');
|
||||
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition');
|
||||
const definitionPermalink = require('./11ty/helpers/definitionPermalink')
|
||||
const renderDefinitionContentNextEntries = require('./11ty/shortcodes/renderDefinitionContentNextEntries')
|
||||
const findExistingDefinition = require('./11ty/filters/helpers/findExistingDefinition')
|
||||
|
||||
module.exports = function(config) {
|
||||
// Add a filter using the Config API
|
||||
config.addFilter('linkTarget', definitionPermalink);
|
||||
// Add a filter using the Config API
|
||||
config.addFilter('linkTarget', definitionPermalink)
|
||||
|
||||
config.addFilter('linkIfExistsInCollection', (word, collection) => {
|
||||
const existingDefinition = findExistingDefinition(word, collection);
|
||||
config.addFilter('linkIfExistsInCollection', (word, collection) => {
|
||||
const existingDefinition = findExistingDefinition(word, collection)
|
||||
|
||||
if (existingDefinition) {
|
||||
return `<a href="${definitionPermalink(
|
||||
existingDefinition.data.slug
|
||||
)}">${word}</a>`;
|
||||
}
|
||||
if (existingDefinition) {
|
||||
return `<a href="${definitionPermalink(existingDefinition.data.slug)}">${word}</a>`
|
||||
}
|
||||
|
||||
return `<span>${word}</span>`;
|
||||
});
|
||||
return `<span>${word}</span>`
|
||||
})
|
||||
|
||||
config.addFilter('linkSubTermIfDefined', (subTermData, collection) => {
|
||||
const existingDefinition = findExistingDefinition(
|
||||
subTermData.full_title,
|
||||
collection
|
||||
);
|
||||
config.addFilter('linkSubTermIfDefined', (subTermData, collection) => {
|
||||
const existingDefinition = findExistingDefinition(subTermData.full_title, collection)
|
||||
|
||||
if (existingDefinition) {
|
||||
return `<a href="${definitionPermalink(
|
||||
existingDefinition.data.slug
|
||||
)}">${subTermData.text}</a>`;
|
||||
}
|
||||
if (existingDefinition) {
|
||||
return `<a href="${definitionPermalink(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
|
||||
config.addFilter('postInspect', function(post) {
|
||||
console.log(post);
|
||||
});
|
||||
// just a debug filter to lazily inspect the content of anything in a template
|
||||
config.addFilter('postInspect', function(post) {
|
||||
console.log(post)
|
||||
})
|
||||
|
||||
config.addShortcode('definitionFlag', (flag) => {
|
||||
const cleanText = new Map([
|
||||
[
|
||||
'avoid',
|
||||
{
|
||||
class: 'avoid',
|
||||
text: 'Avoid'
|
||||
}
|
||||
],
|
||||
[
|
||||
'better-alternative',
|
||||
{
|
||||
class: 'better',
|
||||
text: 'Better alternate'
|
||||
}
|
||||
],
|
||||
[
|
||||
'tool',
|
||||
{
|
||||
class: 'tool',
|
||||
text: ''
|
||||
}
|
||||
],
|
||||
[
|
||||
'warning',
|
||||
{
|
||||
class: 'warning',
|
||||
text: 'Content warning'
|
||||
}
|
||||
]
|
||||
]);
|
||||
config.addShortcode('definitionFlag', (flag) => {
|
||||
const cleanText = new Map([
|
||||
[
|
||||
'avoid',
|
||||
{
|
||||
class: 'avoid',
|
||||
text: 'Avoid'
|
||||
}
|
||||
],
|
||||
[
|
||||
'better-alternative',
|
||||
{
|
||||
class: 'better',
|
||||
text: 'Better alternate'
|
||||
}
|
||||
],
|
||||
[
|
||||
'tool',
|
||||
{
|
||||
class: 'tool',
|
||||
text: ''
|
||||
}
|
||||
],
|
||||
[
|
||||
'warning',
|
||||
{
|
||||
class: 'warning',
|
||||
text: ''
|
||||
}
|
||||
]
|
||||
])
|
||||
|
||||
if (flag) {
|
||||
const info = cleanText.get(flag.level.toLowerCase());
|
||||
if (flag) {
|
||||
const info = cleanText.get(flag.level.toLowerCase())
|
||||
|
||||
const sep = flag.text && info.text ? '—' : '';
|
||||
const text = flag.text ? [info.text, flag.text].join(sep) : info.text;
|
||||
const sep = flag.text && 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(
|
||||
'renderDefinitionContentNextEntries',
|
||||
renderDefinitionContentNextEntries
|
||||
);
|
||||
config.addShortcode('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
|
||||
config.addCollection('tableOfContent', (collection) => {
|
||||
const allItems = collection
|
||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||
.filter((word) => !word.data.skip_in_table_of_content)
|
||||
.sort((a, b) => {
|
||||
const { title: firstTitle } = a.data;
|
||||
const { title: secondTitle } = b.data;
|
||||
const sortA = firstTitle.toLowerCase().replace(/^-/, '');
|
||||
const sortB = secondTitle.toLowerCase().replace(/^-/, '');
|
||||
// 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) => {
|
||||
const allItems = collection
|
||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||
.filter((word) => !word.data.skip_in_table_of_content)
|
||||
.sort((a, b) => {
|
||||
const { title: firstTitle } = a.data
|
||||
const { title: secondTitle } = b.data
|
||||
const sortA = firstTitle.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
|
||||
return sortA.localeCompare(sortB);
|
||||
});
|
||||
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
||||
return sortA.localeCompare(sortB)
|
||||
})
|
||||
|
||||
const split = {
|
||||
notLetters: {
|
||||
title: '#',
|
||||
definitions: []
|
||||
},
|
||||
aToE: {
|
||||
title: 'A–E',
|
||||
definitions: []
|
||||
},
|
||||
fToL: {
|
||||
title: 'F–L',
|
||||
definitions: []
|
||||
},
|
||||
mToS: {
|
||||
title: 'M–S',
|
||||
definitions: []
|
||||
},
|
||||
tToZ: {
|
||||
title: 'T–Z',
|
||||
definitions: []
|
||||
}
|
||||
};
|
||||
const split = {
|
||||
notLetters: {
|
||||
title: '#',
|
||||
definitions: []
|
||||
},
|
||||
aToE: {
|
||||
title: 'A–E',
|
||||
definitions: []
|
||||
},
|
||||
fToL: {
|
||||
title: 'F–L',
|
||||
definitions: []
|
||||
},
|
||||
mToS: {
|
||||
title: 'M–S',
|
||||
definitions: []
|
||||
},
|
||||
tToZ: {
|
||||
title: 'T–Z',
|
||||
definitions: []
|
||||
}
|
||||
}
|
||||
|
||||
allItems.forEach((word) => {
|
||||
const { title } = word.data;
|
||||
const { notLetters, aToE, fToL, mToS, tToZ } = split;
|
||||
const sortableTitle = title.replace(/^-/, '');
|
||||
allItems.forEach((word) => {
|
||||
const { title } = word.data
|
||||
const { notLetters, aToE, fToL, mToS, tToZ } = split
|
||||
const sortableTitle = title.replace(/^-/, '')
|
||||
|
||||
if (/^[a-e]/gim.test(sortableTitle)) {
|
||||
return aToE.definitions.push(word);
|
||||
}
|
||||
if (/^[a-e]/gim.test(sortableTitle)) {
|
||||
return aToE.definitions.push(word)
|
||||
}
|
||||
|
||||
if (/^[f-l]/i.test(sortableTitle)) {
|
||||
return fToL.definitions.push(word);
|
||||
}
|
||||
if (/^[f-l]/i.test(sortableTitle)) {
|
||||
return fToL.definitions.push(word)
|
||||
}
|
||||
|
||||
if (/^[m-s]/i.test(sortableTitle)) {
|
||||
return mToS.definitions.push(word);
|
||||
}
|
||||
if (/^[m-s]/i.test(sortableTitle)) {
|
||||
return mToS.definitions.push(word)
|
||||
}
|
||||
|
||||
if (/^[t-z]/i.test(sortableTitle)) {
|
||||
return tToZ.definitions.push(word);
|
||||
}
|
||||
if (/^[t-z]/i.test(sortableTitle)) {
|
||||
return tToZ.definitions.push(word)
|
||||
}
|
||||
|
||||
// no reg ex as the fallback to avoid testing for emojis and numbers
|
||||
notLetters.definitions.push(word);
|
||||
});
|
||||
// no reg ex as the fallback to avoid testing for emojis and numbers
|
||||
notLetters.definitions.push(word)
|
||||
})
|
||||
|
||||
return Object.keys(split).map((key) => {
|
||||
const { title, definitions } = split[key];
|
||||
return Object.keys(split).map((key) => {
|
||||
const { title, definitions } = split[key]
|
||||
|
||||
return { title, definitions };
|
||||
});
|
||||
});
|
||||
return { title, definitions }
|
||||
})
|
||||
})
|
||||
|
||||
config.addCollection('definedWords', (collection) => {
|
||||
return collection
|
||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||
.filter((word) => word.data.defined)
|
||||
.sort((a, b) => {
|
||||
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
||||
return a.data.title
|
||||
.toLowerCase()
|
||||
.localeCompare(b.data.title.toLowerCase());
|
||||
});
|
||||
});
|
||||
config.addCollection('definedWords', (collection) => {
|
||||
return collection
|
||||
.getFilteredByGlob('./11ty/definitions/*.md')
|
||||
.filter((word) => word.data.defined)
|
||||
.sort((a, b) => {
|
||||
// `localeCompare()` is super cool: http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare
|
||||
return a.data.title.toLowerCase().localeCompare(b.data.title.toLowerCase())
|
||||
})
|
||||
})
|
||||
|
||||
const mdIt = require('markdown-it')({
|
||||
html: true
|
||||
});
|
||||
const prism = require('markdown-it-prism');
|
||||
const anchor = require('markdown-it-anchor');
|
||||
const mdIt = require('markdown-it')({
|
||||
html: true
|
||||
})
|
||||
const prism = require('markdown-it-prism')
|
||||
const anchor = require('markdown-it-anchor')
|
||||
|
||||
mdIt.use(prism);
|
||||
mdIt.use(anchor);
|
||||
mdIt.use(prism)
|
||||
mdIt.use(anchor)
|
||||
|
||||
config.setLibrary('md', mdIt);
|
||||
config.setLibrary('md', mdIt)
|
||||
|
||||
// You can return your Config object (optional).
|
||||
return {
|
||||
dir: {
|
||||
input: '11ty',
|
||||
output: 'dist'
|
||||
},
|
||||
templateFormats: ['njk', 'md'],
|
||||
htmlTemplateEngine: 'njk',
|
||||
markdownTemplateEngine: 'njk'
|
||||
};
|
||||
};
|
||||
// You can return your Config object (optional).
|
||||
return {
|
||||
dir: {
|
||||
input: '11ty',
|
||||
output: 'dist'
|
||||
},
|
||||
templateFormats: [ 'njk', 'md' ],
|
||||
htmlTemplateEngine: 'njk',
|
||||
markdownTemplateEngine: 'njk'
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,12 @@
|
||||
flag.text and
|
||||
(flag.level == 'avoid') -%}
|
||||
<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><strong>Content warnings usually take the form of "Content warning: {{ title }}" or "CW: {{ title }}. We recommend the former when possible.</strong></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>Content warnings should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
||||
<ul class="list-default">
|
||||
<li>Articles under the byline, before content</li>
|
||||
@ -22,8 +26,12 @@
|
||||
flag.text and
|
||||
(flag.level == 'warning') -%}
|
||||
<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><strong>Content warnings usually take the form of "Content warning: [{{ title }}]" or "CW: [{{ title }}]. We recommend the former when possible.</strong></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>This content warning should be given at the earliest possible opportunity. Examples of where you can do this are:</p>
|
||||
<ul class="list-default">
|
||||
<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
|
||||
|
||||
[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.
|
||||
|
||||
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
|
||||
slug: suicide
|
||||
defined: true
|
||||
speech: noun
|
||||
flag:
|
||||
level: warning
|
||||
text:
|
||||
text: content warning
|
||||
reading:
|
||||
- text: "Mental Health Foundation: Suicide"
|
||||
href: https://www.mentalhealth.org.uk/a-to-z/s/suicide
|
||||
|
Loading…
x
Reference in New Issue
Block a user