@@ -11,7 +11,7 @@ import os | |||||
import sys | import sys | ||||
os.chdir("..") | 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.template import Template | ||||
from mako.lookup import TemplateLookup | from mako.lookup import TemplateLookup | ||||
@@ -42,6 +42,7 @@ class Builder(object): | |||||
self.static_dir = "static" | self.static_dir = "static" | ||||
self.pages_dir = "pages" | self.pages_dir = "pages" | ||||
self.support_dir = "pages/support" | self.support_dir = "pages/support" | ||||
self.source_dir = "toolserver" | |||||
self.temp_dir = "temp" | self.temp_dir = "temp" | ||||
self.rs_file = "rewrite.script" | self.rs_file = "rewrite.script" | ||||
@@ -68,6 +69,7 @@ class Builder(object): | |||||
logger.debug("build {0} -> {1}".format(src, dest)) | logger.debug("build {0} -> {1}".format(src, dest)) | ||||
content = page_src.replace("{{src}}", src) | content = page_src.replace("{{src}}", src) | ||||
content = content.replace("{{pages_dir}}", self.pages_dir) | content = content.replace("{{pages_dir}}", self.pages_dir) | ||||
content = content.replace("{{source_dir}}", self.source_dir) | |||||
content = content.replace("{{temp_dir}}", self.temp_dir) | content = content.replace("{{temp_dir}}", self.temp_dir) | ||||
with open(dest, "w") as fp: | with open(dest, "w") as fp: | ||||
fp.write(content) | fp.write(content) | ||||
@@ -1,6 +1,6 @@ | |||||
<%include file="/support/header.mako" args="environ=environ, title='Copyvio Detector', add_css=('copyvios.css',), add_js=('copyvios.js',)"/>\ | <%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) %> | <% lang, project, name, title, url, site, page, result = main(environ) %> | ||||
<h1>Copyvio Detector</h1> | <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> | <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> | ||||
@@ -5,7 +5,7 @@ from earwigbot.bot import Bot | |||||
from .checker import get_results | from .checker import get_results | ||||
from .highlighter import highlight_delta | from .highlighter import highlight_delta | ||||
from ..support.sites import get_site, get_sites | |||||
from ..sites import get_site, get_sites | |||||
def main(context, environ): | def main(context, environ): | ||||
lang = orig_lang = project = name = title = url = None | lang = orig_lang = project = name = title = url = None |
@@ -6,7 +6,7 @@ from time import time | |||||
from earwigbot import exceptions | 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): | def get_results(bot, site, title, url, query): | ||||
page = site.get_page(title) | page = site.get_page(title) |