jormungandr-patches/patches/newmfm/0002-ruby-mfm.patch
2024-07-14 20:32:39 -06:00

34 lines
1.3 KiB
Diff

From 54a84e11c19a4f90803c126d203e0e34fb202bd7 Mon Sep 17 00:00:00 2001
From: limepotato <limepot@protonmail.ch>
Date: Sun, 14 Jul 2024 06:01:33 -0600
Subject: [PATCH 2/5] ruby mfm
---
packages/client/src/components/mfm.ts | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts
index 32b72564b..2beee156c 100644
--- a/packages/client/src/components/mfm.ts
+++ b/packages/client/src/components/mfm.ts
@@ -320,6 +320,17 @@ export default defineComponent({
style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px;${token.props.args.noclip ? '' : ' overflow: clip;'}`;
break;
}
+ case 'ruby': {
+ if (token.children.length === 1) {
+ const child = token.children[0];
+ let text = child.type === 'text' ? child.props.text : '';
+ return h('ruby', {}, [text.split(' ')[0], h('rt', text.split(' ')[1])]);
+ } else {
+ const rt = token.children.at(-1)!;
+ let text = rt.type === 'text' ? rt.props.text : '';
+ return h('ruby', {}, [...genEl(token.children.slice(0, token.children.length - 1), scale), h('rt', text.trim())]);
+ }
+ }
case "small": {
return h(
"small",
--
2.45.2