sphinxcontrib-jupyter icon indicating copy to clipboard operation
sphinxcontrib-jupyter copied to clipboard

ENH: add next and prev metadata

Open mmcky opened this issue 4 years ago • 8 comments

Currently we don't pass next and prev document metadata. This is something used a lot in core sphinx themes.

mmcky avatar Feb 18 '20 22:02 mmcky

Something to work on while @DrDrij is here?

jstac avatar Feb 18 '20 23:02 jstac

hey @DrDrij I think we can fix this pretty easily on the sphincontrib-jupyter side.

Can you let me know what you need as the metadata format

nb.metadata.next = (link, title-text)
nb.metadata.previous = (link, title-text)

mmcky avatar Jun 09 '20 23:06 mmcky

@mmcky That looks perfect. Access to title and link is all I need.

DrDrij avatar Jun 10 '20 00:06 DrDrij

@DrDrij can I give you the following meta data sample?

 "metadata": {
  "date": 1591752665.62833,
  "filename": "about_py.rst",
  "kernelspec": {
   "display_name": "Python",
   "language": "python3",
   "name": "python3"
  },
  "next_doc": {
   "link": "getting_started",
   "title": "Setting up Your Python Environment"
  },
  "prev_doc": {
   "link": "index_learning_python",
   "title": "Introduction to Python"
  },
  "title": "About Python"
 },

this should be:

  1. relative uri (without the html postfix added)
  2. title of that document

it will be convenient to not have html hard coded in case we need to reference an ipynb later on etc.

mmcky avatar Jun 10 '20 01:06 mmcky

I can work with that :)

DrDrij avatar Jun 10 '20 01:06 DrDrij

last question - if there is no previous or next document would you rather

missing metadata (i.e. no previous_doc as a key in the notebook metadata) OR some value to indicate not applicable

mmcky avatar Jun 10 '20 01:06 mmcky

the current index metadata is

 "metadata": {
  "date": 1591753649.837961,
  "filename": "index.rst",
  "kernelspec": {
   "display_name": "Python",
   "language": "python3",
   "name": "python3"
  },
  "next_doc": {
   "link": "index_toc",
   "title": "Table of Contents"
  },
  "title": "Python Programming for Economics and Finance"
 },

mmcky avatar Jun 10 '20 01:06 mmcky

That works @mmcky - I will enter an if clause to check whether prev/next exist.

DrDrij avatar Jun 10 '20 02:06 DrDrij