From de0fb1faf74498dd148ffab60e9ff2338a4e0752 Mon Sep 17 00:00:00 2001 From: Tsche Date: Fri, 16 Feb 2024 02:53:53 +0100 Subject: [PATCH] datatables --- docs/Doxyfile | 12 +- docs/charts.md | 5 +- docs/header.html | 15 + docs/tables.md | 122 ++++ docs/{test_data.json => test_chart_data.json} | 0 docs/test_table.json | 522 ++++++++++++++++++ docs/test_table_data.json | 515 +++++++++++++++++ doxygen-awesome/doxygen-awesome-tables.css | 23 + doxygen-awesome/doxygen-awesome-tables.js | 103 ++++ 9 files changed, 1310 insertions(+), 7 deletions(-) create mode 100644 docs/tables.md rename docs/{test_data.json => test_chart_data.json} (100%) create mode 100644 docs/test_table.json create mode 100644 docs/test_table_data.json create mode 100644 doxygen-awesome/doxygen-awesome-tables.css create mode 100644 doxygen-awesome/doxygen-awesome-tables.js diff --git a/docs/Doxyfile b/docs/Doxyfile index 37aa14d..c48efc4 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -1315,7 +1315,8 @@ HTML_EXTRA_STYLESHEET = docs/style/doxygen-awesome.css \ docs/style/doxygen-awesome-sidebar-only.css \ docs/style/doxygen-awesome-sidebar-only-darkmode-toggle.css \ docs/github-corner.css \ - doxygen-awesome/doxygen-awesome-godbolt.css + doxygen-awesome/doxygen-awesome-godbolt.css\ + doxygen-awesome/doxygen-awesome-tables.css # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note @@ -1332,9 +1333,12 @@ HTML_EXTRA_FILES = LICENSE \ docs/style/doxygen-awesome-interactive-toc.js \ doxygen-awesome/doxygen-awesome-alerts.js \ doxygen-awesome/doxygen-awesome-charts.js \ + doxygen-awesome/doxygen-awesome-tables.js \ doxygen-awesome/doxygen-awesome-godbolt.js \ - docs/test_data.json \ - docs/test_chart.json + docs/test_chart_data.json \ + docs/test_chart.json \ + docs/test_table.json \ + docs/test_table_data.json # The HTML_COLORSTYLE tag can be used to specify if the generated HTML output # should be rendered with a dark or light theme. @@ -1347,7 +1351,7 @@ HTML_EXTRA_FILES = LICENSE \ # The default value is: AUTO_LIGHT. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_COLORSTYLE = AUTO_LIGHT +HTML_COLORSTYLE = LIGHT # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to diff --git a/docs/charts.md b/docs/charts.md index ba5bb80..33ea5ea 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -8,7 +8,6 @@ The `doxygen-awesome-charts` extension allows embedding of frappe charts with cu ## Installation * Ensure you have doxygen-awesome properly configured for this project -* Add `doxygen-awesome/doxygen-awesome-charts.css` to `HTML_EXTRA_STYLESHEET` in your Doxyfile * Add `doxygen-awesome/doxygen-awesome-charts.js` to `HTML_EXTRA_FILES` in your Doxyfile > [!TIP] @@ -62,7 +61,7 @@ frappe-chart foo "#d9f2e5", "#6e72f4" ], - "data": "test_data.json", + "data": "test_chart_data.json", "type": "line", "height": 400, "lineOptions": { @@ -82,7 +81,7 @@ frappe-chart foo "#d9f2e5", "#6e72f4" ], - "data": "test_data.json", + "data": "test_chart_data.json", "type": "line", "height": 400, "lineOptions": { diff --git a/docs/header.html b/docs/header.html index 449f51f..c930cf0 100644 --- a/docs/header.html +++ b/docs/header.html @@ -35,6 +35,20 @@ + + + + + + + + + + + + + + diff --git a/docs/tables.md b/docs/tables.md new file mode 100644 index 0000000..57748bc --- /dev/null +++ b/docs/tables.md @@ -0,0 +1,122 @@ +# Tables +[TOC] + +The `doxygen-awesome-tables` extension allows embedding of datatables with custom markup. + + +## Usage + +## Installation +* Ensure you have doxygen-awesome properly configured for this project +* Add `doxygen-awesome/doxygen-awesome-tables.css` to `HTML_EXTRA_STYLESHEET` in your Doxyfile +* Add `doxygen-awesome/doxygen-awesome-tables.js` to `HTML_EXTRA_FILES` in your Doxyfile + +> [!TIP] +> If you have already created a custom `HTML_HEADER` you can skip to step 6 + +* Run `doxygen -w html header.html delete_me.html delete_me.css` in a command prompt and delete the files called `delete_me` +* Set `HTML_HEADER` to the path of your `header.html` file in your Doxyfile + +* Add +```html + + + +``` +to the `` node of your `header.html` + +* Activate the extension by also putting +```html + +``` +into your `header.html`'s `` node. + +* (Optional) Add your chart input files to `HTML_EXTRA_FILES` in your Doxyfile if you want Doxygen to copy them to the html root for you. + +You can now embed tables in your documentation. Note that chart names must be unique since they will be used as id for the `` datatable renders to. + +## Example + +### Shorthand +tables can easily be embedded using image syntax. Note that the alt name must start with the special marker `datatable` and contain a unique name. The link target should be a JSON file with the chart data in it. +```markdown +![datatable zoinks](test_table.json) +``` +This expects a full datatables configuration object. + +#### Demo +![datatable zoinks](test_table.json) + + +### Inline +An alternative way is to provide the chart as code block. In this mode the first line must start with the special marker `datatable` and contain a unique name. Everything but the first line is interpreted as JSON input to datatables. + +You can either provide the data as link: +```markdown +'''json +datatable foo +{ + "columns": [ + { + "className": "dt-control", + "orderable": false, + "data": null, + "defaultContent": "" + }, + {"data": "name"}, {"data": "position"}, {"data": "office"}, + {"data": "salary"} + + ], + "data": "test_table_data.json", +} +''' + + +``` +```json +datatable foo +{ + "columns": [ + { + "className": "dt-control", + "orderable": false, + "data": null, + "defaultContent": "" + }, + {"data": "name"}, {"data": "position"}, {"data": "office"}, + {"data": "salary"} + + ], + "data": "test_table_data.json" +} +``` + +@htmlonly + +@endhtmlonly \ No newline at end of file diff --git a/docs/test_data.json b/docs/test_chart_data.json similarity index 100% rename from docs/test_data.json rename to docs/test_chart_data.json diff --git a/docs/test_table.json b/docs/test_table.json new file mode 100644 index 0000000..bb89100 --- /dev/null +++ b/docs/test_table.json @@ -0,0 +1,522 @@ +{ + "columns": [ + {"data": "name"}, {"data": "position"}, {"data": "office"}, + {"data": "salary"} + + ], + "data": [ + { + "id": "1", + "name": "Tiger Nixon", + "position": "System Architect", + "salary": "$320,800", + "start_date": "2011-04-25", + "office": "Edinburgh", + "extn": "5421" + }, + { + "id": "2", + "name": "Garrett Winters", + "position": "Accountant", + "salary": "$170,750", + "start_date": "2011-07-25", + "office": "Tokyo", + "extn": "8422" + }, + { + "id": "3", + "name": "Ashton Cox", + "position": "Junior Technical Author", + "salary": "$86,000", + "start_date": "2009-01-12", + "office": "San Francisco", + "extn": "1562" + }, + { + "id": "4", + "name": "Cedric Kelly", + "position": "Senior Javascript Developer", + "salary": "$433,060", + "start_date": "2012-03-29", + "office": "Edinburgh", + "extn": "6224" + }, + { + "id": "5", + "name": "Airi Satou", + "position": "Accountant", + "salary": "$162,700", + "start_date": "2008-11-28", + "office": "Tokyo", + "extn": "5407" + }, + { + "id": "6", + "name": "Brielle Williamson", + "position": "Integration Specialist", + "salary": "$372,000", + "start_date": "2012-12-02", + "office": "New York", + "extn": "4804" + }, + { + "id": "7", + "name": "Herrod Chandler", + "position": "Sales Assistant", + "salary": "$137,500", + "start_date": "2012-08-06", + "office": "San Francisco", + "extn": "9608" + }, + { + "id": "8", + "name": "Rhona Davidson", + "position": "Integration Specialist", + "salary": "$327,900", + "start_date": "2010-10-14", + "office": "Tokyo", + "extn": "6200" + }, + { + "id": "9", + "name": "Colleen Hurst", + "position": "Javascript Developer", + "salary": "$205,500", + "start_date": "2009-09-15", + "office": "San Francisco", + "extn": "2360" + }, + { + "id": "10", + "name": "Sonya Frost", + "position": "Software Engineer", + "salary": "$103,600", + "start_date": "2008-12-13", + "office": "Edinburgh", + "extn": "1667" + }, + { + "id": "11", + "name": "Jena Gaines", + "position": "Office Manager", + "salary": "$90,560", + "start_date": "2008-12-19", + "office": "London", + "extn": "3814" + }, + { + "id": "12", + "name": "Quinn Flynn", + "position": "Support Lead", + "salary": "$342,000", + "start_date": "2013-03-03", + "office": "Edinburgh", + "extn": "9497" + }, + { + "id": "13", + "name": "Charde Marshall", + "position": "Regional Director", + "salary": "$470,600", + "start_date": "2008-10-16", + "office": "San Francisco", + "extn": "6741" + }, + { + "id": "14", + "name": "Haley Kennedy", + "position": "Senior Marketing Designer", + "salary": "$313,500", + "start_date": "2012-12-18", + "office": "London", + "extn": "3597" + }, + { + "id": "15", + "name": "Tatyana Fitzpatrick", + "position": "Regional Director", + "salary": "$385,750", + "start_date": "2010-03-17", + "office": "London", + "extn": "1965" + }, + { + "id": "16", + "name": "Michael Silva", + "position": "Marketing Designer", + "salary": "$198,500", + "start_date": "2012-11-27", + "office": "London", + "extn": "1581" + }, + { + "id": "17", + "name": "Paul Byrd", + "position": "Chief Financial Officer (CFO)", + "salary": "$725,000", + "start_date": "2010-06-09", + "office": "New York", + "extn": "3059" + }, + { + "id": "18", + "name": "Gloria Little", + "position": "Systems Administrator", + "salary": "$237,500", + "start_date": "2009-04-10", + "office": "New York", + "extn": "1721" + }, + { + "id": "19", + "name": "Bradley Greer", + "position": "Software Engineer", + "salary": "$132,000", + "start_date": "2012-10-13", + "office": "London", + "extn": "2558" + }, + { + "id": "20", + "name": "Dai Rios", + "position": "Personnel Lead", + "salary": "$217,500", + "start_date": "2012-09-26", + "office": "Edinburgh", + "extn": "2290" + }, + { + "id": "21", + "name": "Jenette Caldwell", + "position": "Development Lead", + "salary": "$345,000", + "start_date": "2011-09-03", + "office": "New York", + "extn": "1937" + }, + { + "id": "22", + "name": "Yuri Berry", + "position": "Chief Marketing Officer (CMO)", + "salary": "$675,000", + "start_date": "2009-06-25", + "office": "New York", + "extn": "6154" + }, + { + "id": "23", + "name": "Caesar Vance", + "position": "Pre-Sales Support", + "salary": "$106,450", + "start_date": "2011-12-12", + "office": "New York", + "extn": "8330" + }, + { + "id": "24", + "name": "Doris Wilder", + "position": "Sales Assistant", + "salary": "$85,600", + "start_date": "2010-09-20", + "office": "Sydney", + "extn": "3023" + }, + { + "id": "25", + "name": "Angelica Ramos", + "position": "Chief Executive Officer (CEO)", + "salary": "$1,200,000", + "start_date": "2009-10-09", + "office": "London", + "extn": "5797" + }, + { + "id": "26", + "name": "Gavin Joyce", + "position": "Developer", + "salary": "$92,575", + "start_date": "2010-12-22", + "office": "Edinburgh", + "extn": "8822" + }, + { + "id": "27", + "name": "Jennifer Chang", + "position": "Regional Director", + "salary": "$357,650", + "start_date": "2010-11-14", + "office": "Singapore", + "extn": "9239" + }, + { + "id": "28", + "name": "Brenden Wagner", + "position": "Software Engineer", + "salary": "$206,850", + "start_date": "2011-06-07", + "office": "San Francisco", + "extn": "1314" + }, + { + "id": "29", + "name": "Fiona Green", + "position": "Chief Operating Officer (COO)", + "salary": "$850,000", + "start_date": "2010-03-11", + "office": "San Francisco", + "extn": "2947" + }, + { + "id": "30", + "name": "Shou Itou", + "position": "Regional Marketing", + "salary": "$163,000", + "start_date": "2011-08-14", + "office": "Tokyo", + "extn": "8899" + }, + { + "id": "31", + "name": "Michelle House", + "position": "Integration Specialist", + "salary": "$95,400", + "start_date": "2011-06-02", + "office": "Sydney", + "extn": "2769" + }, + { + "id": "32", + "name": "Suki Burks", + "position": "Developer", + "salary": "$114,500", + "start_date": "2009-10-22", + "office": "London", + "extn": "6832" + }, + { + "id": "33", + "name": "Prescott Bartlett", + "position": "Technical Author", + "salary": "$145,000", + "start_date": "2011-05-07", + "office": "London", + "extn": "3606" + }, + { + "id": "34", + "name": "Gavin Cortez", + "position": "Team Leader", + "salary": "$235,500", + "start_date": "2008-10-26", + "office": "San Francisco", + "extn": "2860" + }, + { + "id": "35", + "name": "Martena Mccray", + "position": "Post-Sales support", + "salary": "$324,050", + "start_date": "2011-03-09", + "office": "Edinburgh", + "extn": "8240" + }, + { + "id": "36", + "name": "Unity Butler", + "position": "Marketing Designer", + "salary": "$85,675", + "start_date": "2009-12-09", + "office": "San Francisco", + "extn": "5384" + }, + { + "id": "37", + "name": "Howard Hatfield", + "position": "Office Manager", + "salary": "$164,500", + "start_date": "2008-12-16", + "office": "San Francisco", + "extn": "7031" + }, + { + "id": "38", + "name": "Hope Fuentes", + "position": "Secretary", + "salary": "$109,850", + "start_date": "2010-02-12", + "office": "San Francisco", + "extn": "6318" + }, + { + "id": "39", + "name": "Vivian Harrell", + "position": "Financial Controller", + "salary": "$452,500", + "start_date": "2009-02-14", + "office": "San Francisco", + "extn": "9422" + }, + { + "id": "40", + "name": "Timothy Mooney", + "position": "Office Manager", + "salary": "$136,200", + "start_date": "2008-12-11", + "office": "London", + "extn": "7580" + }, + { + "id": "41", + "name": "Jackson Bradshaw", + "position": "Director", + "salary": "$645,750", + "start_date": "2008-09-26", + "office": "New York", + "extn": "1042" + }, + { + "id": "42", + "name": "Olivia Liang", + "position": "Support Engineer", + "salary": "$234,500", + "start_date": "2011-02-03", + "office": "Singapore", + "extn": "2120" + }, + { + "id": "43", + "name": "Bruno Nash", + "position": "Software Engineer", + "salary": "$163,500", + "start_date": "2011-05-03", + "office": "London", + "extn": "6222" + }, + { + "id": "44", + "name": "Sakura Yamamoto", + "position": "Support Engineer", + "salary": "$139,575", + "start_date": "2009-08-19", + "office": "Tokyo", + "extn": "9383" + }, + { + "id": "45", + "name": "Thor Walton", + "position": "Developer", + "salary": "$98,540", + "start_date": "2013-08-11", + "office": "New York", + "extn": "8327" + }, + { + "id": "46", + "name": "Finn Camacho", + "position": "Support Engineer", + "salary": "$87,500", + "start_date": "2009-07-07", + "office": "San Francisco", + "extn": "2927" + }, + { + "id": "47", + "name": "Serge Baldwin", + "position": "Data Coordinator", + "salary": "$138,575", + "start_date": "2012-04-09", + "office": "Singapore", + "extn": "8352" + }, + { + "id": "48", + "name": "Zenaida Frank", + "position": "Software Engineer", + "salary": "$125,250", + "start_date": "2010-01-04", + "office": "New York", + "extn": "7439" + }, + { + "id": "49", + "name": "Zorita Serrano", + "position": "Software Engineer", + "salary": "$115,000", + "start_date": "2012-06-01", + "office": "San Francisco", + "extn": "4389" + }, + { + "id": "50", + "name": "Jennifer Acosta", + "position": "Junior Javascript Developer", + "salary": "$75,650", + "start_date": "2013-02-01", + "office": "Edinburgh", + "extn": "3431" + }, + { + "id": "51", + "name": "Cara Stevens", + "position": "Sales Assistant", + "salary": "$145,600", + "start_date": "2011-12-06", + "office": "New York", + "extn": "3990" + }, + { + "id": "52", + "name": "Hermione Butler", + "position": "Regional Director", + "salary": "$356,250", + "start_date": "2011-03-21", + "office": "London", + "extn": "1016" + }, + { + "id": "53", + "name": "Lael Greer", + "position": "Systems Administrator", + "salary": "$103,500", + "start_date": "2009-02-27", + "office": "London", + "extn": "6733" + }, + { + "id": "54", + "name": "Jonas Alexander", + "position": "Developer", + "salary": "$86,500", + "start_date": "2010-07-14", + "office": "San Francisco", + "extn": "8196" + }, + { + "id": "55", + "name": "Shad Decker", + "position": "Regional Director", + "salary": "$183,000", + "start_date": "2008-11-13", + "office": "Edinburgh", + "extn": "6373" + }, + { + "id": "56", + "name": "Michael Bruce", + "position": "Javascript Developer", + "salary": "$183,000", + "start_date": "2011-06-27", + "office": "Singapore", + "extn": "5384" + }, + { + "id": "57", + "name": "Donna Snider", + "position": "Customer Support", + "salary": "$112,000", + "start_date": "2011-01-25", + "office": "New York", + "extn": "4226" + } + ] + } \ No newline at end of file diff --git a/docs/test_table_data.json b/docs/test_table_data.json new file mode 100644 index 0000000..a00e0ff --- /dev/null +++ b/docs/test_table_data.json @@ -0,0 +1,515 @@ +[ + { + "id": "1", + "name": "Tiger Nixon", + "position": "System Architect", + "salary": "$320,800", + "start_date": "2011-04-25", + "office": "Edinburgh", + "extn": "5421" + }, + { + "id": "2", + "name": "Garrett Winters", + "position": "Accountant", + "salary": "$170,750", + "start_date": "2011-07-25", + "office": "Tokyo", + "extn": "8422" + }, + { + "id": "3", + "name": "Ashton Cox", + "position": "Junior Technical Author", + "salary": "$86,000", + "start_date": "2009-01-12", + "office": "San Francisco", + "extn": "1562" + }, + { + "id": "4", + "name": "Cedric Kelly", + "position": "Senior Javascript Developer", + "salary": "$433,060", + "start_date": "2012-03-29", + "office": "Edinburgh", + "extn": "6224" + }, + { + "id": "5", + "name": "Airi Satou", + "position": "Accountant", + "salary": "$162,700", + "start_date": "2008-11-28", + "office": "Tokyo", + "extn": "5407" + }, + { + "id": "6", + "name": "Brielle Williamson", + "position": "Integration Specialist", + "salary": "$372,000", + "start_date": "2012-12-02", + "office": "New York", + "extn": "4804" + }, + { + "id": "7", + "name": "Herrod Chandler", + "position": "Sales Assistant", + "salary": "$137,500", + "start_date": "2012-08-06", + "office": "San Francisco", + "extn": "9608" + }, + { + "id": "8", + "name": "Rhona Davidson", + "position": "Integration Specialist", + "salary": "$327,900", + "start_date": "2010-10-14", + "office": "Tokyo", + "extn": "6200" + }, + { + "id": "9", + "name": "Colleen Hurst", + "position": "Javascript Developer", + "salary": "$205,500", + "start_date": "2009-09-15", + "office": "San Francisco", + "extn": "2360" + }, + { + "id": "10", + "name": "Sonya Frost", + "position": "Software Engineer", + "salary": "$103,600", + "start_date": "2008-12-13", + "office": "Edinburgh", + "extn": "1667" + }, + { + "id": "11", + "name": "Jena Gaines", + "position": "Office Manager", + "salary": "$90,560", + "start_date": "2008-12-19", + "office": "London", + "extn": "3814" + }, + { + "id": "12", + "name": "Quinn Flynn", + "position": "Support Lead", + "salary": "$342,000", + "start_date": "2013-03-03", + "office": "Edinburgh", + "extn": "9497" + }, + { + "id": "13", + "name": "Charde Marshall", + "position": "Regional Director", + "salary": "$470,600", + "start_date": "2008-10-16", + "office": "San Francisco", + "extn": "6741" + }, + { + "id": "14", + "name": "Haley Kennedy", + "position": "Senior Marketing Designer", + "salary": "$313,500", + "start_date": "2012-12-18", + "office": "London", + "extn": "3597" + }, + { + "id": "15", + "name": "Tatyana Fitzpatrick", + "position": "Regional Director", + "salary": "$385,750", + "start_date": "2010-03-17", + "office": "London", + "extn": "1965" + }, + { + "id": "16", + "name": "Michael Silva", + "position": "Marketing Designer", + "salary": "$198,500", + "start_date": "2012-11-27", + "office": "London", + "extn": "1581" + }, + { + "id": "17", + "name": "Paul Byrd", + "position": "Chief Financial Officer (CFO)", + "salary": "$725,000", + "start_date": "2010-06-09", + "office": "New York", + "extn": "3059" + }, + { + "id": "18", + "name": "Gloria Little", + "position": "Systems Administrator", + "salary": "$237,500", + "start_date": "2009-04-10", + "office": "New York", + "extn": "1721" + }, + { + "id": "19", + "name": "Bradley Greer", + "position": "Software Engineer", + "salary": "$132,000", + "start_date": "2012-10-13", + "office": "London", + "extn": "2558" + }, + { + "id": "20", + "name": "Dai Rios", + "position": "Personnel Lead", + "salary": "$217,500", + "start_date": "2012-09-26", + "office": "Edinburgh", + "extn": "2290" + }, + { + "id": "21", + "name": "Jenette Caldwell", + "position": "Development Lead", + "salary": "$345,000", + "start_date": "2011-09-03", + "office": "New York", + "extn": "1937" + }, + { + "id": "22", + "name": "Yuri Berry", + "position": "Chief Marketing Officer (CMO)", + "salary": "$675,000", + "start_date": "2009-06-25", + "office": "New York", + "extn": "6154" + }, + { + "id": "23", + "name": "Caesar Vance", + "position": "Pre-Sales Support", + "salary": "$106,450", + "start_date": "2011-12-12", + "office": "New York", + "extn": "8330" + }, + { + "id": "24", + "name": "Doris Wilder", + "position": "Sales Assistant", + "salary": "$85,600", + "start_date": "2010-09-20", + "office": "Sydney", + "extn": "3023" + }, + { + "id": "25", + "name": "Angelica Ramos", + "position": "Chief Executive Officer (CEO)", + "salary": "$1,200,000", + "start_date": "2009-10-09", + "office": "London", + "extn": "5797" + }, + { + "id": "26", + "name": "Gavin Joyce", + "position": "Developer", + "salary": "$92,575", + "start_date": "2010-12-22", + "office": "Edinburgh", + "extn": "8822" + }, + { + "id": "27", + "name": "Jennifer Chang", + "position": "Regional Director", + "salary": "$357,650", + "start_date": "2010-11-14", + "office": "Singapore", + "extn": "9239" + }, + { + "id": "28", + "name": "Brenden Wagner", + "position": "Software Engineer", + "salary": "$206,850", + "start_date": "2011-06-07", + "office": "San Francisco", + "extn": "1314" + }, + { + "id": "29", + "name": "Fiona Green", + "position": "Chief Operating Officer (COO)", + "salary": "$850,000", + "start_date": "2010-03-11", + "office": "San Francisco", + "extn": "2947" + }, + { + "id": "30", + "name": "Shou Itou", + "position": "Regional Marketing", + "salary": "$163,000", + "start_date": "2011-08-14", + "office": "Tokyo", + "extn": "8899" + }, + { + "id": "31", + "name": "Michelle House", + "position": "Integration Specialist", + "salary": "$95,400", + "start_date": "2011-06-02", + "office": "Sydney", + "extn": "2769" + }, + { + "id": "32", + "name": "Suki Burks", + "position": "Developer", + "salary": "$114,500", + "start_date": "2009-10-22", + "office": "London", + "extn": "6832" + }, + { + "id": "33", + "name": "Prescott Bartlett", + "position": "Technical Author", + "salary": "$145,000", + "start_date": "2011-05-07", + "office": "London", + "extn": "3606" + }, + { + "id": "34", + "name": "Gavin Cortez", + "position": "Team Leader", + "salary": "$235,500", + "start_date": "2008-10-26", + "office": "San Francisco", + "extn": "2860" + }, + { + "id": "35", + "name": "Martena Mccray", + "position": "Post-Sales support", + "salary": "$324,050", + "start_date": "2011-03-09", + "office": "Edinburgh", + "extn": "8240" + }, + { + "id": "36", + "name": "Unity Butler", + "position": "Marketing Designer", + "salary": "$85,675", + "start_date": "2009-12-09", + "office": "San Francisco", + "extn": "5384" + }, + { + "id": "37", + "name": "Howard Hatfield", + "position": "Office Manager", + "salary": "$164,500", + "start_date": "2008-12-16", + "office": "San Francisco", + "extn": "7031" + }, + { + "id": "38", + "name": "Hope Fuentes", + "position": "Secretary", + "salary": "$109,850", + "start_date": "2010-02-12", + "office": "San Francisco", + "extn": "6318" + }, + { + "id": "39", + "name": "Vivian Harrell", + "position": "Financial Controller", + "salary": "$452,500", + "start_date": "2009-02-14", + "office": "San Francisco", + "extn": "9422" + }, + { + "id": "40", + "name": "Timothy Mooney", + "position": "Office Manager", + "salary": "$136,200", + "start_date": "2008-12-11", + "office": "London", + "extn": "7580" + }, + { + "id": "41", + "name": "Jackson Bradshaw", + "position": "Director", + "salary": "$645,750", + "start_date": "2008-09-26", + "office": "New York", + "extn": "1042" + }, + { + "id": "42", + "name": "Olivia Liang", + "position": "Support Engineer", + "salary": "$234,500", + "start_date": "2011-02-03", + "office": "Singapore", + "extn": "2120" + }, + { + "id": "43", + "name": "Bruno Nash", + "position": "Software Engineer", + "salary": "$163,500", + "start_date": "2011-05-03", + "office": "London", + "extn": "6222" + }, + { + "id": "44", + "name": "Sakura Yamamoto", + "position": "Support Engineer", + "salary": "$139,575", + "start_date": "2009-08-19", + "office": "Tokyo", + "extn": "9383" + }, + { + "id": "45", + "name": "Thor Walton", + "position": "Developer", + "salary": "$98,540", + "start_date": "2013-08-11", + "office": "New York", + "extn": "8327" + }, + { + "id": "46", + "name": "Finn Camacho", + "position": "Support Engineer", + "salary": "$87,500", + "start_date": "2009-07-07", + "office": "San Francisco", + "extn": "2927" + }, + { + "id": "47", + "name": "Serge Baldwin", + "position": "Data Coordinator", + "salary": "$138,575", + "start_date": "2012-04-09", + "office": "Singapore", + "extn": "8352" + }, + { + "id": "48", + "name": "Zenaida Frank", + "position": "Software Engineer", + "salary": "$125,250", + "start_date": "2010-01-04", + "office": "New York", + "extn": "7439" + }, + { + "id": "49", + "name": "Zorita Serrano", + "position": "Software Engineer", + "salary": "$115,000", + "start_date": "2012-06-01", + "office": "San Francisco", + "extn": "4389" + }, + { + "id": "50", + "name": "Jennifer Acosta", + "position": "Junior Javascript Developer", + "salary": "$75,650", + "start_date": "2013-02-01", + "office": "Edinburgh", + "extn": "3431" + }, + { + "id": "51", + "name": "Cara Stevens", + "position": "Sales Assistant", + "salary": "$145,600", + "start_date": "2011-12-06", + "office": "New York", + "extn": "3990" + }, + { + "id": "52", + "name": "Hermione Butler", + "position": "Regional Director", + "salary": "$356,250", + "start_date": "2011-03-21", + "office": "London", + "extn": "1016" + }, + { + "id": "53", + "name": "Lael Greer", + "position": "Systems Administrator", + "salary": "$103,500", + "start_date": "2009-02-27", + "office": "London", + "extn": "6733" + }, + { + "id": "54", + "name": "Jonas Alexander", + "position": "Developer", + "salary": "$86,500", + "start_date": "2010-07-14", + "office": "San Francisco", + "extn": "8196" + }, + { + "id": "55", + "name": "Shad Decker", + "position": "Regional Director", + "salary": "$183,000", + "start_date": "2008-11-13", + "office": "Edinburgh", + "extn": "6373" + }, + { + "id": "56", + "name": "Michael Bruce", + "position": "Javascript Developer", + "salary": "$183,000", + "start_date": "2011-06-27", + "office": "Singapore", + "extn": "5384" + }, + { + "id": "57", + "name": "Donna Snider", + "position": "Customer Support", + "salary": "$112,000", + "start_date": "2011-01-25", + "office": "New York", + "extn": "4226" + } +] \ No newline at end of file diff --git a/doxygen-awesome/doxygen-awesome-tables.css b/doxygen-awesome/doxygen-awesome-tables.css new file mode 100644 index 0000000..816242d --- /dev/null +++ b/doxygen-awesome/doxygen-awesome-tables.css @@ -0,0 +1,23 @@ +.dt-input { + background-color: var(--page-background-color) !important; +} + +div.dt-container .dt-paging .dt-paging-button.disabled.first, +div.dt-container .dt-paging .dt-paging-button.disabled.first:hover, +div.dt-container .dt-paging .dt-paging-button.disabled.first:active, +div.dt-container .dt-paging .dt-paging-button.disabled.previous, +div.dt-container .dt-paging .dt-paging-button.disabled.previous:hover, +div.dt-container .dt-paging .dt-paging-button.disabled.previous:active, +div.dt-container .dt-paging .dt-paging-button.disabled.next, +div.dt-container .dt-paging .dt-paging-button.disabled.next:hover, +div.dt-container .dt-paging .dt-paging-button.disabled.next:active, +div.dt-container .dt-paging .dt-paging-button.disabled.last, +div.dt-container .dt-paging .dt-paging-button.disabled.last:hover, +div.dt-container .dt-paging .dt-paging-button.disabled.last:active +{ + color: var(--page-secondary-foreground-color) !important; +} + +table.dataTable>tbody>tr { + background-color: var(--page-background-color) !important; +} \ No newline at end of file diff --git a/doxygen-awesome/doxygen-awesome-tables.js b/doxygen-awesome/doxygen-awesome-tables.js new file mode 100644 index 0000000..bc4404d --- /dev/null +++ b/doxygen-awesome/doxygen-awesome-tables.js @@ -0,0 +1,103 @@ +function waitForElement(selector) { + return new Promise(resolve => { + if (document.querySelector(selector)) { + return resolve(document.querySelector(selector)); + } + + const observer = new MutationObserver(mutations => { + if (document.querySelector(selector)) { + observer.disconnect(); + resolve(document.querySelector(selector)); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + }); +} + +class DoxygenAwesomeTables { + static marker = 'datatable'; + + static replaceElement(element, name) { + let chart_container = document.createElement('table'); + chart_container.id = name; + element.replaceWith(chart_container); + } + + /** + * DoxygenAwesomeTables.detailHandler("container_name", (row) => { return "content"; }); + * @param {str} table Table name + * @param {function} detail_fnc + */ + static detailHandler(table, detail_fnc) { + waitForElement(`#${table} tbody`).then((_) => { + $(`#${table} tbody`).on('click', 'td.dt-control', function() { + const tr = $(this).closest('tr'); + const row = $(`#${table}`).DataTable().row(tr); + + if (row.child.isShown()) { + row.child.hide(); + } else { + row.child(detail_fnc(row.data())).show(); + } + }); + }); + } + + static jumpTo(table, search_fnc) { + $(`#${table}`).DataTable().row(search_fnc).select().show().draw(false); + } + + static init() { + $(() => { + const images = document.getElementsByTagName('img'); + for (const image of Array.from(images)) { + if (!image.alt.startsWith(DoxygenAwesomeTables.marker)) { + continue; + } + + const name = image.alt.split('\n', 1)[0] + .slice(DoxygenAwesomeTables.marker.length) + .trim(); + const data_src = image.src; + + // create container + DoxygenAwesomeTables.replaceElement(image.parentElement, name); + + $.getJSON(data_src, (settings) => { + return $(`#${name}`).DataTable(settings); + }); + } + const fragments = document.getElementsByClassName('fragment'); + for (const fragment of Array.from(fragments)) { + fragment.querySelectorAll('.lineno, .ttc') + .forEach((node) => {node.remove()}); + let {textContent} = fragment; + textContent = textContent.trim(); + + if (!textContent.startsWith(DoxygenAwesomeTables.marker)) { + continue; + } + + let [name] = textContent.split('\n', 1); + const data = textContent.slice(name.length); + name = name.slice(DoxygenAwesomeTables.marker.length).trim(); + + DoxygenAwesomeTables.replaceElement(fragment, name); + let config = JSON.parse(data); + if (typeof config.data === 'string' || config.data instanceof String) { + // string-like data => need to fetch + $.getJSON(config.data, (settings) => { + config.data = settings; + return $(`#${name}`).DataTable(config); + }); + } else { + $(`#${name}`).DataTable(config); + } + } + }) + } +}