Improve comment filtering in embed action
This commit is contained in:
parent
7d77ec8a1a
commit
97edb4bee9
@ -20,10 +20,12 @@
|
|||||||
s = s:gsub("[\r]", "")
|
s = s:gsub("[\r]", "")
|
||||||
|
|
||||||
-- strip out block comments
|
-- strip out block comments
|
||||||
s = s:gsub("%-%-%[%[.-%-%-%]%]", "")
|
s = s:gsub("[^\"']%-%-%[%[.-%]%]", "")
|
||||||
|
s = s:gsub("[^\"']%-%-%[=%[.-%]=%]", "")
|
||||||
|
s = s:gsub("[^\"']%-%-%[==%[.-%]==%]", "")
|
||||||
|
|
||||||
-- strip out inline comments
|
-- strip out inline comments
|
||||||
s = s:gsub("\n%-%-[^\n]*", "")
|
s = s:gsub("\n%-%-[^\n]*", "\n")
|
||||||
|
|
||||||
-- escape backslashes
|
-- escape backslashes
|
||||||
s = s:gsub("\\", "\\\\")
|
s = s:gsub("\\", "\\\\")
|
||||||
@ -32,7 +34,7 @@
|
|||||||
s = s:gsub("\n+", "\n")
|
s = s:gsub("\n+", "\n")
|
||||||
|
|
||||||
-- strip out leading comments
|
-- strip out leading comments
|
||||||
s = s:gsub("^%-%-\n", "")
|
s = s:gsub("^%-%-[^\n]*\n", "")
|
||||||
|
|
||||||
-- escape line feeds
|
-- escape line feeds
|
||||||
s = s:gsub("\n", "\\n")
|
s = s:gsub("\n", "\\n")
|
||||||
|
Reference in New Issue
Block a user