Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...')
@ 2008-01-14 12:24 Marcus Williams
  2008-01-15  5:20 ` William Morgan
  0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2008-01-14 12:24 UTC (permalink / raw)


---
 lib/sup/modes/reply-mode.rb |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 04018e3..59ffa66 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -9,6 +9,14 @@ class ReplyMode < EditMessageMode
     :list => "Mailing list",
     :user => "Customized"
   }
+  
+  HookManager.register "quoteline", <<EOS
+Generates a quote line "On 1/4/2007, Joe Bloggs wrote:".
+Variables:
+      message: A message object representing the message being replied to
+Return value:
+  A string containing the text of the quote line
+EOS
 
   def initialize message
     @m = message
@@ -115,11 +123,16 @@ protected
   end
 
   def reply_body_lines m
-    lines = ["Excerpts from #{@m.from.name}'s message of #{@m.date}:"] + m.quotable_body_lines.map { |l| "> #{l}" }
+    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
+    lines = [quoteline] + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end
 
+  def default_quoteline m
+    "Excerpts from #{@m.from.name}'s message of #{@m.date}:"
+  end
+
   def handle_new_text new_header, new_body
     old_header = @headers[@type_selector.val]
     if new_header.size != old_header.size || old_header.any? { |k, v| new_header[k] != v }
-- 
1.5.3.7



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...')
  2008-01-14 12:24 [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...') Marcus Williams
@ 2008-01-15  5:20 ` William Morgan
  2008-01-15  9:18   ` Marcus Williams
  0 siblings, 1 reply; 10+ messages in thread
From: William Morgan @ 2008-01-15  5:20 UTC (permalink / raw)


Hi Marcus,

Two small comments:

First, can you please use the Official Commit Log Entry Format(tm) as
detailed on the wiki, so that all the git tools that rely on that
function nicely?

Second:

Excerpts from Marcus Williams's message of Mon Jan 14 04:24:27 -0800 2008:
> +    lines = [quoteline] + m.quotable_body_lines.map { |l| "> #{l}" }

Can we instead do quoteline.split("\n"), so that people can return
multi-line things? Not that I endore that practice, but, de gustibus and
all that.

Other than that looks good.

-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...')
  2008-01-15  5:20 ` William Morgan
@ 2008-01-15  9:18   ` Marcus Williams
  2008-01-15  9:40     ` [sup-talk] [PATCH] Added quoteline hook for reply mode Marcus Williams
  0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2008-01-15  9:18 UTC (permalink / raw)


On 15.1.2008, William Morgan wrote:
> First, can you please use the Official Commit Log Entry Format(tm) as
> detailed on the wiki, so that all the git tools that rely on that
> function nicely?

Sorry missed that - I did try to get git to do something like that but
couldnt figure out how to bend it the way I wanted. Will revert and
resend.

> Excerpts from Marcus Williams's message of Mon Jan 14 04:24:27 -0800 2008:
> > +    lines = [quoteline] + m.quotable_body_lines.map { |l| "> #{l}" }
> 
> Can we instead do quoteline.split("\n"), so that people can return
> multi-line things? Not that I endore that practice, but, de gustibus and
> all that.

No problems (multi-line quote lines... bleurgh)

Marcus


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook for reply mode
  2008-01-15  9:18   ` Marcus Williams
@ 2008-01-15  9:40     ` Marcus Williams
  2008-01-16  1:31       ` William Morgan
  2008-01-16 16:32       ` Grant Hollingworth
  0 siblings, 2 replies; 10+ messages in thread
From: Marcus Williams @ 2008-01-15  9:40 UTC (permalink / raw)


This hook allows a user to configure a quote line for replies. The
default is the standard sup quote line "Excerpts from...". Multiple
lines are allowed.
---
 lib/sup/modes/reply-mode.rb |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 04018e3..9c4b11d 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -9,6 +9,14 @@ class ReplyMode < EditMessageMode
     :list => "Mailing list",
     :user => "Customized"
   }
+  
+  HookManager.register "quoteline", <<EOS
+Generates a quote line "On 1/4/2007, Joe Bloggs wrote:".
+Variables:
+      message: A message object representing the message being replied to
+Return value:
+  A string containing the text of the quote line (can be multi-line)
+EOS
 
   def initialize message
     @m = message
@@ -115,11 +123,16 @@ protected
   end
 
   def reply_body_lines m
-    lines = ["Excerpts from #{@m.from.name}'s message of #{@m.date}:"] + m.quotable_body_lines.map { |l| "> #{l}" }
+    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
+    lines = quoteline.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end
 
+  def default_quoteline m
+    "Excerpts from #{@m.from.name}'s message of #{@m.date}:"
+  end
+
   def handle_new_text new_header, new_body
     old_header = @headers[@type_selector.val]
     if new_header.size != old_header.size || old_header.any? { |k, v| new_header[k] != v }
