olddoc user/dev discussion/patches/bugs/etc
 help / color / mirror / code / Atom feed
* [PATCH] linkify source commands and URLs
@ 2019-01-04 13:59 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-01-04 13:59 UTC (permalink / raw)
  To: olddoc-public

It's common to have gitweb and cgit URLs which are
viewable in the browser AND clonable.  So add links
to encourage follows.
---
 lib/oldweb/_tail.rhtml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/oldweb/_tail.rhtml b/lib/oldweb/_tail.rhtml
index 14fc5a8..e3fada5 100644
--- a/lib/oldweb/_tail.rhtml
+++ b/lib/oldweb/_tail.rhtml
@@ -22,8 +22,11 @@ href="mailto:<%= private_email %>"><%= private_email %></a><%
   end
 
 if url_or_cmd = source_code.shift
+  url_or_cmd = url_or_cmd.sub(%r{\b(https?://\S+)}, "<a\nhref='\\1'>\\1</a>")
 %>
 source code: <%= url_or_cmd %>
-<% source_code.each do |x| %><%= "\t#{x}" %><% end
+<% source_code.each do |x| %><%=
+  %Q{\t#{x.sub(%r{\b(https?://\S+)}, %Q{<a\nhref='\\1'>\\1</a>})}}
+%><% end
 end
 %></pre><% end %>
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-04 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 13:59 [PATCH] linkify source commands and URLs Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/olddoc.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).