# -*- coding: utf-8 -*-
#
# Copyright 2016 Pedro Salgado
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Package to standardize Sphinx documentation in a GitHub organization."""

from jinja2 import Environment, PackageLoader


class Organization(object):

    def __init__(self, name, package):
        self.name = name
        self.package = package
        self.metadata = __import__('%s.metadata' % package)
        self.env = None

    def _load_environment(self):
        """Load Jinja 2 environment."""
        self.env = Environment(
            loader=PackageLoader('%s.sphinx' % self.name, 'templates'))

    def generate_conf(self):
        return self.env.get_template('conf.py.j2').render(metadata=self.metadata)

    def generate_makefile(self):
        return self.env.get_template('Makefile.j2').render(metadata=self.metadata)

@@ -721,16 +721,52 @@
 eLoader%0A
+from steenzout.object import Object%0A
 %0A%0Aclass 
@@ -778,17 +778,17 @@
 ization(
-o
+O
 bject):%0A
@@ -947,106 +947,8 @@
 ge)%0A
-        self.env = None%0A%0A    def _load_environment(self):%0A        %22%22%22Load Jinja 2 environment.%22%22%22%0A
     
@@ -1127,32 +1127,45 @@
 .py.j2').render(
+%0A            
 metadata=self.me
@@ -1170,16 +1170,50 @@
 metadata
+,%0A            package=self.package
 )%0A%0A    d
@@ -1299,16 +1299,29 @@
 .render(
+%0A            
 metadata
@@ -1334,10 +1334,44 @@
 metadata
+,%0A            package=self.package
 )%0A

use steenzout.object.Object.