From a12257762adb07cc1f708baed0724921e6dbbf20 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 18 Aug 2011 15:18:15 +0000 Subject: Started cleanup, not complete --- weblog-viewweblog-html.lsp | 58 +++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 16 deletions(-) (limited to 'weblog-viewweblog-html.lsp') diff --git a/weblog-viewweblog-html.lsp b/weblog-viewweblog-html.lsp index a03c3e6..5aaabea 100644 --- a/weblog-viewweblog-html.lsp +++ b/weblog-viewweblog-html.lsp @@ -1,6 +1,31 @@ <% local data, viewlibrary, page_info, session = ... %> <% require("viewfunctions")%> -<% require("weblogviewfunctions")%> + +<% +-- Insert a string into another string +function string_insert(value, insert, place) + if place == nil then + place = string.len(value)+1 + end + + return string.sub(value, 1,place-1) .. tostring(insert) .. string.sub(value, place, string.len(value)) +end + +--Highlight occurences of a word in a string +function string_highlight(txtvalue, searchval, fcolour, bcolour) + if txtvalue ~=nil and searchval ~= nil then + sStart = string.find(string.lower(txtvalue),string.lower(searchval)) + if sStart ~= nil then + sEnd = sStart + string.len(searchval) + txtvalue = string.insert(txtvalue,"", sEnd) + txtvalue = string.insert(txtvalue,"", sStart) + end + end + + return txtvalue +end +%> + <% if data.value.focus.value ~= "" then %>