0

We have a large source repository and we don't want to archive the documentation that we generate. We have a target in the top level makefile 'doc' which kicks off doxygen to generate the documentation.

So I have in the top level directory a local page that references my doxygen documentation.

documents.html

it contains this single line.

/--! <meta http-equiv="REFRESH" content="0;URL=somepath/html/index.html">

This works fine when the documentation has been generated via doxygen.

However, the browser just displays "page not found" when doxygen has not been run.

Is there a way to display an error message when the documentation has not been generated?

something like "please run 'make doc' first."

mike_p
  • 21
  • 5

1 Answers1

1

After 3 days of struggling with this I found a link on Stackoverflow that allowed me to hack out a solution with my limited JS skills.

thanks to Siubear Check if a file exists locally using JavaScript only

<span> </span>  
<SCRIPT>
    function load_home() {
      window.open ('project_x/toplevel/docs/html/index.html','_self',false)
    }

    function get_error(x){
        document.getElementsByTagName('span')[0].innerHTML+=x+" does not exist. Run 'make doc'";
    }
    url="project_x/toplevel/docs/html/index.html";
    url+="?"+new Date().getTime()+Math.floor(Math.random()*1000);
    var doc=document.createElement('script');
    doc.id="project_x/toplevel/docs/html/index.html";
    doc.onload=function(){ if(doc.onload)load_home()}
    doc.onerror=function(){ if(doc.onerror)get_error(this.id) } 
    doc.src=url;
    document.body.appendChild(doc);                                                                                                 
</SCRIPT>
mike_p
  • 21
  • 5