Skip to content

Commit

Permalink
Clean conf
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Jul 28, 2023
1 parent 6a90b34 commit 5b8ef83
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions doc/sphinx/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
import lief
import os
Expand All @@ -9,11 +8,7 @@
import inspect
from sphinx.util import logging
from sphinx.util.inspect import (
evaluate_signature,
getdoc,
object_description,
safe_getattr,
stringify_signature,
signature_from_str
)

Expand Down Expand Up @@ -66,6 +61,8 @@
source_suffix = '.rst'

master_doc = 'index'
gh_org = "lief-project"
gh_repo = "LIEF"

project = 'LIEF'
html_title = "LIEF Documentation"
Expand Down Expand Up @@ -102,26 +99,29 @@

# -- Options for HTML output ----------------------------------------------
def commit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
commit_link = nodes.reference(
"", text[:7], refuri="https://github.com/lief-project/LIEF/commit/{}".format(text), **options)
commit_link = nodes.reference("", text[:7],
refuri=f"https://github.com/{gh_org}/{gh_repo}/commit/{text}",
**options)

return [commit_link], []

def pr_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
pr_link = nodes.reference(
"", '#' + text, refuri="https://github.com/lief-project/LIEF/pull/{}".format(text), **options)
pr_link = nodes.reference("", '#' + text,
refuri=f"https://github.com/{gh_org}/{gh_repo}/pull/{text}",
**options)

return [pr_link], []

def issue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
issue_link = nodes.reference(
"", '#' + text, refuri="https://github.com/lief-project/LIEF/issues/{}".format(text), **options)
issue_link = nodes.reference("", '#' + text,
refuri=f"https://github.com/{gh_org}/{gh_repo}/issues/{text}",
**options)

return [issue_link], []

def github_user(name, rawtext, text, lineno, inliner, options={}, content=[]):
issue_link = nodes.reference(
"", text, refuri="https://github.com/{}".format(text), **options)
issue_link = nodes.reference("", text, refuri=f"https://github.com/{text}",
**options)

return [issue_link], []

Expand Down Expand Up @@ -175,7 +175,7 @@ def process_property(name: str, obj, options, signature: str,

return "()", return_annotation
except Exception:
logger.warn(f"Error with {name}: {lines[0]}")
logger.warning(f"Error with {name}: {lines[0]}")

return signature, return_annotation

Expand Down Expand Up @@ -286,6 +286,7 @@ def setup(app):
html_theme_options = {
"commit": commit,
"base_url": f"{base_url}/",
"sponsor_link": "https://github.com/sponsors/lief-project/",
"repo_url": "https://github.com/lief-project/LIEF/",
"repo_name": "LIEF",
"html_minify": True,
Expand All @@ -300,22 +301,26 @@ def setup(app):
{
"href": html_base_url,
"internal": False,
"title": "Home"
"title": "Home",
"icon": "fa-solid fa-house"
},
{
"href": f"{html_base_url}/blog",
"internal": False,
"title": "Blog"
"title": "Blog",
"icon": "fa-solid fa-rss"
},
{
"href": f"{html_base_url}/download",
"internal": False,
"title": "Download"
"title": "Download",
"icon": "fa-solid fa-download",
},
{
"href": "index",
"internal": True,
"title": "Documentation",
"icon": "fa-solid fa-book",
"subnav": [
{
"title": "Doxygen",
Expand All @@ -327,6 +332,7 @@ def setup(app):
"href": f"{html_base_url}/about",
"internal": False,
"title": "About",
"icon": "fa-solid fa-bars-staggered"
},
],
"table_classes": ["plain"],
Expand All @@ -341,4 +347,3 @@ def setup(app):
html_static_path = ['_static']

htmlhelp_basename = 'LIEFdoc'

0 comments on commit 5b8ef83

Please sign in to comment.