# -*- coding: utf-8 -*-

from AbstractVisitor import AbstractVisitor

class AddGitHubArticleLinkVisitor(AbstractVisitor):
    def __init__(self, args):
        self.repo = args.github_repository
        self.law_id = None

        super(AddGitHubArticleLinkVisitor, self).__init__()

    def visit_law_reference_node(self, node, post):
        if post:
            return

        self.law_id = node['lawId']

    def visit_article_reference_node(self, node, post):
        if post:
            return

        node['githubHistory'] = ('https://github.com/'
            + self.repo + '/commits/master/'
            + 'loi_' + self.law_id + '/'
            + 'Article_' + node['id'] + '.md')

Add a visitor to generate the github history link.
Add a visitor to generate the github history link.
