Skip to content

Commit

Permalink
Merge pull request #94 from hideki0403/next-release
Browse files Browse the repository at this point in the history
release: v2023.10.1-kakurega.1.22.0
  • Loading branch information
hideki0403 authored Oct 20, 2023
2 parents 19220f1 + 2498abb commit baa26bc
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 9 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/create-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
push:
branches:
- 'dev-kakurega'
- 'next-release'
paths:
- 'package.json'

Expand All @@ -22,10 +23,10 @@ jobs:

- name: get package version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
uses: martinbeentjes/npm-get-version-action@v1.3.1

- name: check tag exists
uses: mukunku/tag-exists-action@v1.0.0
uses: mukunku/tag-exists-action@v1.4.0
id: check-tag
with:
tag: v${{ steps.package-version.outputs.current-version }}
Expand All @@ -40,7 +41,8 @@ jobs:
echo "Using repository: ${{ github.repository }}"
gh repo set-default ${{ github.repository }}
COUNT=$(gh pr list -S 'release in:title' --json title --jq '.[].title' | grep '${{ steps.package-version.outputs.current-version }}' | wc -l)
MISSKEY_VERSION=$(echo '${{ steps.package-version.outputs.current-version }}' | cut -d '-' -f 1)
COUNT=$(gh pr list -S 'release in:title' --json title --jq '.[].title' | grep $MISSKEY_VERSION | wc -l)
if [ $((COUNT)) -gt 0 ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "PR already exists"
Expand All @@ -60,7 +62,7 @@ jobs:
fi
echo "Creating PR"
COMMAND_ARGS=(-B "master-kakurega" -H "dev-kakurega" -t "release: v${{ steps.package-version.outputs.current-version }}" -b "Automated pr by github actions")
COMMAND_ARGS=(-B "master-kakurega" -H "${{ github.ref_name }}" -t "release: v${{ steps.package-version.outputs.current-version }}" -b "Automated pr by github actions")
if git log "$TAG" -1 --pretty=%B | grep -E "^Merge tag '.+-(alpha|beta|rc).+'"; then
COMMAND_ARGS+=(--draft)
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/pr-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: PR latest version check
on:
pull_request:
types: [synchronize]

jobs:
check-latest-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: get package version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1

- name: check version
id: check-version
run: |
echo "Check if the version name has changed"
echo "Using repository: ${{ github.repository }}"
gh repo set-default ${{ github.repository }}
MISSKEY_VERSION=$(echo '${{ steps.package-version.outputs.current-version }}' | cut -d '-' -f 1)
COUNT=$(gh pr view ${{ github.event.number }} --json title --jq '.title' | grep $MISSKEY_VERSION | wc -l)
if [ $((COUNT)) -gt 0 ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Version already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Version does not exist"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: update pr
if: steps.check-version.outputs.exists == 'false'
shell: bash
run: |
gh pr edit ${{ github.event.number }} -t "release: v${{ steps.package-version.outputs.current-version }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions CHANGELOG_KAKUREGA.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.22.0
Release: 2023/10/21
Base: 2023.10.1

### 新機能
- ルビを振れる機能を実装
- 独自のMFM記法でルビを振ることが出来ます。
- `$[ruby 漢字 かんじ]` → 「<ruby>漢字<rt>かんじ</rt></ruby>」のように解釈されます。
- ページ限定の機能として、カクヨム形式でのルビを振ることも出来ます。詳しくは「[ルビや傍点を付ける(カクヨム記法を使う)](https://kakuyomu.jp/help/entry/notation)」をご覧ください。

## 1.21.0
Release: 2023/10/19
Base: 2023.10.1
Expand Down
5 changes: 5 additions & 0 deletions DIFFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
リモートの絵文字と同名の絵文字がローカルにあった場合に、リモートの絵文字を押すことでローカルの同名の絵文字を付与できるようになっています。
[Ebisskey様の実装](https://github.com/shrimpia/misskey/commit/e91295ff9c6f8ac90f61c8de7a891a6836e48e95)を参考にさせて頂きました。

### ルビを振れるように
独自のMFM記法でルビを振ることができ、`$[ruby 漢字 かんじ]` → 「<ruby>漢字<rt>かんじ</rt></ruby>」のように解釈されます。
ページ限定の機能として、カクヨム形式でのルビを振ることも出来ます。詳しくは「[ルビや傍点を付ける(カクヨム記法を使う)](https://kakuyomu.jp/help/entry/notation)」をご覧ください。
[tar-bin様の実装](https://github.com/tar-bin/misskey/commit/3f8c2dda491ef9f5f1914f81c050334659f7539b)および[Yuriha様の実装](https://github.com/misskey-dev/misskey/compare/develop...yuriha-chan:misskey:mfm-ruby-fn)を参考にさせていただきました。

### ミュートとブロックを同時に行えるように
ノートの右クリックメニューの「ユーザー」にある「ミュート&ブロック」を押すことで、ミュートとブロックを一気に行うことができるようになっています。

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "2023.10.1-kakurega.1.21.0",
"version": "2023.10.1-kakurega.1.22.0",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ export default function(props: {
author?: Misskey.entities.UserLite;
i?: Misskey.entities.UserLite;
isNote?: boolean;
isPage?: boolean;
emojiUrls?: string[];
rootScale?: number;
}) {
const isNote = props.isNote !== undefined ? props.isNote : true;
const isNote = props.isNote ?? true;
const isPage = props.isPage ?? false;

if (props.text == null || props.text === '') return;

Expand All @@ -64,7 +66,28 @@ export default function(props: {
const res: (VNode | string)[] = [];
for (const t of text.split('\n')) {
res.push(h('br'));
res.push(t);

// ページならカクヨム形式のルビ振りを有効にする
if (isPage) {
const text2 = t.replace(/<ruby>(.+?)<rt>(.+?)<\/rt><\/ruby>/g, '\n<ruby>$1<rt>$2</rt></ruby>\n')
.replace(/《《(.+?)》》/g, (match, c1) => c1.replace(/(.)/g, '\n<ruby>$1<rt>・</rt></ruby>\n'))
.replace(/[\||](.+?)《(.+?)》/g, '\n<ruby>$1<rt>$2</rt></ruby>\n')
.replace(/([一-龠]+)《(.+?)》/g, '\n<ruby>$1<rt>$2</rt></ruby>\n')
.replace(/[\||]《(.+?)》/g, '《$1》');

for (const t2 of text2.split('\n')) {
const match = t2.match(/<ruby>(.+?)<rt>(.+?)<\/rt><\/ruby>/);

if (match !== null && match.length > 2) {
const [_, rb, rt] = match;
res.push(h('ruby', { style: rb.length < rt.length ? 'ruby-align:center' : 'ruby-align:space-around' }, [rb, h('rt', rt)]));
} else if (t2 !== '') {
res.push(t2);
}
}
} else {
res.push(t);
}
}
res.shift();
return res;
Expand Down Expand Up @@ -225,6 +248,28 @@ export default function(props: {
style = `background-color: #${color};`;
break;
}
case 'ruby': {
token.children.forEach((t) => { if (t.type === 'text') { t.props.text = t.props.text.trim(); }});
let rb: string | (string | VNode)[];
let rt: string | (string | VNode)[];

const children = token.children.filter((t) => t.type !== 'text' || t.props.text !== '');
if (children.length === 1 && children[0].type === 'text') {
const tokens = children[0].props.text.split(' ');
rb = [tokens[0]];
rt = [tokens.slice(1).join(' ')];
} else if (children.length >= 2) {
rb = genEl([children[0]], scale);
rt = genEl(children.slice(1), scale);
} else {
return genEl(children, scale);
}

if (typeof rb[0] === 'string' && typeof rt[0] === 'string' && rt[0] === '') rt = '・'.repeat(rb[0].length);
const align = typeof rb[0] === 'string' ? { style: rb.length < rt.length ? 'ruby-align:center' : 'ruby-align:space-around' } : {};

return h('ruby', align, [rb, h('rt', rt)]);
}
}
if (style == null) {
return h('span', {}, ['$[', token.props.name, ' ', ...genEl(token.children, scale), ']']);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/page/page.block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import XText from './page.text.vue';
import XSection from './page.section.vue';
import XImage from './page.image.vue';
import XNote from './page.note.vue';
import { Block } from './block.type';
import { Block } from './block.type.js';
function getComponent(type: string) {
switch (type) {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/page/page.text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only

<template>
<div class="_gaps">
<Mfm :text="block.text" :isNote="false" :i="$i"/>
<Mfm :text="block.text" :isNote="false" :isPage="true" :i="$i"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div>
</template>
Expand Down

0 comments on commit baa26bc

Please sign in to comment.