Is there a way to embed <script> content into a Doxygen \mainpage section?

ⅰ亾dé卋堺 提交于 2019-12-30 05:09:45

问题


I would like to introduce some javascript <script>xxx</script> content into my generated index.html in order to add reddit and facebook "like" buttons to my project's main page. Is there a way to accomplish this automatically using Doxygen?

Thanks,

SetJmp


回答1:


You can use @mainpage in combination with an @htmlonly...@endhtmlonly block. Here is an example:

/** @mainpage My Script Page

Here is an embedded script:
@htmlonly
 <script type="text/javascript">
 function displayDate()
 {
 document.getElementById("demo").innerHTML=Date();
 }
 </script>
 <div id="demo">date</div>
 <script type="text/javascript">displayDate();</script>
 <br/>
 <button type="button" onclick="displayDate()">Refresh Date</button>
@endhtmlonly

*/


来源:https://stackoverflow.com/questions/7315493/is-there-a-way-to-embed-script-content-into-a-doxygen-mainpage-section

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!