Quote:
Originally Posted by motherat
Here's a dilemma:
Stripping style attributes from stories dowloaded from fanfiction.net removes some relevant formatting done by the author, for example style="text-align:center;".
However, not stripping style attributes results in preserving some weird and unnecessary padding that the site apparently puts into its div tags by default. (It looks like this: <div class="storytextp" id="storytextp" style="padding:0 0.5em 0 0.5em;">)
Does anyone have a solution? It's not possible to strip style attributes from div tags while preserving them for p tags, is it? 
|
Years ago I made a userscript downloader for FFFnet and ran into this exact issue...FFFnet when adding a story "converts" each paragraph into a new <div> element then moves to the next and so on. Since I could not just strip all using some serious jQuery I was able to make it look for all the elements I wanted to removed then convert the all <div>that made the "paragraphs" into proper <p> elements this solved all my formatting issues.
Now...I would not have any idea how to get this FFF program to do that but I thought that seeing the "logic" I used when doing this in javascript might give you an idea or two...if not just forget all this...lol.