Updated: Comment #N

Problem/Motivation

blanks lines are part of our coding standards. examples are having those blank lines (newlines) stripped out.
Examples:
https://drupal.org/node/1353118
https://drupal.org/node/2122241

Proposed resolution

Fix filters?

Remaining tasks

Remaining tasks

User interface changes

No.

API changes

No.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tvn’s picture

Issue tags: +Drupal.org 7.1
mgifford’s picture

I noticed this too.

Line 1

Line 3

Line 5
Line 6

Was rather annoying to me.

jhodgdon’s picture

Isn't this probably a Core bug with the text filter, rather than a Drupal.org-specific issue? Or maybe it's the order of text filters in the d.o "Filtered HTML" text format?

mgifford’s picture

I think we'd have found it if it before was a core bug. Mind you the order of the filters is quite likely...

danylevskyi’s picture

Assigned: Unassigned » danylevskyi

Code Filter module removes leading and trailing line breaks. I think we should remove this functionality and let user decide to remove or leave line breaks.

tvn’s picture

tvn’s picture

Project: [Archive] Drupal.org D7 upgrade QA » Code Filter
Version: » 7.x-1.x-dev
Priority: Minor » Normal
jhodgdon’s picture

RE #5 - the problem here is not the first/last newlines being stripped out. It is that blank lines in the middle of code blocks are stripped out.

danylevskyi’s picture

Yeah. We have a real problem. Code Filter removes blank lines in order to avoid clashes with line break filter which converts them to html tags...

dokumori’s picture

Status: Active » Needs review

The filter 'Convert line breaks into HTML' needs to come after 'Code filter' to fix this issue.

kalman.hosszu’s picture

Status: Needs review » Active
FileSize
28.46 KB

@dokumori I tested it with your solution but it didn't fix the problem. The blank line between other lines was removed. I tied it here: https://kalman-drupal.redesign.devdrupal.org/node/2234363/

marvil07’s picture

Assigned: danylevskyi » Unassigned
Status: Active » Needs review
FileSize
1.18 KB

The cleanest way I found to make this happen is to add extra markup.

After reading the drupal core filter which does the replacement of new lines(see _filter_autop()), which is causing the problem, I also see that it is skipping the pre tag contents.
That makes sense, so if we wrap the return text with the pre tag, drupal core will not try to replace newlines inside.
That's actually what pre(formatted) tag means, so it sounds consistent.

In the drupal.org specific case:

  • We need to re-arrange the order as dokumori mentions, which is also added on the module's readme.
  • It sounds like a good opportunity to update the module code. This patch is against 7.x-1.x branch, which is several commits ahead of 1.0, which AFAIK is used on d.o

Status: Needs review » Needs work

The last submitted patch, 12: 0001-Issue-2134969-Keep-new-lines-on-php-blocks.patch, failed testing.

marvil07’s picture

Status: Needs work » Needs review
FileSize
4.31 KB
3.83 KB

Fixing text in the test to match new output, also includes a new line there so this behavior is tested too(maybe we need to add one more when core filter is also there).

tvn’s picture

Issue summary: View changes
Issue tags: +Novice, +affects drupal.org

Tag and testing instructions.

drumm’s picture

Status: Needs review » Needs work

I think the same change should be made in codefilter_process_code() for blocks like in comment #2.

Cameron Tod’s picture

I think it is looking ok without an additional change in codefilter_process_code():

editing screenshot
output screenshot

  • Commit 18f825d on 7.x-1.x authored by marvil07, committed by cam8001:
    Issue #2134969: Preserve blank lines in codefilter output.
    
Cameron Tod’s picture

Status: Needs work » Fixed

Setting to fixed - let me know if there is more to do here.

markhalliwell’s picture

sun’s picture

Status: Fixed » Needs review
FileSize
2.91 KB

Not sure why #17 performed a manual test instead of adding an automated test...?

sun’s picture

Re-rolled against HEAD.

sun’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -drupal.org szeged sprint, -Novice

This follow-up patch just adds an automated test for the manual test performed in #17.

Cameron Tod’s picture

Status: Reviewed & tested by the community » Fixed

This actually got commited, with the wrong commit message. Thanks sun!

sun’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Fixed » Patch (to be ported)

The cumulative change needs to be forward-ported to D8.

tvn’s picture

Issue tags: +needs drupal.org deployment
tvn’s picture

Issue tags: -Drupal.org 7.1, -needs drupal.org deployment
YesCT’s picture