paulremo / NRPMHandbook

Repository to store and track the development on the ADS/Matrisk project for developing a jupyter book of the NRPM handbook.
Other
1 stars 1 forks source link

Move searchable tables to jupyter book source #39

Closed paulremo closed 2 years ago

paulremo commented 2 years ago

Searchable tables are currently embedded with iframes as external HTML pages. This works for the web version of the digital handbook but it is problematic for two reasons:

  1. Content is not searchable from the central search feature;
  2. Tables do not show up when document is compiled with LaTeX.

It is, therefore, suggested to transform the existing tables into standard .md tables and connect the table_search.js to the to the HTML tables generated by jupyter-book.

From a quick inspection of the tables that jupyter book creates (e.g., table on this page), this should be possible.

I think the necessary steps to make this work would be:

  1. transform the existing html tables to reStructured tables and include them directly in the .md source. Transformation is possible here. This might need some manual tweaking because we ultimately require list-tables to allow formatting (e.g., different relative column widths);
  2. give each table a unique name, e.g., my-table-12314 (ATTENTION: don't use underscore in name, instructions);
  3. rewrite the searchTable function inside table_search.js to accept a target table argument
  4. Include only the source code for the input field directly above the list-tables directive (<input type="text" class="myInput" id="myInput" onkeyup="searchTableJupyter(this,my-table-12314)" placeholder="Search table...">)

@csxADS: Do you think this is feasible?

paulremo commented 2 years ago

A working test was commited in bb9de59c95330d4699a15835a6b7f740fa6dd134.

paulremo commented 2 years ago

The source of all searchable tables should be moved to the jupyter book .md source files.

csxADS commented 2 years ago

Done during refactoring

paulremo commented 2 years ago

Thanks!