Sample Header Ad - 728x90

How to extract table of contents from fb2 book?

0 votes
3 answers
240 views
I have a book in fb2 format. I want to print the table of contents, containing names and numbers of "parts", "chapters", "episodes" and so on. Is there a way I can do this from terminal? There is a similar question, but for epub format . I know fb2 is an xml format. But is there a tool to extract only TOC? They are inside tags `, and `. If there is not, I guess it is possible to make xsl file based on official FB2_to_txt.xsl file. Also maybe ebook-convert could do this? The book that I am working on has the following structure:
fiction
      
        John
        Doe
      
      Fiction Book
      
        

Hello

john, doe, fiction 18.07.2011 en Fb2 Gem 18.07.2011 1.0

John Doe

Fiction Book

Part 1

Some name of Part 1

Chapter 1

Some name of Chapter 1

Episode 1

Line one of the first episode

Line two of the first episode

Line three of the first episode

Episode 2

Line one of the second episode

Line two of the second episode

Line three of the second episode

Part 2

Some name of Part 2

Chapter 3

Some name of Chapter 3

Episode 3

Line one of the third episode

Line two of the third episode

Line three of the third episode

Episode 4

Line one of the fourth episode

Line two of the fourth episode

Line three of the fourth episode

I want to get the following on the output:
Part 1
Some name of Part 1
Chapter 1
Some name of Chapter 1
Episode 1
Episode 2
Part 2
Some name of Part 2
Chapter 3
Some name of Chapter 3
Episode 3
Episode 4
Asked by Ashark (1069 rep)
May 4, 2023, 11:43 PM
Last activity: May 15, 2023, 03:05 PM