jckantor / nbpages

Command line tool to maintain a repository of Jupyter notebooks.
https://jckantor.github.io/nbpages/
MIT License
1 stars 4 forks source link

Special processing for tag under-construction #28

Open adowling2 opened 4 years ago

adowling2 commented 4 years ago

Proposal: With a special command-line option, if nbpages finds a header cell with the tag under-construction, it will strip out replace all of the subsequent non-header cells that under it with custom text. We can make the default "This notebook section is under construction". Check again soon."

Example with three markdown cells:

## Some time here

blah A blah A blab A 
### Subtle point 1

blah B blah B blah B
### Subtle point 2

blah C blah C blah C

If I tagged the first cell with under-construction, then the contents "blah B blah B, blah B" and "blah C blah C, blah C" would get replaced with "This notebook section is under construction".

Why is this helpful? I want to start migrating old class notebooks but I do not want to make the contents, besides the header structure, public. Some notebooks require a major text or example rewrite. I'd prefer to get everything online and "under construction" then systematically clean notebooks up one section at a time.

jckantor commented 4 years ago

Interesting idea. Would be enough to do the following ...

Maybe that's saying same thing you intended, just trying to be sure I understand.

adowling2 commented 4 years ago

Yes, that would work. We should also keep the under-construction tag.

jckantor commented 4 years ago

Looking into this. Trickier than it might seem. In this case, the under-construction removal requires access to the nbpages "level" metadata that is inserted when the sections are numbered. Removing the under-construction items amounts to rewriting the notebooks after numbering and adding metadata.

The problem is that I've assumed there is no rewriting of the notebooks during nbpages processing. Based on that assumption, the various indices are constructed just once and cached for reuse. So the indices would would have out-of-date information unless there is a lot of care about order of operations.

I'd suggest that a new class be created for handling indices, and then revisit this issue.