Loading ...
Sorry, an error occurred while loading the content.

Find Links to "Nonstandard" CSS files

Expand Messages
  • Ray Shapp
    To All, I want to find all HTM or HTML files which contain links to any external style sheet(s) other than plain_black.css or ccars.css . These two style
    Message 1 of 6 , Apr 1, 2011
    • 0 Attachment
      To All,

      I want to find all HTM or HTML files which contain links to any external
      style sheet(s) other than "plain_black.css" or "ccars.css". These two style
      sheets are "standard" in the sense that I adapted them from
      EasyImager<http://www.fookes.com/ezimager/albums.php>(another fine
      Fookes product). "ccars.css" is linked from within over 3,700
      of my web pages, and "plain_black.css" is linked from 98 of my pages. In
      some cases, both style sheets are used in the same web page.

      An earlier webmaster loaded several other style sheets onto the site. He
      also used alternate capitalization in some instances. I'm not sure whether
      he linked to any additional style sheets elsewhere on the server. I'd like
      to find all files that reference these other "nonstandard" style sheets.

      I am using a case-sensitive Regex in the file search tool (Ctrl+D) in NTP to
      examine all the *.html files in the folder on my PC which mirrors one of my
      websites. I rerun the Regex on the *.htm files.

      Multiple variations of the following Regex don't work as desired:

      ^((?!ccars\.css).*)$ ^((?!plain_black\.css).*)$

      I was hoping that the carat preceding each expression would match the .css
      string only if the string is not preceded by one of the standard names, and
      that a hit would occur only if both expressions found a match.

      Multiple variations of the following produced even less promising results:

      \bccars\.css\|plain_black\.css\b

      Please help me develop a Regex that will match all files that contain the
      string "*.css" other than "plain_black.css" and/or "ccars.css".

      I suspect the number of hits will be fairly low, however it might be useful
      to write the fully qualified file names into a new document. I definitely
      don't want Ctrl+D to open the documents it finds. IOW, when I run Ctrl+D
      manually, I use the "confirm" option.

      There are at least two issues here: how to write the Regex, and how to pipe
      the output from file search into a text file.

      Thank you for your help.

      Ray Shapp
      NTP 6.2/fv Win7 Pro SP1 64-bit


      [Non-text portions of this message have been removed]
    • Axel Berger
      ... For both I can reuse things I ve done before. won t suffice, you ll have to loop through and open all your files. The loop is something I reuse
      Message 2 of 6 , Apr 2, 2011
      • 0 Attachment
        Ray Shapp wrote:
        > There are at least two issues here: how to write the Regex, and
        > how to pipe the output from file search into a text file.

        For both I can reuse things I've done before. <Ctrl><D> won't suffice,
        you'll have to loop through and open all your files. The loop is
        something I reuse often. The top adaptation block need not be altered,
        it just makes the follwing wizards quicker to use, if they're already
        pointed in the right direction. The inner adaptation is your current
        task.

        There are two ways of loading CSS that I use, so the first Find looks
        for both. An error means there's no CSS and we can move on to the next
        file. The second find checks the found (and highlighted) .css id it's
        one of your standard ones. If yes (no error) there may be more CSS files
        loaded so search on. If not this is one of the files you're looking for,
        so add it to the list and move on to the next file.

        The clip is not tested but ought to work:



        ; Adapt this part to the task in hand
        ^!Set %varFIL%="F:\Webspace\index.php"
        ^!Set %varPAT%="*.htm*"
        ; End of individual adaptation

        ^!SetWizardLabel "Please define the files to be converted"
        ;^!SetDebug On
        ; Long line start
        ^!Set %varFIL%=^?{(T=O;F="Source
        Files|*.html;*.htm;*.?html;*.xml;*asp;*.css;*.php;*.php3;*.php4")Sample
        file=^%varFIL%}; %varSDR%=^?{(T=L)Include Subdirectories?==_Yes|No};
        %varPAT%=^?{Search Pattern=^%varPAT%}
        ; Long line end
        ^!Set %varPTH%=^$GetPath(^%varFIL%)$
        ^!If "^%varSDR%"="Yes" yessub ELSE nosub
        :yessub
        ^!Set %varFIL%=^$GetFileFirst("+^%varPTH%";"^%varPAT%")$
        ^!Goto loop
        :nosub
        ^!Set %varFIL%=^$GetFileFirst("^%varPTH%";"^%varPAT%")$
        :loop
        ^!IfTrue ^$IsEmpty(^%varFIL%)$ finished
        ;^!Continue ^%varFIL%
        ^!Open "^%varFIL%"

        ; Adapt this part to the task in hand

        ^!Jump TEXT_START
        :more
        ^!Find "(url\(.+\.css\);|HREF=".+\.css">)" RASTI
        ^!IfError done
        ^!Find "(plain_black\.css|ccars\.css)" HRASTI
        ^!IfError NEXT ELSE more
        ^!AppendToFile "E:\Temp\00A.htm" ^$GetDocName$

        ; End of individual adaptation

        :done
        ^!Close ALL
        ^!Set %varFIL%=^$GetFileNext$
        ^!Goto loop
        :finished
        ^!CloseFileFind




        Axel
      • Axel Berger
        ... Why do I always see obvious mistakes just after posting? Apart from the typo, id should be if we want to have each found file in a separate line not
        Message 3 of 6 , Apr 2, 2011
        • 0 Attachment
          Axel Berger wrote:
          > The clip is not tested but ought to work:

          Why do I always see obvious mistakes just after posting?
          Apart from the typo, "id" should be "if" we want to have each found file
          in a separate line not all run together:

          ^!AppendToFile "E:\Temp\00A.htm" ^$GetDocName$^%NL%

          Axel
        • Axel Berger
          ... Ray, as I overwrote my test clip with a new test clip just now I noticed I haven t heard if my solution worked for you. Hope I haven t destroyed your
          Message 4 of 6 , Apr 10, 2011
          • 0 Attachment
            Axel Berger wrote:
            > The clip is not tested but ought to work:

            Ray, as I overwrote my test clip with a new test clip just now I noticed
            I haven't heard if my solution worked for you. Hope I haven't destroyed
            your complete site and you aren't speaking to me any more.

            Axel
          • Ray Shapp
            Hi Axel,
            Message 5 of 6 , Apr 11, 2011
            • 0 Attachment
              Hi Axel,

              <<I haven't heard if my solution worked for you.>>

              I think I asked the wrong question in my original post. My aim is to create
              a template as defined by the EzImager program, but I am confused by the
              interaction between the album settings .INI files, the templates, the CSS
              files that are linked, and the settings that can be entered on the "Web
              Album" tab in EzImager. Greg Chapman gave me some help on the EZImager
              discussion group, but I'm still confused. My history with the classic cars
              site is that I helped my brother direct a third party to set it up about
              five years ago. He gave the maintenance to two other people in succession
              after that. person. The latest person dropped out abruptly last November,
              and since I have been distantly in touch with the site all along, I took it
              over when the other support ended. I recently transferred from a WinXP
              machine to a new PC running Win7, and in the process, I ended up with three
              copies of EzImager on the new PC with various numbers of templates and album
              setting files in the different locations. Some of these files have exactly
              the same names in three different places on this one PC, and their contents
              differ in some cases. It was only after I originated this thread that I
              discovered the the album settins for use with the new template are going
              into a fourth place:

              C:\Users\RAS\AppData\Roaming\Easy Imager\AlbumSettings

              In attempting to prune out some of the redundancies yesterday,I already
              destroyed one album (I hope not more) because EzImager couldn't find an
              essential file. Luckily Eric's error message identified the problem, and I
              was able to recover.

              As I work with the software, I keep seeing various kinds of errors in the
              content of the albums (mix-up among vehicles, bad grammar, duplicate photos,
              stray photos not associated with any album), so I stop to fix those
              problems. Only two of the top level HTML pages pass validation. While
              working to validate one of the pages, I selected the option to replace
              <font> tags with equivalent CSS. The page is working now, but it took two
              days to recover. In the process, I altered one of my "standard" style
              sheets. I added a class with a unique name, so I hope that doesn't affect
              any of the other 3700 web pages that link to that CSS file.

              My brother continues to send updates for the website as vehicles are
              acquired or sold and restoration work continues.

              Beginning April 2, I've resumed lecturing and providing filtered telescopic
              views of the Sun at a local nature center every Saturday.

              I haven't used your clip because of the distractions described above and
              because I don't think I'm ready to deal with the files on the site that link
              to "non-standard" CSS files. My problem is more basic than that, and I'm not
              even sure of what questions to ask. For now, I'll continue trying to build a
              custom template while tending to problems and normal updates that arrive
              continuously. One of the benefits I hope to achieve from working on a custom
              template is a better insight as to the internal operation of the EzImager
              software.

              Ray Shapp


              On Sun, Apr 10, 2011 at 4:12 PM, Axel Berger <Axel-Berger@...> wrote:

              >
              >
              > Axel Berger wrote:
              > > The clip is not tested but ought to work:
              >
              > Ray, as I overwrote my test clip with a new test clip just now I noticed
              > I haven't heard if my solution worked for you. Hope I haven't destroyed
              > your complete site and you aren't speaking to me any more.
              >
              > Axel
              >
              >
              >


              [Non-text portions of this message have been removed]
            • Axel Berger
              ... I don t know that one, but my general impression is, these things take away all your power and freedom, press you into a tight harness, and give very
              Message 6 of 6 , Apr 11, 2011
              • 0 Attachment
                Ray Shapp wrote:
                > the EzImager software.

                I don't know that one, but my general impression is, these things take
                away all your power and freedom, press you into a tight harness, and
                give very little in return.

                The great thing about NoteTab is, imho, that it takes nearly all the
                slog and graft out of doing everything by hand and makes that approach
                downright pleasurable.

                My clip is an example of that. Normally, if you find a mistake or a bad
                choice and have to correct hundreds or thousands of pages and files,
                that can ruin your life for weeks. With NoteTab all it amounts to is
                spending an hour, or two at most (half an hour with experience) on
                devising and testing a clip and then just start that and sit back
                watching it run. I never turn off screen updates, I just love watching
                NoteTab scurrying all over the place with never a breather or a tea
                break, while I just sit there twiddling my thumbs. What bliss.

                Axel
              Your message has been successfully submitted and would be delivered to recipients shortly.