Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 3d05db8

Browse files
authored
Merge pull request #1220 from bjones1/wavedrom
Add: Files to support a wavedrom diagram.
2 parents 1a49e2d + d5abb50 commit 3d05db8

9 files changed

Lines changed: 499 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"jexcel": "^3.9.1",
3939
"jquery-ui": "1.10.4",
4040
"sql.js": "1.5.0",
41-
"vega-embed": "3.14.0"
41+
"vega-embed": "3.14.0",
42+
"wavedrom": "^2.0.0"
4243
}
4344
}

runestone/wavedrom/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .wavedrom import setup

runestone/wavedrom/js/wavedrom.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************
2+
// |docname| - JavaScript for the WaveDrom library
3+
// ***********************************************
4+
'use strict';
5+
6+
// This took a fair amount of experimenting to figure out how to make this work with NPM and Webpack. Sigh. Here's the working result.
7+
//
8+
// All we need is the ability to call the default export of ``ProcessAll`` in order to render timing diagrams.
9+
import ProcessAll from "wavedrom/lib/process-all.js";
10+
11+
// WaveSkin isn't defined globally, so import the default export to get access to it.
12+
import WaveSkin from "wavedrom/lib/wave-skin.js";
13+
// Make the required WaveSkin (needed by WaveDrom) available globally.
14+
window.WaveSkin = WaveSkin;
15+
16+
// Run the render after the dynamic load is done.
17+
$(document).on("runestone:login-complete", ProcessAll);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*************
2+
Wavedrom test
3+
*************
4+
5+
.. wavedrom::
6+
:caption: Two signals, PB1 (the pushbutton) and LED1, change over time.
7+
8+
signal: [
9+
{name: 'PB1', wave: '1.0..1..0..1..', node: '..a..b..c..d', phase: 0.5},
10+
{name: 'LED1', wave: '0.1.....0....', node: '..f.....g'},
11+
], edge: [
12+
'a~f', 'c~g',
13+
],

