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

Commit be242ad

Browse files
committed
Add: Files to support a wavedrom diagram.
1 parent 7592a3e commit be242ad

9 files changed

Lines changed: 494 additions & 1 deletion

File tree

package.json

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

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

0 commit comments

Comments
 (0)