View Single Post
Old 11-15-2023, 06:23 AM   #1786
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,212
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by DNSB View Post
Hmmm.... How are you planning on reading the file without opening it. Do you mean without opening it in a viewer? As for doing this automatically? If/when the plugin is created, hopefully it will work with Action Chains.
Action Chains (coupled with Editor Chains) can already do something like this. Editor Chains has an action called "Tag Actions" which allow the user to use criteria to locate tags. So for example, a user can use to search for all h1,h2,h3 tags with a class called "toc", and then count these tags, after which "Action Chains" can update a custom column with the count. Attached below is the two chains that implement this solution (I left out specifying a class name and only specified tag names, you can add yourself with whatever criteria you wish).

As for counting TOC entries, that is also trivial with "Action Chains", although it needs a couple of python lines. Counting toc entries might not be as useful and has its own pitfalls as some have already point out. Also attached below is a chain that implements this solution.

For both solutions you will have to configure the chain to choose the right column name you want to update.

Edit: The first solution also gives the opportunity to exclude or include tags based on their text (regex), so can only add tag the have the names chapter of part, or the tag that end or start with digit, and so on.

Edit2: zip files for the chains are move to these posts: Count headers, Count ToC

Last edited by capink; 11-16-2023 at 09:48 PM. Reason: remove attatchments
capink is offline   Reply With Quote