Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2018
    Posts
    3

    Default Ignore new line between PHP tags

    Hi,

    I've installed the PHP file type config which is getting me half-way to where I want. Example differences I wan to ignore are: -

    PHP Code:
    <?php
    /*================ Software Name ================
      = (c)2003-2017 My Co. Ltd.                    =
      = All Rights Reserved                         =
      = Redistribution of this file is prohibited.  =
      = http://www.mysite.com/                      =
      ==============================================*/
    ?><?php
    vs

    PHP Code:
    <?php
    /*================ Software Name ================
      = (c)2003-2018 My Co. Ltd.                    =
      = All Rights Reserved                         =
      = Redistribution of this file is prohibited.  =
      = http://www.mysite.com/                      =
      ==============================================*/
    ?>
    <?php
    The year difference in the comments is ignored, but note the new line between the closing PHP tag and the opening PHP tag - I'd like this to be ignored as well. If all there is is whitespace and / or new lines between these, they can be safely ignored as well.

    How do I add that to the file type settings?

    Also - how do I automatically check the contents when opening folders for comparison? I get the quick check results, but I'd rather get a full rules based comparison by default.

    Thanks in advance!

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,826

    Default

    Hello,

    The quick answer is to use HTML Tidied additional file format to reformat the files with normalized whitespace, which you can download here:
    http://www.scootersoftware.com/downl..._moreformatsv4

    Line breaks (or resorted lines) are always considered different, but the external conversion can reformat the files. Please note, any Save would save in the new format with the new line breaks. If this cannot be allowed, please also edit the File Format to prevent editing under the Tools menu -> File Formats, select format, Conversion tab, and in the Loading section enable "Disable editing".

    The file format can use any conversion utility, documentation and example here:
    http://www.scootersoftware.com/suppo...rnalconversion

    To automatically apply this scan when loading folders, edit that folder's Session Settings (or the global defaults for all future Folder Compare sessions) to enable Rules-based comparison. In the Folder Compare's Session menu -> Session Settings, Comparison tab, leave the defaults enabled (timestamp, size, override) and also enable Content Compare: Rules-based.
    http://www.scootersoftware.com/suppo...ferentthensame
    Aaron P Scooter Software

  3. #3
    Join Date
    Sep 2018
    Posts
    3

    Default

    Thanks for the answers.

    I often edit these files and save one of them, so disabling editing wouldn't be good, but I'm afraid I wouldn't 100% trust the conversion utility to keep things correct.

    Is there no way to simply treat: -

    ?><?php

    and

    ?>
    <?php

    as a minor difference? It's always this, not any and all line breaks, that I want to treat as minor. For some reason the author of the software I'm comparing decided at some point to insert the line break, and it's making comparison a nightmare.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,826

    Default

    I'm afraid not; the line break is always important. You can have both File Formats installed, and in the Tools menu -> File Formats dialog, move the new HTML Tidied to be lower in the list than the default HTML format. This way, HTML is used by default (being the topmost associated with your files), and then you can manually pick the conversion utility when needed to compare, and switch back for edits.

    Note that switching formats can be done per pane (clicking the Format's name in the Left or Right upper status bars) or for both pane's (clicking the dropdown arrow next to the Format button in the top toolbar).
    Aaron P Scooter Software

  5. #5
    Join Date
    Sep 2018
    Posts
    3

    Default

    Thanks Aaron. I'll try what you suggest, I do appreciate your help but in practice it is a bit of a convoluted work-around.

    I see from some fairly old posts that adding the option to treat line breaks as minor has been planned for some time - has that idea now been shelved?

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,826

    Default

    Hello,

    Not shelved, but a very large project with various hurdles that are difficult to solve. I'll add your notes/example to the wishlist entry on the subject. In the meantime, if you can find a trustworthy utility (or test HTML Tidy for comfort), normalizing the whitespace/line breaks between files is the best solution for the comparison.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •