15 Replies Latest reply on Feb 16, 2017 5:04 PM by edgeimpact67

    Extra blank lines in source code

    jefflamonica Level 1

      I have built a website in Dreamweaver CS4 and have a client editing pages in Contribute CS5. Both of us are working on Windows 7, and the site is hosted on Linux. When she makes edits to the page, something is introducing a GAZILLION blank lines in the source code. A typical page for this site is about 380 lines of code. The problem page is now more than 310,000 lines code with 100-200 blank lines between every "real" line of code. What the...?!

       

      I need to know how to stop this and how to remove the blank lines from the source code using Dreamweaver.

       

      The page in question lives here: http://www.alexandercitychamber.com/member-category.html

       

      HELP!!!

       

      Jeff

        • 3. Re: Extra blank lines in source code
          Diane123456 Level 1

          Jeff -- have you found a solution?  I have exactly the same problem except the extra lines are up to over about two million!   The apply source formatting command doesn't work.  The extra blank lines in the source code are all in an editable area in the head section, in front of style definitions the client has added to the page.  augh!

           

          I do not have the exact software the person who has been doing the maintenance is using (they move equipment around).  I think it is Windows 7 and Contribute CS5, but I'll find out asap.

           

          Any help will be greatly appreciated.

           

          Thanks! Diane

          • 4. Re: Extra blank lines in source code
            Diane123456 Level 1

            I am able to remove the blank lines by highlighting them and "cutting" them out... but I need to know how to prevent this from happening.

             

            I've noticed that Contribute does add a few extra lines to the source code when I go in and do the heavy lifting on one of my sites that the client is maintaining... which is annoying but until now has been harmless -- this is simply ridiculous...

             

            What about everyone else?  Have you noticed a lot of extra lines in your source code after you (or your client) edits the page with Contribute?

            • 5. Re: Extra blank lines in source code
              jefflamonica Level 1

              Hello, Diane -

               

              We've got two separate issues here, but I think we have the solution to both.

               

              1. How to stop Contribute from adding blank lines in the code, and

              2. How to clean up a GAZILLION lines of blank code in a document.

               

              First, Number 1. I assume you're working in Dreamweaver. If not, I'm not sure how to guide you. But, when you define a Contribute Site, there is an area to specify administrative roles and permissions. Under each Role, at the bottom, you will see a popup for what kind of server the site is hosted on. The default is Windows. I had to change this to Unix (Linux) to match the hosting of our problem site. Find out what platform your host is using. You will have to specify this under each admistrative Role. After doing this, I had the client make some edits, then I opened the files in Dreamweaver. No new blank lines. I admit, I still have my fingers crossed somewhat.

               

              Okay, now how to clean up your source code and remove blank lines. A developer friend found this on some forum I had not seen. I don't know where, but I am grateful to the person who wrote it. It didn't get all the blank lines in my files, but I think some of the others, which I removed manually, were probably from the client pasting content in from Word. Here's what to do:

               

              1. Open the file in Dreamweaver
              2. Click CTRL + F, or go to EDIT > FIND AND REPLACE
              3. Select "Current document" in "Find In" (You can also select the folder if you have multiple files.
              4. Search in "Source Code"
              5. Check the box labeled "Use regular expression"
              6. Type "[\r\n]{2,}" (without quotes) in "Find"
              7. Type "\n" (without quotes) in "Replace"
              8. Press "Replace All"

               

              The operation chugged for a few minutes with my 301,000-line document. Yours may a take a little longer, but it did work. Good luck!

               

              Jeff

              jefflamonica@monsoondigital.com

              • 6. Re: Extra blank lines in source code
                Diane123456 Level 1

                Thank You So Much Jeff,

                 

                I turned on some music, bit the bullet and deleted those lines <ugh>.   Maybe I'll try the routine your developer friend found on a forum on a backup copy just to test it.

                 

                Yes I'm using Dreamweaver.  I've CS5, but only CS4 for Contribute.   I'm wondering if you're using CS5.   I don't recall seeing server type anywhere.  In my case, all my sites are on Unix servers, so if I saw a Windows server setting I would definitely have changed it. 

                 

                However.... now that you mention this, there is a drop down menu for line break type on the editing screen and the options are Windows, Mac, or Unix.  Could this possibly be the CS4 equivalent?  If so, what is the Mac setting for?  I guess I'll do a little experimenting, but not tonight <big yawn, long day>

                 

                I'll share my results tomorrow

                 

                thanks again,

                 

                Diane

                • 7. Re: Extra blank lines in source code
                  jefflamonica Level 1

                  Hey, Diane -

                   

                  Ouch! You deleted those lines manually? You're braver than me. Testing the Find and Replace script on a backup copy is always a good idea. There are two different types of settings -- one about what a "carriage return" does, and one about server type. To access them, you'll need to...

                   

                  - go to SITE > MANAGE SITES, then choose your site and click EDIT.

                  - on the resulting dialog box, click the ADVANCED tab at the top

                  - on the left of that pane, click CONTRIBUTE

                  - then click the ADMINISTER SITE IN CONTRIBUTE BUTTON

                  - provide the login, if required

                  - after some chugging, it should come up to the Users and Roles dialog box.

                  - for EACH of the roles listed here, you'll have to EDIT ROLE SETTINGS

                  - when you click that button, go to the EDITING pane on the resulting dialog box.

                  - change Paragraph Spacing to "Two lines" (see the screen snap below)

                  - change Line Break Type in the popup at the bottom to whatever your server type is. Mac is in there because they do make servers.

                   

                  contribute-role-settings.jpg

                   

                  This should help prevent the introduction of the blank lines. The Find and Replace script is to help you get rid of the ones Contribute stuck in there on its own.

                  • 8. Re: Extra blank lines in source code
                    JulesN Level 2

                    Oh boy!  Thank you very much for posting this!  You've just saved me tons of work!  I found out that if you change that setting and republish the page, you don't have to do anything else.  It automatically takes the blank lines of code out.

                     

                    Unix doesn't seem to want to stick, and I've never had this issue with any other versions of Contribute.  Is there any way to make this a default setting?  That would be great!

                    • 9. Re: Extra blank lines in source code
                      Dominic_Michael1 Adobe Employee

                      Once you had chosen this setting it should remember the saved setting. You can refer to https://blogs.adobe.com/contribute/2010/06/paragraph_spacing_options_in_a.html for more details on this setting.

                      • 10. Re: Extra blank lines in source code
                        JulesN Level 2

                        Well Dominic,

                         

                        I don't know if this is a Mac thing, or if my settings are completely out of whack, but it doesn't remember my settings at all.  In fact, I have the entire Web collection cs5.5, and my settings don't get remembered on any other program, either.  Don't know if there's an adjustment for that or not.  I'm using Lion, which I think has created some issues that I never had before.  Hmmmmm....

                        • 11. Re: Extra blank lines in source code
                          Dominic_Michael1 Adobe Employee

                          I doubt that user account might have some folder access/permission issue. Can you please try creating new User account in Mac and then verify whether the settings are remembered?

                          • 12. Re: Extra blank lines in source code
                            JulesN Level 2

                            Well, I created a new user account.  Logged in... started up Contribute... set up a couple different Websites, the first one to use the Unix setting, and when I set up the second one, it automatically listed Windows again.

                             

                            I have decided it isn't that important and will just remember to go back in and choose it.  I did rename the preferences files in my normal user account and have seemed to get it to remember last used settings on other programs such as PS.  That's a big deal to me, all by itself!  Maybe that'll stop DW from crashing constantly on me as well!  Really shouldn't have downloaded Lion!!!

                            • 13. Re: Extra blank lines in source code
                              jefflamonica Level 1

                              I was in on this tread earlier (actually started it), found the solution for my problem (above) and have noticed your posts. I'm using Dreamweaver CS4 on Windows 7. In my experience, I've had to set the server type every time I establish a new site. But only have to do it once.

                               

                              Good luck!

                              • 14. Re: Extra blank lines in source code
                                edgeimpact67 Level 1

                                Reference using regular expression and Type "[\r\n]{2,}": I found it is easier to remove the extra line spacings by:
                                1. select from the end of one line to the start of the next, which includes the blank line in between the code.
                                2. Ctrl F to bring up the Find and Replace popup which automatically inserts what you have selected into its Find field.
                                3. Click in the Replace section and then hold the shift key down and press enter. This will give you a new line.
                                4. Click Replace All button.

                                • 15. Re: Extra blank lines in source code
                                  edgeimpact67 Level 1

                                  I am using Windows 10 and Dreamweaver CS5 with websites on Linux. One of my guys is using Windows 10 and Atom as an editor. When he uploads a new file and I download it with Dreamweaver CS5 it has blank lines between every code line. I wrote PHP to display the sections of the file on the server in hex using:

                                  $EicKg = substr(file_get_contents($_SERVER['DOCUMENT_ROOT'].'/Folder/File1.php'),110,50);

                                  echo htmlentities($EicKg, ENT_COMPAT, 'utf-8');

                                  echo '<br />';

                                  echo bin2hex($EicKg);
                                  The hex code showed 0D0A (CR LF) and no extra lines but when downloaded on my computer there are blank lines between every code lines and when hex dumped on my computer it shows 0D0D0A (CR CR LF).
                                  This indicates to me that there is a Dreamweaver bug in downloading from Linux.

                                  HOWEVER when I remove the extra blank lines between the code and upload to the Linux server from my computer and my guy downloads the copy I uploaded then both of us can upload and download and no more blank lines are created.
                                  This indicates to me that Atom is uploading the file in a state that Linux records (maybe that it is coming from something other than a Windows computer) and when I upload it, it records that it is a Windows file.
                                  Sounds Mad, I know, but we have repeated it a few times and there is no doubt about what is happening. It is annoying and frustrating. We have checked Atom configuration and Dreamweaver configuration and cannot find how to stop this happening.