Newlines (br) and Paragraphs (p) not parsed

Created on 7 December 2021, about 3 years ago
Updated 10 August 2023, over 1 year ago

Same issue as was reported for 1.x here - https://www.drupal.org/node/2926300 β†’ .

I took a look at the code where it was fixed (in 2.x I believe), in the Docx.php file, and I believe this is the code that parses
and

tags:

        else {
			// Parsing line breaks and paragraphs
			$value = $this->formatValue($value);
			$text = $this->getTextBetweenTags($value, 'p'); // P tags are already handled by the PHPWord processor, so we're just focussing on the BR tag here.
			$sectionLines = $section->addTextRun();
			foreach($text AS $line) {
			  foreach(explode('<br>', $line) AS $v) {
			    $sectionLines->addText($v); // Adding the text.
				$sectionLines->addTextBreak(); // Because there's a BR here, we want to create a newline
			  }
			}
        }

But with the dependency injection in 3.x a lot has changed and I'm not proficient enough in php to know how to adapt and add it back in.

πŸ“Œ Task
Status

Needs work

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States w01f

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024