If anyone wants to modify my blog linking commands to work with Markdown, feel free ;-). I'm so used to HTML that I didn't even think to code it in (sorry) and I'd never use it, so I'll leave it up to someone who will...
Brett
On 4. Nov 2006, at 22:24, Brett Terpstra wrote:
If anyone wants to modify my blog linking commands to work with Markdown, feel free ;-). I'm so used to HTML that I didn't even think to code it in (sorry) and I'd never use it, so I'll leave it up to someone who will...
I am at a point where I am thinking we should abstract the output, seeing how many commands we have that generate links.
How do you mean?
On Nov 5, 2006, at 4:49 AM, Allan Odgaard wrote:
On 4. Nov 2006, at 22:24, Brett Terpstra wrote:
If anyone wants to modify my blog linking commands to work with Markdown, feel free ;-). I'm so used to HTML that I didn't even think to code it in (sorry) and I'd never use it, so I'll leave it up to someone who will...
I am at a point where I am thinking we should abstract the output, seeing how many commands we have that generate links.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 5. Nov 2006, at 12:07, Brett Terpstra wrote:
[ abstracting link creation ]
How do you mean?
Well, something like we make a function:
module LinkFactory module_function
def create(url, link_text = url, title = "") case ENV['TM_SCOPE'] when /\btext.html.markdown\b/: "[#{link_text}](#{url})" when /\btext.html\b/: "<a href="#{url}"#{" title="#{title}"" unless title.empty?}>#{link_text}</a>" when … … end end end
Then all the commands which generate links (wrap selection, lucky, wikipedia, link to blog post, etc.) use LinkFactory.create(…) and we just need one version which works nicely with both HTML, Markdown, Textile, and possibly other formats.
That would be soooo cool. Especially for people like me who spend way too much time making linking commands. I'd help you out, but honestly, I've never bothered to learn Markdown or Textile or anything other than HTML and XHTML.
Brett
On Nov 5, 2006, at 6:17 AM, Allan Odgaard wrote:
On 5. Nov 2006, at 12:07, Brett Terpstra wrote:
[ abstracting link creation ]
How do you mean?
Well, something like we make a function:
module LinkFactory module_function def create(url, link_text = url, title = "") case ENV['TM_SCOPE'] when /\btext.html.markdown\b/: "[#{link_text}](#{url})" when /\btext.html\b/: "<a href=\"#{url}\"#{" title=\"#{title}\"" unless
title.empty?}>#{link_text}</a>" when … … end end end
Then all the commands which generate links (wrap selection, lucky, wikipedia, link to blog post, etc.) use LinkFactory.create(…) and we just need one version which works nicely with both HTML, Markdown, Textile, and possibly other formats.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 5. Nov 2006, at 13:25, Brett Terpstra wrote:
That would be soooo cool. Especially for people like me who spend way too much time making linking commands. I'd help you out, but honestly, I've never bothered to learn Markdown or Textile or anything other than HTML and XHTML.
No problem, I will make something probably later today -- it is quite simple, just needs to find the best abstraction.
Probably I should use an environment variable for the format string, so the scope matching is not in the actual LinkFactory, but is indeed done by TextMate by relying on the variable to be set for the various scopes.
Btw: have you taken a quick look at Markdown? Try Markdown → Syntax Cheat Sheet in TextMate -- I find it very hard to write HTML after having adopted Markdown, i.e. you’re really missing out ;)
I just gave it a read-through. It's intriguing, I suppose, but I spend so much time coding HTML in my day to day life that it's second nature to me. And I've got my TextMate so wired for it that everything is just a shortcut away. I'm tend to get so picky about my markup that I get scared about how a once-removed language like Markdown will translate. But I'm probably speaking out of ignorance... I'll give it a whirl and see if my fears are justified ;-).
Brett
Btw: have you taken a quick look at Markdown? Try Markdown → Syntax Cheat Sheet in TextMate -- I find it very hard to write HTML after having adopted Markdown, i.e. you’re really missing out ;)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate