(Please see release notes for a description of the above plugin)
Hi everyone...I'm currently working, together with Doitsu, to fix various problems with the above plugin when div tags are used in various formats with the image tag lines.
The current problem -- and the last problem -- that I'm having is that when I run Granny Grump's Irving Washington epub through this plugin I'm still getting one error with this problem which is a missing end </div> tag for just one image only in dual format. All the other images in the ebook which are formatted in exactly the same way are OK. And when I test other ebooks with and without the div tag formatting I never get this problem. So this is both a consistent problem occurring with one image only in one epub and it's also a quirky problem because I can't reproduce this problem in any other epub ebook on test.
I also cannot understand why this missing div tag problem is occurring.
The plugin itself is quite small -- all it does is add the relevant media queries to the selected stylesheet and then dual format all images in the epub HTML files for KF7(in pixels) and KF8(as % values).
Here is the main driver code for the program:
Spoiler:
Code:
def processAllTasks(bk, wdir, t_ids, t_fnames, s_ids, s_fnames):
print('\n -- Processing automatic tasks...')
for fname in t_fnames:
if 'cover.xhtml' in fname or 'TOC.xhtml' in fname:
continue
else:
fname = os.path.join(wdir, fname)
reformatImageLayout(wdir, fname) # put all the possible forms of div/img formatting into a standard input format
reformatSmallImages(wdir, fname) # create two separate img lines to enable dual format for Kindle KF7 and KF7 devices
if options.SYS_EXIT == True:
return(0)
prettifyXHTMLFile(wdir, fname) # prettify the html display
fixBrokenTags(wdir, fname) # fix any broken tags
# now add the media queries to the selected stylesheet
for file in s_fnames:
if file == options.SET_CSS_FNAME:
file = os.path.join(wdir, file)
prettifyCSS1(wdir, file)
addMediaQueries2CSS(wdir, file)
prettifyCSS2(wdir, file)
# write css files back to epub
writeFiles2Epub(bk, wdir, t_ids, t_fnames)
writeFiles2CSS(bk, wdir, s_ids, s_fnames)
return(0)
And here is the main function that does all the dual formatting for the html image lines in GG's ebook(please also note that there is no div tag formatting at all in this function). This function appears to be working without any problems:
Also, both the
reformatDivLayout() and
fixBrokenTags() functions were added after we got the missing div tag problem. Similarly the
prettifyXHTMLFiles() function also has nothing to do with this problem because I've already used this function in all my other plugins without any problems whatsoever. So these functions have nothing to do with the missing div tag problem.
Below you can also download the new version of this plugin(v0.1.5 -- which is only for test purposes only and not released yet) as well as Doitsu's test epub so that you can see the missing div tag problem on Epubcheck for yourself. The test epub by Granny Grump is called Irving,Washington-LegendOfSleepyHollow-illus-Rackham.epub.