-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from kirbs-/dev
v0.5.5
- Loading branch information
Showing
14 changed files
with
26,966 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
# Building 3.3 fails; | ||
# ImportError: Tornado requires an up-to-date SSL module. This means Python 2.7.9+ or 3.4+ (although some distributions | ||
# have backported the necessary changes to older versions). | ||
# - "3.3" | ||
- "3.4" | ||
- "3.5" | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
# does not have headers provided, please ask https://launchpad.net/~pypy/+archive/ppa | ||
# maintainers to fix their pypy-dev package. | ||
- "pypy" | ||
# - "pypy" | ||
# command to install dependencies | ||
install: | ||
# force six to install first as it's a dependicy of simplegeneric and simplegeneric is erroring. | ||
- pip install six | ||
- pip install jupyter | ||
- pip install pdfkit | ||
- pip install -e . | ||
- pip install . | ||
- sudo apt-get update | ||
- sudo apt-get install texlive-xetex xvfb libfontconfig wkhtmltopdf pandoc texlive-fonts-recommended texlive-generic-recommended texlive-latex-extra texlive-generic-extra lmodern | ||
|
||
# command to run tests | ||
script: | ||
- jupyter nbextension install --py hide_code --sys-prefix | ||
- jupyter nbextension enable --py hide_code --sys-prefix | ||
- jupyter serverextension enable --py hide_code --sys-prefix | ||
- jupyter nbconvert "$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')/hide_code/test/utf-8 test.ipynb" --to hide_code_slides | ||
# wkhtmltopdf has a bug in Ubuntu 16.04 apt package https://unix.stackexchange.com/questions/192642/wkhtmltopdf-qxcbconnection-could-not-connect-to-display | ||
# - jupyter nbconvert "$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')/hide_code/test/utf-8 test.ipynb" --to hide_code_pdf | ||
- jupyter nbconvert "$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')/hide_code/test/utf-8 test.ipynb" --to hide_code_html | ||
- jupyter nbconvert "$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')/hide_code/test/utf-8 test.ipynb" --to hide_code_latex | ||
- jupyter nbconvert "$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')/hide_code/test/utf-8 test.ipynb" --to hide_code_latexpdf | ||
# - jupyter nbextension install --py hide_code --sys-prefix | ||
# - jupyter nbextension enable --py hide_code --sys-prefix | ||
# - jupyter serverextension enable --py hide_code --sys-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"source": [ | ||
"## Hide_code: Jupyter code, input and output hiding\n", | ||
"\n", | ||
"To get started, select \"View\" -> \"Cell Toolbar\" -> \"Hide code\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Goodbye prompts\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print('Goodbye code')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Goodbye prompts\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print('Goodbye prompts')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"hideCode": false, | ||
"hideOutput": true, | ||
"hidePrompt": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Goodbye output\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print('Goodbye output')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"source": [ | ||
"Change cell toolbar to \"None\" to pretty up the notebook." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"source": [ | ||
"Tryout the [keyboard shortcuts](https://github.com/kirbs-/hide_code/wiki/Keyboard-Shortcuts).\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Try hiding code by kitting the W key in command mode (blue bar highlight on this cell).\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Try hiding code by kitting the W key in command mode (blue bar highlight on this cell).\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Unhide code with SHIFT + W.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Unhide code with SHIFT + W.\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"hideCode": false, | ||
"hidePrompt": false | ||
}, | ||
"source": [ | ||
"Try selecting the above two cells (SHIFT + click) and hiding/unhiding their code with the \"W\"/SHIFT + \"W\" keys.\n", | ||
"\n", | ||
"Want to hide everything or need to start over? Click on the '</>' icon above. This toggles hidind all code and inputs at once. \n", | ||
"\n", | ||
"When the notebook is formatted to your liking, click on the \"Hide Code\" menu bar to export into your desired format." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"celltoolbar": "Hide code", | ||
"hide_code_all_hidden": false, | ||
"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.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from .hide_code_html_exporter import HideCodeHTMLExporter | ||
from .hide_code_pdf_exporter import HideCodePDFExporter | ||
from .hide_code_preprocessor import HideCodePreprocessor | ||
from .hide_code_latex_exporter import HideCodeLatexExporter | ||
from .hide_code_slides_exporter import HideCodeSlidesExporter | ||
from .hide_code import * | ||
from .hide_code_config import HideCodeConfig | ||
from .utils import Utils | ||
from .hide_code import _jupyter_nbextension_paths, _jupyter_server_extension_paths | ||
from hide_code.hide_code_html_exporter import HideCodeHTMLExporter | ||
from hide_code.hide_code_pdf_exporter import HideCodePDFExporter | ||
from hide_code.hide_code_latexpdf_exporter import HideCodeLatexPDFExporter | ||
from hide_code.hide_code_preprocessor import HideCodePreprocessor | ||
from hide_code.hide_code_latex_exporter import HideCodeLatexExporter | ||
from hide_code.hide_code_slides_exporter import HideCodeSlidesExporter | ||
from hide_code.hide_code import * | ||
from hide_code.hide_code_config import HideCodeConfig | ||
from hide_code.utils import Utils | ||
from hide_code.hide_code import _jupyter_nbextension_paths, _jupyter_server_extension_paths |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
import os.path | ||
|
||
from traitlets.config import Config | ||
from nbconvert.exporters.pdf import PDFExporter | ||
from traitlets.log import get_logger | ||
|
||
|
||
class HideCodeLatexPDFExporter(PDFExporter): | ||
def __init__(self, config=None, **kw): | ||
# self.register_preprocessor('hide_code.HideCodePreprocessor', True) | ||
super(HideCodeLatexPDFExporter, self).__init__(config, **kw) | ||
self.preprocessors = ['hide_code.HideCodePreprocessor'] | ||
self._init_preprocessors() | ||
|
||
def _template_file_default(self): | ||
return 'hide_code_article' | ||
|
||
@property | ||
def template_path(self): | ||
""" | ||
We want to inherit from HTML template, and have template under | ||
`./templates/` so append it to the search path. (see next section) | ||
""" | ||
return super(HideCodeLatexPDFExporter, self).template_path + [os.path.join(os.path.dirname(__file__), "Templates")] |
Oops, something went wrong.