-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Behavior with blank line in itemize or enumerate environment #158
Comments
@atsuyaw |
$ cat << EOF > sample.tex
\begin{enumerate}
\item aaaaa
% \vspace{8zh}
\item bbbb
\end{enumerate}
EOF npx luparse -lc sample.tex$ npx luparse -lc sample.tex
{
"kind": "ast.root",
"content": [
{
"kind": "env",
"name": "enumerate",
"args": [],
"content": [
{
"kind": "command",
"name": "item",
"args": [],
"location": {
"start": {
"offset": 19,
"line": 2,
"column": 2
},
"end": {
"offset": 24,
"line": 2,
"column": 7
}
}
},
{
"kind": "text.string",
"content": "aaaaa",
"location": {
"start": {
"offset": 25,
"line": 2,
"column": 8
},
"end": {
"offset": 30,
"line": 2,
"column": 13
}
}
},
{
"kind": "parbreak",
"location": {
"start": {
"offset": 30,
"line": 2,
"column": 13
},
"end": {
"offset": 49,
"line": 5,
"column": 2
}
}
},
{
"kind": "command",
"name": "item",
"args": [],
"location": {
"start": {
"offset": 49,
"line": 5,
"column": 2
},
"end": {
"offset": 54,
"line": 5,
"column": 7
}
}
},
{
"kind": "text.string",
"content": "bbbb",
"location": {
"start": {
"offset": 55,
"line": 5,
"column": 8
},
"end": {
"offset": 59,
"line": 5,
"column": 12
}
}
}
],
"location": {
"start": {
"offset": 0,
"line": 1,
"column": 1
},
"end": {
"offset": 75,
"line": 6,
"column": 16
}
}
}
],
"comment": [
{
"kind": "comment",
"content": " \\vspace{8zh}",
"location": {
"start": {
"offset": 33,
"line": 4,
"column": 2
},
"end": {
"offset": 48,
"line": 5,
"column": 1
}
}
}
]
} The location of parbreak (next line of "location": {
"start": {
"offset": 30,
"line": 2,
"column": 13
},
"end": {
"offset": 49,
"line": 5,
"column": 2
}
} The location of comment is: "location": {
"start": {
"offset": 33,
"line": 4,
"column": 2
},
"end": {
"offset": 48,
"line": 5,
"column": 1
}
} The parbreak seems including the comment node, but it cannot have child nodes actually. So it will become an error. (However, now we use [email protected]. Even if this is resolved by latex-utensils, we may have to resolve #79 (comment) first.) |
npx luparse -lc sample.tex{
"kind": "ast.root",
"content": [
{
"kind": "env",
"name": "document",
"args": [],
"content": [
{
"kind": "parbreak",
"location": {
"start": {
"offset": 16,
"line": 1,
"column": 17
},
"end": {
"offset": 34,
"line": 5,
"column": 1
}
}
}
],
"location": {
"start": {
"offset": 0,
"line": 1,
"column": 1
},
"end": {
"offset": 48,
"line": 5,
"column": 15
}
}
},
{
"kind": "parbreak",
"location": {
"start": {
"offset": 48,
"line": 5,
"column": 15
},
"end": {
"offset": 50,
"line": 7,
"column": 1
}
}
}
],
"comment": [
{
"kind": "comment",
"content": " \\vspace{8zh}",
"location": {
"start": {
"offset": 18,
"line": 3,
"column": 1
},
"end": {
"offset": 33,
"line": 4,
"column": 1
}
}
}
]
} The location of parbreak is: "location": {
"start": {
"offset": 16,
"line": 1,
"column": 17
},
"end": {
"offset": 34,
"line": 5,
"column": 1
}
} The location of the comment is: "location": {
"start": {
"offset": 18,
"line": 3,
"column": 1
},
"end": {
"offset": 33,
"line": 4,
"column": 1
}
} In the same way, the parbreak node appears to contain the comment node. However, this can be parsed by tex2tast. {
"type": "Document",
"range": [
0,
50
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 6,
"column": 0
}
},
"children": [
{
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 4,
"column": 0
}
},
"range": [
18,
33
],
"value": " \\vspace{8zh}",
"type": "Comment"
}
]
} @tani textlint-plugin-latex2e/src/latex-to-ast.ts Line 525 in ab826ee
|
Hmm, the code you mentioned is very clear and looks it has no problem. We should also check the code inserting comment nodes. @atsuyaw, Could you give one week to us because the behavior of code is curious. |
We should also report this but to upstream because of the bug @pddg mentioned. |
@tani |
I see. Hmm... |
I found a solution. textlint-plugin-latex2e/src/latex-to-ast.ts Lines 528 to 533 in 0c4d0a2
|
When there is a blank line just before/after comment line in
itemize
orenumerate
environment, textlint shows error:I encountered this issue with the
tex
file such as the below:In case without comment line or/and blank line, the error is not shown.
I am sorry but I'm not acquainted with programming, so I can't provide any idea for solute this issue.
The text was updated successfully, but these errors were encountered: