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
|
# File 'lib/sanscript/detect.rb', line 53
def detect_script(text)
text = text.to_str.gsub(/(?<!\\)##.*?(?<!\\)##|(?<!\\)\{#.*?(?<!\\)#\}/, "")
if RE_BRAHMIC_RANGE === text
RE_BRAHMIC_SCRIPTS.each do |script, regex|
return script if regex === text
end
end
if RE_IAST_OR_KOLKATA_ONLY === text
return :kolkata if RE_KOLKATA_ONLY === text
:iast
elsif RE_ITRANS_ONLY === text
:itrans
elsif RE_SLP1_ONLY === text
:slp1
elsif RE_VELTHUIS_ONLY === text
:velthuis
elsif RE_ITRANS_OR_VELTHUIS_ONLY === text
:itrans
elsif RE_HARVARD_KYOTO === text
:hk
else
:unknown
end
end
|