195 lines
6.1 KiB
Swift
195 lines
6.1 KiB
Swift
#if os(macOS)
|
||
|
||
enum GitHubEmoji {
|
||
static func replaceShortcodes(in text: String) -> String {
|
||
text.replacing(/:([\w+-]+):/) { match in
|
||
shortcodes[String(match.1)] ?? String(match.0)
|
||
}
|
||
}
|
||
|
||
/// Common GitHub / gitmoji shortcodes → Unicode emoji
|
||
private static let shortcodes: [String: String] = [
|
||
// Gitmoji (commit conventions)
|
||
"art": "🎨",
|
||
"zap": "⚡",
|
||
"fire": "🔥",
|
||
"bug": "🐛",
|
||
"ambulance": "🚑",
|
||
"sparkles": "✨",
|
||
"memo": "📝",
|
||
"rocket": "🚀",
|
||
"lipstick": "💄",
|
||
"tada": "🎉",
|
||
"white_check_mark": "✅",
|
||
"lock": "🔒",
|
||
"closed_lock_with_key": "🔐",
|
||
"bookmark": "🔖",
|
||
"rotating_light": "🚨",
|
||
"construction": "🚧",
|
||
"green_heart": "💚",
|
||
"arrow_down": "⬇️",
|
||
"arrow_up": "⬆️",
|
||
"pushpin": "📌",
|
||
"construction_worker": "👷",
|
||
"chart_with_upwards_trend": "📈",
|
||
"recycle": "♻️",
|
||
"heavy_plus_sign": "➕",
|
||
"heavy_minus_sign": "➖",
|
||
"wrench": "🔧",
|
||
"hammer": "🔨",
|
||
"globe_with_meridians": "🌐",
|
||
"pencil2": "✏️",
|
||
"pencil": "📝",
|
||
"poop": "💩",
|
||
"rewind": "⏪",
|
||
"twisted_rightwards_arrows": "🔀",
|
||
"package": "📦",
|
||
"alien": "👽",
|
||
"truck": "🚚",
|
||
"page_facing_up": "📄",
|
||
"boom": "💥",
|
||
"bento": "🍱",
|
||
"wheelchair": "♿",
|
||
"bulb": "💡",
|
||
"beers": "🍻",
|
||
"speech_balloon": "💬",
|
||
"card_file_box": "🗃️",
|
||
"loud_sound": "🔊",
|
||
"mute": "🔇",
|
||
"busts_in_silhouette": "👥",
|
||
"children_crossing": "🚸",
|
||
"building_construction": "🏗️",
|
||
"iphone": "📱",
|
||
"clown_face": "🤡",
|
||
"egg": "🥚",
|
||
"see_no_evil": "🙈",
|
||
"camera_flash": "📸",
|
||
"alembic": "⚗️",
|
||
"mag": "🔍",
|
||
"label": "🏷️",
|
||
"seedling": "🌱",
|
||
"triangular_flag_on_post": "🚩",
|
||
"goal_net": "🥅",
|
||
"dizzy": "💫",
|
||
"wastebasket": "🗑️",
|
||
"passport_control": "🛂",
|
||
"adhesive_bandage": "🩹",
|
||
"monocle_face": "🧐",
|
||
"coffin": "⚰️",
|
||
"test_tube": "🧪",
|
||
"necktie": "👔",
|
||
"stethoscope": "🩺",
|
||
"bricks": "🧱",
|
||
"technologist": "🧑💻",
|
||
|
||
// Common faces & people
|
||
"smile": "😄",
|
||
"laughing": "😆",
|
||
"blush": "😊",
|
||
"smiley": "😃",
|
||
"grinning": "😀",
|
||
"wink": "😉",
|
||
"heart_eyes": "😍",
|
||
"kissing_heart": "😘",
|
||
"sunglasses": "😎",
|
||
"thinking": "🤔",
|
||
"thumbsup": "👍",
|
||
"+1": "👍",
|
||
"thumbsdown": "👎",
|
||
"-1": "👎",
|
||
"clap": "👏",
|
||
"pray": "🙏",
|
||
"wave": "👋",
|
||
"raised_hands": "🙌",
|
||
"ok_hand": "👌",
|
||
"point_up": "☝️",
|
||
"point_down": "👇",
|
||
"point_left": "👈",
|
||
"point_right": "👉",
|
||
"muscle": "💪",
|
||
|
||
// Hearts & symbols
|
||
"heart": "❤️",
|
||
"broken_heart": "💔",
|
||
"star": "⭐",
|
||
"star2": "🌟",
|
||
"warning": "⚠️",
|
||
"x": "❌",
|
||
"heavy_check_mark": "✔️",
|
||
"question": "❓",
|
||
"exclamation": "❗",
|
||
"bangbang": "‼️",
|
||
"interrobang": "⁉️",
|
||
"100": "💯",
|
||
|
||
// Objects & nature
|
||
"gear": "⚙️",
|
||
"key": "🔑",
|
||
"link": "🔗",
|
||
"shield": "🛡️",
|
||
"bell": "🔔",
|
||
"no_bell": "🔕",
|
||
"clipboard": "📋",
|
||
"books": "📚",
|
||
"book": "📖",
|
||
"computer": "💻",
|
||
"desktop_computer": "🖥️",
|
||
"electric_plug": "🔌",
|
||
"battery": "🔋",
|
||
"floppy_disk": "💾",
|
||
"file_folder": "📁",
|
||
"open_file_folder": "📂",
|
||
"calendar": "📅",
|
||
"clock1": "🕐",
|
||
"hourglass": "⌛",
|
||
"stopwatch": "⏱️",
|
||
"timer_clock": "⏲️",
|
||
"inbox_tray": "📥",
|
||
"outbox_tray": "📤",
|
||
"envelope": "✉️",
|
||
"email": "📧",
|
||
"newspaper": "📰",
|
||
"scroll": "📜",
|
||
"trophy": "🏆",
|
||
"medal_sports": "🏅",
|
||
"gem": "💎",
|
||
"hammer_and_wrench": "🛠️",
|
||
"nut_and_bolt": "🔩",
|
||
"chains": "⛓️",
|
||
"magnet": "🧲",
|
||
"trash": "🗑️",
|
||
"world_map": "🗺️",
|
||
|
||
// Arrows & indicators
|
||
"arrow_right": "➡️",
|
||
"arrow_left": "⬅️",
|
||
"arrow_upper_right": "↗️",
|
||
"arrow_lower_right": "↘️",
|
||
"arrows_counterclockwise": "🔄",
|
||
"back": "🔙",
|
||
"new": "🆕",
|
||
"up": "🆙",
|
||
"cool": "🆒",
|
||
"free": "🆓",
|
||
"information_source": "ℹ️",
|
||
|
||
// Nature & weather
|
||
"sunny": "☀️",
|
||
"cloud": "☁️",
|
||
"snowflake": "❄️",
|
||
"rainbow": "🌈",
|
||
"ocean": "🌊",
|
||
"leaves": "🍃",
|
||
"four_leaf_clover": "🍀",
|
||
"evergreen_tree": "🌲",
|
||
"deciduous_tree": "🌳",
|
||
"cactus": "🌵",
|
||
"cherry_blossom": "🌸",
|
||
"rose": "🌹",
|
||
"sunflower": "🌻",
|
||
"herb": "🌿",
|
||
]
|
||
}
|
||
|
||
#endif
|