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

Re: [Clip] Batch HTML Tidy

Expand Messages
  • Jeffery Scism
    I had asked this question last year and have several clips (that I never got to work) that were sent to me. Here is the one I saved, but never got back to:
    Message 1 of 3 , Oct 6, 2005
    • 0 Attachment
      I had asked this question last year and have several clips (that I never
      got to work) that were sent to me.

      Here is the one I saved, but never got back to:


      ^!Continue Opens all files in a folder, Tidies HTML coding. Continue?

      ^!ClearVariables
      ^!Set %Folder%=^?{(T=D)&Browse: full path, end in
      backslash=^$GetValue(DirStuff:Browse)$}; %Drop%=^?{&Drop down: full
      path, end in backslash=_If used, Browse is ignored, may enter path
      manually^=1|^$GetValue(DirStuff:Path1)$|^$GetValue(DirStuff:Path2)$|^$GetValue(DirStuff:Path3)$|^$GetValue(DirStuff:Path4)$|^$GetValue(DirStuff:Path5)$|^$GetValue(DirStuff:Path6)$|^$GetValue(DirStuff:Path7)$|^$GetValue(DirStuff:Path8)$|^$GetValue(DirStuff:Path9)$};
      %Subs%=^?{Do su&bfolders=Yes^=+|_No^=}; %Type%=^?{(H=10)File &Types,
      wildcards OK: *.txt or *.*htm*;*.txt=All Files^=*.*|_Html
      Only^=*.*htm*|Text Only^=*.txt|Html &
      Text^=*.*htm*;*.txt|Outline^=*.otl|Clipbook Library^=*.clb|Ini^=*.ini};
      %Atrb%=^?{&Attributes, A: Archive, H: Hidden, R: Read-only, S:
      System=_All^=All|AHRS}; %Sort%=^?{&Sort
      order=Date|_Name|Size|Type|UnSorted}; %Rev%=^?{&Reverse sort
      order=Yes^=Rev|_No^=}; %FileCnt%=^?{Get &number of files only=Yes|_No}

      ^!SetHintInfo Opening Files...

      ; Checks to see if Browse or Drop was used
      ^!IfTrue ^%Drop% Skip
      ^!Set %Folder%=^%Drop%

      ^!SetListDelimiter ^p
      ^!SetArray
      %OpenList%=^$GetFiles("^%Subs%^%Folder%";^%Type%;^%Atrb%;^%Rev%^%Sort%)$
      ^!Set %Count%=^%OpenList0%
      ^!Set %Index%=0
      ^!Set %FileCount%=0

      :Loop
      ^!SetScreenUpdate Off
      ^!Inc %Index%
      ^!If ^%Index% > ^%Count% Stats
      ^!IfTrue ^%FileCnt% Skip
      ^!Open ^%OpenList^%Index%%

      ^!KEYBOARD Shift+Ctrl+H
      ^!Menu Tools/Tidy HTML Code 1000
      ^!CLOSE SAVE


      ^!Inc %FileCount%
      ^!Set %FileSize%=^$GetFileSize("^%OpenList^%Index%%")$
      ^!IfTrue ^%FirstPass% Skip_3
      ^!Set %TotalSize%=^$Calc((^%FileSize%+0)/1024)$
      ^!Set %FirstPass%=1
      ^!Goto Skip
      ^!Set %TotalSize%=^$Calc((^%FileSize%/1024+^%TotalSize%))$
      ^!Goto Loop

      :Stats
      ^!IfSame "^%Subs%" "+" Skip_2
      ^!Set %Subs%=No
      ^!Goto Skip
      ^!Set %Subs%=Yes
      ^!If ^%TotalSize% > 1023 Next else Skip_3
      ^!SetWizardTitle ~^$StrFill(" ";33)$http://www.notetab.net^$StrFill("
      ";33)$~
      ^!Info [L]Directory: ^%Folder%^pOpened subfolder(s): ^%Subs%^pFile
      Type(s): ^%Type%^pFile(s) opened: ^%FileCount%^pSorted by:
      ^%Sort%^%Rev%^pAttribute(s) set: ^%Atrb%^pTotal size:
      ^$Calc((^%TotalSize%0)/1024)$Mb^p
      ^!Goto End

      ^!SetWizardTitle ~^$StrFill(" ";33)$http://www.notetab.net^$StrFill("
      ";33)$~
      ^!Info [L]Directory: ^%Folder%^pOpened subfolder(s): ^%Subs%^pFile
      Type(s): ^%Type%^pFile(s) opened: ^%FileCount%^pSorted by:
      ^%Sort%^%Rev%^pAttribute(s) set: ^%Atrb%^pTotal size: ^%TotalSize%Kb^p


      ~~

      Jeffery G. Scism, IBSSG
      Local Coordinator Representative,
      NE/NC Region, USGenWeb Project

      http://usgenweb.org/





      xtx222003 wrote:

      >Hi-- Is there a way to run Tidy HTML on a folder of HTML files in
      >NoteTab? This way I could tidy an entire project, without having to
      >tidy each file individually? I read a post that suggested their was
      >one, and to ask here.
      >
      >
      >Thanks,
      >Corl
      >
      >
      >
      >
      >
      >
      >
      >
      >Fookes Software: http://www.fookes.us, http://www.fookes.com
      >Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
      >
      >Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
    • xtx222003
      Hi Jeff-- Unfortunately that clip didn t work at all. But, thank you very much for trying. Since I posted my question I came up with a good solution that does
      Message 2 of 3 , Oct 6, 2005
      • 0 Attachment
        Hi Jeff-- Unfortunately that clip didn't work at all. But, thank you
        very much for trying.

        Since I posted my question I came up with a good solution that does
        exactly what I wanted to do with tidy -- optimize my XHTML files, but
        without tidy.

        I'm already validating each page with Igor Podlubny's off-line HTML
        Validator clipbook http://www.tuke.sk/podlubny/ov.html, so I know
        each page is valid markup.

        Here are the steps I came up with to optimize my file sizes by 42%:

        Optimized.htm
        9.15 kb original
        5.90 kb <!-- yada, yada --> removed with FARs www.helpware.net/FAR/
        Advanced Find & Replace
        5.82 kb ^T removed with NoteTab Search Disk
        5.39 kb ^P removed with NoteTab Search Disk
        5.36 kb replace > < with >< with NoteTab Search Disk
        ? kb replace "space space" with "space", with NoteTab Search Disk

        The new file is 58% of the original, 42% faster loading! Validates on
        & offline! The valid XHTML is not changed at all, but optimized as
        small as possible. Without wordwrap on, its one very long runon line.

        It only takes 1 or 2 minutes to process my project of 5,000 files
        9.15*5,000=45750
        45750*58%=26535
        45750-26535=19215
        19215kb or 18.76MB savings, or an additional capasity of 2,100 files.

        If someone turns this into a clip, please let me know.

        Best Regards,
        Corl
      Your message has been successfully submitted and would be delivered to recipients shortly.