-- 
1.5.3.7



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook for reply mode
  2008-01-15  9:40     ` [sup-talk] [PATCH] Added quoteline hook for reply mode Marcus Williams
@ 2008-01-16  1:31       ` William Morgan
  2008-01-16 16:32       ` Grant Hollingworth
  1 sibling, 0 replies; 10+ messages in thread
From: William Morgan @ 2008-01-16  1:31 UTC (permalink / raw)


Reformatted excerpts from Marcus Williams's message of 2008-01-15:
> This hook allows a user to configure a quote line for replies. The
> default is the standard sup quote line "Excerpts from...". Multiple
> lines are allowed.

Applied to next. Thanks!

-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook for reply mode
  2008-01-15  9:40     ` [sup-talk] [PATCH] Added quoteline hook for reply mode Marcus Williams
  2008-01-16  1:31       ` William Morgan
@ 2008-01-16 16:32       ` Grant Hollingworth
  2008-01-16 16:39         ` Marcus Williams
  1 sibling, 1 reply; 10+ messages in thread
From: Grant Hollingworth @ 2008-01-16 16:32 UTC (permalink / raw)


* Marcus Williams [Tue Jan 15 04:40:04 -0500 2008]:
> This hook allows a user to configure a quote line for replies. The
> default is the standard sup quote line "Excerpts from...". Multiple
> lines are allowed.

Thanks! I can take that off my to-do list now.

I like Mutt's term "attribution" slightly more than "quoteline".


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook for reply mode
  2008-01-16 16:32       ` Grant Hollingworth
@ 2008-01-16 16:39         ` Marcus Williams
  2008-01-16 21:09           ` William Morgan
  0 siblings, 1 reply; 10+ messages in thread
From: Marcus Williams @ 2008-01-16 16:39 UTC (permalink / raw)


On 16.1.2008, Grant Hollingworth wrote:
> I like Mutt's term "attribution" slightly more than "quoteline".

:) I only called it quoteline because I couldnt think of a term for
it. "attribution" is much nicer.

Marcus


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] Added quoteline hook for reply mode
  2008-01-16 16:39         ` Marcus Williams
@ 2008-01-16 21:09           ` William Morgan
  2008-01-17 17:49             ` [sup-talk] [PATCH] renamed "quoteline" hook to "attribution" Grant Hollingworth
  0 siblings, 1 reply; 10+ messages in thread
From: William Morgan @ 2008-01-16 21:09 UTC (permalink / raw)


Reformatted excerpts from Marcus Williams's message of 2008-01-16:
> :) I only called it quoteline because I couldnt think of a term for
> it. "attribution" is much nicer.

Patches welcome! :)

-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] renamed "quoteline" hook to "attribution"
  2008-01-16 21:09           ` William Morgan
@ 2008-01-17 17:49             ` Grant Hollingworth
  2008-01-22  2:49               ` William Morgan
  0 siblings, 1 reply; 10+ messages in thread
From: Grant Hollingworth @ 2008-01-17 17:49 UTC (permalink / raw)


---
 lib/sup/modes/reply-mode.rb |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index 2d05f15..3b8c920 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -10,10 +10,11 @@ class ReplyMode < EditMessageMode
     :user => "Customized"
   }
 
-  HookManager.register "quoteline", <<EOS
-Generates a quote line "On 1/4/2007, Joe Bloggs wrote:".
+  HookManager.register "attribution", <<EOS
+Generates an attribution ("Excerpts from Joe Bloggs's message of Fri Jan 11 09:54:32 -0500 2008:").
 Variables:
-      message: A message object representing the message being replied to
+  message: a message object representing the message being replied to
+    (useful values include message.from.name and message.date)
 Return value:
   A string containing the text of the quote line (can be multi-line)
 EOS
@@ -123,13 +124,13 @@ protected
   end
 
   def reply_body_lines m
-    quoteline = HookManager.run("quoteline", :message => m) || default_quoteline(m)
-    lines = quoteline.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
+    attribution = HookManager.run("attribution", :message => m) || default_attribution(m)
+    lines = attribution.split("\n") + m.quotable_body_lines.map { |l| "> #{l}" }
     lines.pop while lines.last =~ /^\s*$/
     lines
   end
 
-  def default_quoteline m
+  def default_attribution m
     "Excerpts from #{@m.from.name}'s message of #{@m.date}:"
   end
 
-- 
1.5.3.7


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [sup-talk] [PATCH] renamed "quoteline" hook to "attribution"
  2008-01-17 17:49             ` [sup-talk] [PATCH] renamed "quoteline" hook to "attribution" Grant Hollingworth
@ 2008-01-22  2:49               ` William Morgan
  0 siblings, 0 replies; 10+ messages in thread
From: William Morgan @ 2008-01-22  2:49 UTC (permalink / raw)


Applied, thanks. Anyone tracking next with a quoteline hook, you will
have to rename the file.

-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-01-22  2:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-14 12:24 [sup-talk] [PATCH] Added quoteline hook. This allows you to specify how the text above the quoted email should look (Normally 'Excerpts froms...') Marcus Williams
2008-01-15  5:20 ` William Morgan
2008-01-15  9:18   ` Marcus Williams
2008-01-15  9:40     ` [sup-talk] [PATCH] Added quoteline hook for reply mode Marcus Williams
2008-01-16  1:31       ` William Morgan
2008-01-16 16:32       ` Grant Hollingworth
2008-01-16 16:39         ` Marcus Williams
2008-01-16 21:09           ` William Morgan
2008-01-17 17:49             ` [sup-talk] [PATCH] renamed "quoteline" hook to "attribution" Grant Hollingworth
2008-01-22  2:49               ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox