QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
77 stars 23 forks source link

ENH: add next and prev metadata #317

Open mmcky opened 4 years ago

mmcky commented 4 years ago

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

jstac commented 4 years ago

Something to work on while @DrDrij is here?

mmcky commented 4 years ago

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)
DrDrij commented 4 years ago

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

mmcky commented 4 years ago

@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.

DrDrij commented 4 years ago

I can work with that :)

mmcky commented 4 years ago

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 commented 4 years ago

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"
 },
DrDrij commented 4 years ago

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