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

the notebook: a table of cell forms #49

Merged
merged 44 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
aaee258
update the authoring checklist with structural changes
tonyfast Mar 15, 2023
2a1e0dc
update details>summaries
tonyfast Mar 15, 2023
a356970
add docstrings
tonyfast Mar 27, 2023
554deb6
update deps
tonyfast Mar 27, 2023
01fc370
new form exproter script
tonyfast Mar 27, 2023
ed096fd
add content for the sematnic forms. lets fight some ci now
tonyfast Mar 27, 2023
3c9f901
update cis and add configuration for docs
tonyfast Mar 27, 2023
4a852c6
remove a file
tonyfast Mar 27, 2023
a36a4f5
push mods
tonyfast Mar 27, 2023
7e64a22
pretty clean on the equal access checker
tonyfast Mar 28, 2023
76578d9
generate a table of contents in a disclosure
tonyfast Mar 28, 2023
21460ca
more toc work
tonyfast Mar 28, 2023
598f955
add metadata dialogs and shuffle elements to their approrpiate places
tonyfast Mar 28, 2023
774eb0f
extract compoenents to separate file
tonyfast Mar 31, 2023
7deadfd
switch to table because it reads better
tonyfast Mar 31, 2023
0317ba4
all the javascript is gone! how cool is that. still got bootstrap css.
tonyfast Apr 1, 2023
8fa8c6f
update the toc navigation
tonyfast Apr 3, 2023
1c2e14b
add js
tonyfast Apr 3, 2023
733ed69
make the textarea visually hidden and include outputs in page history…
tonyfast Apr 3, 2023
d1a7f53
move script to the end
tonyfast Apr 3, 2023
2bd8af8
more bad ideas on the cutting room floor
tonyfast Apr 4, 2023
e1187bc
move cell id to tbody for better focus
tonyfast Apr 4, 2023
c2ff8fc
nav id
tonyfast Apr 4, 2023
46d028e
use a different cdn
tonyfast Apr 4, 2023
df8b18f
use rowindex aria instead of posinset
tonyfast Apr 5, 2023
3a8abc5
aria and tag housekeeping
tonyfast Apr 5, 2023
1d2fe4c
add doctype and placeholder meta tags
tonyfast Apr 5, 2023
9e817ae
make the template conform closer to nbconvert specifications and use …
tonyfast Apr 5, 2023
1517614
use output tags
tonyfast Apr 5, 2023
a290a93
sensible aria labels
tonyfast Apr 5, 2023
061cfda
this changes uses javascrupt to build the doc and anchors. it removes…
tonyfast Apr 5, 2023
d94fbe9
need this post fixing function for now
tonyfast Apr 5, 2023
026c910
table of contents updates by js
tonyfast Apr 5, 2023
417cca0
attach id to heading
tonyfast Apr 5, 2023
d2ac24d
support light mode, colorbind pygments, dyslexic font
tonyfast Apr 6, 2023
0f09b38
configure semantic table pygments
tonyfast Apr 6, 2023
3b04b65
add a readme to describe what is going on here.
tonyfast Apr 6, 2023
fd94ff6
add template description to the documentation
tonyfast Apr 6, 2023
41889f1
merge changes
tonyfast Apr 6, 2023
dbacc4e
readme
tonyfast Apr 6, 2023
c493a07
update displays tempalte
tonyfast Apr 7, 2023
36d05b5
rename the nbconvert exports
tonyfast Apr 7, 2023
e1812db
update configurations and entry points
tonyfast Apr 7, 2023
89e1a50
configure set up and test
tonyfast Apr 7, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
strategy:
matrix:
python-version:
- 3.9
- "3.10"
runs-on: ubuntu-latest
steps:
- name: fetch all history and tags
Expand Down
10 changes: 7 additions & 3 deletions dodo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from curses.ascii import US
from shutil import copytree, move, copyfile
from doit import create_after, task_params
from pathlib import Path
from functools import partial
import warnings

from sys import executable
HERE = Path(__file__).parent

DOCS = Path("docs")
Expand All @@ -17,6 +16,11 @@
AUDITS = EXPORTS / "audits"
REPORTS = EXPORTS / "reports"

def do(cmd, *args):
from doit.cmd_base import CmdAction
from shlex import split
return CmdAction(split(cmd) + list(args), shell=False)

