Esempio n. 1
0
    def generate_config(self, hepigram_yaml, chapters_data, input_data):
        """This function will generate the final MkDocs configuration
        according to whatever was specificed on hepigram.yaml. It consists of
        two dicts: `base_config` and `optional_config`. `base_config` is
        filled with expected/important data while `optional_config` is
        generated according to extra parameters."""

        base_config = {
            'site_name': hepigram_yaml['title'],
            'docs_dir': self.BUILD_DIR,
            'pages': chapters_data,
            'theme': hepigram_yaml['theme']
        }

        optional_config = dict()

        # Custom theme support (if specified)
        if 'theme_dir' in hepigram_yaml:
            optional_config['theme_dir'] = absolutify(
                hepigram_yaml['theme_dir']
            )
        elif input_data['theme']['path']:
            optional_config['theme_dir'] = absolutify(
                input_data['theme']['path']
            )

        # Merge `base_config` and `optional_config`
        config_data = base_config.copy()
        config_data.update(optional_config)

        self.CONFIG = config_data
Esempio n. 2
0
    def prepare_input(self):
        """Lint the command-line arguments (input) & store it."""

        HEpigramLinter.lint_input(self.input_data)

        self.SOURCE_PATH = absolutify(self.input_data['source']['path'])

        self.GitHandler.ORIGIN_PATH = self.SOURCE_PATH
Esempio n. 3
0
 def prepare_mkdocs(self):
     self.MkDocs.BUILD_DIR = absolutify(self.input_data['build']['path'])
     self.MkDocs.DOCS_DIR = self.SOURCE_PATH
     self.MkDocs.OUTPUT_DIR = absolutify(self.input_data['output'])