|
|
@@ -438,7 +438,8 @@ def namumark(title, data):
|
|
|
if(c):
|
|
|
if(not re.search("^파일:([^\n]*)", title)):
|
|
|
backlink_plus(title, '파일:' + c[0], 'file')
|
|
|
-
|
|
|
+
|
|
|
+ comp = re.compile("^(.+)(\.(?:jpg|gif|png|jpeg))$", re.I)
|
|
|
if(c[1]):
|
|
|
n = re.search("width=([^ \n&]*)", c[1])
|
|
|
e = re.search("height=([^ \n&]*)", c[1])
|
|
|
@@ -456,17 +457,19 @@ def namumark(title, data):
|
|
|
height = ''
|
|
|
|
|
|
try:
|
|
|
- extension = re.search("^(.+)(\.(?:[Jj][Pp][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg]|[Pp][Nn][Gg]))$", c[0]).groups()
|
|
|
-
|
|
|
- img = re.sub("\.(?P<in>[Jj][Pp][Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg])", "#\g<in>#", extension[1])
|
|
|
+ extension = comp.search(c[0]).groups()
|
|
|
+
|
|
|
+ comp = re.compile("\.(?P<in>jpg|gif|png|jpeg)", re.I)
|
|
|
+ img = comp.sub("#\g<in>#", extension[1])
|
|
|
data = re.sub("\[\[파일:((?:(?!\]\]|\?).)*)(?:\?((?:(?!\]\]).)*))?\]\]", '<a href="/w/파일:' + extension[0] + img + '"><img src="/image/' + sha224(extension[0]) + img + '" width="' + width + '" height="' + height + '"></a>', data, 1)
|
|
|
except:
|
|
|
data = re.sub("\[\[파일:((?:(?!\]\]|\?).)*)(?:\?((?:(?!\]\]).)*))?\]\]", 'Error', data, 1)
|
|
|
else:
|
|
|
try:
|
|
|
- extension = re.search("^(.+)(\.(?:[Jj][Pp][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg]|[Pp][Nn][Gg]))$", c[0]).groups()
|
|
|
+ extension = comp.search(c[0]).groups()
|
|
|
|
|
|
- img = re.sub("\.(?P<in>[Jj][Pp][Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg])", "#\g<in>#", extension[1])
|
|
|
+ comp = re.compile("\.(?P<in>jpg|gif|png|jpeg)", re.I)
|
|
|
+ img = comp.sub("#\g<in>#", extension[1])
|
|
|
data = re.sub("\[\[파일:((?:(?!\]\]|\?).)*)(?:\?((?:(?!\]\]).)*))?\]\]", "<a href='/w/파일:" + extension[0] + img + "'><img src='/image/" + sha224(extension[0]) + img + "'></a>", data, 1)
|
|
|
except:
|
|
|
data = re.sub("\[\[파일:((?:(?!\]\]|\?).)*)(?:\?((?:(?!\]\]).)*))?\]\]", 'Error', data, 1)
|
|
|
@@ -527,10 +530,13 @@ def namumark(title, data):
|
|
|
|
|
|
b = re.search("^http(?:s)?:\/\/", results[0])
|
|
|
if(b):
|
|
|
- c = re.search("(?:\.[Jj][Pp][Gg]|\.[Pp][Nn][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg])", results[0])
|
|
|
+ comp = re.compile("(?:\.(?:jpg|png|gif|jpeg))", re.I)
|
|
|
+ c = comp.search(results[0])
|
|
|
if(c):
|
|
|
img = results[0]
|
|
|
- img = re.sub("\.(?P<in>[Jj][Pp][Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg])", "#\g<in>#", img)
|
|
|
+
|
|
|
+ comp = re.compile("\.(?P<in>jpg|gif|png|jpeg)", re.I)
|
|
|
+ img = comp.sub("#\g<in>#", img)
|
|
|
|
|
|
data = re.sub('\[\[(((?!\]\]).)*)\]\]', '<a class="out_link" href="' + img + sharp + '">' + g + '</a>', data, 1)
|
|
|
else:
|
|
|
@@ -554,7 +560,7 @@ def namumark(title, data):
|
|
|
break
|
|
|
|
|
|
while(True):
|
|
|
- com = re.compile("(http(?:s)?:\/\/(?:(?:(?:(?!\.[Jj][Pp][Gg]|\.[Pp][Nn][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg]|#[Jj][Pp][Gg]#|#[Pp][Nn][Gg]#|#[Gg][Ii][Ff]#|#[Jj][Pp][Ee][Gg]#|<\/(?:[^>]*)>).)*)(?:\.[Jj][Pp][Gg]|\.[Pp][Nn][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg])))(?:(?:(?:\?)width=((?:[0-9]*)(?:px|%)?))?(?:(?:\?|&)height=((?:[0-9]*)(?:px|%)?))?)")
|
|
|
+ com = re.compile("(http(?:s)?:\/\/(?:(?:(?:(?!\.(?:jpg|png|gif|jpeg)|#(?:jpg|png|gif|jpeg)#|<\/(?:[^>]*)>).)*)(?:\.(?:jpg|png|gif|jpeg))))(?:(?:(?:\?)width=((?:[0-9]*)(?:px|%)?))?(?:(?:\?|&)height=((?:[0-9]*)(?:px|%)?))?)", re.I)
|
|
|
m = com.search(data)
|
|
|
if(m):
|
|
|
result = m.groups()
|
|
|
@@ -573,7 +579,9 @@ def namumark(title, data):
|
|
|
height = ''
|
|
|
|
|
|
c = result[0]
|
|
|
- c = re.sub("\.(?P<in>[Jj][Pp][Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg])", "#\g<in>#", c)
|
|
|
+
|
|
|
+ comp = re.compile("\.(?P<in>jpg|gif|png|jpeg)", re.I)
|
|
|
+ c = comp.sub("#\g<in>#", c)
|
|
|
|
|
|
data = com.sub("<img width='" + width + "' height='" + height + "' src='" + c + "'>", data, 1)
|
|
|
else:
|
|
|
@@ -616,7 +624,8 @@ def namumark(title, data):
|
|
|
|
|
|
data = re.sub('\[age\(([0-9]{4})-([0-9]{2})-([0-9]{2})\)\]', str(year), data, 1)
|
|
|
|
|
|
- data = re.sub("#(?P<in>[Jj][Pp][Gg]|[Pp][Nn][Gg]|[Gg][Ii][Ff]|[Jj][Pp][Ee][Gg])#", ".\g<in>", data)
|
|
|
+ comp = re.compile("#(?P<in>jpg|gif|png|jpeg)#", re.I)
|
|
|
+ data = comp.sub(".\g<in>", data)
|
|
|
data = re.sub("-{4,11}", "<hr>", data)
|
|
|
|
|
|
while(True):
|