Merge pull request #1771 from spotify/mob/add-metadata-generation-techdocs-core

Metadata generation in techdocs-core python package
This commit is contained in:
Sebastian Qvarfordt
2020-07-29 16:38:33 +02:00
committed by GitHub
3 changed files with 13 additions and 4 deletions
@@ -1,4 +1,5 @@
site_name: 'mock-docs'
site_description: 'mock-docs site description'
nav:
- Home: index.md
@@ -18,7 +18,7 @@ from setuptools import setup, find_packages
setup(
name='mkdocs-techdocs-core',
version='0.0.2',
version='0.0.3',
description='A Mkdocs package that contains TechDocs defaults',
long_description='',
keywords='mkdocs',
@@ -16,16 +16,24 @@
from mkdocs.plugins import BasePlugin, PluginCollection
from mkdocs.theme import Theme
from mkdocs.contrib.search import SearchPlugin
from mkdocs_monorepo_plugin.plugin import MonorepoPlugin
import tempfile
import os
class TechDocsCore(BasePlugin):
def on_config(self, config):
fp = open(os.path.join(tempfile.gettempdir(), "techdocs_metadata.json"), "w+")
fp.write(
'{\n "site_name": "{{ config.site_name }}",\n "site_description": "{{ config.site_description }}"\n}'
)
# Theme
config["theme"] = Theme(name="material")
config["theme"] = Theme(
name="material", static_templates=["techdocs_metadata.json",],
)
config["theme"].dirs.append(tempfile.gettempdir())
# Plugins
del config["plugins"]["techdocs-core"]