Error in smart-quote rendering #136

Closed
opened 8 years ago by olivertaylor · 3 comments
olivertaylor commented 8 years ago (Migrated from github.com)

Given this example:

This is a "◊em{simple}" --- test.

The result is:

This is a "<em>simple</em>“—test.

The output should be:

This is a “<em>simple</em>”—test.

Given this example: `This is a "◊em{simple}" --- test.` The result is: `This is a "<em>simple</em>“—test.` The output should be: `This is a “<em>simple</em>”—test.`
mbutterick commented 8 years ago (Migrated from github.com)

The smart-quotes function is “shallow” in the sense that it only looks to the immediate left & right to determine what kind of curly quote to use (I concede this is not ideal, but that is why it’s relegated to the unstable collection.)

The problem with putting an embedded X-expression flush against to the quote is that you’d have to descend into the X-expression to find out if the next character triggers a curly quote. Your example is simple, but in fact the X-expressions could be nested to any depth. This seems potentially messy & slow. Though it’s probably just a matter of trying harder.

The `smart-quotes` function is “shallow” in the sense that it only looks to the immediate left & right to determine what kind of curly quote to use (I concede this is not ideal, but that is why it’s relegated to the `unstable` collection.) The problem with putting an embedded X-expression flush against to the quote is that you’d have to descend into the X-expression to find out if the next character triggers a curly quote. Your example is simple, but in fact the X-expressions could be nested to any depth. This seems potentially messy & slow. Though it’s probably just a matter of trying harder.
mbutterick commented 8 years ago (Migrated from github.com)
#lang pollen/markup
(require pollen/unstable/typography)
(define (root . xs) (smart-quotes `(root ,@xs)))

This is a "◊em{simple}" --- test.
'(root "This is a “" (em "simple") "” --- test.")
```racket #lang pollen/markup ◊(require pollen/unstable/typography) ◊(define (root . xs) (smart-quotes `(root ,@xs))) This is a "◊em{simple}" --- test. ``` ``` '(root "This is a “" (em "simple") "” --- test.") ```
olivertaylor commented 8 years ago (Migrated from github.com)

Thanks!

Thanks!
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#136
Loading…
There is no content yet.