Skip to content
This repository has been archived by the owner on Dec 25, 2020. It is now read-only.

放宽引用gist的格式 #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions v2ex/templatetags/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def avatar(value, arg):

# github gist script support
def gist(value):
return re.sub(r'(http://gist.github.com/[\d]+)', r'<script src="\1.js"></script>', value)
return re.sub(r'(http(s)?://gist.github.com/[\d]+)(\.git)?', r'<script src="\1.js"></script>', value)
register.filter(gist)

_base_js_escapes = (
Expand All @@ -235,4 +235,4 @@ def escapejs(value):
for bad, good in _js_escapes:
value = value.replace(bad, good)
return value
register.filter(escapejs)
register.filter(escapejs)