You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/quad/quadwriter/markdown.rkt

51 lines
1.6 KiB
Racket

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#lang debug racket/base
(require (for-syntax racket/base)
racket/list
racket/match
quadwriter/core
"tags.rkt"
"font.rkt"
"reader-helper.rkt")
(provide (except-out (all-defined-out) mb)
(rename-out [mb #%module-begin])
#%app #%datum #%top-interaction
(all-from-out "tags.rkt"))
(define rsquo "")
(define rdquo "")
(define lsquo "")
(define ldquo "")
(define hellip "")
(define ndash "")
(define mdash "")
(define-syntax-rule (mb PATH-STRING . STRS)
(#%module-begin
;; stick an nbsp in the strings so we have one printing char
(define strs (match (list . STRS)
[(? null?) '(" ")]
[strs strs]))
(define qx (root null (add-between strs (list pbr)
#:before-first (list pbr)
#:after-last (list pbr)
#:splice? #true)))
(run qx (path-string->pdf-path 'PATH-STRING))))
(module reader racket/base
(require syntax/strip-context
(only-in markdown parse-markdown)
"reader-helper.rkt")
(provide (rename-out [rs read-syntax]))
(define (rs path-string p)
(define stxs (quad-at-reader path-string p))
(define parsed-stxs
(datum->syntax stxs
(xexpr->parse-tree
(parse-markdown (apply string-append (syntax->datum stxs))))))
(strip-context
(with-syntax ([PATH-STRING path-string]
[PARSED-STXS parsed-stxs])
#'(module _ quadwriter/markdown
PATH-STRING
. PARSED-STXS)))))