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

[Clip] Re: [NH] HTML Validator TEMPLATE?

Expand Messages
  • Raymond Fitzgerald
    Hi Brett, ... this...? If I understand what you re after, this sort of thing is a piece of cake in NoteTab! Just create a template file containing this: =
    Message 1 of 5 , Jan 7, 2000
    • 0 Attachment
      Hi Brett,

      You wrote:
      ><html>
      ><head>
      ><title>My Hobbies</title>
      ></head>
      ><body>
      >(The body of the HTML document can go here. This text is not changed by the
      >Template Tool because it is not within the body of the following comment
      >section.)
      ><!-- TEMPLATESTART
      >TEMPLATE=c:\html\footer1.txt
      >NAME=John Doe
      >-->
      ><p><hr>
      >Content by John Doe.
      ></body>
      ></html>
      ><!-- TEMPLATEEND -->
      >
      >Now what I was wondering is if anyone out there could write a clip that did
      this...?

      If I understand what you're after, this sort of thing is a "piece of cake"
      in NoteTab! Just create a template file containing this:
      = DocTemplate "NoName%0.2d" ClipCode
      ^!SetIniFile ^$GetTemplatePath$Names.ini
      ^!IfFalse ^$IsEmpty(^$GetValue("Name")$)$ Skip
      ^!SaveValue Name=Brett
      <head>
      <title>My Hobbies</title>
      </head>
      <body>
      <p><hr>
      Content by ^$GetValue("Name")$
      </body>
      </html>

      In this example, the SaveValue command creates the INI file automatically
      for you and saves only one Name value. (INI contains just this:
      [ClipValues]
      Name="Brett"

      I was trying to duplicate your example exactly. You'd actually want several
      names, right? Otherwise why bother. So this is where there are many
      possibilities:

      1. Have the user type their name each time, as in: Content by ^?[Your
      Name?] (but then you don't need those first three lines in the example
      above)

      2. Prompt the user, but display a default value that they can change. In
      which case the template would look like this:
      = DocTemplate "NoName%0.2d" clipCode
      ^!SetIniFile ^$GetTemplatePath$Names.ini
      ^!IfFalse ^$IsEmpty(^$GetValue("Name")$)$ Skip
      ^!SaveValue Name=_Brett|Jane|Bill
      <head>
      <title>My Hobbies</title>
      </head>
      <body>
      <p><hr>
      ^!Set %Name%=^?{Your name?=^$GetValue("Name")$}
      ^!InsertText ^pContent by ^%Name%^p
      </body>
      </html>
      ^!Savevalue Name=^$SetDefaultValue(^$GetValue("Name")$;^%Name%)$

      3. Or if you have several users on different PCs and a shared drive, then
      you could have each user do a one-time setup so that their local drive knows
      who they are:
      ^!IfFalse ^$IsEmpty(^$GetValue("Name")$)$ Skip
      ^!SaveValue Name=^?{Your name?==_Brett|Jane|Bill}

      And the "content" line becomes just this again:
      Content by ^$GetValue("Name")$
      so there's no prompt to slow things down.

      Hope this help,
      Ray
    • Brett Taylor
      ... From: Raymond Fitzgerald [mailto:raymond.fitzgerald@usaa.com] Sent: Saturday, January 08, 2000 6:27 PM To: Ntb-Clips eGroups Subject: [Clip] Re: [NH] HTML
      Message 2 of 5 , Jan 8, 2000
      • 0 Attachment
        -----Original Message-----
        From: Raymond Fitzgerald [mailto:raymond.fitzgerald@...]
        Sent: Saturday, January 08, 2000 6:27 PM
        To: Ntb-Clips eGroups
        Subject: [Clip] Re: [NH] HTML Validator TEMPLATE?

        > If I understand what you're after, this sort of thing is a "piece of cake"
        > in NoteTab! Just create a template file containing this:

        Hi, sorry if you got the wrong end of the stick, but heres the scoop:

        <html>
        <head>
        <title>My Hobbies</title>
        </head>
        <body>
        (The body of the HTML document can go here. This text is not changed by the
        Template Tool because it is not within the body of the following comment
        section.)
        <!-- TEMPLATESTART
        TEMPLATE=c:\html\footer1.txt
        NAME=John Doe
        -->
        ****** IMPORTANT SPOT NUMBER ONE*******
        <!-- TEMPLATEEND -->

        What I need is a clip that looks at the current document. If it sees this:

        <!-- TEMPLATESTART
        TEMPLATE=c:\html\footer1.txt
        NAME=John Doe
        -->
        ****** IMPORTANT SPOT NUMBER ONE*******
        <!-- TEMPLATEEND -->

        It will replace everything in Important spot number one
        (ie, between the two comments) with the contents of the file stated after
        TEMPLATE=.

        if that file happened to contain:

        <p><hr>
        Content by $"NAME".
        </body>
        </html>

        It would replace $"NAME" with the text after NAME=

        hence the result:

        <html>
        <head>
        <title>My Hobbies</title>
        </head>
        <body>
        (The body of the HTML document can go here. This text is not changed by the
        Template Tool because it is not within the body of the following comment
        section.)
        <!-- TEMPLATESTART
        TEMPLATE=c:\html\footer1.txt
        NAME=John Doe
        -->
        <p><hr>

        Content by John Doe.
        </body>
        </html>
        <!-- TEMPLATEEND -->

        I hope this has cleared it up for ya and any others working on the script.
        If not, check out www.htmlvalidator.com/ and get the lite version and read
        the docs supplied with it. ITS FREE! But its a hassle to load it up cos you
        have to be online to use it.

        I sincerly hope someone got some good stuff out of the script Raymond wrote
        before this mail...

        God Bless,
        - Brett Taylor -
        ______________________________________________________________________
        | _ (!) Brett Taylor <weednix@...>, Nerd for Hire |
        | ( º> ´ http://enkisoft.cjb.net/ icq: 8473626 +64 21-120-3272 |
        | ///\ "Standards are industry's way of codifying obsolescence." |
        | \V_/ dwb |
        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
      • Raymond Fitzgerald
        Hi Brett, ... OK, still a piece of cake ! I ll revise the clip after work and get it back to ya. ... you ... I can imagine! Some of us are running lite
        Message 3 of 5 , Jan 10, 2000
        • 0 Attachment
          Hi Brett,

          >What I need is a clip that looks at the current document. If it sees this:
          >
          ><!-- TEMPLATESTART
          >TEMPLATE=c:\html\footer1.txt
          >NAME=John Doe
          >-->
          >****** IMPORTANT SPOT NUMBER ONE*******
          ><!-- TEMPLATEEND -->
          >
          >It will replace everything in Important spot number one

          OK, still a "piece of cake"! I'll revise the clip after work and get it back
          to ya.

          >I hope this has cleared it up for ya and any others working on the script.
          >If not, check out www.htmlvalidator.com/ and get the lite version and read
          >the docs supplied with it. ITS FREE! But its a hassle to load it up cos
          you
          >have to be online to use it.

          I can imagine! Some of us are running lite version 1.0 which doesn't have
          advertising. Let me know if you'd like that one. But you may also want to
          try v2.55 (http://www.htmlvalidator.com/htmldownload2v255.html), which is an
          old unsupported version and also free. If you do, you may be interested in
          my "Validate" clip, which uses HTMLValidator and which I still need to
          revise to properly run that lite v1.0.

          Later,
          Ray
        • Raymond Fitzgerald
          Hi Brett, ... OK, here s a bare-bones clip that does what I think I understand you want! You ve got hobbies.html and template1.txt filed under c: html . Then
          Message 4 of 5 , Jan 11, 2000
          • 0 Attachment
            Hi Brett,

            >What I need is a clip that looks at the current document. If it sees this:
            >
            ><!-- TEMPLATESTART
            >TEMPLATE=c:\html\footer1.txt
            >NAME=John Doe
            >-->
            >****** IMPORTANT SPOT NUMBER ONE*******
            ><!-- TEMPLATEEND -->
            >
            >It will replace everything in Important spot number one
            >(ie, between the two comments) with the contents of the file stated after
            >TEMPLATE=.
            >
            >if that file happened to contain:
            >
            ><p><hr>
            >Content by $"NAME".
            ></body>
            ></html>
            >
            >It would replace $"NAME" with the text after NAME=

            OK, here's a bare-bones clip that does what I think I understand you want!
            You've got hobbies.html and template1.txt filed under c:\html\. Then run the
            clip and see how it does. If you like it we can enhance it later (show fewer
            screen updates, make it quicker, save/close files automatically, etc.).

            H="Brett template"
            ; 011100/rayfitz
            ^!Open \html\hobbies.html
            ^!Set %DocIndex%=^$GetDocIndex$
            ^!Find "<!-- TEMPLATESTART^pTEMPLATE=" I
            ^!Jump Select_End
            ^!Select EOL
            ^!Open ^$GetSelection$
            ^!Set %Text%=^$GetText$
            ^!Find "$""
            ^!Jump Select_End
            ^!Set %Start%=^$GetRow$:^$GetCol$
            ^!Select EOL
            ^!Find """ BH
            ^!SelectTo ^%Start%
            ^!Set %Var%=^$GetSelection$
            ^!SetDocIndex ^%DocIndex%
            ^!Find "^%Var%="
            ^!Jump Select_End
            ^!Select EOL
            ; long line follows!
            ^!Set
            %Text%=^$StrReplace("$"^%Var%"";"^$GetSelection$";"^%Text%";False;False)$
            ; end of long line
            ^!Find "<!-- TEMPLATEEND -->" I
            ^!Set %End%=^$GetRow$:^$GetCol$
            ^!Jump Select_Start
            ^!Find "-->" B
            ^!Jump Select_End
            ^!SelectTo ^%End%
            ^!Replace "^$GetSelection$" >> "^p^%Text%" H
            ; end of clip

            Cheers,
            Ray
          • Brett Taylor
            ... Wow! It handles the files perfectly! The start searching from the start of the document was annoying (solved by a ^!keyboard ctrl-home or something of the
            Message 5 of 5 , Jan 12, 2000
            • 0 Attachment
              > -----Original Message-----
              > From: Raymond Fitzgerald [mailto:raymond.fitzgerald@...]
              > Sent: Wednesday, January 12, 2000 4:44 PM
              > To: 'ntb-clips@egroups.com'
              > Subject: [Clip] Re: [NH] HTML Validator TEMPLATE?
              >
              > OK, here's a bare-bones clip that does what I think I understand you want!
              > You've got hobbies.html and template1.txt filed under c:\html\.
              > Then run the
              > clip and see how it does. If you like it we can enhance it later
              > (show fewer
              > screen updates, make it quicker, save/close files automatically, etc.).

              Wow! It handles the files perfectly!

              The start searching from the start of the document was annoying (solved by a
              ^!keyboard ctrl-home or something of the like), but other than that, I
              eagerly await the fully blown clip!

              Thanks very much! Anyone else think they'll find this clip helpful? Eager
              to find out :)


              God Bless,
              - Brett Taylor -
              ______________________________________________________________________
              | _ (!) Brett Taylor <weednix@...>, Nerd for Hire |
              | ( º> ´ http://enkisoft.cjb.net/ icq: 8473626 +64 21-120-3272 |
              | ///\ "Standards are industry's way of codifying obsolescence." |
              | \V_/ dwb |
              ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
            Your message has been successfully submitted and would be delivered to recipients shortly.