Compare commits
4 Commits
dev-gang-r
...
master
Author | SHA1 | Date |
---|---|---|
Matthew Butterick | 1fa3f236c2 | 8 months ago |
Matthew Butterick | 1d1cc0df84 | 1 year ago |
Matthew Butterick | c182a30f57 | 2 years ago |
Matthew Butterick | 99c43e6ad3 | 2 years ago |
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
40 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
41 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
42 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
43 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
44 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
45 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
46 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
47 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
48 file
|
|
@ -1,2 +0,0 @@
|
|||||||
#lang pollen
|
|
||||||
49 file
|
|
@ -1,34 +0,0 @@
|
|||||||
#lang br
|
|
||||||
(require racket/path
|
|
||||||
pollen/private/file-utils
|
|
||||||
racket/file)
|
|
||||||
|
|
||||||
(define sources (for/list ([p (in-directory ".")]
|
|
||||||
#:when (path-has-extension? p #"pm"))
|
|
||||||
p))
|
|
||||||
|
|
||||||
#R sources
|
|
||||||
|
|
||||||
(define temp-template (build-path "/Users/MB/Desktop/sources/template.txt"))
|
|
||||||
(define output-paths (map simplify-path (map path->complete-path (map ->output-path sources))))
|
|
||||||
#R output-paths
|
|
||||||
|
|
||||||
(define render-results
|
|
||||||
(eval (with-syntax ([MODNAME (gensym)]
|
|
||||||
[TEMPLATE-PATH-STRING (path->string temp-template)])
|
|
||||||
#`(begin
|
|
||||||
(println 'MODNAME)
|
|
||||||
(module MODNAME pollen/private/gang-helper
|
|
||||||
#:sources #,@(map path->string sources)
|
|
||||||
#:template TEMPLATE-PATH-STRING
|
|
||||||
#:result-id result)
|
|
||||||
(let ()
|
|
||||||
(local-require 'MODNAME)
|
|
||||||
result)))))
|
|
||||||
|
|
||||||
(for ([render-result (in-list render-results)]
|
|
||||||
[output-path (in-list output-paths)])
|
|
||||||
(display-to-file render-result
|
|
||||||
output-path
|
|
||||||
#:exists 'replace
|
|
||||||
#:mode (if (string? render-result) 'text 'binary)))
|
|
@ -1,8 +0,0 @@
|
|||||||
#lang br
|
|
||||||
(require racket/file)
|
|
||||||
|
|
||||||
(for ([i 50])
|
|
||||||
(display-to-file (format "#lang pollen\n~a file" i)
|
|
||||||
(string->path (format "~a.txt.pm" i))
|
|
||||||
#:exists 'replace
|
|
||||||
#:mode 'text))
|
|
@ -1,6 +0,0 @@
|
|||||||
#lang br
|
|
||||||
|
|
||||||
(module setup racket/base
|
|
||||||
(provide (all-defined-out))
|
|
||||||
#;(define render-cache-active #false)
|
|
||||||
#;(define compile-cache-active #false))
|
|
@ -1 +0,0 @@
|
|||||||
here is doc: ◊(cdr doc)
|
|
@ -1,55 +0,0 @@
|
|||||||
#lang racket/base
|
|
||||||
(require (for-syntax racket/base
|
|
||||||
syntax/strip-context
|
|
||||||
"project.rkt"
|
|
||||||
"../setup.rkt")
|
|
||||||
racket/stxparam
|
|
||||||
racket/splicing
|
|
||||||
"external/include-template.rkt"
|
|
||||||
"../cache.rkt"
|
|
||||||
"../pagetree.rkt"
|
|
||||||
"../core.rkt"
|
|
||||||
"../setup.rkt"
|
|
||||||
"../template.rkt"
|
|
||||||
"../top.rkt")
|
|
||||||
|
|
||||||
(provide (rename-out [mb #%module-begin])
|
|
||||||
(except-out (all-from-out racket/base) #%module-begin))
|
|
||||||
|
|
||||||
(define-syntax-parameter doc (λ (stx) (error 'doc-not-parameterized)))
|
|
||||||
(define-syntax-parameter metas (λ (stx) (error 'metas-not-parameterized)))
|
|
||||||
(define-syntax-parameter result (λ (stx) (error 'result-not-parameterized)))
|
|
||||||
|
|
||||||
(define-syntax (mb stx)
|
|
||||||
(syntax-case stx ()
|
|
||||||
;; markup / markdown branch
|
|
||||||
[(_ #:sources SOURCE-PATH-STRING ...
|
|
||||||
#:template TEMPLATE-PATH-STRING
|
|
||||||
#:result-id RESULT-ID)
|
|
||||||
(let ([source-path (syntax->datum (car (syntax->list #'(SOURCE-PATH-STRING ...))))])
|
|
||||||
(with-syntax ([DIRECTORY-REQUIRE-FILES
|
|
||||||
(replace-context #'here (require-directory-require-files source-path))]
|
|
||||||
[DOC-ID pollen-main-export]
|
|
||||||
[METAS-ID pollen-meta-export]
|
|
||||||
[COMMAND-CHAR (setup:command-char source-path)]
|
|
||||||
[(SUBRESULT ...) (generate-temporaries #'(SOURCE-PATH-STRING ...))])
|
|
||||||
#'(#%module-begin
|
|
||||||
DIRECTORY-REQUIRE-FILES
|
|
||||||
(splicing-syntax-parameterize
|
|
||||||
([doc (make-rename-transformer #'DOC-ID)]
|
|
||||||
[metas (make-rename-transformer #'METAS-ID)]
|
|
||||||
[result (make-rename-transformer #'RESULT-ID)])
|
|
||||||
(define SUBRESULT
|
|
||||||
(parameterize ([current-pagetree (make-project-pagetree (current-project-root))]
|
|
||||||
[current-metas (cached-metas SOURCE-PATH-STRING)])
|
|
||||||
(define doc (cached-doc SOURCE-PATH-STRING))
|
|
||||||
(define metas (current-metas))
|
|
||||||
(define here (path->pagenode
|
|
||||||
(or (select-from-metas pollen-here-path-key metas) 'unknown)))
|
|
||||||
(if (bytes? doc) ; if main export is binary, just pass it through
|
|
||||||
doc
|
|
||||||
;; allows `require` in a template
|
|
||||||
(splicing-let-syntax ([require (make-rename-transformer #'local-require)])
|
|
||||||
(include-template #:command-char COMMAND-CHAR (file TEMPLATE-PATH-STRING)))))) ...
|
|
||||||
(define result (list SUBRESULT ...))
|
|
||||||
(provide result)))))]))
|
|
@ -1 +1 @@
|
|||||||
1656292611
|
1710316839
|
||||||
|
Loading…
Reference in New Issue