Exemple #1
0
def diff():
    json_response = request.json
    if check_json_response(json_response):
        return jsonify(
            {'text': textDiff(json_response['doc1'], json_response['doc2'])})
    else:
        return abort(400)
Exemple #2
0
def index():
    if request.method == 'GET':
        return render_template('index.html')
    data = request.form.to_dict()
    html_diff = diff.textDiff(**data)
    return render_template('index.html',
                           html1=data['html1'],
                           html2=data['html2'],
                           html_diff=html_diff)
Exemple #3
0
    def get(self, page_title, first_revision, second_revision):
        entry = WikiContent.gql('WHERE title = :1', page_title).get()

        if entry:
            first_revision = WikiRevision.gql('WHERE wiki_page =  :1 '
                                              'AND version_number = :2', entry, int(first_revision)).get()
            second_revision = WikiRevision.gql('WHERE wiki_page =  :1 '
                                              'AND version_number = :2', entry, int(second_revision)).get()

            import diff
            body = diff.textDiff(first_revision.revision_body, second_revision.revision_body)

            self.generate('view_diff.html', template_values={'page_title': page_title,
                                                             'body': body,
                                                             })
Exemple #4
0
    def cachable_history_single(request, ac, has_parent,
                                has_child, lang="en", id=None):

        ac.diff = diff.textDiff(
            ac.parent.content if ac.parent else '',
            ac.content
        )

        originalArticle = article.get_newest_content(lang=lang)

        return render(request, 'history_single.html', {
            'ac': ac,
            'next_ac': ac.child,
            'prev_ac': ac.parent,
            'back_url': originalArticle.get_absolute_url
        })
Exemple #5
0
    def cachable_history_single(request,
                                ac,
                                has_parent,
                                has_child,
                                lang="en",
                                id=None):

        ac.diff = diff.textDiff(ac.parent.content if ac.parent else '',
                                ac.content)

        originalArticle = article.get_newest_content(lang=lang)

        return render(
            request, 'history_single.html', {
                'ac': ac,
                'next_ac': ac.child,
                'prev_ac': ac.parent,
                'back_url': originalArticle.get_absolute_url
            })
Exemple #6
0
    def get(self, page_title, first_revision, second_revision):
        entry = WikiContent.gql('WHERE title = :1', page_title).get()

        if entry:
            first_revision = WikiRevision.gql(
                'WHERE wiki_page =  :1 '
                'AND version_number = :2', entry, int(first_revision)).get()
            second_revision = WikiRevision.gql(
                'WHERE wiki_page =  :1 '
                'AND version_number = :2', entry, int(second_revision)).get()

            import diff
            body = diff.textDiff(first_revision.revision_body,
                                 second_revision.revision_body)

            self.generate('view_diff.html',
                          template_values={
                              'page_title': page_title,
                              'body': body,
                          })