reenable twemoji

This commit is contained in:
Andrea 2022-06-08 09:22:01 +02:00
parent ac915aeac2
commit b6c0c8c074
2 changed files with 21 additions and 27 deletions

View File

@ -1,40 +1,34 @@
<template> <template>
<!-- twemoji disabled, testing Noto Emoji instead -->
<span>
<slot ref="source"></slot>
</span>
<!--
<span> <span>
<span ref="source" v-show="false"> <span ref="source" v-show="false">
<slot ref="source"></slot> <slot ref="source"></slot>
</span> </span>
<span ref="target"></span> <span ref="target"></span>
</span> </span>
-->
</template> </template>
<script> <script>
// import twemoji from 'twemoji'; import twemoji from 'twemoji';
export default { export default {
// mounted() { mounted() {
// this.update(); this.update();
//
// const observer = new MutationObserver(this.update); const observer = new MutationObserver(this.update);
// observer.observe(this.$refs.source, { observer.observe(this.$refs.source, {
// childList: true, childList: true,
// subtree: true subtree: true
// }); });
// this.observer = observer; this.observer = observer;
// }, },
// beforeUnmount() { beforeUnmount() {
// this.observer.disconnect(); this.observer.disconnect();
// }, },
// methods: { methods: {
// update() { update() {
// this.$refs.target.innerHTML = twemoji.parse(this.$refs.source.innerHTML); this.$refs.target.innerHTML = twemoji.parse(this.$refs.source.innerHTML);
// }, },
// }, },
}; };
</script> </script>

View File

@ -1,4 +1,4 @@
// import twemoji from 'twemoji'; import twemoji from 'twemoji';
const census_groups = { const census_groups = {
'location_poland': 'Osoby mieszkające w Polsce', 'location_poland': 'Osoby mieszkające w Polsce',
@ -77,7 +77,7 @@ export default async function parseMarkdown(markdown) {
.replace(/<p>{census_groups}<\/p>(.+?)<p>{\/census_groups}<\/p>/gms, mainPlusDetails(census_groups, false)) .replace(/<p>{census_groups}<\/p>(.+?)<p>{\/census_groups}<\/p>/gms, mainPlusDetails(census_groups, false))
.replace(/<p>{census_comparisons}<\/p>(.+?)<p>{\/census_comparisons}<\/p>/gms, mainPlusDetails(census_comparisons, true)) .replace(/<p>{census_comparisons}<\/p>(.+?)<p>{\/census_comparisons}<\/p>/gms, mainPlusDetails(census_comparisons, true))
.replace(/{json=([^=}]+)=([^=}]+)}/g, fetchJson) .replace(/{json=([^=}]+)=([^=}]+)}/g, fetchJson)
.replace(/<p>{twemoji}<\/p>(.+?)<p>{\/twemoji}<\/p>/gms, (_, c) => c) // twemoji.parse(c) .replace(/<p>{twemoji}<\/p>(.+?)<p>{\/twemoji}<\/p>/gms, (_, c) => twemoji.parse(c))
+ '</div>' + '</div>'
; ;
content = content.replace(/{table_of_contents}/g, generateToC(content)); content = content.replace(/{table_of_contents}/g, generateToC(content));