浏览代码

Restructure into an actual package that makes sense.

pull/24/head
Ben Kurtovic 12 年前
父节点
当前提交
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 查看文件


正在加载...
取消
保存