-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Improve Buffer class #239
Comments
So if I understand well, you would like
Would that work for you? Oh and also, I think there is a need for detecting the ident, right? So that the caller does not have to provide it? |
The detection of indentation might be hard to wrap in a method as it is depending on the context where you are in the parser. But what you see a lot in RST is that indentation marks the beginning of a block. So when the parser detects a line starting with a whitespace it will start collecting a block. Which ends when the next line is less Indented. The content of each block is passed to a separate parser pipeline to make it easier to work with, we decided to remove the initial indentation of a block before passing it to the new pipeline. So for example a listitem will always start with a dash. If we would keep the indentation of a block. The list item detection should be aware of this indentation. Right now it doesn't have to know about it. So yes.. remove indentation would be the default. Unless we want to do something special, then we would need the raw content. |
Okay… I have started working on something, please let me know if you think it is the right direction: #442 I have managed to reduce code in |
Right now we have a number of locations using the buffer class to collect lines from the documents to parse them as blocks. These blocks are always indented. When consuming this buffer we need to remove the initial indentation of the block to be able to process the lines are normal lines.
We want the buffer to be responsible for this un-indenting part. To centralize the way we are doing this. The complexity here is that the indentation of a block may defer per situation. and can be something between 2 or PHP_MAX_INT spaces.
Locations where to do this improvement:
This method removes the indenting. Based on the first line of a block.
\phpDocumentor\Guides\RestructuredText\Parser\Productions\BlockQuoteRule::normalizeLines
See #225 for the original discussion.
The text was updated successfully, but these errors were encountered: