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 http://www.smileonmymac.com/TextExpander/ 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’: “https://intranet.mycompany.com%s” % element[‘href’]})
total += 1

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


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.

https://spuder.wordpress.com/2013/07/24/macjournal-using-code-blocks/