Merge pull request #18 from mabrains/fix_docs_warnings
Fixing warnings
diff --git a/docs/_static/extra.css b/docs/_static/extra.css
new file mode 100644
index 0000000..a122c80
--- /dev/null
+++ b/docs/_static/extra.css
@@ -0,0 +1,71 @@
+/* -*- coding: utf-8 -*-
+ Copyright 2022 Google LLC
+
+ 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
+
+ https://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.
+
+ SPDX-License-Identifier: Apache-2.0
+*/
+
+img.align-center {
+ display: block;
+}
+
+span.lib-process {
+ color: green;
+}
+
+span.lib-src {
+ color: purple;
+}
+
+span.lib-type {
+ color: orange;
+}
+
+span.lib-name {
+ color: blue;
+}
+
+span.drc-rule {
+ font-family: monospace;
+ white-space: pre;
+ display: inline-block;
+}
+
+span.drc-tag {
+ font-family: monospace;
+ white-space: pre;
+ display: inline-block;
+}
+
+span.drc-flag {
+ font-family: monospace;
+ white-space: pre;
+ display: inline-block;
+}
+
+span.layer {
+ font-family: monospace;
+ white-space: pre;
+ display: inline-block;
+}
+
+.page-content table thead th {
+ position: sticky !important;
+ top: 0;
+ z-index: 2;
+ background-color: #fff;
+ box-shadow: 0 1px 1px -1px rgba(0, 0, 0, 0.4);
+}
+
+
diff --git a/docs/conf.py b/docs/conf.py
index 6068bbb..35a232f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -31,8 +31,8 @@
import docutils
import os
import re
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
+import sys
+sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
@@ -59,6 +59,7 @@
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
+ 'sphinx_pdk_roles'
]
# Add any paths that contain templates here, relative to this directory.
diff --git a/docs/sphinx_pdk_roles.py b/docs/sphinx_pdk_roles.py
new file mode 100644
index 0000000..a5e56cc
--- /dev/null
+++ b/docs/sphinx_pdk_roles.py
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 Google LLC
+#
+# 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
+#
+# https://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.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+from docutils.parsers.rst import directives, roles, nodes
+import re
+
+LIB_REGEX = re.compile('gf180mcu_(?P<lib_src>[^_\s]*)_(?P<lib_type>[^_\s]*)(_(?P<lib_name>[^_\s]*))?')
+CELL_REGEX = re.compile('gf180mcu_(?P<lib_src>[^_\s]*)_(?P<lib_type>[^_\s]*)(_(?P<lib_name>[^_\s]*))?__(?P<cell_name>[^\s]*)')
+
+def lib_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ """Library name which gets colorized."""
+ m = LIB_REGEX.match(text)
+ if not m:
+ msg = inliner.reporter.error("Malformed library name of "+repr(text), line=lineno)
+ prb = inliner.problematic(rawtext, rawtext, msg)
+ return [prb], [msg]
+ app = inliner.document.settings.env.app
+
+ lib_process = 'gf180mcu'
+ lib_src = m.group('lib_src')
+ lib_type = m.group('lib_type')
+ lib_name = m.group('lib_name')
+
+ r = [
+ nodes.inline(lib_process, lib_process, classes=['lib-process']),
+ nodes.inline('_', '_', options=options),
+ nodes.inline(lib_src, lib_src, classes=['lib-src']),
+ nodes.inline('_', '_', options=options),
+ nodes.inline(lib_type, lib_type, classes=['lib-type']),
+ ]
+ if lib_name:
+ r.append(nodes.inline('_', '_', options=options))
+ r.append(nodes.inline(lib_name, lib_name, classes=['lib-name']))
+
+ return r, []
+
+
+def cell_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
+ """Cell name which gets colorized."""
+ m = CELL_REGEX.match(text)
+ if not m:
+ msg = inliner.reporter.error("Malformed cell name of "+repr(text), line=lineno)
+ prb = inliner.problematic(rawtext, rawtext, msg)
+ return [prb], [msg]
+ app = inliner.document.settings.env.app
+
+ lib_process = 'gf180mcu'
+ lib_src = m.group('lib_src')
+ lib_type = m.group('lib_type')
+ lib_name = m.group('lib_name')
+ cell_name = m.group('cell_name')
+
+ r = [
+ nodes.inline(lib_process, lib_process, classes=['lib-process']),
+ nodes.inline('_', '_', options=options),
+ nodes.inline(lib_src, lib_src, classes=['lib-src']),
+ nodes.inline('_', '_', options=options),
+ nodes.inline(lib_type, lib_type, classes=['lib-type']),
+ ]
+ if lib_name:
+ r.append(nodes.inline('_', '_', options=options))
+ r.append(nodes.inline(lib_name, lib_name, classes=['lib-name']))
+ r.append(nodes.inline('__', '__', options=options))
+ r.append(nodes.inline(cell_name, cell_name, classes=['cell-name']))
+
+ return r, []
+
+
+def add_role(app, new_role_name):
+ options = {
+ 'class': directives.class_option(new_role_name),
+ }
+ role = roles.CustomRole(new_role_name, roles.generic_custom_role, options, "")
+ app.add_role(new_role_name, role)
+
+
+def setup(app):
+ app.add_css_file('extra.css')
+ add_role(app, 'cell_name')
+ add_role(app, 'lib_process')
+ add_role(app, 'lib_src')
+ add_role(app, 'lib_type')
+ add_role(app, 'lib_name')
+ add_role(app, 'drc_rule')
+ add_role(app, 'drc_tag')
+ add_role(app, 'drc_flag')
+ add_role(app, 'layer')
+
+ app.add_role('lib', lib_role)
+ app.add_role('cell', cell_role)
+ app.add_role('model', cell_role)
+
+ return {
+ "parallel_read_safe": True,
+ "parallel_write_safe": True,
+ }
+
diff --git a/docs/versioning.rst b/docs/versioning.rst
index 8d90ace..78504d5 100644
--- a/docs/versioning.rst
+++ b/docs/versioning.rst
@@ -1,3 +1,5 @@
+.. _Versioning:
+
Versioning Information
======================