def cp(x , y):
x, y = map(Path, (x, y))
if x.is_dir():
Expand Down Expand Up @@ -209,7 +213,7 @@ def readme(target):
yield dict(
name=str(name),
actions=[
f"jupyter nbconvert --config {c} --output {name} --output-dir {target} {nb}"
do(f"{executable} -m jupyter nbconvert --config {c} --output {name} --output-dir {target} {nb}")
],
file_dep=[nb, c],
targets=[t],
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ nav:
- exports/reports/notebooks.md
- exports/reports/configs.md
- nbconvert_html5 module:
- DEVELOPER.md
- nbconvert_html5.md

hooks:
- hooks.py
Expand Down
16 changes: 15 additions & 1 deletion nbconvert_html5/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
from .exporters import Html5
"""nbconvert_soup organically added tooling to the nbconvert library.

nbconvert is a community convention for converting ipynb files to
other formats like html, pdf, epub, tex. the goal of this work is to
test accessibility remediations made to the html version of notebooks.
nbconvert suits our needs, and it is well integrated into the jupyter command line for reuse.

we found that nbconvert's configuration system was valuable for recording
the state of manual testing sessions.

we called this library `nbconvert_html5` because we hope discover html5 patterns
that offer a POUR notebook reading experience for assistive tech.
"""

from .form_exporter import FormExporter as Html5
2 changes: 1 addition & 1 deletion nbconvert_html5/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def test_axe_one(file: Path, browser=None, **config):
config.setdefault("runOnly", ["best-practice", "wcag22aa", "wcag2aaa"])
config.setdefault("allowedOrigins", ["<same_origin>"])
logger.info(f"inject axe {page.url}")
await page.evaluate(requests.get("https://unpkg.com/axe-core").text)
await page.evaluate(requests.get("https://cdn.jsdelivr.net/npm/axe-core").text)
logger.info(f"running axe tests {page.url}")
try:
return await page.evaluate(f"window.axe.run(window.document, {dumps(config)})")
Expand Down
37 changes: 18 additions & 19 deletions nbconvert_html5/exporters.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""nbconvert exporters towards accessible notebook html"""

import os
import os.path
from pathlib import Path
Expand All @@ -13,7 +15,8 @@
PROMPT_RE = compile("(In|Out)(\s|&nbsp;){0,1}\[(?P<n>[0-9]+)\]")


def soupify(body):
def soupify(body: str) -> BeautifulSoup:
"""convert a string of html to an beautiful soup object"""
return BeautifulSoup(body, features="html.parser")


Expand All @@ -29,31 +32,23 @@ class PostProcessExporter(HTMLExporter):
def post_process_code_cell(self, cell):
pass
A/B testing with out requiring `nbconvert` or notebook knowleldge."""

export_from_notebook = "html5"
enabled = True
extra_template_paths = List([(DIR / "templates").absolute().__str__()])
post_processor = Callable(lambda x: x).tag(config=True)

def code_set_cell_label(self, cell, label=None):
pass

def post_process_cell(self, cell):
pass

def post_process_markdown_cell(self, cell):
pass

def post_process_code_cell(self, cell):
pass

# def _template_file_default(self):
# return "html5-lab.j2"


from traitlets import Bool, CUnicode


class Html5(PostProcessExporter):
class Html5Test(PostProcessExporter):
"""the primary exporter produced by notebooks for all

this class has a lot of flags that we designed to test.
the naming occurred organically as the project progressed.
we try to limit the degrees of freedom of each trait
so that the configuration changes are minimal.
"""

def from_notebook_node(self, nb, **kw):
result, meta = super().from_notebook_node(nb, **kw)
result = self.post_process_html(result)
Expand Down Expand Up @@ -114,6 +109,9 @@ def from_notebook_node(self, nb, **kw):
scroll_to_top = Bool(False, help="include a scroll to top link").tag(config=True)

def post_process_head(self, soup):
"""post process the head of the document.

add custom css based on flags"""
script = soup.new_tag("style", type="text/css", rel="stylesheet")
script.string = ""
if self.increase_prompt_visibility:
Expand Down Expand Up @@ -292,3 +290,4 @@ def write_config(cls, dir=Path.cwd(), file="jupyter_nbconvert_config.py"):

print(f"writing config to {target}")
target.write_text(cls.generate_config())

Loading