;
+ inner = ;
key = 'latex' + suggestion.expression;
}
diff --git a/app/javascript/flavours/glitch/components/autosuggest_latex.js b/app/javascript/flavours/glitch/components/autosuggest_latex.jsx
similarity index 77%
rename from app/javascript/flavours/glitch/components/autosuggest_latex.js
rename to app/javascript/flavours/glitch/components/autosuggest_latex.jsx
index 02fe0605ef749d..ef65d493895089 100644
--- a/app/javascript/flavours/glitch/components/autosuggest_latex.js
+++ b/app/javascript/flavours/glitch/components/autosuggest_latex.jsx
@@ -1,7 +1,5 @@
-import React from 'react';
import PropTypes from 'prop-types';
-
-const assetHost = process.env.CDN_HOST || '';
+import React from 'react';
export default class AutosuggestLatex extends React.PureComponent {
@@ -15,6 +13,9 @@ export default class AutosuggestLatex extends React.PureComponent {
componentDidMount() {
try {
+ // Loaded in script tag on page. not great but we couldn't figure out
+ // How to use MathJax as a module
+ // eslint-disable-next-line no-undef
MathJax.typeset([this.node]);
} catch(e) {
console.error(e);
@@ -28,7 +29,7 @@ export default class AutosuggestLatex extends React.PureComponent {
return (
\({latex.expression}\)
-
+
Convert to unicode
);
diff --git a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx
index cfd6b359d172b5..7b4c2777d438b8 100644
--- a/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx
+++ b/app/javascript/flavours/glitch/components/autosuggest_textarea.jsx
@@ -18,9 +18,9 @@ const textAtCursorMatchesToken = (str, caretPosition) => {
let left;
let right;
- left = str.slice(0, caretPosition).search(/\\[\(\[](?:(?!\\[\)\]]).)*(?:\\[\)\]])?$/);
+ left = str.slice(0, caretPosition).search(/\\[([](?:(?!\\[)]]).)*(?:\\[)\]])?$/);
if (left >= 0) {
- right = str.slice(caretPosition).search(/\\[\)\]]/);
+ right = str.slice(caretPosition).search(/\\[)\]]/);
if (right < 0) {
word = str.slice(left);
} else {
@@ -205,7 +205,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
inner = ;
key = suggestion.id;
} else if (suggestion.type === 'latex') {
- inner = ;
+ inner = ;
key = suggestion.expression;
}
diff --git a/app/javascript/flavours/glitch/components/status_content.jsx b/app/javascript/flavours/glitch/components/status_content.jsx
index 4da4dcc18cb1bf..ff31a38baa621f 100644
--- a/app/javascript/flavours/glitch/components/status_content.jsx
+++ b/app/javascript/flavours/glitch/components/status_content.jsx
@@ -8,12 +8,11 @@ import classnames from 'classnames';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
-import { Icon } from 'flavours/glitch/components/icon';
import { autoPlayGif, languages as preloadedLanguages } from 'flavours/glitch/initial_state';
import { decode as decodeIDNA } from 'flavours/glitch/utils/idna';
-import StatusExpandButton from './status_expand_button';
import Permalink from './permalink';
+import StatusExpandButton from './status_expand_button';
const textMatchesTarget = (text, origin, host) => {
return (text === origin || text === host
@@ -239,11 +238,14 @@ class StatusContent extends PureComponent {
_renderMathJax() {
const {status} = this.props;
const contentHtml = status.get('contentHtml');
- if(this.last_contentHtml == contentHtml) {
+ if(this.last_contentHtml === contentHtml) {
return;
}
this.last_contentHtml = contentHtml;
try {
+ // Loaded in script tag on page. not great but we couldn't figure out
+ // How to use MathJax as a module
+ // eslint-disable-next-line no-undef
MathJax.typeset([this.contentsNode]);
} catch(e) {
console.error(e);
diff --git a/app/javascript/flavours/glitch/components/status_expand_button.js b/app/javascript/flavours/glitch/components/status_expand_button.js
deleted file mode 100644
index 3f5d8638640147..00000000000000
--- a/app/javascript/flavours/glitch/components/status_expand_button.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import React from 'react';
-import { useState, useEffect } from 'react';
-import PropTypes from 'prop-types';
-import { FormattedMessage } from 'react-intl';
-import Icon from './icon';
-
-
-const StatusExpandButton=(
- {
- hidden,
- handleSpoilerClick,
- mediaIcons,
- },
-)=>{
- const makeToggleText = () => {
- let newText;
- if (hidden) {
- newText = [
- ,
- ];
- if (mediaIcons) {
- mediaIcons.forEach((mediaIcon, idx) => {
- newText.push(
- ,
- );
- });
- }
- } else {
- newText = (
-
- );
- }
- return(newText);
- };
-
- // const [hidden, setHidden] = useState(false);
- const [toggleText, setToggleText] = useState(makeToggleText());
-
- // Change the text when the hidden state changes
- useEffect(() => {
- setToggleText(makeToggleText());
- }, [hidden]);
-
- return(
-
- );
-};
-
-StatusExpandButton.propTypes = {
- hidden: PropTypes.bool,
- handleSpoilerClick: PropTypes.func,
- mediaIcons: PropTypes.arrayOf(PropTypes.string),
-};
-
-export default StatusExpandButton;
diff --git a/app/javascript/flavours/glitch/components/status_expand_button.jsx b/app/javascript/flavours/glitch/components/status_expand_button.jsx
new file mode 100644
index 00000000000000..3f425cfbcc2f7c
--- /dev/null
+++ b/app/javascript/flavours/glitch/components/status_expand_button.jsx
@@ -0,0 +1,71 @@
+import PropTypes from 'prop-types';
+import React, { useState, useEffect } from 'react';
+
+import { FormattedMessage } from 'react-intl';
+
+import { Icon } from './icon';
+
+const makeToggleText = (hidden, mediaIcons) => {
+ let newText;
+ if (hidden) {
+ newText = [
+ ,
+ ];
+ if (mediaIcons) {
+ mediaIcons.forEach((mediaIcon, idx) => {
+ newText.push(
+ ,
+ );
+ });
+ }
+ } else {
+ newText = (
+
+ );
+ }
+ return(newText);
+};
+
+const StatusExpandButton=(
+ {
+ hidden,
+ handleSpoilerClick,
+ mediaIcons,
+ },
+) => {
+ const [toggleText, setToggleText] = useState(makeToggleText(hidden, mediaIcons));
+
+ // Change the text when the hidden state changes
+ useEffect(() => {
+ let text = makeToggleText(hidden, mediaIcons);
+ setToggleText(text);
+ }, [hidden, mediaIcons]);
+
+ return(
+
+ );
+};
+
+StatusExpandButton.propTypes = {
+ hidden: PropTypes.bool,
+ handleSpoilerClick: PropTypes.func,
+ mediaIcons: PropTypes.arrayOf(PropTypes.string),
+};
+
+export default StatusExpandButton;
diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx
index 7e9be5dfa99e60..5a400d70d8f010 100644
--- a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx
+++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx
@@ -13,8 +13,8 @@ import { isMobile } from 'flavours/glitch/is_mobile';
import AutosuggestInput from '../../../components/autosuggest_input';
import AutosuggestTextarea from '../../../components/autosuggest_textarea';
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
-import OptionsContainer from '../containers/options_container';
import LaTeXDropdown from '../containers/latex_dropdown_container';
+import OptionsContainer from '../containers/options_container';
import PollFormContainer from '../containers/poll_form_container';
import ReplyIndicatorContainer from '../containers/reply_indicator_container';
import UploadFormContainer from '../containers/upload_form_container';
diff --git a/app/javascript/flavours/glitch/features/compose/containers/latex_dropdown_container.js b/app/javascript/flavours/glitch/features/compose/containers/latex_dropdown_container.js
index a4efc9db19025a..8fedc0dc720233 100644
--- a/app/javascript/flavours/glitch/features/compose/containers/latex_dropdown_container.js
+++ b/app/javascript/flavours/glitch/features/compose/containers/latex_dropdown_container.js
@@ -1,8 +1,8 @@
import { connect } from 'react-redux';
-import LaTeXDropdown from '../components/latex_dropdown';
-import { startLaTeXCompose } from '../../../actions/compose';
+
import { openModal, closeModal } from '../../../actions/modal';
import { isUserTouching } from '../../../is_mobile';
+import LaTeXDropdown from '../components/latex_dropdown';
const mapStateToProps = state => ({
value: state.getIn(['compose', 'startlatex']),
diff --git a/app/javascript/flavours/glitch/features/compose/util/autolatex/autolatex.js b/app/javascript/flavours/glitch/features/compose/util/autolatex/autolatex.js
index abea97df554441..09e1bea5c71105 100644
--- a/app/javascript/flavours/glitch/features/compose/util/autolatex/autolatex.js
+++ b/app/javascript/flavours/glitch/features/compose/util/autolatex/autolatex.js
@@ -2,36 +2,36 @@
// Based on the list of TeX to unicode replacements from UnicodeIt
//
-import {replacements, combiningmarks, subsuperscripts} from './data.js';
+import {replacements, combiningmarks, subsuperscripts} from './data';
function is_math_mode(str) {
let state = '';
- const bits = str.match(/\\[\(\)\[\]]/g);
+ const bits = str.match(/\\[()[\]]/g);
if(!bits) {
return false;
}
for(let delimit of bits) {
switch(state) {
case '\\(':
- if(delimit=='\\)') {
+ if(delimit === '\\)') {
state = '';
}
break;
case '\\[':
- if(delimit=='\\]') {
+ if(delimit === '\\]') {
state = '';
}
break;
default:
- if(delimit=='\\(' || delimit=='\\[') {
+ if(delimit === '\\(' || delimit === '\\[') {
state = delimit;
}
- }
+ }
}
- return state != '';
+ return state !== '';
}
-const normal_letters = replacements.map(([from,to])=>[from.match(/^\\mathit\{(.)\}$/),to]).filter(([m,to])=>m).map(([m,to])=>[m[1],to]);
+const normal_letters = replacements.map(([from,to])=>[from.match(/^\\mathit\{(.)\}$/),to]).filter(([m,])=>m).map(([m,to])=>[m[1],to]);
export const macros = replacements.concat(subsuperscripts,normal_letters);
@@ -48,9 +48,9 @@ export function try_replace(elem) {
return;
}
for(let [from,to] of macros) {
- if(pos-1>=from.length && value.slice(pos-1-from.length,pos-1)==from) {
- for(let [from2,to2] of macros) {
- if(value.slice(pos-1-from.length,pos) == from2.slice(0,from.length+1)) {
+ if(pos-1>=from.length && value.slice(pos-1-from.length,pos-1) === from) {
+ for(let [from2,] of macros) {
+ if(value.slice(pos-1-from.length,pos) === from2.slice(0,from.length+1)) {
return;
}
}
@@ -66,6 +66,8 @@ function simple_match(pattern,result) {
const m = expr.match(pattern);
if(m) {
return [result===undefined ? m[0] : result, expr.slice(m[0].length)];
+ } else {
+ return undefined;
}
}
}
@@ -79,12 +81,12 @@ function find_inside(start_pattern,pattern_has_braces = false) {
return function(expr) {
const start = expr.match(start_pattern);
if(!start) {
- return;
+ return undefined;
}
expr = expr.slice(start[0].length);
- const brace = expr.match(/^\{([^\}]*)\}/);
+ const brace = expr.match(/^\{([^}]*)\}/);
if(!brace) {
- return;
+ return undefined;
}
const s = start[0]+(pattern_has_braces ? '{' : '');
let inside = brace[1];
@@ -96,12 +98,12 @@ function find_inside(start_pattern,pattern_has_braces = false) {
inside = sp[1];
continue;
}
- const r = macros.find(([from,to])=>from.startsWith(s) && (s+inside).startsWith(pattern_has_braces ? from.slice(0,-1) : from) && (!from.startsWith(s+'\\') || inside.slice(from.length-s.length).match(/^(\W|$)/)));
+ const r = macros.find(([from,])=>from.startsWith(s) && (s+inside).startsWith(pattern_has_braces ? from.slice(0,-1) : from) && (!from.startsWith(s+'\\') || inside.slice(from.length-s.length).match(/^(\W|$)/)));
if(r) {
out += r[1];
inside = inside.slice(r[0].length-s.length - (pattern_has_braces ? 1 : 0));
} else {
- return
+ return undefined;
}
}
return [out,expr.slice(brace[0].length)];
@@ -112,15 +114,17 @@ const subsuperscript = find_inside(/^[_^]/);
const mathfont = find_inside(/^\\math[a-z]+/,true);
function replacement(expr) {
- const rep = macros.find(([from,to])=>expr.startsWith(from) && (from.endsWith('}') || !from.startsWith('\\') || expr.slice(from.length).match(/^(\W|\p{P}|$)/u)));
+ const rep = macros.find(([from,])=>expr.startsWith(from) && (from.endsWith('}') || !from.startsWith('\\') || expr.slice(from.length).match(/^(\W|\p{P}|$)/u)));
if(rep) {
const [from,to] = rep;
return [to, expr.slice(from.length)];
+ } else {
+ return undefined;
}
}
function combiningmark(expr) {
- const mark = combiningmarks.find(([from,to])=>expr.startsWith(from+'{'));
+ const mark = combiningmarks.find(([from,])=>expr.startsWith(from+'{'));
if(mark) {
const [from,to] = mark;
const [inside,rest] = some_tex_to_unicode(expr.slice(from.length+1));
@@ -129,7 +133,11 @@ function combiningmark(expr) {
const mid = Math.ceil(chars.length/2);
const [a,b] = [chars.slice(0,mid),chars.slice(mid)];
return [a.join('')+to+b.join(''), rest.slice(1)];
+ } else {
+ return undefined;
}
+ } else {
+ return undefined;
}
}
@@ -166,5 +174,7 @@ export function tex_to_unicode(expr) {
const [out,nexpr] = some_tex_to_unicode(expr);
if(!nexpr) {
return out;
+ } else {
+ return undefined;
}
}
diff --git a/app/javascript/flavours/glitch/features/compose/util/autolatex/data.js b/app/javascript/flavours/glitch/features/compose/util/autolatex/data.js
index 6d4cd5e218649b..b16eaaa7098a4a 100644
--- a/app/javascript/flavours/glitch/features/compose/util/autolatex/data.js
+++ b/app/javascript/flavours/glitch/features/compose/util/autolatex/data.js
@@ -1049,7 +1049,7 @@ export const replacements = [
['\\mathrm{\\xi}', 'ξ'],
['\\mathrm{\\pi}', 'π'],
['\\hspace{0pt}', ''],
- ['\\smblkcircle', '•'],
+ ['\\smblkcircle', '·'],
['\\backtrprime', '‷'],
['\\caretinsert', '‸'],
['\\vertoverlay', '⃒'],
@@ -2937,7 +2937,7 @@ export const replacements = [
['\\lmidot', 'ŀ'],
['\\nvdash', '⊬'],
['\\lbrace', '{'],
- ['\\bullet', '•'],
+ ['\\bullet', '·'],
['\\varphi', 'φ'],
['\\bumpeq', '≏'],
['\\ddot{}', '¨'],
@@ -4360,9 +4360,9 @@ export const subsuperscripts = [
['_β', 'ᵦ'],
['_\\gamma', 'ᵧ'],
['_γ', 'ᵧ'],
- ['^\phi', 'ᵠ'],
+ ['^phi', 'ᵠ'],
['^φ', 'ᵠ'],
- ['^\chi', 'ᵡ'],
+ ['^chi', 'ᵡ'],
['^χ', 'ᵡ'],
['^\\delta', 'ᵟ'],
['^δ', 'ᵟ'],
diff --git a/app/javascript/flavours/glitch/features/compose/util/autolatex/index.js b/app/javascript/flavours/glitch/features/compose/util/autolatex/index.js
index 5ca21e67a35e07..e24ca7e84f5e12 100644
--- a/app/javascript/flavours/glitch/features/compose/util/autolatex/index.js
+++ b/app/javascript/flavours/glitch/features/compose/util/autolatex/index.js
@@ -1,4 +1,4 @@
-import {tex_to_unicode, macros} from './autolatex.js';
+import {tex_to_unicode, macros} from './autolatex';
window.macros = macros;
window.tex_to_unicode = tex_to_unicode;
diff --git a/app/javascript/flavours/glitch/styles/components/status.scss b/app/javascript/flavours/glitch/styles/components/status.scss
index c7afdfae375395..ffbac26273bb95 100644
--- a/app/javascript/flavours/glitch/styles/components/status.scss
+++ b/app/javascript/flavours/glitch/styles/components/status.scss
@@ -332,7 +332,6 @@
max-height: 6em;
overflow: hidden;
text-overflow: ellipsis;
- //padding-top: 0;
&::after {
content: '';
diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js
index 994a8b2aff7dc1..66e2f3c3c69e4e 100644
--- a/app/javascript/mastodon/actions/compose.js
+++ b/app/javascript/mastodon/actions/compose.js
@@ -7,12 +7,15 @@ import api from 'mastodon/api';
import { search as emojiSearch } from 'mastodon/features/emoji/emoji_mart_search_light';
import { tagHistory } from 'mastodon/settings';
+import { tex_to_unicode } from '../features/compose/util/autolatex/autolatex';
+
import { showAlert, showAlertForError } from './alerts';
import { useEmoji } from './emojis';
import { importFetchedAccounts, importFetchedStatus } from './importer';
import { openModal } from './modal';
import { updateTimeline } from './timelines';
-import { tex_to_unicode } from '../features/compose/util/autolatex/autolatex.js';
+
+
/** @type {AbortController | undefined} */
let fetchComposeSuggestionsAccountsController;
@@ -583,7 +586,7 @@ const fetchComposeSuggestionsTags = throttle((dispatch, getState, token) => {
const fetchComposeSuggestionsLatex = (dispatch, getState, token) => {
const start_delimiter = token.slice(0,2);
const end_delimiter = {'\\(': '\\)', '\\[': '\\]'}[start_delimiter];
- let expression = token.slice(2).replace(/\\[\)\]]?$/,'');
+ let expression = token.slice(2).replace(/\\[)\]]?$/,'');
let brace = 0;
for(let i=0;i
\({latex.expression}\)
-
+
Convert to unicode
);
diff --git a/app/javascript/mastodon/components/autosuggest_textarea.jsx b/app/javascript/mastodon/components/autosuggest_textarea.jsx
index fc5cc91e3610b6..3ce995eaae6c5b 100644
--- a/app/javascript/mastodon/components/autosuggest_textarea.jsx
+++ b/app/javascript/mastodon/components/autosuggest_textarea.jsx
@@ -18,9 +18,9 @@ const textAtCursorMatchesToken = (str, caretPosition) => {
let left;
let right;
- left = str.slice(0, caretPosition).search(/\\[\(\[](?:(?!\\[\)\]]).)*(?:\\[\)\]])?$/);
+ left = str.slice(0, caretPosition).search(/\\[([](?:(?!\\[)\]]).)*(?:\\[)\]])?$/);
if (left >= 0) {
- right = str.slice(caretPosition).search(/\\[\)\]]/);
+ right = str.slice(caretPosition).search(/\\[)\]]/);
if (right < 0) {
word = str.slice(left);
} else {
diff --git a/app/javascript/mastodon/components/status_content.jsx b/app/javascript/mastodon/components/status_content.jsx
index 0677b4ba72f2ef..fb35bbb5d076b3 100644
--- a/app/javascript/mastodon/components/status_content.jsx
+++ b/app/javascript/mastodon/components/status_content.jsx
@@ -167,11 +167,14 @@ class StatusContent extends PureComponent {
_renderMathJax() {
const {status} = this.props;
const contentHtml = status.get('contentHtml');
- if(this.last_contentHtml == contentHtml) {
+ if(this.last_contentHtml === contentHtml) {
return;
}
this.last_contentHtml = contentHtml;
try {
+ // Loaded in script tag on page. not great but we couldn't figure out
+ // How to use MathJax as a module
+ // eslint-disable-next-line no-undef
MathJax.typeset([this.node]);
} catch(e) {
console.error(e);
diff --git a/app/javascript/mastodon/features/compose/containers/latex_dropdown_container.js b/app/javascript/mastodon/features/compose/containers/latex_dropdown_container.js
index a4efc9db19025a..8fedc0dc720233 100644
--- a/app/javascript/mastodon/features/compose/containers/latex_dropdown_container.js
+++ b/app/javascript/mastodon/features/compose/containers/latex_dropdown_container.js
@@ -1,8 +1,8 @@
import { connect } from 'react-redux';
-import LaTeXDropdown from '../components/latex_dropdown';
-import { startLaTeXCompose } from '../../../actions/compose';
+
import { openModal, closeModal } from '../../../actions/modal';
import { isUserTouching } from '../../../is_mobile';
+import LaTeXDropdown from '../components/latex_dropdown';
const mapStateToProps = state => ({
value: state.getIn(['compose', 'startlatex']),
diff --git a/app/javascript/mastodon/features/compose/util/autolatex/autolatex.js b/app/javascript/mastodon/features/compose/util/autolatex/autolatex.js
index abea97df554441..e621b26a8141af 100644
--- a/app/javascript/mastodon/features/compose/util/autolatex/autolatex.js
+++ b/app/javascript/mastodon/features/compose/util/autolatex/autolatex.js
@@ -2,36 +2,36 @@
// Based on the list of TeX to unicode replacements from UnicodeIt
//
-import {replacements, combiningmarks, subsuperscripts} from './data.js';
+import {replacements, combiningmarks, subsuperscripts} from './data';
function is_math_mode(str) {
let state = '';
- const bits = str.match(/\\[\(\)\[\]]/g);
+ const bits = str.match(/\\[()[\]]/g);
if(!bits) {
return false;
}
for(let delimit of bits) {
switch(state) {
case '\\(':
- if(delimit=='\\)') {
+ if(delimit === '\\)') {
state = '';
}
break;
case '\\[':
- if(delimit=='\\]') {
+ if(delimit === '\\]') {
state = '';
}
break;
default:
- if(delimit=='\\(' || delimit=='\\[') {
+ if(delimit === '\\(' || delimit === '\\[') {
state = delimit;
}
- }
+ }
}
- return state != '';
+ return state !== '';
}
-const normal_letters = replacements.map(([from,to])=>[from.match(/^\\mathit\{(.)\}$/),to]).filter(([m,to])=>m).map(([m,to])=>[m[1],to]);
+const normal_letters = replacements.map(([from,to])=>[from.match(/^\\mathit\{(.)\}$/),to]).filter(([m,])=>m).map(([m,to])=>[m[1],to]);
export const macros = replacements.concat(subsuperscripts,normal_letters);
@@ -48,9 +48,9 @@ export function try_replace(elem) {
return;
}
for(let [from,to] of macros) {
- if(pos-1>=from.length && value.slice(pos-1-from.length,pos-1)==from) {
- for(let [from2,to2] of macros) {
- if(value.slice(pos-1-from.length,pos) == from2.slice(0,from.length+1)) {
+ if(pos-1>=from.length && value.slice(pos-1-from.length,pos-1) === from) {
+ for(let [from2,] of macros) {
+ if(value.slice(pos-1-from.length,pos) === from2.slice(0,from.length+1)) {
return;
}
}
@@ -66,6 +66,8 @@ function simple_match(pattern,result) {
const m = expr.match(pattern);
if(m) {
return [result===undefined ? m[0] : result, expr.slice(m[0].length)];
+ } else {
+ return undefined;
}
}
}
@@ -79,12 +81,12 @@ function find_inside(start_pattern,pattern_has_braces = false) {
return function(expr) {
const start = expr.match(start_pattern);
if(!start) {
- return;
+ return undefined;
}
expr = expr.slice(start[0].length);
- const brace = expr.match(/^\{([^\}]*)\}/);
+ const brace = expr.match(/^\{([^}]*)\}/);
if(!brace) {
- return;
+ return undefined;
}
const s = start[0]+(pattern_has_braces ? '{' : '');
let inside = brace[1];
@@ -96,12 +98,12 @@ function find_inside(start_pattern,pattern_has_braces = false) {
inside = sp[1];
continue;
}
- const r = macros.find(([from,to])=>from.startsWith(s) && (s+inside).startsWith(pattern_has_braces ? from.slice(0,-1) : from) && (!from.startsWith(s+'\\') || inside.slice(from.length-s.length).match(/^(\W|$)/)));
+ const r = macros.find(([from,])=>from.startsWith(s) && (s+inside).startsWith(pattern_has_braces ? from.slice(0,-1) : from) && (!from.startsWith(s+'\\') || inside.slice(from.length-s.length).match(/^(\W|$)/)));
if(r) {
out += r[1];
inside = inside.slice(r[0].length-s.length - (pattern_has_braces ? 1 : 0));
} else {
- return
+ return undefined;
}
}
return [out,expr.slice(brace[0].length)];
@@ -112,15 +114,17 @@ const subsuperscript = find_inside(/^[_^]/);
const mathfont = find_inside(/^\\math[a-z]+/,true);
function replacement(expr) {
- const rep = macros.find(([from,to])=>expr.startsWith(from) && (from.endsWith('}') || !from.startsWith('\\') || expr.slice(from.length).match(/^(\W|\p{P}|$)/u)));
+ const rep = macros.find(([from,])=>expr.startsWith(from) && (from.endsWith('}') || !from.startsWith('\\') || expr.slice(from.length).match(/^(\W|\p{P}|$)/u)));
if(rep) {
const [from,to] = rep;
return [to, expr.slice(from.length)];
+ } else {
+ return undefined;
}
}
function combiningmark(expr) {
- const mark = combiningmarks.find(([from,to])=>expr.startsWith(from+'{'));
+ const mark = combiningmarks.find(([from,])=>expr.startsWith(from+'{'));
if(mark) {
const [from,to] = mark;
const [inside,rest] = some_tex_to_unicode(expr.slice(from.length+1));
@@ -129,7 +133,11 @@ function combiningmark(expr) {
const mid = Math.ceil(chars.length/2);
const [a,b] = [chars.slice(0,mid),chars.slice(mid)];
return [a.join('')+to+b.join(''), rest.slice(1)];
+ } else {
+ return undefined;
}
+ } else {
+ return undefined;
}
}
@@ -166,5 +174,7 @@ export function tex_to_unicode(expr) {
const [out,nexpr] = some_tex_to_unicode(expr);
if(!nexpr) {
return out;
+ } else {
+ return undefined;
}
}
diff --git a/app/javascript/mastodon/features/compose/util/autolatex/data.js b/app/javascript/mastodon/features/compose/util/autolatex/data.js
index 6d4cd5e218649b..b16eaaa7098a4a 100644
--- a/app/javascript/mastodon/features/compose/util/autolatex/data.js
+++ b/app/javascript/mastodon/features/compose/util/autolatex/data.js
@@ -1049,7 +1049,7 @@ export const replacements = [
['\\mathrm{\\xi}', 'ξ'],
['\\mathrm{\\pi}', 'π'],
['\\hspace{0pt}', ''],
- ['\\smblkcircle', '•'],
+ ['\\smblkcircle', '·'],
['\\backtrprime', '‷'],
['\\caretinsert', '‸'],
['\\vertoverlay', '⃒'],
@@ -2937,7 +2937,7 @@ export const replacements = [
['\\lmidot', 'ŀ'],
['\\nvdash', '⊬'],
['\\lbrace', '{'],
- ['\\bullet', '•'],
+ ['\\bullet', '·'],
['\\varphi', 'φ'],
['\\bumpeq', '≏'],
['\\ddot{}', '¨'],
@@ -4360,9 +4360,9 @@ export const subsuperscripts = [
['_β', 'ᵦ'],
['_\\gamma', 'ᵧ'],
['_γ', 'ᵧ'],
- ['^\phi', 'ᵠ'],
+ ['^phi', 'ᵠ'],
['^φ', 'ᵠ'],
- ['^\chi', 'ᵡ'],
+ ['^chi', 'ᵡ'],
['^χ', 'ᵡ'],
['^\\delta', 'ᵟ'],
['^δ', 'ᵟ'],
diff --git a/app/javascript/mastodon/features/compose/util/autolatex/index.js b/app/javascript/mastodon/features/compose/util/autolatex/index.js
index 5ca21e67a35e07..e24ca7e84f5e12 100644
--- a/app/javascript/mastodon/features/compose/util/autolatex/index.js
+++ b/app/javascript/mastodon/features/compose/util/autolatex/index.js
@@ -1,4 +1,4 @@
-import {tex_to_unicode, macros} from './autolatex.js';
+import {tex_to_unicode, macros} from './autolatex';
window.macros = macros;
window.tex_to_unicode = tex_to_unicode;
diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss
index f0c1632596c7dc..9a183b88d8a39b 100644
--- a/app/javascript/styles/mastodon/components.scss
+++ b/app/javascript/styles/mastodon/components.scss
@@ -419,6 +419,7 @@ body > [data-popper-placement] {
top: 0;
inset-inline-end: 0;
}
+
.latex-dropdown {
position: absolute;
top: 24px;
@@ -545,8 +546,9 @@ body > [data-popper-placement] {
line-height: 18px;
font-size: 14px;
}
+
.autosuggest-latex .hint {
- font-style: italic;
+ font-style: italic;
}
.autosuggest-hashtag {
@@ -5020,8 +5022,8 @@ a.status-card {
margin-right: 10px;
img {
- width: 24px;
- height: 24px;
+ width: 24px;
+ height: 24px;
}
}
diff --git a/app/services/bootstrap_timeline_service.rb b/app/services/bootstrap_timeline_service.rb
index 8ed2974b09a0c1..02f292870cca32 100644
--- a/app/services/bootstrap_timeline_service.rb
+++ b/app/services/bootstrap_timeline_service.rb
@@ -18,7 +18,7 @@ def autofollow_inviter!
end
def autofollow!
- return unless ENV['AUTOFOLLOW'].present?
+ return if ENV['AUTOFOLLOW'].blank?
ENV['AUTOFOLLOW'].to_s.split(',').each do |account|
begin
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index dc178f5e368f8a..3b5ab297666056 100755
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -35,9 +35,6 @@
= csrf_meta_tags unless skip_csrf_meta_tags?
%meta{ name: 'style-nonce', content: request.content_security_policy_nonce }
- -#%script{ src: '/MathJax/config.js' }
- -#%script{ src: '/MathJax/es5/tex-chtml.js' }
-
:javascript
var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
window.MathJax = {
diff --git a/app/views/layouts/embedded.html.haml b/app/views/layouts/embedded.html.haml
index cacbc699a57e43..df2787e24dd639 100644
--- a/app/views/layouts/embedded.html.haml
+++ b/app/views/layouts/embedded.html.haml
@@ -11,8 +11,6 @@
- if storage_host?
%link{ rel: 'dns-prefetch', href: storage_host }/
- -#%script{ src: '/MathJax/es5/tex-chtml.js' }
-
:javascript
var nonce = document.querySelector('meta[name="style-nonce"]').getAttribute('content');
window.MathJax = {