Skip to content

Commit

Permalink
Merged: #81 from Jim Zwartveld; Feature: Intertext as per #82
Browse files Browse the repository at this point in the history
  • Loading branch information
connorferster committed Jun 4, 2021
1 parent f77a1db commit 114771b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 206 deletions.
3 changes: 1 addition & 2 deletions handcalcs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "1.3.0" #
__version__ = "1.4.0" #
from handcalcs.decorator import handcalc
# from handcalcs.install_templates import install_html, install_latex
__all__ = ["handcalc"]

6 changes: 3 additions & 3 deletions handcalcs/handcalcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,8 @@ def convert_param_to_long(line: ParameterLine):
return line


@convert_applicable_long_lines.register(ParameterLine)
def convert_param_to_long(line: ParameterLine):
@convert_applicable_long_lines.register(IntertextLine)
def convert_intertext_to_long(line: IntertextLine):
return line


Expand Down Expand Up @@ -1379,7 +1379,7 @@ def format_symbolic_line(line: SymbolicLine) -> SymbolicLine:
@format_lines.register(IntertextLine)
def format_intertext_line(line: IntertextLine) -> IntertextLine:
cleaned_line = line.line.replace("##", "")
line.latex = f"\\intertext{cleaned_line}\\\n"
line.latex = f"& \\textrm{{{cleaned_line}}}"
return line


Expand Down
124 changes: 0 additions & 124 deletions handcalcs/install_templates.py

This file was deleted.

6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ show_missing = true

[tool.poetry]
name = "handcalcs"
version = "1.3.0"
version = "1.4.0"
description = "Python calculations in Jupyter as though you wrote them by hand."
authors = ["Connor Ferster"]
license = "Apache-2.0"
Expand All @@ -29,13 +29,9 @@ innerscope = "^0.2.0"
[tool.poetry.dev-dependencies]
pytest-cov = "^2.9.0"
coverage = {extras = ["toml"], version = "^5.1"}
<<<<<<< HEAD
jupyterlab = "^3.0.0"
=======
jupyterlab = "^2.1.5"
nbconvert = "^6.0.0"
pdbpp = "^0.10.2"
>>>>>>> f6b78140879f6ed864f7a9befda98932d8260aa6
ipython = "^7.18.1"
sympy = "^1.6.2"
forallpeople = "^2.0.1"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
EMAIL = '[email protected]'
AUTHOR = 'Connor Ferster'
REQUIRES_PYTHON = '>=3.7.0'
VERSION = '1.3.0'
VERSION = '1.4.0'

# What packages are required for this module to be executed?
REQUIRED = [
'pyparsing',
'nbconvert>=6.0.0',
'innerscope >= 0.2.0',
'more-itertools >= 8.5.0'
'more-itertools >= 8.5.0',
'jupyterlab >= 3.0.0'
# 'requests', 'maya', 'records',
]

Expand Down
70 changes: 0 additions & 70 deletions test_handcalcs/test_handcalcs_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from handcalcs.handcalcs import ParameterLine, CalcLine, LongCalcLine, ConditionalLine
from handcalcs.handcalcs import ParameterCell, LongCalcCell, CalcCell
from handcalcs.decorator import handcalc
from handcalcs.install_templates import install_html, install_latex


# When writing a new test create a new "cell" .py file
Expand Down Expand Up @@ -281,88 +280,19 @@ def test_handcalcs3():


def test_latex_exporter():
"""
"""

exporter = LatexHideInputExporter()
assert exporter.exclude_input == True


def test_pdf_exporter():
"""
"""

exporter = PDFHideInputExporter()
assert exporter.exclude_input == True


def test_html_exporter():
"""
"""

exporter = HTMLHideInputExporter()
assert exporter.exclude_input == True


# def test_install_latex(capsys):
# HERE = pathlib.Path(__file__).resolve().parent
# TEMPLATES = HERE.parent / "handcalcs" / "templates"
# MAIN_TEMPLATE = TEMPLATES / "latex" / "t-makaro_classic_romanoutput_noinput.tplx"
# NBCONVERT_TEMPLATES_DIR = (
# pathlib.Path(nbconvert.__file__).resolve().parent / "templates" / "latex"
# )
#
# install_latex()
# captured = capsys.readouterr()
# assert (
# captured.out
# == "Available templates: \n ['t-makaro_classic_romanoutput_noinput.tplx']\n"
# )
# install_latex(swap_in="t-makaro_classic_romanoutput_noinput.tplx")
# assert filecmp.cmp(MAIN_TEMPLATE, NBCONVERT_TEMPLATES_DIR / "article.tplx")
#
#
# def test_install_latex_restore():
# HERE = pathlib.Path(__file__).resolve().parent
# TEMPLATES = HERE.parent / "handcalcs" / "templates"
# MAIN_TEMPLATE = TEMPLATES / "latex" / "t-makaro_classic_romanoutput_noinput.tplx"
# NBCONVERT_TEMPLATES_DIR = (
# pathlib.Path(nbconvert.__file__).resolve().parent / "templates" / "latex"
# )
#
# install_latex(restore=True)
# assert not filecmp.cmp(MAIN_TEMPLATE, NBCONVERT_TEMPLATES_DIR / "article.tplx")
#
#
# def test_install_html(capsys):
# HERE = pathlib.Path(__file__).resolve().parent
# TEMPLATES = HERE.parent / "handcalcs" / "templates"
# MAIN_TEMPLATE = TEMPLATES / "html" / "full_html_noinputs.tpl"
# NBCONVERT_TEMPLATES_DIR = (
# pathlib.Path(nbconvert.__file__).resolve().parent / "templates" / "html"
# )
#
# install_html()
# captured = capsys.readouterr()
# assert captured.out == "Available templates: \n ['full_html_noinputs.tpl']\n"
# install_html(swap_in="full_html_noinputs.tpl")
# assert filecmp.cmp(MAIN_TEMPLATE, NBCONVERT_TEMPLATES_DIR / "full.tpl")
#
#
# def test_install_html_restore():
# HERE = pathlib.Path(__file__).resolve().parent
# TEMPLATES = HERE.parent / "handcalcs" / "templates"
# MAIN_TEMPLATE = TEMPLATES / "html" / "full_html_noinputs.tpl"
# NBCONVERT_TEMPLATES_DIR = (
# pathlib.Path(nbconvert.__file__).resolve().parent / "templates" / "html"
# )
# install_html(restore=True)
# assert not filecmp.cmp(MAIN_TEMPLATE, NBCONVERT_TEMPLATES_DIR / "full.tpl")


# Test expected exceptions


Expand Down

0 comments on commit 114771b

Please sign in to comment.