2015-05 - 1/1 Blog automation (4) documentation (8) example (2) latex (2) notebook (4) sphinx (10)
2015-05 - 1/1¶
Convert a notebook into slides¶
2015-05-16
I thought it would be easy to convert a notebook into slides. I would just have to execute nbconvert. I went through two issues. The first one came from reveal.js. My first tries did not work. I decided to take the version included in the module sphinxjp.themes.revealjs and I also updated the output of nbconvert to remove external links as much as possible.
The second issue was that all my notebooks did not include any metadata
indicated to indicate whether or not a new slide or subslide should start.
So I create a simple function which does that on a notebook
add_tag_slide
.
It does not overwrite existing metadata but start new slides for every section
and new subslide if the current one becomes too long:
from pyquickhelper.ipythonhelper import read_nb
nb = read_nb("your notebook.ipynb")
nb.add_tag_slide()
nb.to_json("the modified notebook.ipynb")
It is too simple to be perfect, it is difficult to guess the size
of the rendering of some objects (images, javascript...).
You can check the results for this notebook:
example pyquickhelper.
That what the function nb2slides
is doing first and then converts it into slides:
from pyquickhelper import nb2slides
nb2slides(("your notebook.ipynb", "convert.slides.html")
Create a script to read this blog¶
2015-05-10
The module now includes a function
write_module_scripts
creates a script auto_rss_server.py which grabs the latest blog post
from this stream, runs a server and opens the default browser to read them.
It uses the module
pyrsslocal.
Here is the code to read this blog:
from pyquickhelper import write_module_scripts, __blog__
write_module_scripts("blog", blog_list=__blog__)
The blog list can be replaced by any other one. Here is its content:
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>blog</title>
</head>
<body>
<outline text="pyquickhelper"
title="pyquickhelper"
type="rss"
xmlUrl="http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/_downloads/rss.xml"
htmlUrl="http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/blog/main_0000.html" />
</body>
</opml>
Frequent commands and automation¶
2015-05-06
The script setup.py
accepts several options
such as install
or build
. It also accepts
unittest
to run the unit tests or build_sphinx
to build the documentation.
It usually requires to have a command line windows opened
as well as an editor to write programs.
On Windows, the module now produces a series of scripts
to automate tasks such as running the unit tests,
building the documentation. They are not included in the sources
anymore but the can be obtained by typing:
python setup.py build_script
The scripts can now be produced for every module using pyquickhelper to automate setup, unit tests and documentation.
2015-05 - 1/1 2015-04 (8) 2015-05 (4) 2015-08 (2) 2015-10 (1) 2015-12 (3) 2016-01 (1) 2016-02 (3) 2016-04 (1) 2016-06 (1)