Dear ML members,
I had the need for a very simple blog-like page within the embedded doc functionality where a th1 page (with enabled th1-doc feature) displays a list with links to all documents within a specific folder. Whenever a new file gets added to the folder the script will automatically pick it up and display a link to it. In addition I added 'index.th1' to the automatically searched index files if TH1-DOC are enabled during compile time. Another use case would be to auto generate some kind of sitemap with a glob mask of e.g. "index.md" providing links to index.md files in all subdirectories. I've added the Readme describing the patch and a screen shot which shows the example code and output. The code can be reviewed at https://server.ac-drexler.de/fossil/fossil/ci/adcc95e64d?sbs=1 Please let me know if you think that could be helpful for a wider audience and/or if you have improvement ideas. Thanks for this cool piece of software and for any feedback you might have :-) Chris
# TH1 command: dir ## Help documentation **TH1 command: dir CHECKIN ?GLOB?** Returns a list containing all files in CHECKIN. If GLOB is given only the files matching the pattern GLOB within CHECKIN will be returned. ## Problem I wanted to have automated listing of documentation files so that there is no need to manually update an index file when new files are added. The idea was to provide a simple blog functionality. It should take a CHECKIN and a GLOB and output a list with all filenames matching the glob on that given checkin. ## Approach I first analyzed the www command "dir" but later found that the cli command "ls" already provides the needed functionality. To stay closer with www interface I created a new TH1 command function "dirCmd" in "th\_main.c" and also copied the "ls\_cmd\_rev" from "checkin.c" as new function "dir\_cmd\_rev". Function calls were adjusted to use the appropriate "th1\_\*" versions and the parameter handling was simplified by stripping out most of the original options (reverse date sorting and extended output). ## Todo * so far the GLOB cannot limited to one specific directory but all files in all sub-directories are listed as well. Maybe the use of LIKE instead of GLOB in the query could help. * additional sorting options as in the original implementation could be added * no test exist yet, not sure how to write proper test for such TH1 commands
_______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users