Closed FelipeMaldonado closed 4 years ago
@FelipeMaldonado thanks for this PR.
Can you document the usage for enabling local
folders? Is it possible to keep a global _static
folder if jupyter_static_folder=False
?
@mmcky I fixed a few things (I'll update the PR), and actually we don't need to set jupyter_static_folder=False
to have the former structure (with the global _static).
The only modification that needs to be done, is to include the name of the folders that you want to convert to a jupyter notebook in the conf.py
in the following way folders = ["lecture1", "lecture2",..., "lecturen"]
If folders is empty you will have the same structure that is currently implemented.
@FelipeMaldonado is there no way to mirror the folder structure of the RST? It would be nice not to have to specify folders. My thinking on this is that we would assume the links in the RST are valid (that people specify) and mirror the local folder structure -- not putting everything in a global static, but keeping local folders that could be named img
etc.
@mmcky probably the answer is yes, but I'm still not sure how to do it. I'll let you know if I find the way to do it.
If there is no selective file copy going on at the sphinx
level, @FelipeMaldonado I think the easiest strategy here would be to compile a list of images
, downloads
etc. when visiting each node type and generating a list of references. I have done this for images in PR #116 as self.images
which we could then pass to a copy_assets
function that walks the list and copies assets across accordingly. This would be enabled via a global option jupyter_nonglobal_static = True
. If False
it would follow jupyter_static_path
.
@FelipeMaldonado haven;t had time to review this yet -- but I will.
@FelipeMaldonado I think it would be better to have jupyter_global_static = True
(default) and False
would follow the source folder structure. Don't like double negatives (I find it confusing) - I know it came from my comment :)
@FelipeMaldonado is this the global option to switch the behaviour on/off?
app.add_config_value("jupyter_static_folder", True, "jupyter")
@FelipeMaldonado is this the global option to switch the behaviour on/off?
app.add_config_value("jupyter_static_folder", True, "jupyter")
@mmcky actually, now that I notice, that option is not doing anything, and it can be deleted from both the conf.py
and __init__.py
. Not sure if it's necessary the on/off option, since, with this implementation, if there's no subfolders, then it will remain exactly as it is now (a unique global _static folder), and if there is any subfolder, then there will be both global and local static folders.
@FelipeMaldonado as discussed earlier today - I think we need a more general solution to dependent files that are located in sub-directories. The current implementation requires _static
folders to be used. It might be nice to allow different directory structures (otherwise we would need to document this behaviour). Anther limitation here is that this doesn't allow for nested directories.
The other approach is to generate a list of used dependencies during the writer
stage which would then propagate files that are used by the RST and automatically mirror the sub-directory structure.
The other approach is to generate a list of used dependencies during the
writer
stage which would then propagate files that are used by the RST and automatically mirror the sub-directory structure.
Agree, that's the approach I'm taking now. I'll keep you updated.
hey @FelipeMaldonado I will review this PR once the tests are in place. Thanks for getting this working!
hey @FelipeMaldonado I will review this PR once the tests are in place. Thanks for getting this working!
@mmcky The solution has some issues with nested subfolders, I'm trying to fix that before including the tests, I'll let you know when it's ready.
@AakashGfude can we review this issue together sometime and see if we can merge it for subfolder support of _static
assets.
@AakashGfude let's review this tomorrow when we meet up in the lab. If its a quick review we can update and merge -- otherwise I will put against 0.6
the extension is undergoing a significant re-write. Closing this PR. New implementations of static folder structure is in work.
This PR tries to answer the Issue #68 , where we replicate the subfolder structure of the .rst files into the notebooks, so each notebook has its own _static subfolder, instead of a unique one as the current state of the extension.
The key step was modifying the conf.py including the whole path of each static folder. I believe that a similar approach can be taken to solve Issue #116 .