Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support opening and closing delimiters #110

Merged
merged 1 commit into from
Mar 9, 2019
Merged

support opening and closing delimiters #110

merged 1 commit into from
Mar 9, 2019

Conversation

davidchambers
Copy link
Owner

Commit message:

For optimal Transcribe compatibility, conflicts with Markdown syntax must be avoided. Markdown uses GREATER-THAN SIGN (>) at the beginning of each line of a <blockquote>. This conflicts with that character's use to signify doctest input, as in the following example:

//# K :: a -> b -> a
//.
//. This is a paragraph.
//.
//. > This is a block quotation.
//. > It should not be evaluated!
//.
//. ```javascript
//. > K (true) (42)
//. true
//. ```

This commit adds --opening-delimiter and --closing-delimiter options to the command-line interface, enabling the use of Markdown's <blockquote> syntax in source files with delimited doctest blocks.

The following options would resolve the conflict in the example above:

$ doctest --prefix . \
.         --opening-delimiter '```javascript' \
.         --closing-delimiter '```' \
.         -- path/to/file.js

See sanctuary-js/sanctuary#600 for the motivation for this feature.

I don't think processLine requires careful review as I spent several hours tightening it after getting it to work. I would, though, appreciate a review of the additions to the command-line interface. Are you happy with the names and descriptions of --opening-delimiter and --closing-delimiter?

/cc @Bradcomp

Copy link
Collaborator

@danse danse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 😎

For optimal Transcribe compatibility, conflicts with Markdown syntax
must be avoided. Markdown uses GREATER-THAN SIGN (>) at the beginning
of each line of a <blockquote>. This conflicts with that character's
use to signify doctest input, as in the following example:

    //# K :: a -> b -> a
    //.
    //. This is a paragraph.
    //.
    //. > This is a block quotation.
    //. > It should not be evaluated!
    //.
    //. ```javascript
    //. > K (true) (42)
    //. true
    //. ```

This commit adds --opening-delimiter and --closing-delimiter options to
the command-line interface, enabling the use of Markdown's <blockquote>
syntax in source files with delimited doctest blocks.

The following options would resolve the conflict in the example above:

    $ doctest --prefix . \
    .         --opening-delimiter '```javascript' \
    .         --closing-delimiter '```' \
    .         -- path/to/file.js
@davidchambers davidchambers merged commit 8b17fb2 into master Mar 9, 2019
@davidchambers davidchambers deleted the delimiters branch March 9, 2019 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants