<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def doctree_resolved(app, doctree, fromdocname):
 """ When the document, and all the links are fully resolved, we inject one raw html element for running the command for processing the wavedrom diagrams at the onload event. """

    # Skip for non-html or if javascript is not inlined
    if not app.env.config.wavedrom_html_jsinline:
        return

    text = """
    <script type="text/javascript">
        function init() {
            WaveDrom.ProcessAll();
        }
        window.onload = init;
    </script>"""
    doctree.append(nodes.raw(text=text, format='html'))