Conversation
What works: template-generated paths (css, js, navbar, etc.)
What doesnt: pretty much all rest, including
rst-generated urls, breadcrumb, pages hierarchy
Codecov Report
@@ Coverage Diff @@
## master #163 +/- ##
==========================================
- Coverage 98.25% 98.22% -0.03%
==========================================
Files 27 27
Lines 6647 6716 +69
Branches 44 44
==========================================
+ Hits 6531 6597 +66
- Misses 116 119 +3
Continue to review full report at Codecov.
|
The only change is path with '/' first searched in name_map, if not found return as is
| output += self.suffix_length_struct.pack(e.suffix_length) | ||
| output += e.name.encode('utf-8') | ||
| if e.url: | ||
| if e.name and e.url: |
There was a problem hiding this comment.
This change made to match above lines (250-251):
if e.name and e.url:
offset += len(e.url.encode('utf-8')) + 1Could be it should be turned around.
| _url_formatter = None | ||
| _external_data = set() | ||
| # A helper function to work-around for stateless Docutils transforms | ||
| def get_image_extracter(source, external_data:set, config): |
There was a problem hiding this comment.
Every function call generates new class with captured function parameters, a work-around stateless transform limitation.
Not perfect, but probably not a big overhead in python realm.
I've mocked this usage pattern to measure memory footprint. It turned out that python is able to garbage collect most of unused classes as long as they are not referenced from elsewhere.
Here is test and measurement result: https://gist.github.com/sizmailov/93cb521557dd64019598554626defe23
Note: rightmost column can be turned to zeros via extra gc.collect() call
| image_abs_path = os.path.realpath(os.path.join(os.path.dirname(source), image['uri'])) | ||
| # Use relative path if image within INPUT directory, otherwise absolute | ||
| if image_abs_path.startswith(input_path): | ||
| image_path = os.path.relpath(image_abs_path, input_path) |
There was a problem hiding this comment.
This always returns relative path to INPUT directory, will be patched later by PatchReferences
This PR adds basic support for nested pages for
python.py.Changes:
default_url_formatter-generated.htmltree structure mirrors input.rstlayout../*prefix prepended to references and image sources in nested pages (both.rst-generated code and in templates)I use relative paths because it would make possible to place C++ and Python API on same domain.
TODO:
Show nested structure inpagesCopy images with relative paths to avoid clashesAvoid clearing jinja cacheSearch results