Emoji reference and such
This commit is contained in:
parent
62f4d9963e
commit
29f2196376
8 changed files with 2049 additions and 29 deletions
|
@ -7,10 +7,11 @@ SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
|||
ROOTDIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Syntax: $0 FILE.(js|json)"
|
||||
echo "Syntax: $0 FILE.(js|json|md)"
|
||||
echo "Example:"
|
||||
echo " $0 emoji-converted.json"
|
||||
echo " $0 $ROOTDIR/server/static/js/emoji.js"
|
||||
echo " $0 $ROOTDIR/docs/emojis.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -19,6 +20,30 @@ if [[ "$1" == *.js ]]; then
|
|||
// Original data source: https://github.com/github/gemoji/blob/master/db/emoji.json
|
||||
const rawEmojis = " > "$1"
|
||||
cat "$SCRIPTDIR/emoji.json" | jq -rc 'map({emoji: .emoji,aliases: .aliases})' >> "$1"
|
||||
elif [[ "$1" == *.md ]]; then
|
||||
echo "# Emoji reference
|
||||
|
||||
<!-- This file was generated by scripts/emoji-convert.sh -->
|
||||
|
||||
You can [tag messages](../publish/#tags-emojis) with emojis 🥳 🎉 and other relevant strings. Matching tags are automatically
|
||||
converted to emojis. This is a reference of all supported emojis. To learn more about the feature, please refer to the
|
||||
[tagging and emojis page](../publish/#tags-emojis).
|
||||
|
||||
<table class="remove-md-box"><tr>
|
||||
" > "$1"
|
||||
|
||||
count="$(cat "$SCRIPTDIR/emoji.json" | jq -r '.[] | .emoji' | wc -l)"
|
||||
percolumn=$(($count / 3)) # This will misbehave if the count is not divisible by 3
|
||||
for col in 0 1 2; do
|
||||
from="$(($col * $percolumn + 1))"
|
||||
to="$(($col * $percolumn + 1 + $percolumn))"
|
||||
echo "<td><table><thead><tr><th>Tag</th><th>Emoji</th></tr></thead><tbody>" >> "$1"
|
||||
cat "$SCRIPTDIR/emoji.json" \
|
||||
| jq -r '.[] | "<tr><td><code>" + .aliases[0] + "</code></td><td>" + .emoji + "</td></tr>"' \
|
||||
| sed -n "${from},${to}p" >> "$1"
|
||||
echo "</tbody></table></td>" >> "$1"
|
||||
done
|
||||
echo "</tr></table>" >> "$1"
|
||||
else
|
||||
cat "$SCRIPTDIR/emoji.json" | jq -rc 'map({emoji: .emoji,aliases: .aliases})' > "$1"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue