-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to superimpose labels on wells
This commit also adds some infrastructure to help with customizing the appearance of layouts: - The `extras` and `report_dependencies` arguments to `load()` are deprecated, and replaced by the new `meta` argument. - Style objects can be specified in TOML files, in new [meta.style] and [meta.param_styles] tables. - The `Style` class was rewritten to give it the ability to check for errors, and to merge styles. Fixes #24
- Loading branch information
1 parent
35539f6
commit cca214e
Showing
35 changed files
with
2,351 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Show subsections in the navigation bar of the File Format document. | ||
// | ||
// It's helpful to understand how the navigation bar styling is supposed to | ||
// work, to see why it doesn't normally show subsections. Here are the | ||
// steps: | ||
// | ||
// - Sphinx RTD theme only includes in the navigation bar links that have a | ||
// parent of class `.current`. The HTML for any other links is present, | ||
// but hidden. | ||
// | ||
// - Sphinx add the `.current` class to links that point to the current page. | ||
// All ancestors of a "current" link are also given the `.current` class. | ||
// The idea is that themes might want to apply a unique style to the links | ||
// leading up to the current page. Importantly, links that point within | ||
// the current page, not to the page as a whole (i.e. sections and | ||
// subsections), are not considered current. | ||
// | ||
// - Ultimately, this all means that only top-level sections are included in | ||
// the navigation bar. | ||
// | ||
// I initially tried taking an approach where I manually added the `.current` | ||
// class to the necessary elements to get the subsection links to appear. | ||
// The upside was that I didn't have to hard-code the padding, but the | ||
// downside was the font weight and background color were also (undesireably) | ||
// affected. I decided that it was easier to just apply the specific styles | ||
// I wanted. | ||
// | ||
// It might be possible to avoid the hard-coding by querying the style sheets | ||
// somehow, e.g. `document.styleSheets`. But this seemed like to much effort | ||
// for something that could break in many other ways anyways. | ||
|
||
document.addEventListener("DOMContentLoaded", function(){ | ||
subsection_docs = [ | ||
'file_format.html', | ||
'basic_usage_python.html', | ||
'basic_usage_r.html', | ||
] | ||
is_subsection_doc = subsection_docs.some( | ||
(p) => window.location.pathname.endsWith(p) | ||
) | ||
if(! is_subsection_doc) { | ||
return | ||
} | ||
|
||
ul = document.querySelectorAll('.toctree-l2 > ul'); | ||
for(var i = 0; i < ul.length; i++) { | ||
ul[i].style.display = 'block'; | ||
|
||
a = ul[i].querySelectorAll('.toctree-l3 > a'); | ||
for(var j = 0; j < a.length; j++) { | ||
// The padding come from the following selector (note the `.current`): | ||
// `.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a` | ||
a[j].style.padding = '.4045em 1.618em .4045em 4.045em' | ||
} | ||
} | ||
}); | ||
|
||
// Don't show subsections in the Python API docs. | ||
// | ||
// This is really a hacky work-around to an missing feature in autodoc. | ||
// Directives like `.. function::` have the `:no-contents-entry:` option to | ||
// prevent them from appearing in the TOC, but `.. autofunction::` doesn't | ||
// expose this. So the only alternative I can think of is to hide these links | ||
// after the fact. | ||
|
||
document.addEventListener("DOMContentLoaded", function(){ | ||
api_pattern = /api\/wellmap.*html$/ | ||
|
||
if (! window.location.pathname.match(api_pattern)) { | ||
return | ||
} | ||
|
||
ul = document.querySelector('.toctree-l2.current > ul'); | ||
ul.style.display = 'none'; | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{ fullname | escape | underline}} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
|
||
{% block methods %} | ||
{% if methods %} | ||
.. rubric:: {{ _('Methods') }} | ||
|
||
.. autosummary:: | ||
{% for item in methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block attributes %} | ||
{% if attributes %} | ||
.. rubric:: {{ _('Attributes') }} | ||
|
||
.. autosummary:: | ||
{% for item in attributes %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
************ | ||
Deprecations | ||
************ | ||
|
||
This pages lists features that have been slated for removal from wellmap. The | ||
goal is to briefly explain the reason for removing each feature, and to show | ||
how to update old code at a glance. | ||
|
||
A `DeprecationWarning` is issued when any of these features is used. However, | ||
be aware that python makes an effort to only show such warnings to "developers" | ||
and not to "users". See :pep:`565` for details. | ||
|
||
From the first release where a feature is deprecated, the deprecated behavior | ||
is guaranteed to remain available for at least two years. The feature will be | ||
removed in the next major release after that. | ||
|
||
.. _load-extras-deps: | ||
|
||
The *extras* and *report_dependencies* arguments to `wellmap.load()` | ||
==================================================================== | ||
Both of these arguments request that the `load()` function return additional | ||
information about the layout file. It seems likely that more and more similar | ||
arguments will be added over time, so to avoid having to keep changing the | ||
signature of `load()`, these arguments were consolidated into a single | ||
:class:`~wellmap.Meta` object. See :issue:`38` for more information. | ||
|
||
Old syntax (available until at least November 2025): | ||
|
||
.. code:: | ||
df, extras, deps = wellmap.load( | ||
'path/to/layout.toml', | ||
extras=True, | ||
report_dependencies=True, | ||
) | ||
New syntax (available since version 3.5): | ||
|
||
.. code:: | ||
df, meta = wellmap.load('path/to/layout.toml', meta=True) | ||
extras = meta.extras | ||
deps = meta.dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.