Просмотр исходного кода

Again, fix link and cleanup.

copyvios-ng
Ben Kurtovic 7 лет назад
Родитель
Сommit
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): def get_attribution_info(site, page):
"""Check to see if the given page has some kind of attribution info. """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: if site.name not in ATTRIB_TEMPLATES:
return None return None
@@ -30,5 +30,7 @@ def get_attribution_info(site, page):


for template in page.parse().ifilter_templates(): for template in page.parse().ifilter_templates():
if template.name.matches(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 return None

+ 1
- 2
templates/index.mako Просмотреть файл

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


<% attrib = get_attribution_info(query.site, query.page) %> <% attrib = get_attribution_info(query.site, query.page) %>
% if attrib: % if attrib:
<% attrib_page = query.site.get_page(unicode(attrib.name)) %>
<div id="attribution-warning" class="yellow-box"> <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> </div>
% endif % endif




Загрузка…
Отмена
Сохранить