Feature #7552
Implement multiline string support
Status: | Resolved | Start date: | 2010-04-30 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Tobias Liebig | % Done: | 100% |
|
Category: | - | |||
Target version: | - |
Description
This should be possible:
foo = Text foo.value = " The text starts at this line ... and ends a few lines later. "
Associated revisions
[~TASK] TypoScript (Parser): Removed usage of Object Factory and the old Object Manager API
[~TASK] TypoScript (Parser): Wrote fixture and test case for multiline string support - however, the actual support for it is still missing. Relates to #7552
[+FEATURE] TypoScript: Implement multiline string support. resolves #7552
History
#1 Updated by Robert Lemke about 5 years ago
- Assigned To changed from Robert Lemke to Tobias Liebig
#2 Updated by Tobias Liebig about 5 years ago
- % Done changed from 0 to 50
#3 Updated by Tobias Liebig about 5 years ago
- File patch_7552.diff added
- % Done changed from 50 to 70
i've created a patch to implement multiline strings in typoscript.
If the parser detects the beginning of a multiline string value, it will step forward till it finds the matching closing quote char (" or ').
Due to that i needed to change how the parser iterates through the lines of TypoScript.
If i'm right $this->currentSourceCodeLines
was meant for that, but not used till now.
#4 Updated by Sebastian Kurfuerst about 5 years ago
Hey Tobi,
I just had a quick look through your patch, and these are my comments:
- It'd be great if you could format the Regexps like that it is done in Fluid, as it makes it a lot more readable: https://svn.typo3.org/FLOW3/Packages/Fluid/trunk/Classes/Core/Parser/TemplateParser.php
- I'd suggest to use named parameters in the Regex (see above link), as then it gets a lot more readable than the index shuffling - so lines like
isset($matches[3]) ? $matches[3] : $matches[1];
is a lot nicer to read then :)
That's it from my side :) Didn't test the patch, but they are just some cosmetical remarks I had.
Greets, and thanks for your nice work!
Sebastian
#5 Updated by Tobias Liebig about 5 years ago
@sebastian: good advice. I like the formatting of the RegExps. This should be done for all regexps in the parser (which then is a new task).
#6 Updated by Robert Lemke about 5 years ago
Hi Tobi,
I had problems applying the patch but generally it looks good.
Generally we use inline comments very sparingly, so I think that "increase the pointer" is unnecessary in this case. If you feel like adding an inline comment that usually is a sign to extract the behavior into its own method and use a meaningful method name for a better explanation. Anyway, I think in this case the code is obvious enough.
Please commit your patch (after naming the regex parameters - see Sebastians comment) and then I'll try it out again.
#7 Updated by Tobias Liebig about 5 years ago
- Status changed from Accepted to Resolved
- % Done changed from 70 to 100
Applied in changeset r4584.