From e3c0ba7edc6792f7a1480512750e60834dbed8a5 Mon Sep 17 00:00:00 2001 From: jurgenwigg Date: Tue, 3 Oct 2023 20:35:32 +0000 Subject: [PATCH] refactor: files formatted with black and isort --- mkpdfs_mkdocs/generator.py | 170 +++++++++--------- mkpdfs_mkdocs/mkpdfs.py | 35 ++-- mkpdfs_mkdocs/preprocessor/__init__.py | 2 +- mkpdfs_mkdocs/preprocessor/links/__init__.py | 2 +- mkpdfs_mkdocs/preprocessor/links/transform.py | 10 +- mkpdfs_mkdocs/preprocessor/links/util.py | 16 +- mkpdfs_mkdocs/preprocessor/prep.py | 30 ++-- mkpdfs_mkdocs/utils.py | 43 ++--- pyproject.toml | 42 +++++ setup.cfg | 2 - setup.py | 50 ------ 11 files changed, 204 insertions(+), 198 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/mkpdfs_mkdocs/generator.py b/mkpdfs_mkdocs/generator.py index 20f5534..857277a 100644 --- a/mkpdfs_mkdocs/generator.py +++ b/mkpdfs_mkdocs/generator.py @@ -3,64 +3,78 @@ import sys from uuid import uuid4 -from weasyprint import HTML, urls, CSS from bs4 import BeautifulSoup +from weasyprint import CSS, HTML, urls from weasyprint.text.fonts import FontConfiguration +from mkpdfs_mkdocs.preprocessor import get_combined as prep_combined +from mkpdfs_mkdocs.preprocessor import get_separate as prep_separate from mkpdfs_mkdocs.utils import gen_address + from .utils import is_external -from mkpdfs_mkdocs.preprocessor import get_separate as prep_separate, get_combined as prep_combined log = logging.getLogger(__name__) class Generator(object): - def __init__(self): self.config = None self.design = None self.mkdconfig = None self.nav = None self.title = None - self.logger = logging.getLogger('mkdocs.mkpdfs') + self.logger = logging.getLogger("mkdocs.mkpdfs") self.generate = True self._articles = {} self._page_order = [] self._base_urls = {} self._toc = None - self.html = BeautifulSoup('\ - ', - 'html.parser') + self.html = BeautifulSoup( + "\ + ", + "html.parser", + ) self.dir = os.path.dirname(os.path.realpath(__file__)) - self.design = os.path.join(self.dir, 'design/report.css') + self.design = os.path.join(self.dir, "design/report.css") def set_config(self, local, config): self.config = local - if self.config['design']: - css_file = os.path.join(os.getcwd(), self.config['design']) + if self.config["design"]: + css_file = os.path.join(os.getcwd(), self.config["design"]) if not os.path.isfile(css_file): - sys.exit('The file {} specified for design has not \ - been found.'.format(css_file)) + sys.exit( + "The file {} specified for design has not \ + been found.".format( + css_file + ) + ) self.design = css_file - self.title = config['site_name'] - self.config['copyright'] = 'CC-BY-SA\ - ' if not config['copyright'] else config['copyright'] + self.title = config["site_name"] + self.config["copyright"] = ( + "CC-BY-SA\ + " + if not config["copyright"] + else config["copyright"] + ) self.mkdconfig = config def write(self): if not self.generate: - self.logger.log(msg='Unable to generate the PDF Version (See Mkpdfs doc)', - level=logging.WARNING, ) + self.logger.log( + msg="Unable to generate the PDF Version (See Mkpdfs doc)", + level=logging.WARNING, + ) return self.gen_articles() font_config = FontConfiguration() self.add_head() - pdf_path = os.path.join(self.mkdconfig['site_dir'], - self.config['output_path']) + pdf_path = os.path.join(self.mkdconfig["site_dir"], self.config["output_path"]) os.makedirs(os.path.dirname(pdf_path), exist_ok=True) - html = HTML(string=str(self.html)).write_pdf(pdf_path, - font_config=font_config) - self.logger.log(msg='The PDF version of the documentation has been generated.', level=logging.INFO, ) + html = HTML(string=str(self.html)).write_pdf(pdf_path, font_config=font_config) + self.logger.log( + msg="The PDF version of the documentation has been generated.", + level=logging.INFO, + ) def add_nav(self, nav): self.nav = nav @@ -68,22 +82,20 @@ def add_nav(self, nav): self.add_to_order(p) def add_to_order(self, page): - if page.is_page and page.meta and 'pdf' in page.meta and not page.meta['pdf']: + if page.is_page and page.meta and "pdf" in page.meta and not page.meta["pdf"]: return if page.is_page: self._page_order.append(page.file.url) elif page.children: uuid = str(uuid4()) self._page_order.append(uuid) - title = self.html.new_tag('h1', - id='{}-title'.format(uuid), - **{'class': 'section_title'} - ) + title = self.html.new_tag( + "h1", id="{}-title".format(uuid), **{"class": "section_title"} + ) title.append(page.title) - article = self.html.new_tag('article', - id='{}'.format(uuid), - **{'class': 'chapter'} - ) + article = self.html.new_tag( + "article", id="{}".format(uuid), **{"class": "chapter"} + ) article.append(title) self._articles[uuid] = article for child in page.children: @@ -96,30 +108,30 @@ def add_article(self, content, page, base_url): if not self.generate: return None self._base_urls[page.file.url] = base_url - soup = BeautifulSoup(content, 'html.parser') - url = page.url.split('.')[0] - article = soup.find('article') + soup = BeautifulSoup(content, "html.parser") + url = page.url.split(".")[0] + article = soup.find("article") if not article: - article = self.html.new_tag('article') - eld = soup.find('div', **{'role': 'main'}) + article = self.html.new_tag("article") + eld = soup.find("div", **{"role": "main"}) article.append(eld) - article.div['class'] = article.div['role'] = None + article.div["class"] = article.div["role"] = None if not article: self.generate = False return None article = prep_combined(article, base_url, page.file.url) - if page.meta and 'pdf' in page.meta and not page.meta['pdf']: + if page.meta and "pdf" in page.meta and not page.meta["pdf"]: # print(page.meta) return self.get_path_to_pdf(page.file.dest_path) self._articles[page.file.url] = article return self.get_path_to_pdf(page.file.dest_path) def add_head(self): - lines = ['{}'.format(self.title)] + lines = ["{}".format(self.title)] for key, val in ( - ("author", self.config['author'] or self.mkdconfig['site_author']), - ("description", self.mkdconfig['site_description']), + ("author", self.config["author"] or self.mkdconfig["site_author"]), + ("description", self.mkdconfig["site_description"]), ): if val: lines.append(''.format(key, val)) @@ -127,29 +139,27 @@ def add_head(self): if css: css_tmpl = '' lines.append(css_tmpl.format(urls.path2url(css))) - head = BeautifulSoup('\n'.join(lines), 'html5lib') + head = BeautifulSoup("\n".join(lines), "html5lib") self.html.head.clear() self.html.head.insert(0, head) def get_path_to_pdf(self, start): - pdf_split = os.path.split(self.config['output_path']) + pdf_split = os.path.split(self.config["output_path"]) start_dir = os.path.split(start)[0] - return os.path.join(os.path.relpath(pdf_split[0], - start_dir), pdf_split[1]) + return os.path.join(os.path.relpath(pdf_split[0], start_dir), pdf_split[1]) def add_tocs(self): - title = self.html.new_tag('h1', id='toc-title') - title.insert(0, self.config['toc_title']) - self._toc = self.html.new_tag('article', id='contents') + title = self.html.new_tag("h1", id="toc-title") + title.insert(0, self.config["toc_title"]) + self._toc = self.html.new_tag("article", id="contents") self._toc.insert(0, title) for n in self.nav: - if n.is_page and n.meta and 'pdf' in n.meta \ - and not n.meta['pdf']: + if n.is_page and n.meta and "pdf" in n.meta and not n.meta["pdf"]: continue - if hasattr(n, 'url') and is_external(n.url): + if hasattr(n, "url") and is_external(n.url): # Skip toc generation for external links continue - h3 = self.html.new_tag('h3') + h3 = self.html.new_tag("h3") h3.insert(0, n.title) self._toc.append(h3) if n.is_page: @@ -160,8 +170,8 @@ def add_tocs(self): self.html.body.append(self._toc) def add_cover(self): - a = self.html.new_tag('article', id='doc-cover') - title = self.html.new_tag('h1', id='doc-title') + a = self.html.new_tag("article", id="doc-cover") + title = self.html.new_tag("h1", id="doc-title") title.insert(0, self.title) a.insert(0, title) a.append(gen_address(self.config)) @@ -169,40 +179,38 @@ def add_cover(self): def gen_articles(self): self.add_cover() - if self.config['toc_position'] == 'pre': + if self.config["toc_position"] == "pre": self.add_tocs() for url in self._page_order: if url in self._articles: self.html.body.append(self._articles[url]) - if self.config['toc_position'] == 'post': + if self.config["toc_position"] == "post": self.add_tocs() def get_path_to_pdf(self, start): - pdf_split = os.path.split(self.config['output_path']) - start_dir = os.path.split(start)[0] if os.path.split(start)[0] else '.' - return os.path.join(os.path.relpath(pdf_split[0], start_dir), - pdf_split[1]) + pdf_split = os.path.split(self.config["output_path"]) + start_dir = os.path.split(start)[0] if os.path.split(start)[0] else "." + return os.path.join(os.path.relpath(pdf_split[0], start_dir), pdf_split[1]) def _gen_toc_section(self, section): if section.children: # External Links do not have children for p in section.children: - if p.is_page and p.meta and 'pdf' \ - in p.meta and not p.meta['pdf']: + if p.is_page and p.meta and "pdf" in p.meta and not p.meta["pdf"]: continue - if not hasattr(p, 'file'): + if not hasattr(p, "file"): # Skip external links continue stoc = self._gen_toc_for_section(p.file.url, p) - child = self.html.new_tag('div') + child = self.html.new_tag("div") child.append(stoc) self._toc.append(child) def _gen_children(self, url, children): - ul = self.html.new_tag('ul') + ul = self.html.new_tag("ul") for child in children: - a = self.html.new_tag('a', href=child.url) + a = self.html.new_tag("a", href=child.url) a.insert(0, child.title) - li = self.html.new_tag('li') + li = self.html.new_tag("li") li.append(a) if child.children: sub = self._gen_children(url, child.children) @@ -211,22 +219,22 @@ def _gen_children(self, url, children): return ul def _gen_toc_for_section(self, url, p): - div = self.html.new_tag('div') - menu = self.html.new_tag('div') - h4 = self.html.new_tag('h4') - a = self.html.new_tag('a', href='#') + div = self.html.new_tag("div") + menu = self.html.new_tag("div") + h4 = self.html.new_tag("h4") + a = self.html.new_tag("a", href="#") a.insert(0, p.title) h4.append(a) menu.append(h4) - ul = self.html.new_tag('ul') + ul = self.html.new_tag("ul") if p.toc: for child in p.toc.items: - a = self.html.new_tag('a', href=child.url) + a = self.html.new_tag("a", href=child.url) a.insert(0, child.title) - li = self.html.new_tag('li') + li = self.html.new_tag("li") li.append(a) if child.title == p.title: - li = self.html.new_tag('div') + li = self.html.new_tag("div") if child.children: sub = self._gen_children(url, child.children) li.append(sub) @@ -235,14 +243,14 @@ def _gen_toc_for_section(self, url, p): menu.append(ul) div.append(menu) div = prep_combined(div, self._base_urls[url], url) - return div.find('div') + return div.find("div") def _gen_toc_page(self, url, toc): - div = self.html.new_tag('div') - menu = self.html.new_tag('ul') + div = self.html.new_tag("div") + menu = self.html.new_tag("ul") for item in toc.items: - li = self.html.new_tag('li') - a = self.html.new_tag('a', href=item.url) + li = self.html.new_tag("li") + a = self.html.new_tag("a", href=item.url) a.append(item.title) li.append(a) menu.append(li) @@ -251,4 +259,4 @@ def _gen_toc_page(self, url, toc): menu.append(child) div.append(menu) div = prep_combined(div, self._base_urls[url], url) - return div.find('ul') + return div.find("ul") diff --git a/mkpdfs_mkdocs/mkpdfs.py b/mkpdfs_mkdocs/mkpdfs.py index e88b3a3..98f1354 100644 --- a/mkpdfs_mkdocs/mkpdfs.py +++ b/mkpdfs_mkdocs/mkpdfs.py @@ -1,10 +1,10 @@ -import os import logging +import os from mkdocs.config import config_options from mkdocs.plugins import BasePlugin +from weasyprint import CSS, HTML, urls -from weasyprint import HTML, urls, CSS from mkpdfs_mkdocs.generator import Generator from mkpdfs_mkdocs.utils import modify_html @@ -12,25 +12,26 @@ class Mkpdfs(BasePlugin): - config_scheme = ( - ('design', config_options.Type(str, default=None)), - ('toc_title', config_options.Type(str, default="Table of Contents")), - ('company', config_options.Type(str, default=None)), - ('author', config_options.Type(str, default=None)), - ('toc_position', config_options.Type(str, default="pre")), - ('pdf_links', config_options.Type(bool, default=True)), - ('output_path', config_options.Type(str, default="pdf/combined.pdf")), + ("design", config_options.Type(str, default=None)), + ("toc_title", config_options.Type(str, default="Table of Contents")), + ("company", config_options.Type(str, default=None)), + ("author", config_options.Type(str, default=None)), + ("toc_position", config_options.Type(str, default="pre")), + ("pdf_links", config_options.Type(bool, default=True)), + ("output_path", config_options.Type(str, default="pdf/combined.pdf")), ) def __init__(self): self.generator = Generator() self._skip_pdf = True if os.environ.get("SKIP_PDF") else False - self._logger = logging.getLogger('mkdocs.mkpdfs') + self._logger = logging.getLogger("mkdocs.mkpdfs") def on_serve(self, server, config, **kwargs): if self._skip_pdf: - self._logger.info("PDF generation will be skipped: presence of env var SKIP_PDF=1") + self._logger.info( + "PDF generation will be skipped: presence of env var SKIP_PDF=1" + ) # TODO: Implement watcher when the user is performing design # print(server.watcher.__dict__) # # builder = build(config, True, False) @@ -40,7 +41,11 @@ def on_serve(self, server, config, **kwargs): def on_config(self, config, **kwargs): if self._skip_pdf: return config - self.config['output_path'] = os.path.join("pdf", "combined.pdf") if not self.config['output_path'] else self.config['output_path'] + self.config["output_path"] = ( + os.path.join("pdf", "combined.pdf") + if not self.config["output_path"] + else self.config["output_path"] + ) self.generator.set_config(self.config, config) return config @@ -64,8 +69,8 @@ def on_post_page(self, output_content, page, config, **kwargs): filename = os.path.splitext(os.path.basename(src_path))[0] base_url = urls.path2url(os.path.join(path, filename)) pdf_url = self.generator.add_article(output_content, page, base_url) - if self.config['pdf_links'] and pdf_url: - output_content = modify_html(output_content,pdf_url) + if self.config["pdf_links"] and pdf_url: + output_content = modify_html(output_content, pdf_url) return output_content def on_post_build(self, config): diff --git a/mkpdfs_mkdocs/preprocessor/__init__.py b/mkpdfs_mkdocs/preprocessor/__init__.py index 8fa23fa..d91c059 100755 --- a/mkpdfs_mkdocs/preprocessor/__init__.py +++ b/mkpdfs_mkdocs/preprocessor/__init__.py @@ -1 +1 @@ -from .prep import get_combined, get_separate \ No newline at end of file +from .prep import get_combined, get_separate diff --git a/mkpdfs_mkdocs/preprocessor/links/__init__.py b/mkpdfs_mkdocs/preprocessor/links/__init__.py index fae95c2..68a2bf3 100755 --- a/mkpdfs_mkdocs/preprocessor/links/__init__.py +++ b/mkpdfs_mkdocs/preprocessor/links/__init__.py @@ -1,2 +1,2 @@ from .transform import transform_href, transform_id -from .util import get_body_id, replace_asset_hrefs, rel_pdf_href \ No newline at end of file +from .util import get_body_id, rel_pdf_href, replace_asset_hrefs diff --git a/mkpdfs_mkdocs/preprocessor/links/transform.py b/mkpdfs_mkdocs/preprocessor/links/transform.py index 080bf76..766c54c 100755 --- a/mkpdfs_mkdocs/preprocessor/links/transform.py +++ b/mkpdfs_mkdocs/preprocessor/links/transform.py @@ -2,19 +2,21 @@ from .util import is_doc, normalize_href + # normalize href to #foo/bar/section:id def transform_href(href: str, rel_url: str): if not is_doc(href): return href - if '#' not in href: - href += '#' + if "#" not in href: + href += "#" return "#" + normalize_href(href, rel_url).replace("#", ":", 1) + # normalize id to foo/bar/section:id def transform_id(id: str, rel_url: str): head, section = os.path.split(rel_url) if len(head) > 0: - head += '/' + head += "/" - return '{}{}:{}'.format(head, section, id) + return "{}{}:{}".format(head, section, id) diff --git a/mkpdfs_mkdocs/preprocessor/links/util.py b/mkpdfs_mkdocs/preprocessor/links/util.py index 1ad7074..87a649f 100755 --- a/mkpdfs_mkdocs/preprocessor/links/util.py +++ b/mkpdfs_mkdocs/preprocessor/links/util.py @@ -1,7 +1,7 @@ import os -from weasyprint import urls from bs4 import BeautifulSoup +from weasyprint import urls # check if href is relative -- @@ -19,11 +19,12 @@ def rel_pdf_href(href: str): head, tail = os.path.split(href) filename, _ = os.path.splitext(tail) - internal = href.startswith('#') + internal = href.startswith("#") if not is_doc(href) or internal: return href - return urls.iri_to_uri(os.path.join(head, filename + '.pdf')) + return urls.iri_to_uri(os.path.join(head, filename + ".pdf")) + def abs_asset_href(href: str, base_url: str): if urls.url_is_absolute(href) or os.path.isabs(href): @@ -31,13 +32,14 @@ def abs_asset_href(href: str, base_url: str): return urls.iri_to_uri(urls.urljoin(base_url, href)) + # makes all relative asset links absolute def replace_asset_hrefs(soup: BeautifulSoup, base_url: str): - for link in soup.find_all('link', href=True): - link['href'] = abs_asset_href(link['href'], base_url) + for link in soup.find_all("link", href=True): + link["href"] = abs_asset_href(link["href"], base_url) for asset in soup.find_all(src=True): - asset['src'] = abs_asset_href(asset['src'], base_url) + asset["src"] = abs_asset_href(asset["src"], base_url) return soup @@ -74,4 +76,4 @@ def normalize_href(href: str, rel_url: str): def get_body_id(url: str): - return '{}:'.format(url) \ No newline at end of file + return "{}:".format(url) diff --git a/mkpdfs_mkdocs/preprocessor/prep.py b/mkpdfs_mkdocs/preprocessor/prep.py index 45b8c83..58ff37c 100755 --- a/mkpdfs_mkdocs/preprocessor/prep.py +++ b/mkpdfs_mkdocs/preprocessor/prep.py @@ -1,30 +1,38 @@ import os -from .links import transform_href, transform_id, get_body_id, replace_asset_hrefs, rel_pdf_href - -from weasyprint import urls from bs4 import BeautifulSoup +from weasyprint import urls + +from .links import ( + get_body_id, + rel_pdf_href, + replace_asset_hrefs, + transform_href, + transform_id, +) + def get_combined(soup: BeautifulSoup, base_url: str, rel_url: str): for id in soup.find_all(id=True): - id['id'] = transform_id(id['id'], rel_url) + id["id"] = transform_id(id["id"], rel_url) - for a in soup.find_all('a', href=True): - if urls.url_is_absolute(a['href']) or os.path.isabs(a['href']): - a['class'] = 'external-link' + for a in soup.find_all("a", href=True): + if urls.url_is_absolute(a["href"]) or os.path.isabs(a["href"]): + a["class"] = "external-link" continue - a['href'] = transform_href(a['href'], rel_url) + a["href"] = transform_href(a["href"], rel_url) - soup.attrs['id'] = get_body_id(rel_url) + soup.attrs["id"] = get_body_id(rel_url) soup = replace_asset_hrefs(soup, base_url) return soup + def get_separate(soup: BeautifulSoup, base_url: str): # transforms all relative hrefs pointing to other html docs # into relative pdf hrefs - for a in soup.find_all('a', href=True): - a['href'] = rel_pdf_href(a['href']) + for a in soup.find_all("a", href=True): + a["href"] = rel_pdf_href(a["href"]) soup = replace_asset_hrefs(soup, base_url) return soup diff --git a/mkpdfs_mkdocs/utils.py b/mkpdfs_mkdocs/utils.py index 3c200c8..c316941 100644 --- a/mkpdfs_mkdocs/utils.py +++ b/mkpdfs_mkdocs/utils.py @@ -2,47 +2,38 @@ def modify_html(html: str, href: str) -> str: - soup = BeautifulSoup(html, 'html.parser') - a = soup.new_tag('a', - href=href, - title='Download', - download=None - ) - a['class'] = 'md-content__icon pdf-download-btn' - i = soup.new_tag('i') - i['class'] = 'fa fas fa-download' - small = soup.new_tag('small') + soup = BeautifulSoup(html, "html.parser") + a = soup.new_tag("a", href=href, title="Download", download=None) + a["class"] = "md-content__icon pdf-download-btn" + i = soup.new_tag("i") + i["class"] = "fa fas fa-download" + small = soup.new_tag("small") a.append(i) - small.append(' PDF') + small.append(" PDF") a.append(small) if soup.article: soup.article.insert(0, a) else: - soup.find('div', **{'role': 'main'}).insert(0, a); + soup.find("div", **{"role": "main"}).insert(0, a) return str(soup) def gen_address(config): - soup = BeautifulSoup('', - 'html5lib' - ) - address = soup.new_tag('address') - p = soup.new_tag('p') - for k, line in {'author': config['author'], - 'company': config['company']}.items(): + soup = BeautifulSoup("", "html5lib") + address = soup.new_tag("address") + p = soup.new_tag("p") + for k, line in {"author": config["author"], "company": config["company"]}.items(): if line: - sp = soup.new_tag('p', **{'class': k}) + sp = soup.new_tag("p", **{"class": k}) sp.append("{}".format(line)) p.append(sp) address.append(p) - if config['copyright']: - span = soup.new_tag('p', - id="copyright" - ) - span.append(config['copyright']) + if config["copyright"]: + span = soup.new_tag("p", id="copyright") + span.append(config["copyright"]) address.append(span) return address def is_external(href: str): - return href.startswith('http://') or href.startswith('https://') + return href.startswith("http://") or href.startswith("https://") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0cd9594 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,42 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "mkpdfs2_mkdocs" +authors = [ + {name = "jurgenwigg", email = "jurgenwigg@protonmail.com"}, +] +description="Allows the generation of the PDF version of your MkDocs documentation." +readme = "README.md" +requires-python = ">=3.8" +keywords = ["mkdocs", "documentation", "pdf", "export", "weasyprint", "markdown", "plugin"] +license = {text = "GPLv3"} +classifiers=[ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Information Technology", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Topic :: Documentation", + "Topic :: Printing", + "Programming Language :: Other", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies = [ + "weasyprint>=0.44", + "mkdocs>=0.17", + "beautifulsoup4>=4.6.3" +] +dynamic = ["version"] + +[project.optional-dependencies] +test = ["tox"] + +[project.entry-points."mkdocs.plugins"] +mkpdfs = "mkpdfs_mkdocs:Mkpdfs" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0c9e0fc..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = LICENSE diff --git a/setup.py b/setup.py deleted file mode 100644 index e9ee321..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from setuptools import setup, find_packages -from pathlib import Path - -long_description = (Path(__file__).parent / "README.md").read_text(encoding="utf-8") - -setup( - name="mkpdfs2-mkdocs", - version="1.0.1", - url="https://github.com/jurgenwigg/mkpdfs2-mkdocs-plugin", - license="GPLv3", - author="Comwes", - author_email="contact@comwes.eu", - maintainer="jurgenwigg", - maintainer_email="jurgenwigg@protonmail.com", - description="Allows the generation of the PDF version of your MkDocs documentation.", - long_description=long_description, - long_description_content_type="text/markdown", - python_requires=">=3.4", - include_package_data=True, - install_requires=["mkdocs>=0.17", "weasyprint>=0.44", "beautifulsoup4>=4.6.3"], - project_urls={ # Optional - "Bug Reports": "https://github.com/jurgenwigg/mkpdfs2-mkdocs-plugin/issues", - "Source": "https://github.com/jurgenwigg/mkpdfs2-mkdocs-plugin", - }, - keywords="mkdocs documentation pdf export weasyprint markdown plugin", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Education", - "Intended Audience :: Information Technology", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Topic :: Documentation", - "Topic :: Printing", - "Programming Language :: Other", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - ], - packages=find_packages(), - entry_points={ - "mkdocs.plugins": [ - "mkpdfs = mkpdfs_mkdocs:Mkpdfs", - ] - }, - zip_safe=False, -)