소스 검색

Again, fix link and cleanup.

copyvios-ng
Ben Kurtovic 7 년 전
부모
커밋
088dfe6197
2개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. +5
    -3
      copyvios/attribution.py
  2. +1
    -2
      templates/index.mako

+ 5
- 3
copyvios/attribution.py 파일 보기

@@ -18,8 +18,8 @@ ATTRIB_TEMPLATES = {
def get_attribution_info(site, page):
"""Check to see if the given page has some kind of attribution info.

If yes, return a mwparserfromhell.nodes.Template object for the attribution
template. If no, return None.
If yes, return a tuple of (attribution template name, template URL).
If no, return None.
"""
if site.name not in ATTRIB_TEMPLATES:
return None
@@ -30,5 +30,7 @@ def get_attribution_info(site, page):

for template in page.parse().ifilter_templates():
if template.name.matches(templates):
return template
name = unicode(template.name)
title = name if ":" in name else prefix + ":" + name
return name, site.get_page(title).url
return None

+ 1
- 2
templates/index.mako 파일 보기

@@ -214,9 +214,8 @@

<% attrib = get_attribution_info(query.site, query.page) %>
% if attrib:
<% attrib_page = query.site.get_page(unicode(attrib.name)) %>
<div id="attribution-warning" class="yellow-box">
This article contains an attribution template: <tt>{{<a href="${attrib_page.url}">${attrib_page.title | h}</a>}}</tt>. Please verify that any potential copyvios are not from properly attributed sources.
This article contains an attribution template: <tt>{{<a href="${attrib[1]}">${attrib[0] | h}</a>}}</tt>. Please verify that any potential copyvios are not from properly attributed sources.
</div>
% endif



불러오는 중...
취소
저장