Code Monkey home page Code Monkey logo

Comments (17)

bavovanachte avatar bavovanachte commented on June 2, 2024

You're right. It isn't properly documented. I'll look into it.

To answer your question: the default mode of this plugin uses the version of the js files hosted on the wavedrom servers. I assume that's the latest (stable) version

If you want more control over which version to use, I suggest you take a look at the example directory. That sphinx project demonstrates how to include offline versions of the js files in your codebase. That would allow you to use any version you want

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

Ah OK. My problem is that I can see the wavedrom code in the generated HTML files, but nothing is shown in the browser. I don't realy know where the start the debugging. I can release the newest documentation - which uses your extension - in one or two days, so I can present the output to you.

I found other useful diagram written by @drom. Like Bitfield. Have you considered to write a sphinx extension for this diagram too?

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

Ok, cool. I can't say I'm an expert in this field (I'm an embedded SW engineer, in fact), but I'll try to take a look!

Bitfield seems incredibly promising, thanks! I've been using nwdiag (packetdiag) for this up until now, but this looks a lot nicer!

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

Until now, I'm using bytefield from LaTeX with the standalone package to generate PDF and PNG outputs. The generated files are then included into other files like PowerPoint or maybe ReStructured Text. I would like to bring it closer to the GitHub + ReadTheDocs (Sphinx) flow.

I'm also no web developer, but I like and use Python and its ecosystem. In fact, I'm a hardware designer for FPGAs with VHDL :). We are currently working on our documentation for our open source IP core library called PoC. So we need to document some interfaces with waveforms to give a better and quicker understanding. (ReadTheDocs estimates our documentation to > 300 PDF pages :)

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

No need to provide any documentation from your part. I made a branch that uses the rtd theme (branch rtd_theme_support), and I seem to be able to reproduce it there. If you have the time, could you confirm?

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

Yes I can confirm it. Here is your example, build on my local machine:
image

You can see the generated HTML source code in the second Chrome window. It contains wavedrom code, but the background windows shows no waveforms.

Is it related to the RTD theme?

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

The fact that it doesn't work on the rtd theme, but does on the alabaster theme seems to be related to the fact that sphinx includes the javascript files at the top for the alabaster theme, and at the bottom for the rtd theme.

By manually playing around with it, I managed to get the diagrams back. I'll try to come up with something in the coming week

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

If I understood your code correctly, the it will insert the JavaScript code multiple times. Is there a way to add the JavaScript file reference in the header, if at least one wavedrom section was found, and add a run command at the end for all wavedrom code snippets?

Thanks for you effort!

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

In fact, the proper way to do it would be to implement it like this: https://www.npmjs.com/package/wavedrom

i.e., adapt the body tag so that it does something like this:

<body onload="WaveDrom.ProcessAll()">

In that case, I can leave the javascript includes as they are (let sphinx handle them), and remove all the duplicate WaveDrom.ProcessAll() entries.

However, I'm not sure that's possible in the sphinx plugin environment. I'll have to do some digging, but the documentation for it isn't exactly huge, so it might take some time

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

The other alternative would be to duplicate the javascript includes (<script type="text/javascript" src="_static/default.js"></script>) for every diagram entry as well. This seems to work (tested manually), and is the easiest solution, but not the nicest..

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

The Sphinx support is quite good. I have filed a lot of issues and questions in the last days. Just ask them who to register such an event in the body and link to this issue discussion :).

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

I added a possible fix in pull request #2 . Any chance I could ask you to test on your side?

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

There is one waveform after each headline. So it should work, right?
Do you supply your fix as a new PyPI version?

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

Not sure what you mean with headline, but I tried to implement the proper solution, i.e. to run wavedrom.processAll() just once, on pageload. The javascript files are also just included once (per rst file)
It seems to work for the example project (I upgraded that to rtd), but wanted to check whether you could test it on your side first. To make things easier, I'll try to supply a version on PyPi tomorrow (if I figure out again how to do that 😏 )

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

headline = the section headlined in the example text.
Thank you very much.

from sphinx-wavedrom.

bavovanachte avatar bavovanachte commented on June 2, 2024

I uploaded version 1.2.0 to pypi. You should be able to download it using pip

from sphinx-wavedrom.

Paebbels avatar Paebbels commented on June 2, 2024

Hello,
I updated the package and it works now.
So this issue can be closed. I'll write another issue (#3) for a different question (just to keep the issue clean and separated :) )

from sphinx-wavedrom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.