Displaying articles with tag

Photoslice in Bluecloth and Mephisto

Posted by hank, Sat Jan 05 16:49:00 UTC 2008

So, I found this today, and it is awesome. I wanted it in Bluecloth so I could use it in Mephisto. Here’s how.

First, I needed to make it so I could still do normal images, but turn on coolness if I want. Here’s the goal I came up with for the grammar:


[![](thumburl.jpg)](imageurl.jpg "Scrolly Text at top" "photoslice")

Here’s the first test, with a single image:

And now a set with a namespace:

I did it by simply modifying the regex and image url parsing function in BlueCloth like so:

  InlineLinkRegex = %r{
    \(            # Literal paren
      [ ]*        # Zero or more spaces
      <?(.+?)>?     # URI = $1
      [ ]*        # Zero or more spaces

      (?:         # title
        ([\"\'])    # Opening quote char = $2
        (.*?)     # Title = $3
        \2        # Matching quote char
      )?          # Title is optional
      [ ]*        # Zero or more spaces
      (?:         # rel
        ([\"\'])    # Opening quote char = $2
        (.*?)     # rel = $5
        \4        # Matching quote char
      )?          # rel is optional
    \)
    }x

    # and later...

        # ...or for an inline style second part
        elsif @scanner.scan( InlineLinkRegex )
          url = @scanner[1]
          title = @scanner[3]
          rel = @scanner[5]
          @log.debug "  Found an inline link to %p" % url

          text += %{<a href="%s"} % escape_md( url )
          if title
            title.gsub!( /"/, "&quot;" )
            text += %{ title="%s"} % escape_md( title )
          end
          if rel
            rel.gsub!( /"/, "&quot;" )
            text += %{ rel="%s"} % escape_md( rel )
          end

I also added the following to my Mephisto theme layout, in the head section:


   <!-- Photoslice -->
   <link rel="stylesheet" type="text/css" href="/javascripts/photoslice/style.css" />
   {{ "photoslice/functions.js" | javascript }} 

Once again, Ruby is awesome. And so is Markdown.

Tags:

Tracking my workouts on cool charts

Posted by hank, Tue Nov 06 00:15:00 UTC 2007

I decided today that I wanted to track my calories burned per day on a nice line graph. I did it, and I think I will continue. The total is automatically calculated by the PHP data source. This was made using my Mephisto Plugin for Open Flash Charts.

Tags:

New Mephisto Post Pinger List

Posted by hank, Sat Oct 06 13:06:00 UTC 2007

Today I found a nice ping list for Wordpress. I decided to put it into my copy of the Mephisto Post Pinger plugin. I’m not sure if it works yet, but this post will give it a good test.

Continue Reading Tags:

Flash Video Player for Mephisto

Posted by hank, Sun Aug 12 22:50:00 UTC 2007

So I made this awesome filter for Mephisto that allows you to easily embed flash videos in your post. May require tweaking if using a non-standard URL root.

It’s as simple as this:


<macro:flash>/assets/2007/8/13/party.flv</macro:flash>

Or, you can make it complicated:


<macro:flash width="640" height="480">/assets/2007/8/13/party.flv</macro:flash>

Which ends up like this:

Installation

Install it from your mephisto directory:


./script/plugin install -x https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_video

Voila! Firebreathing!

Tags:

Mephisto Post Pinging Improvement

Posted by hank, Sat Aug 11 11:47:00 UTC 2007

So, the post pinger plugin was pretty awesome, but it was pinging RubyCorner and Rubylicious when it shouldn’t have. I made it tag-based so it checks a category of feed URL and decides whether the tag matches the category. Right now, I’ve only implemented it for the ruby tag since that’s all I should need for these two services.

ArticlePingObserver::SERVICES = [
  { :url => "http://rpc.pingomatic.com/", :type => :xmlrpc },
  { :url => "http://rpc.weblogs.com/pingSiteForm", :type => :rest },
  { :url => "http://pingomatic.com/ping/", :type => :weblogs_get, :extras => [ "chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_feedster=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on" ] },
  { :url => "http://rpc.technorati.com/rpc/ping", :type => :xmlrpc },
  { :url => "http://ping.syndic8.com/xmlrpc.php", :type => :xmlrpc },
  { :url => "http://rubycorner.com/ping/xmlrpc/e49ac4608c88606f75486e6da3da34de6527622a", :type => :xmlrpc, :category => 'ruby' },
  { :url => "http://rubylicio.us/ping/xmlrpc", :type => :xmlrpc, :category => 'ruby' }
}

There’s the array of services. Now the magic:

    SERVICES.each do |sinfo|
      if sinfo[:category] == "ruby"
        next unless article.tags(true).collect{|t|t[:name]}.join(" ") =~ /\bruby\b/
      end

Very simple. It should work on the basis of the service categories and the tags. We’ll see. Hopefully this post will end up on RubyCorner.

Tags:

Test of XMLRPC in Mephisto

Posted by hank, Tue Apr 24 02:57:47 UTC 2007

This is a simple test of flog with Mephisto.

Tags:

Test of XMLRPC in Mephisto

Posted by hank, Tue Apr 24 02:57:47 UTC 2007

This is a simple test of flog with Mephisto.

Tags:

Mephisto Comment Notification Mod

Posted by hank, Mon Mar 19 15:35:00 UTC 2007

I wanted to be able to click a link in my email to see the comment it talked about. So, I modified Luke Redpath’s Comment Notification Plugin to give that to me. First, I had to do some script/console action:


>> s = Site.find_first
=> #<Site:0xb747e014 @attributes={"current_theme_path"=>"wibbish-mephisto",#...
#...
>> s.host='www.ralree.info'
=> "www.ralree.info"
>> s.save
=> true
>> quit

Next, I did a small model modification:


# app/models/article.rb, in the public section
  def full_external_link
    ["http://", site.host, full_permalink].join("")
  end

And a slight test:


Loading production environment.
>> Article.find_first.full_external_link
=> "http://www.ralree.info/2006/5/21/first-post-what-to-say"

Perfect!

Then, I just modified the view for the email a bit:


# vendor/plugins/mephisto_comment_notification/lib/views/
# comment_notifier/comment_notification.rhtml
A new comment has been posted on your blog for the article '<%= @comment.article.title %>' by <%= @comment.author %> (<%= @comment.author_email %>):            
<%= @comment.article.full_external_link %>

The commenter IP address is <%= @comment.author_ip %>.

Here is the comment that was posted:

"<%= @comment.body %>"

This notification was sent using the Mephisto Comment notification plugin by Luke Redpath.
http://opensource.agileevolved.com/svn/root/rails_plugins/mephisto_comment_notification/trunk
Modified awesomely by Erik Gregg (http://www.ralree.info)

And it’s magic! It totally works!

Tags:

Fixing Mephisto Post Pinger Plugin

Posted by hank, Fri Mar 02 12:56:00 UTC 2007

I wanted some places to get pinged when I posted. I used the mephisto_post_ping plugin, I simply changed the directory structure and class definition around:

Directory Structure


./lib/article_ping_observer.rb
./lib/mephisto_plugins/post_ping.rb
./lib/config.rb
./README
./init.rb

File Changes

init.rb

# $Id$
require 'mephisto_plugins/post_ping'
ActiveRecord::Base.observers << :article_ping_observer

plugin.rb

module Mephisto
  module Plugins
    class PostPinger < Mephisto::Plugin
      author 'Mark Guzman'
      version '$Rev: 82 $'.gsub( "Rev: ", "" )
      notes "Send Weblogs Pings when articles are published"
      homepage "http://hasno.info/2006/11/11/mephisto-plugins"

      class Schema < ActiveRecord::Migration
        def self.install
        end

        def self.uninstall
        end
      end

    end
  end
end

That’s all I changed. This is my first post since the change, so I’ll see if it works. If not, at least Mephisto doesn’t blow up on startup.

Results

Well,


unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info
unable to send xmlrpc weblog ping -> http://www.ralree.info

Seems like a couple might have worked. I’ll keep working on it. But, at least it gets called.

RubyCorner worked!

Tags: