Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a gallery #472

Merged
merged 1 commit into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jupyter_book/book_template/_data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@

- url: /contributing
not_numbered: true

- title: Example Book Gallery
url: /features/gallery
not_numbered: true

- divider: true
- header: Demo textbook
Expand Down
13 changes: 13 additions & 0 deletions jupyter_book/book_template/content/data/gallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- name: Geographic Data Science with Python
url: https://geographicdata.science/book/notebooks/04_spatial_weights.html
logo_url: https://geographicdata.science/book/images/logo/logo.png
- name: AWS Certified Machine Learning-Specialty (ML-S) Guide
url: https://noahgift.github.io/aws-ml-guide/intro
logo_url: https://noahgift.github.io/aws-ml-guide/images/logo.png
- name: Inferential Thinking textbook
url: https://inferentialthinking.com
logo_url: https://www.inferentialthinking.com/favicon.png
- name: Qiskit Textbook
url: https://qiskit.org/textbook/ch-gates/quantum-gates.html
logo_url: https://qiskit.org/textbook/images/logo/logo.png

162 changes: 162 additions & 0 deletions jupyter_book/book_template/content/features/gallery.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A gallery of Jupyter Books\n",
"\n",
"Below is small gallery of Jupyter Books in the wild. They have been semi-randomly selected\n",
"from [the list of GitHub projects that depend on Jupyter Book](https://github.com/jupyter/jupyter-book/network/dependents?package_id=UGFja2FnZS0zMjg0ODMyNzQ%3D).\n",
"\n",
"If you'd like to add your book to the list, you may submit a pull request adding\n",
"your book's information to [this YAML file of demo example books](https://github.com/jupyter/jupyter-book/blob/master/jupyter_book/book_template/content/data/gallery.yml)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": [
"remove_input"
]
},
"outputs": [],
"source": [
"from ruamel.yaml import YAML\n",
"import pandas as pd\n",
"from pathlib import Path\n",
"import numpy as np\n",
"yaml = YAML()\n",
"gallery = Path('../data/gallery.yml')\n",
"gallery = pd.DataFrame(yaml.load(gallery))\n",
"\n",
"html = ['<table class=\"gallery\">']\n",
"n_per_row = 3\n",
"for ii in range(int(np.ceil(gallery.shape[0] / n_per_row))):\n",
" row_items = gallery.iloc[ii * n_per_row: ii * n_per_row + n_per_row]\n",
" html.append('<tr>')\n",
" for ii, (row, vals) in enumerate(row_items.iterrows()):\n",
" item_html = f\"\"\"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href={vals['url']}>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='{vals['logo_url']}' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>{vals['name']}</p>\n",
" </a>\n",
" </td>\"\"\"\n",
" html.append(item_html)\n",
" html.append('</tr>')\n",
"html.append('</table>')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"tags": [
"remove_input"
]
},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"gallery\">\n",
"<tr>\n",
"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href=https://geographicdata.science/book/notebooks/04_spatial_weights.html>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='https://geographicdata.science/book/images/logo/logo.png' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>Geographic Data Science with Python</p>\n",
" </a>\n",
" </td>\n",
"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href=http://pysal.org/notebooks/intro.html>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='http://pysal.org/notebooks/assets/images/logo.png' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>PySAL Notebooks Project</p>\n",
" </a>\n",
" </td>\n",
"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href=https://noahgift.github.io/aws-ml-guide/intro>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='https://noahgift.github.io/aws-ml-guide/images/logo.png' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>AWS Certified Machine Learning-Specialty (ML-S) Guide</p>\n",
" </a>\n",
" </td>\n",
"</tr>\n",
"<tr>\n",
"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href=https://inferentialthinking.com>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='https://www.inferentialthinking.com/favicon.png' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>Inferential Thinking textbook</p>\n",
" </a>\n",
" </td>\n",
"\n",
" <td class='gallery-item' style='text-align: center; width:220px; position: block; padding: 10px'>\n",
" <a href=https://qiskit.org/textbook/ch-gates/quantum-gates.html>\n",
" <img style='height: 180px; max-width:200px; margin: 0px auto' src='https://qiskit.org/textbook/images/logo/logo.png' />\n",
" <br />\n",
" <p style='font-size: 1.2em; text-align: center'>Qiskit Textbook</p>\n",
" </a>\n",
" </td>\n",
"</tr>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import HTML\n",
"HTML('\\n'.join(html))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}