From f715fe8dd8d8cc6e44f060d9d0b4fc5b91511bcf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Dec 2014 05:53:54 +0530 Subject: [PATCH] FB2 Output: Fix generation of FB2 sections based on a multi-level Table of Contents in the input document. Fixes #1393514 [Incorrect nesting of sections in FB2 output](https://bugs.launchpad.net/calibre/+bug/1393514) --- src/calibre/ebooks/fb2/fb2ml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index 9d41111055..ed7a1a459e 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -435,7 +435,7 @@ class FB2MLizer(object): # Start a new section if necessary if newlevel: - if not (newlevel > self.section_level): + while newlevel <= self.section_level: fb2_out.append('') self.section_level -= 1 fb2_out.append('
')