diff --git a/contrib/cont-responder/eval-responder.factor b/contrib/cont-responder/eval-responder.factor index 87d369e331..97f1d02531 100644 --- a/contrib/cont-responder/eval-responder.factor +++ b/contrib/cont-responder/eval-responder.factor @@ -38,6 +38,9 @@ USE: errors USE: strings USE: logic USE: combinators +USE: live-updater +USE: prettyprint +USE: vocabularies : ( stack msg history -- ) #! Create an 'evaluator' object that holds @@ -102,6 +105,47 @@ USE: combinators [ [ [ write-eval-link ] ] ] each ] ; +: with-simple-html-output ( quot -- ) + #! Run the quotation inside an HTML stream wrapped + #! around stdio. +
 [
+    "stdio" get  [
+      call
+    ] with-stream
+  ] 
; + +: html-for-word-source ( word-string -- ) + #! Return an html fragment dispaying the source + #! of the given word. + dup dup + [ + "responder" "inspect" put + [ + [ ] + [ ] + [ ] + [ + + ] + ]
[ "Source" write ]
[ [ see ] with-simple-html-output ]
[ "Apropos" write ] [ "Usages" write ]
[ [ apropos. ] with-simple-html-output ] [ [ usages. ] with-simple-html-output ]
+ ] bind ; + +: display-word-see-form ( url -- ) + #! Write out the html for code that accepts + #! the name of a word, and displays the source + #! code of that word. +
[ + [ + [ + "Enter the name of a word: " write + "see" [ html-for-word-source ] live-search + ] + [ +
[ "" write ]
+ ] + ] vertical-layout + ]
; + : display-last-output ( string -- ) #! Write out html to display the last output. [ @@ -109,12 +153,17 @@ USE: combinators [ ] ]
[
 [ write ] 
]
; + : get-expr-to-eval ( -- string ) #! Show a page to the user requesting the form to be #! evaluated. Return the form as a string. Assumes #! an evaluator is on the namestack. [ [ + [ + [ "Factor Evaluator" write ] + include-live-updater-js + ] [ "Use Alt+E to evaluate, or press 'Evaluate'" paragraph [ @@ -122,6 +171,7 @@ USE: combinators [ "stack" get display-stack ] [ "history" get display-history ] ] horizontal-layout + display-word-see-form "output" get display-last-output ] ]