runestone/wavedrom/test/conf.py

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
# *************************************************************
2+
# |docname| - Sphinx configuration file for a Runestone project
3+
# *************************************************************
4+
#
5+
# Problem Solving with Algorithms and Data Structures documentation build configuration file, created by
6+
# sphinx-quickstart on Thu Oct 27 08:17:45 2011.
7+
#
8+
# This file is execfile()d with the current directory set to its containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
15+
16+
import sys, os
17+
18+
# If extensions (or modules to document with autodoc) are in another directory,
19+
# add these directories to sys.path here. If the directory is relative to the
20+
# documentation root, use os.path.abspath to make it absolute, like shown here.
21+
# sys.path.insert(0, os.path.abspath('../modules'))
22+
23+
from runestone import runestone_static_dirs, runestone_extensions, setup
24+
import pkg_resources
25+
26+
# -- General configuration -----------------------------------------------------
27+
28+
# If your documentation needs a minimal Sphinx version, state it here.
29+
# needs_sphinx = '1.0'
30+
31+
# Add any Sphinx extension module names here, as strings. They can be extensions
32+
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
33+
extensions = ["sphinx.ext.mathjax"] + runestone_extensions()
34+
35+
# ,'runestone.video','runestone.reveal','runestone.poll','runestone.tabbedStuff','runestone.disqus','runestone.codelens','runestone.activecode', 'runestone.assess', 'runestone.animation','runestone.meta', 'runestone.parsons', 'runestone.blockly', 'runestone.livecode','runestone.accessibility']
36+
37+
# This sets up your project to use the defaults. If you want to create a custom set of templates
38+
# for your own project you can over ride them by creating your own _templates folder
39+
templates_path = [
40+
pkg_resources.resource_filename("runestone", "common/project_template/_templates")
41+
]
42+
43+
# The suffix of source filenames.
44+
source_suffix = ".rst"
45+
46+
# The encoding of source files.
47+
# source_encoding = 'utf-8-sig'
48+
49+
# The master toctree document.
50+
master_doc = "index"
51+
52+
# General information about the project.
53+
project = "Runestone Interactive Overview"
54+
copyright = "2017 bjones"
55+
56+
# The version info for the project you're documenting, acts as replacement for
57+
# |version| and |release|, also used in various other places throughout the
58+
# built documents.
59+
#
60+
# The short X.Y version.
61+
version = "0.0.1"
62+
# The full version, including alpha/beta/rc tags.
63+
release = "0.0"
64+
65+
# The language for content autogenerated by Sphinx. Refer to documentation
66+
# for a list of supported languages.
67+
# language = None
68+
69+
# There are two options for replacing |today|: either, you set today to some
70+
# non-false value, then it is used:
71+
# today = ''
72+
# Else, today_fmt is used as the format for a strftime call.
73+
# today_fmt = '%B %d, %Y'
74+
75+
# List of patterns, relative to source directory, that match files and
76+
# directories to ignore when looking for source files.
77+
exclude_patterns = []
78+
79+
# The reST default role (used for this markup: `text`) to use for all documents.
80+
# default_role = None
81+
82+
# If true, '()' will be appended to :func: etc. cross-reference text.
83+
# add_function_parentheses = True
84+
85+
# If true, the current module name will be prepended to all description
86+
# unit titles (such as .. function::).
87+
# add_module_names = True
88+
89+
# If true, sectionauthor and moduleauthor directives will be shown in the
90+
# output. They are ignored by default.
91+
# show_authors = False
92+
93+
# The name of the Pygments (syntax highlighting) style to use.
94+
pygments_style = "sphinx"
95+
96+
# A list of ignored prefixes for module index sorting.
97+
# modindex_common_prefix = []
98+
99+
# `keep_warnings <http://www.sphinx-doc.org/en/stable/config.html#confval-keep_warnings>`_:
100+
# If true, keep warnings as “system message” paragraphs in the built documents.
101+
# Regardless of this setting, warnings are always written to the standard error
102+
# stream when sphinx-build is run.
103+
keep_warnings = True
104+
105+
# `rst_prolog <http://www.sphinx-doc.org/en/stable/config.html#confval-rst_prolog>`_:
106+
# A string of reStructuredText that will be included at the beginning of every
107+
# source file that is read.
108+
rst_prolog = (
109+
# For fill-in-the-blank questions, provide a convenient means to indicate a blank.
110+
"""
111+
112+
.. |blank| replace:: :blank:`x`
113+
"""
114+
# For literate programming files, provide a convenient way to refer to a source file's name. See `runestone.lp.lp._docname_role`.
115+
""".. |docname| replace:: :docname:`name`
116+
"""
117+
)
118+
119+
# Select whether to use server-side grading where possible. Server-side grading
120+
# requires **all** the following:
121+
#
122+
# - The use of Runestone services (``eBookConfig.useRunestoneServices === true``)
123+
# - Logging enabled (``eBookConfig.logLevel > 0``)
124+
#
125+
# The first two conditions cause the ``RunestoneBase.logBookEvent`` in ``runestonebase.js`` to post a student response to the server. The last conditions ensures that ``hsblog`` in ``ajax.py`` on the server will return a response containing grading information.
126+
runestone_server_side_grading = False
127+
128+
# Extensions
129+
# ==========
130+
# CodeChat
131+
# --------
132+
# **CodeChat note:** A dict of {glob_, lexer_alias}, which uses lexer_alias
133+
# (e.g. a lexer's `short name <http://pygments.org/docs/lexers/>`_) to analyze
134+
# any file wihch matches the given `glob
135+
# <https://docs.python.org/2/library/glob.html>`_.
136+
CodeChat_lexer_for_glob = {
137+
# Otherwise, Pygments picks the wrong lexer for CSS...
138+
"*.css": "CSS",
139+
# ... and for JavaScript.
140+
"*.js": "JavaScript",
141+
}
142+
#
143+
# **CodeChat note::** This is a list of exclude_patterns_ which applies only to
144+
# source documents; exclude_patterns_ will exclude the given files from all of
145+
# Sphinx (for example, files here won't be included even if they're mentioned in
146+
# html_static_path_.
147+
CodeChat_excludes = []
148+
#
149+
# Inline syntax highlight
150+
# -----------------------
151+
# `inline_highlight_respect_highlight <https://sphinxcontrib-inlinesyntaxhighlight.readthedocs.io/en/latest/#confval-inline_highlight_respect_highlight>`_:
152+
# Use the language specified by the ``highlight`` directive to syntax highlight ``code`` role contents.
153+
inline_highlight_respect_highlight = True
154+
inline_highlight_literals = False
155+
156+
# -- Options for HTML output ---------------------------------------------------
157+
158+
# The theme to use for HTML and HTML Help pages. See the documentation for
159+
# a list of builtin themes.
160+
html_theme = "sphinx_bootstrap"
161+
162+
# Theme options are theme-specific and customize the look and feel of a theme
163+
# further. For a list of options available for each theme, see the
164+
# documentation.
165+
# html_theme_options = {'nosidebar': 'true'}
166+
html_theme_options = {
167+
# Navigation bar title. (Default: ``project`` value)
168+
"navbar_title": "Wavedrom test",
169+
# Tab name for entire site. (Default: "Site")
170+
"navbar_site_name": "Chapters",
171+
# Global TOC depth for "site" navbar tab. (Default: 1)
172+
# Switching to -1 shows all levels.
173+
"globaltoc_depth": 1,
174+
# Include hidden TOCs in Site navbar?
175+
#
176+
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
177+
# non-hidden ``toctree`` directives in the same page, or else the build
178+
# will break.
179+
#
180+
# Values: "true" (default) or "false"
181+
"globaltoc_includehidden": "true",
182+
# HTML navbar class (Default: "navbar") to attach to <div> element.
183+
# For black navbar, do "navbar navbar-inverse"
184+
"navbar_class": "navbar",
185+
# Fix navigation bar to top of page?
186+
# Values: "true" (default) or "false"
187+
"navbar_fixed_top": "true",
188+
# Location of link to source.
189+
# Options are "nav" (default), "footer" or anything else to exclude.
190+
"source_link_position": "nav",
191+
# Bootswatch (http://bootswatch.com/) theme.
192+
#
193+
# Options are nothing with "" (default) or the name of a valid theme
194+
# such as "amelia" or "cosmo".
195+
#
196+
# Note that this is served off CDN, so won't be available offline.
197+
#'bootswatch_theme': "slate",
198+
}
199+
200+
201+
# This is set up to use the default runestone themes, you can override them by
202+
# creating your own folder and modifying this path.
203+
# Add any paths that contain custom themes here, relative to this directory.
204+
html_theme_path = [
205+
pkg_resources.resource_filename(
206+
"runestone", "common/project_template/_templates/plugin_layouts"
207+
)
208+
]
209+
210+
211+
# The name for this set of Sphinx documents. If None, it defaults to
212+
# "<project> v<release> documentation".
213+
html_title = "Runestone Interactive Overview"
214+
215+
# A shorter title for the navigation bar. Default is the same as html_title.
216+
html_short_title = "Runestone Interactive Overview"
217+
218+
# The name of an image file (relative to this directory) to place at the top
219+
# of the sidebar.
220+
221+
# logo is included in layout file
222+
# html_logo = "../source/_static/logo_small.png"
223+
224+
# The name of an image file (within the static path) to use as favicon of the
225+
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
226+
# pixels large.
227+
# html_favicon = None
228+
229+
# Add any paths that contain custom static files (such as style sheets) here,
230+
# relative to this directory. They are copied after the builtin static files,
231+
# so a file named "default.css" will overwrite the builtin "default.css".
232+
233+
html_static_path = runestone_static_dirs()
234+
235+
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
236+
# using the given strftime format.
237+
# html_last_updated_fmt = '%b %d, %Y'
238+
239+
# If true, SmartyPants will be used to convert quotes and dashes to
240+
# typographically correct entities.
241+
# html_use_smartypants = True
242+
243+
# Custom sidebar templates, maps document names to template names.
244+
# html_sidebars = {}
245+
246+
# Additional templates that should be rendered to pages, maps page names to
247+
# template names.
248+
# html_additional_pages = {}
249+
250+
# If false, no module index is generated.
251+
# html_domain_indices = True
252+
253+
# If false, no index is generated.
254+
# html_use_index = True
255+
256+
# If true, the index is split into individual pages for each letter.
257+
# html_split_index = False
258+
259+
# If true, links to the reST sources are added to the pages.
260+
html_show_sourcelink = False
261+
262+
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
263+
# html_show_sphinx = True
264+
265+
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
266+
# html_show_copyright = True
267+
268+
# If true, an OpenSearch description file will be output, and all pages will
269+
# contain a <link> tag referring to it. The value of this option must be the
270+
# base URL from which the finished HTML is served.
271+
# html_use_opensearch = ''
272+
273+
# This is the file name suffix for HTML files (e.g. ".xhtml").
274+
# html_file_suffix = None
275+
276+
# Output file base name for HTML help builder.
277+
htmlhelp_basename = "PythonCoursewareProjectdoc"
278+
279+
# .. _accessibility_style:
280+
#
281+
# accessibility_style
282+
# -------------------
283+
# This config value is defined in the `../../accessibility/accessibility.py` extension.
284+
# By this config value you can select what accessibility stylesheet
285+
# you want to add (``normal``, ``light``, ``darkest`` or ``none``).
286+
# accessibility_style = 'normal'
287+
288+
# Config values for specific Runestone components
289+
#
290+
# activecode_div_class = 'runestone explainer ac_section alert alert-warning'
291+
# activecode_hide_load_history = False
292+
# mchoice_div_class = 'runestone alert alert-warning'
293+
# clickable_div_class = 'runestone alert alert-warning'
294+
# codelens_div_class = 'alert alert-warning cd_section'
295+
# dragndrop_div_class = 'runestone'
296+
# fitb_div_class = 'runestone'
297+
# parsons_div_class = 'runestone'
298+
# poll_div_class = 'alert alert-warning'
299+
# shortanswer_div_class = 'journal alert alert-warning'
300+
# shortanswer_optional_div_class = 'journal alert alert-success'
301+
# showeval_div_class = 'runestone explainer alert alert-warning'
302+
# tabbed_div_class = 'alert alert-warning'

0 commit comments

Comments
 (0)