Howdy all,
These key words curiously did not seem to locate the long discussion threads I though they might...
After years of dodging it, I have been asked by a client to support italicisation in biblio titles (node title field acck!) and to support simple markup (para returns, bold, italic) in the Abstract field.
(1) Node Title
Over in Drupalland there are some very stiff conversations about the complexity and danger of html markup in the node title field. My question to this forum is:
Given Biblio's overwhelming popularity in academic applications, what is "biblio best practice" for accommodating italics (so we can properly display species names)
(2) Biblio abstract
Having dealt with some harvesting operations I understand the problem of encoding and escaping HTML markup as it moves between systems. But what if that pain is far less than the pain of needing to actually show some simple markup in the Abstract? IS there a cunning/safe way to allow some limited entity use in the abstract field?
Thanks in advance, as always!
JB

CommentFileSizeAuthor
#3 biblio-markup-tick.png9.65 KBboabjohn

Comments

rjerome’s picture

You can use HTML markup in the abstract right now, but I see there is a little bug/issue in that you have to turn on HTML markup on the "Full Text" field for it to work. I'll fix that.

As the the title markup, you can also include the 'a', 'b', 'i', 'u', 'sub', 'sup', 'span' elements in the title field and it will display correctly in biblio generated listings, BUT as you have found, Drupal generated title listings will show the markup characters. You might be able to fix/work around this at the theme level by not printing out the Drupal generated title in certain areas (e.g. node.tpl.php).

Cheers,

Ron.

rjerome’s picture

I just pushed some changes to the 6.x-2.x branch which allow unique "format" settings for each textarea on the input form.

This required an extra column in the database to store the format settings, so running update.php after installing the new code is mandatory.

Ron.

http://drupalcode.org/project/biblio.git/commit/881d4a1

boabjohn’s picture

StatusFileSize
new9.65 KB

Hey there Ron, thanks for the pointers....can I ask a couple of follow-ups?

1. Title markup
You comment:
..."You might be able to fix/work around this at the theme level by not printing out the Drupal generated title in certain areas..."
Can you give a quick snippet of what this might look like? I've got a node-biblio.tpl.php in place and have replaced the normal $title line with this:

<?php if (!$page): ?>
<h2 class="title"><a href="<?php print $node_url; ?>"><?php print $node->biblio_sort_title; ?></a></h2>
<?php endif; ?>

But I get no change at all on the biblio node (as if my template is not even being read?)
Caches all cleared...any clues?

2. Abstract textfield: html option
Working from the 2x dev of Oct 31, I've installed, run db update (no updates noted) and flushed all caches. I still cannot see a new option tick in the fields display (see screenshot). Am I looking imn the worng spot or just blind?

Thanks as always Ron!

rjerome’s picture

Hi John,

It seems that the title is handled by the page.tpl.php file in most cases, which is why your node-biblio.tpl.php didn't have any effect.

It also seems that the title is sanitized in the template_preprocess_page(&$variables) function, so in order to achieve what you desire (at least in terms of title formatting :-), you would have to stick the following function at the end of the biblio.module file...

function biblio_preprocess_page(&$variables) {
  if (isset($variables['node']) && $variables['node']->type == 'biblio') {
    $node = $variables['node'];
    $variables['title'] = filter_xss($node->title, biblio_get_allowed_tags());
  }
 }

This will re-filter the title with a less strict filter, leaving 'a', 'b', 'i', 'u', 'sub', 'sup', 'span' html tags.

In answer to question 2... The format selection is done just below the abstract textarea on the input form itself, so it can/must be set for each node when you create it.

Cheers,

Ron.

boabjohn’s picture

Hey there Ron,
Thanks hugely for that...will give it a try shortly.
But won't that bit of module extension get wiped on our next update? I guess we'll have to just make a note to re-apply the modification after update.

rjerome’s picture

If it does what you want, I'll include it the module. There's no great risk because the title is being rendered on the same page in the exact same format anyway, and it has been filtered for XSS attacks.

boabjohn’s picture

Ron that does the trick for the node display...sweet! The abstract with markup is also rocking. Thanks as always for your generosity and applied intelligence!

Goodness knows what sort of rubbish this will throw when someone tries to harvest these listings through OAI/PMH or similar...but the whole problem of "proper presentation" (eg, italicisation of latin names) vs machine-safe interoperability seems totally vexed to me.

Cheers!
>>Edit follows>>
For example, here's the notification email from Drupal on publish of that node:

Dear Admin,
A new Biblio (publication) post has been published on riel.cdu.edu.au - Sensitivity of the &lt;i&gt;MODIS&lt;/i&gt; fire detection algorithm (MOD14) in the savanna region of the Northern Territory, Australia. 
rjerome’s picture

In "theory" OAI-PMH should be able to deal with it since it encodes (escapes) prior to sending and decodes upon receipt.

rjerome’s picture

Hmm, you can't win them all :-) Unfortunately, the title will be handled in the default fashion anywhere it's not processed through the template_preprocess_page function (such as when that email is created).

This leads back to a debate that was had some time ago re the merits of filtering before saving to the db or after retrieving from the db. In my opinion, threat filters should be run before saving the data, but Drupal will actually save data that contains an XSS attack vector in the database, then (hopefully) filter it out every time that content is loaded.

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.