This works fine for display, but since my application doesn't know about the relationship between annotations and lyrics, it will be hard to, say, add an interface for updating an individual annotation inline (or at all, really).
and the rest I do with jQuery and the fantastic plugin.
a.inner_html = auto_link(a.inner_html.strip, :all, :target => '_blank')
doc.search("div[@id^='note']").set('class', 'annotation').each do |a|
t.inner_html = t.inner_html.strip
doc.search("a[@href^='#note']").set('class', 'tooltip').each do |t|
doc.at('.lyrics').inner_html = doc.at('.lyrics').inner_html.strip
lyrics = read_attribute('annotated_lyrics')
class Song < ActiveRecord::Base
and then processing it with this method for output:
Kumbaya is a campfire singalong.
"Ma" refers to ladies, generally, and specifically also the woman singing the hook; "Stay in tune" is a musical metaphor: he literally stays in tune with the singer and also in the sense that he has game.
<div class="annotations">
This the realest since 'Kumbaya'</a>
<a href="#note2">She like damn
<a href="#note1">Stay in tune with ma</a>
Anyway, my question is how to model these annotations in my application. Right now, I'm storing the lyrics and annotations as one big blob of HTML in this format:
(Original lyrics censored; to see them)
I just started working on a website that will help people understand what rappers are talking about. Users will see the lyrics to a rap song and they'll be able to click certain lyrics to see an explanation. Here's a screenshot (you can also check out the site itself ):
ruby on rails - How to model interpretations of rap music - Stack Overflow
Комментариев нет:
Отправить комментарий