View Single Post
Old 11-16-2023, 09:47 PM   #51
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,118
Karma: 1954138
Join Date: Aug 2015
Device: Kindle
Count chapters by counting headers

This chains are for counting chapters in an epub book and saving the number into a custom column. For this chain to work you will need to have the Editor Chains plugin installed as well.

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 chain 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).

Using this chain, the user has 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.

Note that you will have to configure the chain to choose the right column name you want to update.
Attached Files
File Type: zip Count_headers.zip (860 Bytes, 198 views)

Last edited by capink; 11-24-2023 at 04:08 AM.
capink is offline   Reply With Quote