aboutsummaryrefslogtreecommitdiff
path: root/render.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-05 11:56:54 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-05 11:56:54 -0400
commitb063cac571202757ec25f2c6e2a772684b88d4ae (patch)
treebcdd9426a90d8e9bec4498bffd2f97686ba28d41 /render.f90
parent0ade9914918238b8da35e995fe9782a517988ae2 (diff)
downloadLR-87-b063cac571202757ec25f2c6e2a772684b88d4ae.zip
LR-87-b063cac571202757ec25f2c6e2a772684b88d4ae.tar.gz
Added input handling with escaping, all untested.
Diffstat (limited to 'render.f90')
-rw-r--r--render.f9042
1 files changed, 42 insertions, 0 deletions
diff --git a/render.f90 b/render.f90
index b3b1c32..405fff9 100644
--- a/render.f90
+++ b/render.f90
@@ -275,4 +275,46 @@ contains
end subroutine render_link
+ function handle_input(r, url, unit_number)
+ use escaper
+ implicit none
+
+ class(renderer)::r
+ character(*), intent(inout)::url
+ integer, intent(in)::unit_number
+
+ logical::handle_input
+
+ character(1024)::response_line
+ character(256)::answer
+ integer::question_index
+
+ rewind(unit_number)
+
+ read(unit_number, '(A1024)') response_line
+ question_index = 3
+ do while(response_line(question_index:question_index) == " " .or. &
+ response_line(question_index:question_index) == char(9))
+
+ question_index = question_index + 1
+
+ end do
+
+ handle_input = r%request_input(response_line(question_index:len_trim(response_line)), &
+ answer)
+
+ if(handle_input) then
+ question_index = index(url, "?")
+ if(question_index < 1) then
+ url = trim(url)//"?"
+ question_index = len_trim(url)
+ end if
+
+ call escape_string(answer)
+
+ url = url(1:question_index)//answer
+ end if
+
+ end function handle_input
+
end module render