o3de-api-functions.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/bash
  2. # TOC_PATTERN exists in index.html files to mark a placeholder for the Table of Contents (TOC) table.
  3. # It's automatically written to index.md template, which is used to generate index.html files.
  4. # It may also be manually added to code comments, by using the Doxygen /mainpage command.
  5. TOC_PATTERN=o3de-doxygen-insert-table
  6. # Link to Related Pages page
  7. function find_pages() {
  8. local line="<td><a href=\"pages.html\">Related Pages</a> </td><td>The list related documentation pages. </td></tr>"
  9. [ -f $API_PATH/pages.html ] && DOXY_PAGES=$line || DOXY_ANNOTATED=""
  10. }
  11. function find_modules() {
  12. local line="<td><a href=\"modules.html\">Modules</a> </td><td>The list all modules. </td></tr>"
  13. [ -f $API_PATH/modules.html ] && DOXY_MODULES=$line || DOXY_ANNOTATED=""
  14. }
  15. # Link to Namespaces List page
  16. function find_namespace_list() {
  17. local line="<td><a href=\"namespaces.html\">Namespace List</a> </td><td>The list all documented namedspaces. </td></tr>"
  18. [ -f $API_PATH/namespaces.html ] && DOXY_NAMESPACELIST=$line || DOXY_ANNOTATED=""
  19. }
  20. # Link to Namespaces Members page
  21. function find_namespace_members() {
  22. local line="<td><a href=\"namespacemembers.html\">Namespace Members</a> </td><td>The list all documented namedspace members. </td></tr>"
  23. [ -f $API_PATH/namespacemembers.html ] && DOXY_NAMESPACEMEMBERS=$line || DOXY_ANNOTATED=""
  24. }
  25. # Link to Class List page
  26. function find_annotated() {
  27. local line="<td><a href=\"annotated.html\">Class List</a> </td><td>The list of classes, structs, unions, and interfaces. </td></tr>"
  28. [ -f $API_PATH/classes.html ] && DOXY_ANNOTATED=$line || DOXY_ANNOTATED=""
  29. }
  30. # Link to Class Index page
  31. function find_classes() {
  32. local line="<td><a href=\"classes.html\">Class Index</a> </td><td>The list of classes, structs, unions, and interfaces. </td></tr>"
  33. [ -f $API_PATH/classes.html ] && DOXY_CLASSES=$line || DOXY_CLASSES=""
  34. }
  35. # Link to Class Members page
  36. function find_functions() {
  37. local line="<td><a href=\"functions.html\">Class Members</a> </td><td>The list of class members. </td></tr>"
  38. [ -f $API_PATH/functions.html ] && DOXY_FUNCTIONS=$line || DOXY_FUNCTIONS=""
  39. }
  40. # Link to Class Hierarchy page
  41. function find_hierarchy() {
  42. local line="<td><a href=\"hierarchy.html\">Class Hierarchy</a> </td><td>The class hierarchy based on inheritance. </td></tr>"
  43. [ -f $API_PATH/hierarchy.html ] && DOXY_HIERARCHY=$line || DOXY_HIERARCHY=""
  44. }
  45. # Link to File List page
  46. function find_files() {
  47. local line="<td><a href=\"files.html\">File List</a> </td><td>The list of all documented files. </td></tr>"
  48. [ -f $API_PATH/files.html ] && DOXY_FILELIST=$line || DOXY_HIERARCHY=""
  49. }
  50. # Link to File List page
  51. function find_file_members() {
  52. local line="<td><a href=\"globals.html\">File Members</a> </td><td>The list of all documented file members. </td></tr>"
  53. [ -f $API_PATH/globals.html ] && DOXY_FILEMEMBERS=$line || DOXY_HIERARCHY=""
  54. }
  55. # Link to File List page
  56. function find_examples() {
  57. local line="<td><a href=\"examples.html\">File Members</a> </td><td>The list of all documented examples. </td></tr>"
  58. [ -f $API_PATH/examples.html ] && DOXY_EXAMPLES=$line || DOXY_HIERARCHY=""
  59. }
  60. function generate_toc () {
  61. API_PATH="$1"
  62. API_NAME="$2"
  63. SECTION="<h3>Sections</h3>\n<p>Refer to the following sections of the $API_NAME API Reference.</p>"
  64. BEGIN_TABLE="<table class="doxtable">\n<tr>\n<th>Section </th><th>Description </th></tr>\n<tr>"
  65. END_TABLE="</table>"
  66. # To hold links to generated pages
  67. DOXY_PAGES=""
  68. DOXY_MODULES=""
  69. DOXY_NAMESPACELIST=""
  70. DOXY_NAMESPACEMEMBERS=""
  71. DOXY_ANNOTATED=""
  72. DOXY_CLASSES=""
  73. DOXY_FUNCTIONS=""
  74. DOXY_HIERARCHY=""
  75. DOXY_FILELIST=""
  76. DOXY_FILEMEMBERS=""
  77. DOXY_EXAMPLES=""
  78. # Set links to DOXY_ variables
  79. find_pages
  80. find_modules
  81. find_namespace_list
  82. find_namespace_members
  83. find_annotated # Sets $DOXY_ANNOTATED
  84. find_classes # Sets $DOXY_CLASSES
  85. find_functions # Sets $DOXY_FUNCTIONS
  86. find_hierarchy # Sets $DOXY_HIERARCHY
  87. find_files
  88. find_file_members
  89. find_examples
  90. # Create the table of contents string
  91. # This is in one line due to issues using multi-line vars with sed
  92. LINE="$SECTION$BEGIN_TABLE$DOXY_PAGES$DOXY_MODULES$DOXY_NAMESPACELIST$DOXY_NAMESPACEMEMBERS$DOXY_ANNOTATED$DOXY_CLASSES$DOXY_FUNCTIONS$DOXY_HIERARCHY$DOXY_FILELIST$DOXY_FILEMEMBERS$DOXY_EXAMPLES$END_TABLE"
  93. # Find $PATTERN in index.html and replace with $LINE
  94. sed -i "/$TOC_PATTERN/ c\\$LINE" $API_PATH/index.html
  95. }