Feature #17536

Patch for t3lib/class.t3lib_tsparser.php adding php-HEREDOC like syntax

Added by Jerome Schneider about 12 years ago. Updated over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2007-08-16
Due date:
% Done:

0%

PHP Version:
4.3
Tags:
Complexity:
Sprint Focus:

Description

The TS multiline parenthesis syntax ( ... ) doesn't allow one to define such a multiline text :

config.something (

// this is php that will be eval'd if needed
$res = substr(
"hello world",
0,
5
);

)

As the ");" closing of call to the php function fools the parser, breaking the multiline block.

I implemented a notation similar to php's HEREDOC syntax ( http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc )

So The resulting TS would be:

config.something <<<SOMEPHP

// this is php that will be eval'd if needed
$res = substr(
"hello world",
0,
5
);

SOMEPHP

Note that "SOMEPHP" is variable and defined to whatever the user needs, thus completely avoiding the possibility of end-tag collision with the content.

I checked with TS analyzer and TS syntax highlighting, and patch works fine.
The patch is targeted for v4.1.1 of the file

(issue imported from #M6160)

heredoc_patch.txt View (2.81 KB) Administrator Admin, 2007-08-16 12:14

patch_heredoc_v2.txt View (2.86 KB) Administrator Admin, 2007-08-16 15:05

doc_core_ts_heredoc.sxw (16.5 KB) Administrator Admin, 2007-08-16 15:06

History

#1 Updated by Michael Stucki about 12 years ago

There seems to be an error in your description:

SOMEPHP

I'm quite sure the ">>>" are not needed! Does your patch do it the right way?

#2 Updated by Michael Stucki about 12 years ago

But I must say I like this patch very much. Let's integrate this soon!

If you don't mind, I would be happy if you also can supply the documentation changes needed (should be added to "doc_core_ts").

Regards, michael

#3 Updated by Jerome Schneider about 12 years ago

Actually there's no technical need for end tag to be prefixed with >>>,
But I thought that it's easier to visualy detect, especially when there arelot of lines in the multiline block.

Concerning the doc, I'll update it. What's the procedure ?

With respect,
Jerome

#4 Updated by Michael Stucki about 12 years ago

Well, concerning the end tag, I would like to stick to standards like it is defined on php.net. Your idea is nice, but once we have syntax highlighting integrated with the TypoScript editor, there's no need for that anyway. So I suggest to drop the end tag as it is in PHP.

About documentation: Just post that here, describing where I need to change what, and I will take care of the rest...

#5 Updated by Jerome Schneider about 12 years ago

Hi,

You'll find attached to the Issue the revised version of the patch dropping >>> for the end-tag, and an sxw openoffice doc containing the documentation of the feature, to be inserted in doc_core_ts right after the documentation of multiline ( ) feature.

Regards,
Jerome

#6 Updated by Karsten Dambekalns about 11 years ago

It seems Jerome acted quickly to fulfill the requirements - now this could go into 4.3. :)

#7 Updated by Martin Kutschker about 11 years ago

If you like it propose it on the Core list. But could we change the >>> syntax to something else? It clashes optically with other uses of > in TS. Maybe a (((ENDTAG could be used

#8 Updated by Ernesto Baschny about 9 years ago

Hi Jerome.

I think your improvement is very nice and it might be a candidate to inclusion in 4.5. If you don't mind and have time to work on the issue again, I would be glad. If you have a patch that works with current "trunk" of TYPO3, consider posting it as an RFC to the core list.

Thanks for your help!

#9 Updated by Jerome Schneider about 9 years ago

Hi Ernesto,
I'll be glad to help. I'll rebuild the patch and submit the aforementioned RFC.

#10 Updated by Xavier Perseguers about 8 years ago

  • Target version deleted (4.6.0-beta1)

#11 Updated by Alexander Opitz over 6 years ago

Hi,

this issue is very old, does it still exists with newer versions of TYPO3 CMS (4.5 or 6.1)?
What happened to the patch?

#12 Updated by Ingo Renner over 6 years ago

yes, still not possible AFAIK

#13 Updated by Alexander Opitz over 6 years ago

  • Category set to TypoScript
  • Status changed from Needs Feedback to New

#14 Updated by Mathias Schreiber over 4 years ago

  • Target version set to 7.2 (Frontend)

#15 Updated by Benni Mack over 4 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)

#16 Updated by Susanne Moog about 4 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#17 Updated by Benni Mack about 4 years ago

  • Target version deleted (7.5)

#18 Updated by Sybille Peters over 1 year ago

Thank you for your report.

Even though it has been some time, would you consider checking if your patch idea is still up to date and upload it to our Gerrit review server?

Someone could do this for you, but I am thinking you might like the opportunity to contribute to TYPO3 yourself.

You can find a description of the TYPO3 contribution workflow here: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/

Hint: If you get stuck anywhere, ask on Slack in the #typo3-cms-coredev channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack

Thank you in advance!

Also available in: Atom PDF