Making a book
Today I dug into OpenDSA to figure out how it works and what files are used when
make bookname is executed. There are four main directories
(that I’m aware of):
the config folder contains a json file for each book that can be built. A book’s configuration file contains metadata about the book, as well as all the chapters and what the chapters are called internally. This, in turn, is used to locate the relevant RST file from the RST directory. The RST file contains chapter content, as well as references to excercises and other visualizations.
JSAV is used for creating many of the visualizations, or that’s the end-goal. One problem; JSAV’s documentation is… not great. For example, the keyValuePair API documentation is missing entirely. But the keyValuePair API doesn’t appear to be available in the version of JSAV used by OpenDSA anyhow. While I could choose to use a more recent version, I’m instead going to try to create the visualization using the current version of JSAV. If I could see a preview of what it looks like to use the keyValuePair API, I’d know beforehand if it’s something I’d be willing to go through the trouble of trying to use. But since the documentation contains very few graphics or interactive examples, I’m not going to bother.
I saw the same basic functionality I was looking for in the data structures book. For some of the slideshows demonstrating array-based queues, labels are used in conjunction with single-element arrays to hold the value of a single primitive variable. I believe this will make the most sense in creating visualizations of the different parameter passing methods.
My First Slideshow
I’m finally writing quite a bit. It’s still new, so it’s a learning process. But progress is being made. My first slideshow walks through what it looks like to perform a function call is done by-reference. I discovered that JSAV has a way to visualize pointers, which came in handy.
One obstacle was JSAV’s documentation again. For the
anchor option, it
says it takes a string in the format
horizontal vertical. Except sometimes
it’s backwards. I couldn’t figure out why
center bottom wasn’t working in one
case until I discovered the discrepancy. Then I was able to switch the two and
lo and behold it worked. This could just be due to OpenDSA using an old version
of JSAV, though.
By the end of the day, I finished slideshows demonstrating call-by-value and call-by-reference. The commit can be found here.
Next week I hope to finish the slideshows for all the other methods. I feel comfortable enough with JSAV to do what I want to do, as long as I have an idea on how I think the content should be displayed. That being said, now that I know my way around the framework, it shouldn’t be too hard to do the rest.