Saturday, January 2, 2010

Setting up MacJournal for Code Blocks

So I wanted to get some good syntax highlighting..

        1.        Install SyntaxHighlighter on Blog
        2.        Configure SyntaxHighlighter in MacJournal Blog by turning off Escape < and &gt under the edit server list!
        3.        Create a snippet (pyp) to wrap plain text in <pre class=“brush: python” >)
        4.        Test it out

This is a basic python code block

urldata = urllib.urlopen(settings.PEOPLE_NOTES_BASE_URL).read()
nsoup = BeautifulSoup(urldata)
total = 0
links = nsoup.fetch(‘a’, {‘href’:re.compile(‘\/hr\/.*OpenDocument’)})
for element in links:
if maxNum and total >= maxNum: break
queue.put({u”name”: u”%s” % element.find(text = True),
u’url’: “” % element[‘href’]})
total += 1

for index in range(50):
if maxNum and index >= maxNum: break
thrd = self.ParseUserPage(out_queue, final)
#wait on the queue until everything has been processed

And the important thing is grace..

Continuing this should be fine..

Saturday, January 02, 2010 6:13 AM

1 comment:

spudder said...

Thanks for sharing this, I wish I had know this years ago for my blog.