Jump to content

gillibrand

Member
  • Posts

    9
  • Joined

  • Last visited

Reputation Activity

  1. Like
    gillibrand got a reaction from CarlosNZ in Change Case workflow   
    A workflow to change the case of text on the clipboard to uppercase, lowercase, or title case.
     

     
    Source code and more details on GitHub.
    Or just download the workflow.
     
    ---
     
     
    4/19/2013 - Always sorts the case styles in the same order now: lowercase, uppercase, then title case. (Removed the `uid` from results returned to Alfred as supported in Alfred 2.0.3.)   4/6/2013 - Title case will now leave common acronyms as uppercase (HTML, XML, etc.).
  2. Like
    gillibrand got a reaction from palobo in Newlines in script filter feedback "arg"   
    The `arg` part of a script filter's result (the bit passed on as {query}) is oddly an XML attribute instead of an element. This makes it harder to pass on newlines in results--they just turn into spaces. The trick is to escape the newlines as an entity reference like:
     
    Most XML escape functions won't do that automatically, so you probably need to it yourself. Possibly double-quotes too. The best thing I came up with in Python is:
     
    from xml.sax.saxutils import escape safe_arg = escape(any_crazy_text, {'"': '"', '\n': ' '} )  
     
    I'd be happy to hear that there's a simpler way.
     
    Just passing this on since it stumped me at first.
×
×
  • Create New...