samizdat-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(1) fr.po trivial; (2) automatic URLs for plain text format?


From: boud
Subject: (1) fr.po trivial; (2) automatic URLs for plain text format?
Date: Wed, 29 Nov 2006 05:11:59 +0100 (CET)

hi all,

(1) fr.po

#: cgi-bin/login.rb:23
msgid "Use existing account:"
msgstr "Utiliser le compte existant : "

This should be:
msgstr "Utiliser un compte existant : "


(2) auto-URL patch

On Wed, 29 Nov 2006, Dmitry Borodaenko wrote:

Last but not the least is maintainability. For the number of features it
already has, Samizdat code is really tiny, and it grows slower than
linearly as new features are added. It is well documented from developer
point of view, no one ever complained about it being hard to understand.
Comparison of the "amount of developer time spent to useful
functionality" ratio is also in Samizdat's favor, showing how easy it is
to add new capabilities. And to keep it secure.

Certainly my own experience and intuition agree with this. :)

What do people think of something like the following patch for
"text/plain" articles?

The reason for it is that in typical indymedia cms's, wikis in
general and the mailman archiver, any sequence of characters such as http://some.thing/what/ever gets substituted with an a href link, but it doesn't happen in samizdat-0.5.5.

This auto-URLing is both convenient and helps lower one of the "tech"
barriers for users. It enables people to fairly easily create
intersite links without having to remember any syntax except for the
"http://"; at the beginning.

The patch below is just for illustration purposes - the reg exp probably
needs a bit more work to be more general while avoiding "false positives".

Is there any good reason *not* to do a patch like this? e.g. security?
(Counterargument: since textile and html formats are available, it's hard
to see an obvious security problem.)

i do realise that textile is relativey simple, but writing
 "http://some.url":http://some.url
is still more complicated than typing the URL alone.


My next hypothesis for not doing this is that the message source could
be classified using MIME types or some other standard and so this patch
would create nonstandard content... ?

Counterargument in that case: change the name of the default format
to something like "text/plain-auto-URL" and add "text/plain" as an
additional, non-default format.


Anyway, the patch consists of two gsubs in template.rb.

What do people think?

i realise that this may seem trivial from a software point of view,
i think that from a usability point of view, it's important.



cheers
boud




--- /tmp/s061116/samizdat/lib/samizdat/engine/template.rb       2006-11-16 
02:03:19.000000000 +0100
+++ /usr/lib/ruby/1.8/samizdat/engine/template.rb       2006-11-29 
04:09:28.685170520 +0100
@@ -402,7 +402,7 @@
     html =
       case format
       when 'text/plain'   # inline verbatim text
-        "<pre>#{CGI.escapeHTML(content)}</pre>".gsub(/(https?:\/\/[a-zA-Z\.\-\_\%\/0-9]*)/,'<a 
href="\1">\1</a>')
+        "<pre>#{CGI.escapeHTML(content)}</pre>"
       when 'text/html'   # limited HTML text
         '<div>' + content + '</div>'
       when 'text/textile'   # textile formatted text
@@ -414,7 +414,7 @@
       else   # default text rendering
         CGI.escapeHTML(content).split(/^\s*$/).collect {|p|
           '<p>' + p + "</p>\n"
-        }.join.gsub(/(https?:\/\/[a-zA-Z\.\-\_\%\/0-9]*)/,'<a 
href="\1">\1</a>')
+        }.join
       end
     Samizdat::Sanitize.new(config.xhtml).sanitize(html)
   end




reply via email to

[Prev in Thread] Current Thread [Next in Thread]