5 Replies Latest reply on Jul 31, 2007 11:34 AM by Cro1410

    needless inline styles and span tags

    Catfish Tales
      OS: Win XP SP 2
      Product: RoboHelp HTML 6
      Output: WebHelp

      I am finding some instances of needless inline styles and span tags in some topics in a project. Around these problematic instances are plenty of instances that have no problem. I used non-problematic instances as guides for correcting the problematic instances. Fortunately, RH hasn't overwritten any of my corrections.

      I am concerned about the insertion of needless inline styles and span tags at two levels. First, I see them as indicators of inconsistency. Whether the inconsistency is in myself or in RH, I don't know (but I want to eliminate it). Second, needless code is wasteful (esp., wastes time in code view).

      Has anybody seen this before? Does anyone know or suspect a cause?

      SAMPLE 1
      RH6 created: <p><span><span style="font-weight: normal;">blah blah yaddi yaddi</span></span></p>
      I corrected: <p>blah blah yaddi yaddi</p>

      SAMPLE 2
      RH6 created: <p style="font-weight: normal;"><span style="font-weight: normal;">blah blah yaddi yaddi</span></p>
      I corrected: <p>blah blah yaddi yaddi</p>

      SAMPLE 3
      RH6 created: <p style="font-weight: bold;"><span style="font-weight: bold;">blah blah yaddi yaddi</span></p>
      I corrected: <p style="font-weight: bold;"><>blah blah yaddi yaddi</p>
        • 1. Re: needless inline styles and span tags
          Peter Grainge Adobe Community Professional (Moderator)
          Yes all seen before. We believe there will be a lot of improvement in the next release.

          Re sample 3, Dreamweaver would write that as below.

          <p><b>blah blah yaddi yaddi</b></p>

          • 2. Re: needless inline styles and span tags
            MergeThis Level 4
            Some of this has to do with how users have applied styles in WYSIWYG mode; for example, if you double click a word (which selects the space after) and apply Bold, then later select the word by dragging the cursor to select only the word (which doesn't select the space after), RH will usually surround the selected characters with "normal" span tags and often leave the bold in place.

            This same type of style formatting might have been repeatedly done in the original form that might have been imported (Word, Frame, etc.). So, then, if you compound the code bloat from an imported file with additional formatting in RH, well you do the math.

            I've seen code wherein a six-word sentence might be saddled with as many as 10-12 SPAN tags and might stretch into 6-7 lines of code!

            However, these are still flat files, not binary; you'd need a ton of extra code to increase the aggregate file size a lot. Heck, your graphics will usually take more room than your topics. One of our child projects has 153 .htm files at 3.25 MB, whereas the aggregate of .gif, .jpg, and .bmp graphics exceed 4 MB. My view has always been this: until the underlying code affects the format I expect to see in my output, I consider extra SPAN and KADOV tags to be nothing but white noise.


            Good luck,
            Leon
            • 3. Re: needless inline styles and span tags
              AmyGfromNZ
              I don't have anything to add to the diagnostic advice, but have a couple of notes on treatment.

              - If you have a lot of files to clean up, you may want to look into an automated solution. I've been very happy with HTML Tidy ( http://tidy.sourceforge.net/).

              - Keeping your HTML under version control (and requiring that authors only check in cleaned HTML, if you have automated cleaning set up) can save a lot of hair-tearing when weirdness suddenly shows up.

              - If you don't like RH-flavored HTML (I don't), do all your authoring outside RH and just use RH for creating the index and TOC and stitching the whole thing together.

              A
              • 4. Re: needless inline styles and span tags
                ewriter Level 1
                I have to add a brava to AmyGfromNZ. I use Dreamweaver and CSS for all of my editing and haven't edited a page in RH for the last 5 years. Browser problems are definitely minimized.

                Andrea
                • 5. Re: needless inline styles and span tags
                  Cro1410 Level 1
                  Also, identifying and removing unnecessary tags may be enhanced by showing the tag list from the view menu. This allows you to not have to work directly in the true code view.
                  Chris