Przeglądaj źródła

Again, fix link and cleanup.

copyvios-ng
Ben Kurtovic 7 lat temu
rodzic
commit
088dfe6197
2 zmienionych plików z 6 dodań i 5 usunięć
  1. +5
    -3
      copyvios/attribution.py
  2. +1
    -2
      templates/index.mako

+ 5
- 3
copyvios/attribution.py Wyświetl plik

@@ -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 Wyświetl plik

@@ -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



Ładowanie…
Anuluj
Zapisz