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

Restructure into an actual package that makes sense.

pull/24/head
Ben Kurtovic 11 лет назад
Родитель
Сommit
b4b5ac4f93
8 измененных файлов: 7 добавлений и 5 удалений
  1. +3
    -1
      build.py
  2. +2
    -2
      pages/copyvios.mako
  3. +0
    -0
      toolserver/__init__.py
  4. +1
    -1
      toolserver/copyvios/__init__.py
  5. +1
    -1
      toolserver/copyvios/checker.py
  6. +0
    -0
      toolserver/copyvios/highlighter.py
  7. +0
    -0
      toolserver/misc.py
  8. +0
    -0
      toolserver/sites.py

+ 3
- 1
build.py Просмотреть файл

@@ -11,7 +11,7 @@ import os
import sys

os.chdir("..")
sys.path.insert(0, os.path.join(".", "{{pages_dir}}"))
sys.path.insert(0, os.path.join(".", "{{source_dir}}"))

from mako.template import Template
from mako.lookup import TemplateLookup
@@ -42,6 +42,7 @@ class Builder(object):
self.static_dir = "static"
self.pages_dir = "pages"
self.support_dir = "pages/support"
self.source_dir = "toolserver"
self.temp_dir = "temp"
self.rs_file = "rewrite.script"

@@ -68,6 +69,7 @@ class Builder(object):
logger.debug("build {0} -> {1}".format(src, dest))
content = page_src.replace("{{src}}", src)
content = content.replace("{{pages_dir}}", self.pages_dir)
content = content.replace("{{source_dir}}", self.source_dir)
content = content.replace("{{temp_dir}}", self.temp_dir)
with open(dest, "w") as fp:
fp.write(content)


+ 2
- 2
pages/copyvios.mako Просмотреть файл

@@ -1,6 +1,6 @@
<%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\
<%namespace module="copyvios" import="main, highlight_delta"/>\
<%namespace module="support.misc" import="urlstrip"/>\
<%namespace module="toolserver.copyvios" import="main, highlight_delta"/>\
<%namespace module="toolserver.misc" import="urlstrip"/>\
<% lang, project, name, title, url, site, page, result = main(environ) %>
<h1>Copyvio Detector</h1>
<p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p>


pages/support/__init__.py → toolserver/__init__.py Просмотреть файл


pages/copyvios/__init__.py → toolserver/copyvios/__init__.py Просмотреть файл

@@ -5,7 +5,7 @@ from earwigbot.bot import Bot

from .checker import get_results
from .highlighter import highlight_delta
from ..support.sites import get_site, get_sites
from ..sites import get_site, get_sites

def main(context, environ):
lang = orig_lang = project = name = title = url = None

pages/copyvios/checker.py → toolserver/copyvios/checker.py Просмотреть файл

@@ -6,7 +6,7 @@ from time import time

from earwigbot import exceptions

from ..support.misc import open_sql_connection
from ..misc import open_sql_connection

def get_results(bot, site, title, url, query):
page = site.get_page(title)

pages/copyvios/highlighter.py → toolserver/copyvios/highlighter.py Просмотреть файл


pages/support/misc.py → toolserver/misc.py Просмотреть файл


pages/support/sites.py → toolserver/sites.py Просмотреть файл


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