Closed (outdated)
Project:
Bibliography Module
Version:
6.x-1.15
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Sep 2008 at 13:03 UTC
Updated:
21 Dec 2018 at 20:33 UTC
Jump to comment: Most recent
Comments
Comment #1
rene_w commentedsubscribing
Comment #2
Frank Steiner commentedThis problem is not trivial and has been discussed some times before. biblio uses the normal node title for the publication title, and the node title can be used at so many different places from so many different modules that you cannot keep the brackets in there. So I guess one would need to have an additional biblio_title field to store the (imported or entered) title with brackets while still using node->title for the unbracketed version.
We currently embrace the whole title when exporting (via our famous bibtex hook ;-)) so that the title is at least saved as a whole.
Ron, do you think that using an additional biblio->bibtex-title or similar could be a solution?
Comment #3
rene_w commentedFrom my (end user's) perspective, it's important to have round-trip support for bibtex files. I work with LaTeX, so I need to get the exact same bibtex out of Biblio that I put in, which includes quirks like the {} thing in title/booktitle.
I suppose a separate node-title could work, but then there's a new problem in that changes to one of the titles must be reflected in the other (lest you end up with two different titles for the same entry). Presenting only the bibtex title (braces and all) for editing and automatically deriving the node title from it could work.
Note that there are also math-mode braces in BibTeX titles ("My {$\srqt{\pi^2}$} cents"}, but I image that'll be even more difficult to handle unless you embed tex4ht or somesuch.
Comment #4
rjerome commentedI'd say it's pretty hard to guarantee round trip support, mainly because we are not dealing only with bibtex data. One way might be to simply put a filter in which would remove any remaining {} when the node is displayed but they would remain in the database so on export they should still be in the export data file.
Comment #5
Frank Steiner commentedI tried this once but one will fail to handle at least the node title because an input filter doesn't apply to the title. And so you will see it in any views application and I don't know where else. However, this might be a minor drawback that one might be able to live with.
Comment #6
Tecktron commented[Subscribing]
I agree that this would be great for display purposes only, so that when it's exported it comes directly from the DB where it's stored correctly.
I'd do something along the lines of a preg_replace_callback to simply remove them.
I'll work on the function with a regex and callback so it removes the {} from any string you pass to it, eg:
"This is {CAPITAL} {T}ext in {3D}!" would become simply "This is CAPITAL Text in 3D!"
Then all someone has to do would be to implementing the function where it needs to go =)
Would also be cool and convenient for an option to turn the feature on or off in the admin menu.
Something like:
($remBraceOpt==TRUE)?remBraceFunc($title_string):$title_string;Would be a nice feature in my opinion. Expect something from me soon.
Thanks,
--Craig
Comment #7
masood_mj commentedsubscribing
would you help me to write a sql query to remove { } from biblio tables?
Comment #8
Tecktron commentedSo this takes in a string and removes the braces. The idea is this would be on a db pull and display, but never for saving into the db (you want the braces for export). I've made it so it ignores {$...$} in order to save any math notation. Give it a spin and let me know what you think.
OK Here is the code for the functions:
Now it just needs to be implemented into the hook... Interested Ron? Anybody?
Thanks,
--Craig
Comment #9
rjerome commentedThanks Craig,
I thought maybe I could use hook_nodeapi and the "view" op to achieve this, and it almost works but the page title seems to get rendered prior to this being called so the braces still show up in the page title.
I'll dig around a bit more, but we're close.
Ron.
Comment #10
Tecktron commentedRon,
I've been looking through this a bit (and slowly coming to grasps with Drupal), and I think that "load" case of the nodeapi would work. That's what I see some of the page title modules use (beyond that part I'm lost, but still learning). Maybe give that a shot.
Thanks,
--Craig
Comment #11
rjerome commentedI did try that but the problem with "load" is that it's too early in the process, so if you edit the node, the you will see that the braces are gone, then if you save it the braces will be gone for good. The problem with view is it's just a little too late in the render process so the node "contents/body" are OK, but the title is rendered prior to calling nodeapi with the "view" op so the page title still has the braces.
I just came up with the solution, which is sort of a hybrid, the braces are stripped off in hook_view and then drupal_set_title is called in hook_nodeapi (op == 'view') to reset the title to the braceless version. Using this method, the braces are save in the database, and you will see them when you edit the node but they are not displayed.
Comment #12
Tecktron commentedBrilliant!
Thanks!
I can't wait to see it in action!
--Craig
Comment #13
rjerome commentedNo need to wait Craig, you can try it now in the -dev version...
Ron.
Comment #14
nschloe commentedsubscribing
Comment #15
rjerome commentedIn case you were wondering Nico, this feature is in the 1.6 version.
Ron.
Comment #16
nschloe commentedHm, unconfirmed. -- I'm still getting the issue with 1.6; see, for example, the file at http://drupal.org/node/584616#comment-2088188.
Cheers,
Nico
Comment #17
rene_w commentedHere are some places where I noticed the bibtex braces still showing up (they are already filtered out in the node and list views):
Comment #18
rjerome commentedI've dealt with
The search related ones are going to be a problem though because I haven't yet found a way for the module to modify the search results prior to the system displaying them.
Comment #19
rjerome commentedOk, so I have a new plan for this {Protected} capitalization of titles issue...
In the 6.x-2.x version of the module, each of the import/export types has been made into a separate module which maintains it's own table in the database. So the plan for BibTex is to stick the title with {} included in the biblio_bibtex table, and then strip the {}'s out an store that where the title normally goes in the node table. This way searches and the like will see the sanitized version and when exporting in BibTex format, I'll just substitute the title from the biblio_bibtex table. This also has the benefit of me not having to sanitize the title all over the place.
Ron.
Comment #20
rene_w commentedSounds good, but: Would it then still be possible to _enter_ the protected titles when not importing from bibtex (i.e. entering a publication via the web form)?
Comment #21
rene_w commentedAddendum: The braces also show up in
<bib>) and<ibib>)Comment #22
rene_w commentedRegarding the separate bibtex-title field: as mentioned earlier (http://drupal.org/node/314488#comment-1361860) it would need to be editable, to allow changes in the title field being reflected in the bibtex-title field (and vice versa).
Here's what I would suggest:
Having a separate bibtex-title has some additional benefits, for example, we can have a bibtex-title called "{My $x^{2}$ Cents}" but display the nicer title "My x² Cents"; plus it gets rid of all the special cases handling the braces. We now effectively ask the user to take care of it, which seems reasonable to me.
Comment #23
rjerome commentedI think it will be easier to handle all of this BibTex stuff since it is in a separate module any we can use the nodeapi hook to do this cleanup when the module is enabled.
Comment #24
megic commentedI'd like to work with a stable version of biblio and just came accross the {Protected} problem in the title.
Just wanted to ask what my options are:
-) Correcting the {} manually or through the database
-) Using a dev version (which one?)
Is there a another/better option?
Comment #25
rjerome commentedYou could try the 6.x-1.x-dev version, I believe that issue has be fixed in that version (and you can always switch back to the release version when the next one comes out).
Ron.
Comment #26
shaundychkoputting the following in template.php of your theme removes braces from the main title for each search result (but not the search result subtext...). Adjust [theme-name] accordingly.
Comment #27
liam morlandThis version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.