Download & Extend

drupal_html_to_text() doesn't support <cite> and <code>

Project:Drupal core
Version:6.x-dev
Component:other
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

<cite> and <code> are allowed by the default filter, and drupal_html_to_text() should support them.

This is a bug report, not a feature request, IMO.

Comments

#1

Status:active» needs review

Hope the patch helps.

AttachmentSizeStatusTest resultOperations
mail.inc_.patch805 bytesIgnored: Check issue status.NoneNone

#2

Status:needs review» needs work

No, this is too simple. Maybe it works for <code>, which should just be rendered as it's entered, with all spaces and newlines intact (but I suspect that it's line-wrapped), but <cite> needs to be emphasized in some way, at least with double quotes.

#3

Status:needs work» needs review

The patch renders:

code - 4 spaces indent, surrounded by a newline, preserve all spaces

cite - surround by a 'sharp' symbol, e.g.

<cite>Report on Space Management</cite>, Butch Saul, 1997 -> #Report on Space Management#, Butch Saul, 1997

What we can do with a long lines in 'code' ?
I suggest add the '/' symbol at the end of each wrapped line. But maybe it is not good.

AttachmentSizeStatusTest resultOperations
mail.inc2_.patch2.5 KBIgnored: Check issue status.NoneNone

#4

Status:needs review» needs work

Code tags do not preserve white space in HTML. They should be treated like any other inline tag.

#5

Oh, it's true.

Well, how to emphasize inline code tags here?
1) You can use the %code lnline% tag to define computer code.
2) You can use the {code lnline} tag to define computer code.
3) You can use the [code lnline] tag to define computer code.
4) You can use the -code lnline- tag to define computer code.

What tag should be used for multiline code snippets, 'pre' ?

#6

There is no HTML tag that does what people expect. Pre only preserves white space, but still requires ampersands and angles to be escaped. This is why codefilter exists.

#7

Status:needs work» needs review

I've consulted with http://en.wikipedia.org/wiki/Lightweight_markup_language and have decided:

  • code rendeds into |code| (as it is used as an monospaced font mostly)
  • cite rendeds into [cite] (as cite is used for citations or references, links)

The patch provides this.

AttachmentSizeStatusTest resultOperations
mail.inc3_.patch1.54 KBIgnored: Check issue status.NoneNone

#8

Status:needs review» needs work

By default, every browser I've ever known renders <cite> in italics, so it seems like for consistency, we should use /cite/ just like we do for <i|em>. Also, note that you need to support attributes in these tags. See #258192: drupal_html_to_text() doesn't support <strong class="foo">

#9

Status:needs work» postponed (maintainer needs more info)

Does this issue exist in current D6?

#10

Status:postponed (maintainer needs more info)» needs work
nobody click here