<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Like Wow Online &#187; code</title>
	<atom:link href="http://www.likewowonline.net/tag/code/feed" rel="self" type="application/rss+xml" />
	<link>http://www.likewowonline.net</link>
	<description>A weblog for designers, developers and anyone with an interest in web technology.</description>
	<lastBuildDate>Sat, 03 Oct 2009 07:14:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Generating HTML footnotes with AppleScript and MarsEdit</title>
		<link>http://www.likewowonline.net/web/dev/footnotes-applescript-marsedit.html</link>
		<comments>http://www.likewowonline.net/web/dev/footnotes-applescript-marsedit.html#comments</comments>
		<pubDate>Tue, 15 Jul 2008 01:28:12 +0000</pubDate>
		<dc:creator>Shimone Samuel</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[marsedit]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.likewowonline.net/?p=17</guid>
		<description><![CDATA[
As noted in the intro to Accessible footnotes with HTML and CSS, I&#8217;m using WordPress to manage the contents of this web site. Searching for an offline content manager, I found MarsEdit was consistently praised as both powerful and effective.
Among other features, MarsEdit offers support for AppleScript and intelligent macros using what it calls Text [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/2008/07/flip-flop.jpg" alt="Beach sandal on a tile floor"  /></p>
<p>As noted in the intro to <em><a href="?p=10">Accessible footnotes with HTML and CSS</a></em>, I&#8217;m using WordPress to manage the contents of this web site. Searching for an offline content manager, I found <a href="http://www.red-sweater.com/marsedit/" title="Powerful blog publishing for your Mac">MarsEdit</a> was consistently praised as both powerful and effective.</p>
<p>Among other features, MarsEdit offers support for AppleScript and intelligent macros using what it calls <em>Text Markup</em>. Combining these two features offers users advanced tools for speeding up their workflow.</p>
<p>In the case of footnotes, I&#8217;m using a combination of AppleScript and Text Markup to reduce the process to two simple steps.</p>
<p><span id="more-17"></span></p>
<ol>
<li>AppleScript creates a unique link and identifier from a selection of text.
<pre>&lt;sup&gt;&lt;a href="#63911" id="fn1" title="see footnote 1"&gt;1&lt;/a&gt;&lt;/sup&gt;</pre>
<p>AppleScript then creates the unique identifier and return link. This reference is stored in the clipboard.</p>
<pre>&lt;li id="63911"&gt;FOOTNOTE &lt;a href="#fn1" title="return to article"&gt;↑&lt;/a&gt;&lt;/li&gt;</pre>
</li>
<li>Text Markup creates the footnote code block and includes the stored text from the clipboard.
<pre>&lt;div id="footnote"&gt;
	&lt;ol&gt;
		&lt;li id="63911"&gt;FOOTNOTE &lt;a href="#fn1" title="return to article"&gt;↑&lt;/a&gt;&lt;/li&gt;
	&lt;/ol&gt;
&lt;/div&gt;</pre>
</li>
</ol>
<h3>What the &#8220;Create Footnote&#8221; AppleScript does</h3>
<ol>
<li>Check if MarsEdit has a post window open
<ul>
<li>If no post window is open, return an error message</li>
</ul>
</li>
<li>Check if post window contains a text selection
<ul>
<li>If no text is selected, return an error</li>
</ul>
</li>
<li>Store the selection as a variable</li>
<li>Store the date and time as a unique identifier</li>
<li>Replace the selected text with unique link and identifier</li>
<li>Update clipboard with unique identifier and return link</li>
</ol>
<p class="highlight">Download: <a href="/wp-content/demos/code/Create Footnote.scpt">Create Footnote Applescript</a></p>
<h3>What the &#8220;Footnote Block&#8221; Text Markup does</h3>
<ol>
<li>Generate a block of html code</li>
<li>Add the contents of the clipboard to the code block</li>
<li>Paste the complete code into the post window</li>
</ol>
<p>Text Markup can&#8217;t be exported but the process to create a new macro is simple:</p>
<ol>
<li>Open a post in MarsEdit</li>
<li>Select <em>Edit</em> in the Text Markup menu</li>
<li>Click the &#8220;+&#8221; symbol in the window that opens</li>
<li>Name your new macro &#8220;Footnote Block&#8221;</li>
<li>Enter the following Text Markup into the <em>Opening</em> field and click &#8220;Ok&#8221;</li>
</ol>
<h4>Footnote Block macro</h4>
<pre>&lt;div id="footnote"&gt;
	&lt;ol&gt;
		#pastetext#
	&lt;/ol&gt;
&lt;/div&gt;</pre>
<h3>Generating footnotes with AppleScript and MarsEdit</h3>
<p>Part 1: Setup</p>
<ol>
<li><a href="/wp-content/demos/code/Create Footnote.scpt">Download the <em>Create Footnote</em> Applescript</a>.</li>
<li>Copy the file to your MarsEdit/Scripts folder (to find the folder, click the AppleScript icon in MarsEdit and select &#8220;Open Scripts Folder&#8221;).</li>
<li>Create the <em>Foonote Block</em> macro in MarsEdit using the instructions above.</li>
</ol>
<p>Part 2: Usage</p>
<ol>
<li>Open a post in MarsEdit and make a text selection.</li>
<li>Choose &#8220;Create Footnote&#8221; from the AppleScript menu.</li>
<li>Move the cursor to a new location and select &#8220;Footnote Block&#8221; from the Text Markup menu.</li>
<li>To create additional footnotes, skip the Text Markup step and paste the stored clipboard item in the ordered list.</li>
</ol>
<h3>Demo</h3>
<p>This demo video shows how AppleScript and MarsEdit is used with the methods above to create HTML footnotes.</p>
<p class="highlight">Watch: <a href="/wp-content/demos/footnotes.html?width=798&amp;height=424" class="thickbox" title="Flash movie showing generated HTML footnotes using AppleScript and MarsEdit">Create Footnote demo video</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.likewowonline.net/web/dev/footnotes-applescript-marsedit.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
