Support from Acquia helps fund testing for Drupal Acquia logo

Comments

e.ruiter created an issue. See original summary.

DrIPA’s picture

DrIPA’s picture

Title: Wordpress new line to paragraph convertion » Wordpress new line to paragraph conversion
HongPong’s picture

Status: Active » Needs review
HongPong’s picture

My subjective opinion: If possible this should be made configurable so that if someone does not need this filtering effect, it does not happen. However it should be enabled by default. (On the other hand someone may have created their content without wpautop and therefore this would garble their content). Also linebreaks can be interpreted as paragraph breaks depending on Drupal's text format settings. Thank you for submitting this e.ruiter - it is helpful for most use cases.

phjou’s picture

Ok there is a patch adding a filter_autop option in the process plugin and making it configurable through the UI.

phjou’s picture

FileSize
2.26 KB

If some people are using #2904545: Import permalink as URL paths you might have a conflict. Just uploading a patch for the conflict.

phjou’s picture

Forgot to keep the new Plugin in the patch.

bserem’s picture

Status: Needs review » Reviewed & tested by the community

Patch #8 does work. Given how much of a difference this makes to imported content readability, I'll push this forward. It would be nice to get more people to check this of course.

HongPong’s picture


+    if (\Drupal::moduleHandler()->moduleExists('filter') && $this->configuration['filter_autop']) {
+      $text = _filter_autop($text);
+    }

The snag here is it would silently fail if filter module is not enabled. imo better if it would at least kick a notification. Or a better notice on the option like "Filter module must be enabled, or this step will be skipped silently." Some tweak of that nature. That's the only issue which jumps at me right now. Thanks so much for hashing this out to work cleanly!

+      '#description' => 'Converts line breaks into <p> and <br> in an intelligent fashion.',