-
Notifications
You must be signed in to change notification settings - Fork 56
/
replace markers.lua
123 lines (110 loc) · 2.72 KB
/
replace markers.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
script_name = "Replace markers by styles"
script_description = "Assigns styles based on prefix markers"
script_author = "arc_"
re = require("aegisub.re")
function run(subtitles, markerStyles)
for i = 1, #subtitles do
local line = subtitles[i]
if line.class == "dialogue" and not line.comment then
subtitles[i] = handleLine(line, markerStyles)
end
end
end
function handleLine(line, markerStyles)
local marker
local style
for m, s in pairs(markerStyles) do
if #line.text >= #m and line.text:sub(1, #m) == m then
marker = m
style = s
break
end
end
if style then
line.text = line.text:sub(#marker + 1)
line.style = style
end
return line
end
aegisub.register_macro(
"Replace markers/HimeHina",
script_description,
function(subtitles)
run(
subtitles,
{
["<"] = "Hime",
[">"] = "Hina"
}
)
end
)
aegisub.register_macro(
"Replace markers/Eilene",
script_description,
function(subtitles)
run(
subtitles,
{
["*"] = "YomemiMoemi",
["+"] = "Eilene",
["/"] = "Beilene",
["^"] = "Beno",
["&"] = "Étra"
}
)
end
)
aegisub.register_macro(
"Replace markers/Moe",
script_description,
function(subtitles)
run(
subtitles,
{
["*"] = "Moe",
["+"] = "Killjoy",
["/"] = "Pending"
}
)
end
)
aegisub.register_macro(
"Replace markers/Sifir",
script_description,
function(subtitles)
run(
subtitles,
{
["*"] = "Renana",
["+"] = "Sifir"
}
)
end
)
aegisub.register_macro(
"Replace markers/Idolbu",
script_description,
function(subtitles)
run(
subtitles,
{
["az-"] = "Azuki",
["ba-"] = "Baacharu",
["ch-"] = "Chieri",
["fu-"] = "Futaba",
["io-"] = "Iori",
["ir-"] = "Iroha",
["me-"] = "Mememe",
["mm-"] = "MerryMilk",
["mo-"] = "Mochi",
["na-"] = "Natori",
["pi-"] = "Pino",
["ri-"] = "Riko",
["si-"] = "Siro",
["su-"] = "Suzu",
["ta-"] = "Tama"
}
)
end
)