adjust HTML rendering of paragraphs as table cells; avoiding 'p' tags makes cut-and-paste work better
svn: r11998 original commit: 198b05897ba3f89a6dcfdab1273ace7f2cf55644
This commit is contained in:
parent
82b6b41ac3
commit
21f5773171
|
@ -1008,7 +1008,10 @@
|
||||||
(loop (+ n 1) (cdr ds))]
|
(loop (+ n 1) (cdr ds))]
|
||||||
[else n])))])
|
[else n])))])
|
||||||
null))
|
null))
|
||||||
,@(render-flow d part ri #f))
|
,@(if (and (= 1 (length (flow-paragraphs d)))
|
||||||
|
(omitable-paragraph? (car (flow-paragraphs d))))
|
||||||
|
(render-content (paragraph-content (car (flow-paragraphs d))) part ri)
|
||||||
|
(render-flow d part ri #f)))
|
||||||
(loop (cdr ds) (cdr as) (cdr vas) #f)))]))))
|
(loop (cdr ds) (cdr as) (cdr vas) #f)))]))))
|
||||||
`((table ([cellspacing "0"]
|
`((table ([cellspacing "0"]
|
||||||
,@(if need-inline?
|
,@(if need-inline?
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
(define etc "etc.") ; so we can fix the latex space, one day
|
(define etc "etc.") ; so we can fix the latex space, one day
|
||||||
|
|
||||||
(define (to-flow e)
|
(define (to-flow e)
|
||||||
(make-flow (list (make-paragraph (list e)))))
|
(make-flow (list (make-omitable-paragraph (list e)))))
|
||||||
(define spacer (hspace 1))
|
(define spacer (hspace 1))
|
||||||
(define flow-spacer (to-flow spacer))
|
(define flow-spacer (to-flow spacer))
|
||||||
(define flow-empty-line (to-flow (tt 'nbsp)))
|
(define flow-empty-line (to-flow (tt 'nbsp)))
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
(list
|
(list
|
||||||
(make-flow
|
(make-flow
|
||||||
(list
|
(list
|
||||||
(make-paragraph
|
(make-omitable-paragraph
|
||||||
(cons
|
(cons
|
||||||
spacer
|
spacer
|
||||||
(if lang?
|
(if lang?
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
(define (make-line str)
|
(define (make-line str)
|
||||||
(let* ([line (indent (str->elts str))]
|
(let* ([line (indent (str->elts str))]
|
||||||
[line (list (make-element 'tt line))])
|
[line (list (make-element 'tt line))])
|
||||||
(list (make-flow (list (make-paragraph line))))))
|
(list (make-flow (list (make-omitable-paragraph line))))))
|
||||||
(make-table #f (map make-line strs)))
|
(make-table #f (map make-line strs)))
|
||||||
|
|
||||||
(define-syntax-rule (indexed-scheme x)
|
(define-syntax-rule (indexed-scheme x)
|
||||||
|
@ -850,7 +850,7 @@
|
||||||
[(_ spec-id desc ...)
|
[(_ spec-id desc ...)
|
||||||
#'(*defforms (quote-syntax/loc spec-id) null
|
#'(*defforms (quote-syntax/loc spec-id) null
|
||||||
'(spec-id)
|
'(spec-id)
|
||||||
(list (lambda (x) (make-paragraph (list x))))
|
(list (lambda (x) (make-omitable-paragraph (list x))))
|
||||||
null
|
null
|
||||||
null
|
null
|
||||||
(lambda () (list desc ...)))]))
|
(lambda () (list desc ...)))]))
|
||||||
|
@ -963,7 +963,7 @@
|
||||||
(if (= 1 (length content))
|
(if (= 1 (length content))
|
||||||
(let ([paras (append-map flow-paragraphs (car content))])
|
(let ([paras (append-map flow-paragraphs (car content))])
|
||||||
(if (andmap paragraph? paras)
|
(if (andmap paragraph? paras)
|
||||||
(list (make-paragraph (append-map paragraph-content paras)))
|
(list (make-omitable-paragraph (append-map paragraph-content paras)))
|
||||||
(list (make-table style content))))
|
(list (make-table style content))))
|
||||||
(list (make-table style content))))
|
(list (make-table style content))))
|
||||||
|
|
||||||
|
@ -1483,7 +1483,7 @@
|
||||||
(if (and (short-width . < . max-proto-width)
|
(if (and (short-width . < . max-proto-width)
|
||||||
(not immutable?)
|
(not immutable?)
|
||||||
(not transparent?))
|
(not transparent?))
|
||||||
(make-paragraph
|
(make-omitable-paragraph
|
||||||
(list
|
(list
|
||||||
(to-element
|
(to-element
|
||||||
`(,(schemeparenfont "struct")
|
`(,(schemeparenfont "struct")
|
||||||
|
@ -1595,7 +1595,7 @@
|
||||||
(list
|
(list
|
||||||
(make-flow
|
(make-flow
|
||||||
(list
|
(list
|
||||||
(make-paragraph
|
(make-omitable-paragraph
|
||||||
(list
|
(list
|
||||||
(let ([target-maker
|
(let ([target-maker
|
||||||
((if form? id-to-form-target-maker id-to-target-maker)
|
((if form? id-to-form-target-maker id-to-target-maker)
|
||||||
|
@ -1621,7 +1621,7 @@
|
||||||
spacer ":" spacer))))
|
spacer ":" spacer))))
|
||||||
(make-flow (list (if (block? result-contract)
|
(make-flow (list (if (block? result-contract)
|
||||||
result-contract
|
result-contract
|
||||||
(make-paragraph (list result-contract)))))))))))
|
(make-omitable-paragraph (list result-contract)))))))))))
|
||||||
stx-ids names result-contracts))
|
stx-ids names result-contracts))
|
||||||
(content-thunk))
|
(content-thunk))
|
||||||
null))
|
null))
|
||||||
|
@ -1653,7 +1653,7 @@
|
||||||
(list
|
(list
|
||||||
((or form-proc
|
((or form-proc
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(make-paragraph
|
(make-omitable-paragraph
|
||||||
(list (to-element `(,x . ,(cdr form)))))))
|
(list (to-element `(,x . ,(cdr form)))))))
|
||||||
(and kw-id
|
(and kw-id
|
||||||
(eq? form (car forms))
|
(eq? form (car forms))
|
||||||
|
@ -1717,7 +1717,7 @@
|
||||||
(list
|
(list
|
||||||
(if form-thunk
|
(if form-thunk
|
||||||
(form-thunk)
|
(form-thunk)
|
||||||
(make-paragraph (list (to-element form)))))))
|
(make-omitable-paragraph (list (to-element form)))))))
|
||||||
(if (null? sub-procs)
|
(if (null? sub-procs)
|
||||||
null
|
null
|
||||||
(list (list flow-empty-line)
|
(list (list flow-empty-line)
|
||||||
|
@ -2112,7 +2112,7 @@
|
||||||
(list
|
(list
|
||||||
(list (make-flow
|
(list (make-flow
|
||||||
(list
|
(list
|
||||||
(make-paragraph
|
(make-omitable-paragraph
|
||||||
(list (let ([target-maker (id-to-target-maker stx-id #t)]
|
(list (let ([target-maker (id-to-target-maker stx-id #t)]
|
||||||
[content (list (annote-exporting-library
|
[content (list (annote-exporting-library
|
||||||
(to-element stx-id)))])
|
(to-element stx-id)))])
|
||||||
|
@ -2156,7 +2156,7 @@
|
||||||
#f
|
#f
|
||||||
(cons
|
(cons
|
||||||
(list (make-flow
|
(list (make-flow
|
||||||
(list (make-paragraph
|
(list (make-omitable-paragraph
|
||||||
(list (hspace 2)
|
(list (hspace 2)
|
||||||
(case kind
|
(case kind
|
||||||
[(interface) "implements:"]
|
[(interface) "implements:"]
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
[line (or (syntax-line first) 0)])
|
[line (or (syntax-line first) 0)])
|
||||||
(define (finish-line!)
|
(define (finish-line!)
|
||||||
(when multi-line?
|
(when multi-line?
|
||||||
(set! docs (cons (make-flow (list (make-paragraph (reverse content))))
|
(set! docs (cons (make-flow (list (make-omitable-paragraph (reverse content))))
|
||||||
docs))
|
docs))
|
||||||
(set! content null)))
|
(set! content null)))
|
||||||
(define out
|
(define out
|
||||||
|
|
|
@ -141,6 +141,7 @@
|
||||||
[flow ([paragraphs (listof block?)])]
|
[flow ([paragraphs (listof block?)])]
|
||||||
[paragraph ([content list?])]
|
[paragraph ([content list?])]
|
||||||
[(styled-paragraph paragraph) ([style any/c])]
|
[(styled-paragraph paragraph) ([style any/c])]
|
||||||
|
[(omitable-paragraph paragraph) ()]
|
||||||
[table ([style any/c]
|
[table ([style any/c]
|
||||||
[flowss (listof (listof (or/c flow? (one-of/c 'cont))))])]
|
[flowss (listof (listof (or/c flow? (one-of/c 'cont))))])]
|
||||||
[(auxiliary-table table) ()]
|
[(auxiliary-table table) ()]
|
||||||
|
|
|
@ -334,6 +334,15 @@ A @techlink{paragraph} has a list of @tech{elements}.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defstruct[(omitable-paragraph paragraph) ()]{
|
||||||
|
|
||||||
|
Equivalent to a @scheme[paragraph], except that when a table cell
|
||||||
|
contains a single @scheme[omitable-paragraph], then when rendering to
|
||||||
|
HTML, no @tt{p} tag wraps the cell content.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@defstruct[(styled-paragraph paragraph) ([style any/c])]{
|
@defstruct[(styled-paragraph paragraph) ([style any/c])]{
|
||||||
|
|
||||||
The @scheme[style] can be
|
The @scheme[style] can be
|
||||||
|
|
Loading…
Reference in New Issue
Block a user