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

unDecorateComment possibly skipping too many spaces #25

Closed
kiith-sa opened this issue Dec 25, 2014 · 0 comments
Closed

unDecorateComment possibly skipping too many spaces #25

kiith-sa opened this issue Dec 25, 2014 · 0 comments

Comments

@kiith-sa
Copy link
Contributor

I'm experimenting with Markdown for documentation (Markdown depends on indentation).

I've noticed one more space than needed (?) is being stripped by unDecorateComment() in /** comment lines that didn't "start" with a non-space character.

I don't know if this is an off-by-one error or a peculiarity of the D spec.


It can be fixed by changing <= into < here in std.d.lexer.undecorateComment() (line 1920):

            for (size_t s = 0; (i < j) && (s <= whitespaceToSkip)
                && (comment[i] == ' ' || comment[i] == '\t');)

Example of the behavoir:

/** Merge two entity prototypes; components from over override components from base. The
 * returned prototype is not locked/trimmed.
 *
 ...
 *
 * 1.  This is a list item with two paragraphs. Lorem ipsum dolor
 *     sit amet, consectetuer adipiscing elit. Aliquam hendrerit
 *     mi posuere lectus.
 */

the second part would turn into:

1.  This is a list item with two paragraphs. Lorem ipsum dolor
   sit amet, consectetuer adipiscing elit. Aliquam hendrerit

Similarly,

 * A
 *  B
 * A

would turn into:

A
B
A
Hackerpilot added a commit that referenced this issue Dec 25, 2014
Changed `unDecorateComment()` so it doesn't skip 1 extra space. Fixes #25.
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

No branches or pull requests

1 participant