Question / Feature exploration re Shorthand

  • wavesource, 9th Feb 2012 4:46 pm

    Hi

    I was tweaking my shorthand just now, and was looking at the {{-}} tokens that are used to populate the shorthand variables with descriptors.

    Would it be possible at all to have tokens automatically populated from system clipboard? eg. {{-clipboard}} or {{-paste}}.

    I have constructed quite a tree of extremely useful shorthand snippets which I use pretty much exclusively over keyboard shortcuts, save line returns and non-breaking white space tags/entities etc. but if there was the ability to also use the last copied item on the clipboard as an automatically injected constant into such tokens in a shorthand snippet, then that would be dreamy.

    For example, one snippet that is useful for trudging through client's HTML requirements I use is:

    @begin-s "aha" [fields=1, movecursor=1]

    <a href="http://{{-url|URL|URL}}">{{-}}</a>

    @end-s "aha"

    ('aha' is my own nomenclature for 'a' (anchor) 'h' (requires http://) 'a' (assymetrical - ie. the client likes the links to not display "http://" in the visible text, and all the text they send me doesn't have "http://" in the URLs, so I have to add these. I invoke 'aha' as shorthand after cutting the URL out of their text, which gives me the tag preprended with the "http://" but leaves the actual visible text to be pasted clean, so I then tab through and paste the URL in and the job's done.

    If the copied string from the clipboard could be injected automatically when the shorthand tag renders to the page in the appropriate fields, then one would be able to convert such things in a simple copy/type shorthand code/hit Ctrl-J operation.

    I know one could construct regex to probably attempt to grapple with this, but sometimes it's a bit too big of a gun to pull out every time you want to clean up some code.

    Thanks for your great work, as usual!

    • HTML-Kit Support, 9th Feb 2012 11:15 pm

      On 2/9/2012 4:46 PM, wavesource wrote:

      Hi

      I was tweaking my shorthand just now, and was looking at the {{-}}
      tokens that are used to populate the shorthand variables with
      descriptors.

      Would it be possible at all to have tokens automatically populated
      from system clipboard? eg. {{-clipboard}} or {{-paste}}.

      You have a good idea here! I can see how automatically including
      clipboard text can come in handy.

      I have constructed quite a tree of extremely useful shorthand
      snippets which I use pretty much exclusively over keyboard shortcuts,
      save line returns and non-breaking white space tags/entities etc. but
      if there was the ability to also use the last copied item on the
      clipboard as an automatically injected constant into such tokens in a
      shorthand snippet, then that would be dreamy.

      For example, one snippet that is useful for trudging through
      client's HTML requirements I use is:

      @begin-s "aha" [fields=1, movecursor=1]

      <a href="http://{{-url|URL|URL}}">{{-}}</a>

      @end-s "aha"

      A quick note about {{-}} before I forget... although "{{-}}" works as a
      field, I'd recommend always including a field name for future
      compatibility. Even if it's something generic like {{-content}}

      ('aha' is my own nomenclature for 'a' (anchor) 'h' (requires
      http://) 'a' (assymetrical - ie. the client likes the links to not
      display "http://" in the visible text, and all the text they send me
      doesn't have "http://" in the URLs, so I have to add these. I invoke
      'aha' as shorthand after cutting the URL out of their text, which
      gives me the tag preprended with the "http://" but leaves the actual
      visible text to be pasted clean, so I then tab through and paste the
      URL in and the job's done.

      Aha! Sounds like you're making great use of Shorthand. Nice!

      If the copied string from the clipboard could be injected
      automatically when the shorthand tag renders to the page in the
      appropriate fields, then one would be able to convert such things in
      a simple copy/type shorthand code/hit Ctrl-J operation.

      I know one could construct regex to probably attempt to grapple with
      this, but sometimes it's a bit too big of a gun to pull out every
      time you want to clean up some code.

      There's something waiting for you in the TreeHouse and it just might
      accept something like the following :)

       <a href="http://{{-url|URL|URL|opt_clipboardtext}}">{{-content}}</a>
      

      Having to include opt_clipboardtext option is probably more verbose than
      you wanted, but let's explore usage scenarios a bit first. Also, this
      adds a more consistent way of including clipboard text in templates and
      snippets as well.

      One of the possible issues though is that you'd probably have to create
      a Shorthand that includes clipboard text and one that doesn't. At least
      in my case, I'm likely to forget that I had copied a big block of text
      ten minutes ago. Without a non-clipboard version of a Shorthand, I'd
      have to blank out the clipboard.

      Thanks for your great work, as usual!

      Oh I appreciate it. It's nice to get feedback and some encouraging words
      now and then :)

      Have fun!

      Chami

      • wavesource, 11th Feb 2012 10:07 pm

        Hi Chami

        Hey, that sounds great. I always have thought shorthand is HTK's killer app, and this clipboarding into the shorthand snippet is brilliant. I tend to cut URLs out before applying shorthand, so I don't think I will have to worry about a slab of non-related code coming in - I also use a clipboard manager (Arsclip on PC - it's just that much less intrusive than others) so between them all, it's something I find very useful.

        And yes, I have many, many custom shorthand entries of my own, never fear.

        • HTML-Kit Support, 12th Feb 2012 8:21 am

          On 2/11/2012 10:07 PM, wavesource wrote:

          Hi Chami

          Hey, that sounds great. I always have thought shorthand is HTK's
          killer app, and this clipboarding into the shorthand snippet is
          brilliant. I tend to cut URLs out before applying shorthand, so I
          don't think I will have to worry about a slab of non-related code
          coming in - I also use a clipboard manager (Arsclip on PC - it's just
          that much less intrusive than others) so between them all, it's
          something I find very useful.

          And yes, I have many, many custom shorthand entries of my own, never
          fear.

          I think HTML-Kit Shorthand is one of the underutilized features so I'm
          glad that you're having fun with it :)

          If you'd like to try out opt_clipboardtext option now, you can get the
          test build from TreeHouse section in your User Assistant account. It'll
          be included in the next general update as well if you'd rather wait.

          Thank you for your feedback!

          Chami

          • wavesource, 13th Feb 2012 8:50 pm

            Hi Chami

            I grabbed the latest build from the treehouse and it's providing the desired effect - absolutely brilliant.

            One thing I note is that even if I set the fields to 0, I still have to tab through the two active sections of the snippet after insertion to turn off the highlighting - that's probably being picky, but I just thought I'd mention it - this is my current snippet, and I find that even with movecursor=0, nothing really changes with the behaviour of the shorthand once injected:

            @begin-s "aha" [fields=0, movecursor=1]

            <a href="http://{{-url|URL|URL|opt_clipboardtext}}">{{-url|URL|URL|opt_clipboardtext}}</a>

            @end-s "aha"

            All of this, by the way, is getting me quite excited about how Kit is shaping up. I know it's not on the programming level, but as a single-guy design studio, I have to process regular web text as well as PHP and javascript, and the "HTML document from plain text" option I'm starting to play with looks extremely useful as well. I do quite a few ebooks when not developing and doing print design, and while automatic ebook exports from design applications work, they still don't compete with hand-coded conversions, so all of these features just help sooooooo much in being able to parse people's provided text into shape, whether it's HTML, XHTML / XML. In fact, with all the recent new additions, I'm sure a buit of regex, shorthand and converting HTML docs from plain text might not do everything a top end design program purports to do.

            Anyway, enough from me - keep up the magic.

Advertisements