-
-
Notifications
You must be signed in to change notification settings - Fork 372
Fixes lists with mixed indentation #485
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ var getIndent = require('./get-indentation') | |
|
|
||
| module.exports = indentation | ||
|
|
||
| var tab = '\t' | ||
| var lineFeed = '\n' | ||
| var space = ' ' | ||
| var exclamationMark = '!' | ||
|
|
@@ -21,7 +20,6 @@ function indentation(value, maximum) { | |
| var index | ||
| var indentation | ||
| var stops | ||
| var padding | ||
|
|
||
| values.unshift(repeat(space, maximum) + exclamationMark) | ||
|
|
||
|
|
@@ -56,18 +54,7 @@ function indentation(value, maximum) { | |
| index-- | ||
| } | ||
|
|
||
| if ( | ||
| trim(values[position]).length !== 0 && | ||
| minIndent && | ||
| index !== minIndent | ||
| ) { | ||
| padding = tab | ||
| } else { | ||
| padding = '' | ||
| } | ||
|
|
||
| values[position] = | ||
| padding + values[position].slice(index in stops ? stops[index] + 1 : 0) | ||
| values[position] = values[position].slice(stops[index] + 1) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not needed anymore because |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ | |
| "children": [ | ||
| { | ||
| "type": "text", | ||
| "value": "Very long\n\t\t\tparagraph", | ||
| "value": "Very long\n\tparagraph", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comes from trying to find the indentation of This text is the "internal" content, the content without the indentation. The resulting should be as the Making this changes in the fixture makes it more consistent with the rest of the rest of the |
||
| "position": { | ||
| "start": { | ||
| "line": 3, | ||
|
|
@@ -66,7 +66,7 @@ | |
| "offset": 48 | ||
| }, | ||
| "indent": [ | ||
| 0 | ||
| 2 | ||
| ] | ||
| } | ||
| } | ||
|
|
@@ -83,7 +83,7 @@ | |
| "offset": 48 | ||
| }, | ||
| "indent": [ | ||
| 0 | ||
| 2 | ||
| ] | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For spaces (i.e. with
indent - lastIndent == 1), this is equivalent to juststops[indent]=index; lastIndent=indentFor tabs, this will create entries in
stopsfor all intermediate indents since the last one. For example, if the last indentation point is1(a space), and the next indentation point is5(a tab follows the initial space), this will add stops 2, 3, 4 and 5 pointing to character 1 (the tab).