瀏覽代碼

Again, fix link and cleanup.

master
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



Loading…
取消
儲存