This commit is contained in:
Kefei Lu 2018-04-02 11:18:26 -07:00
Родитель ef55708d63
Коммит a67b338dea
2 изменённых файлов: 6 добавлений и 52 удалений

Просмотреть файл

@ -101,13 +101,12 @@ straightfoward: simply run `msbuild` in `src/`, or use your favorite IDE.
The project structure looks like so:
├───doc
├───src
│ ├───schemy // the core schemy interpreter (schemy.dll)
│ ├───examples
│ │ ├───command_server // loading command handlers from schemy scripts
│ │ └───repl // an interactive interpreter (REPL)
│ └───test
└───tools
└───src
├───schemy // the core schemy interpreter (schemy.dll)
├───examples
│ ├───command_server // loading command handlers from schemy scripts
│ └───repl // an interactive interpreter (REPL)
└───test
## Embedding and Extending Schemy

Просмотреть файл

@ -1,45 +0,0 @@
#|
This script evaluates a script file to transform input file content. The transformed output
is displayed to stdout.
This is currently broken because racket IO APIs doesn't strip BOM at the beginning of the file
|#
#lang at-exp racket
(require web-server/templates
racket/cmdline)
(define template-file (make-parameter ""))
(define input-file (make-parameter ""))
(command-line
#:once-each
[("-t" "--template") template
"template file to use. `FILENAME` and `INPUT` variables are available to the template"
(template-file template)]
#:args (input)
(input-file input))
#|
(define (read-content fn)
(define lines (port->lines (open-input-file #:mode 'text (input-file))))
(string-join lines "\n"))
|#
(define (read-content fn)
(port->string (open-input-file fn))
)
(define INPUT (read-content (input-file)))
(define FILENAME (path->string (file-name-from-path (input-file))))
(define ns (make-base-namespace))
(namespace-set-variable-value! 'INPUT INPUT #f ns)
(namespace-set-variable-value! 'FILENAME FILENAME #f ns)
(void
(write-string
(eval
(read
(open-input-file (template-file))) ns)))