Tags:
create new tag
view all tags

Question

I want to use the searh template provided with the plugin to query some bib files. However, how can I choose the style used to render the results to the query? Something like

%BIBTEX{style="plain" form="on"}%
does not work. The style only affects the results displayed before the query is done.

I have tried to edit the template itself by adding the following input:

<input type="hidden" name="style" value="plain"/>
The output was indeed using the plain style, but I think the site was then using another style for my skin too smile

Thanks in advance

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, BibtexPlugin, BreadCrumbsPlugin, CommentPlugin, EditTablePlugin, EmptyPlugin, FilterPlugin, FlexWebListPlugin, GluePlugin, IfDefinedPlugin, InterwikiPlugin, NatSkinPlugin, PreferencesPlugin, RedDotPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, SpreadSheetPlugin, TablePlugin, TwistyPlugin
Server OS: Mandriva Linux 2006, kernel 2.6.12
Web server: Apache 2.0.54
Perl version: 5.8.7
Client OS: Mandriva Linux 2006, kernel 2.6.12
Web Browser:  
Categories: Plugins

-- TWikiGuest - 24 Aug 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Just to confirm: If you load a topic with a %BIBTEX{style="plain" form="on"}% tag, you see output that matches bibtex rendering of the .bib file with the plain style. But when you do a search, the output is no longer in plain. (at least, this is close to what I saw on my own installation.)

It certainly seems reasonable to me that the output style should be governed by the style setting in the BIBTEX declaration.

The output style appears to be forced to bibtool in the bin/bibsearch script (L115). Commenting this line out allows one to set the style in the search form.

To make this more general, and to set the output style in the BIBTEX macro, add the following patches:
lib/TWiki/Plugins/BibtexPlugin.pm

L672:    $text =~ s/%BIBTEXRESULT%/$result/o;
++++:    $text =~ s/%BIBSTYLE%/$theStyle/o;
L673:    $result = $text;
and data/TWiki/BibtexSearchTemplate.txt
L9:  <input type="hidden" name="total" value="%BIBTOTAL%" />
+++: <input type="hidden" name="style" value="%BIBSTYLE%" />
L10: <table width="100%" cellspacing="0" cellpadding="0" ><tr><td>

I'll check these changes into SVN shortly.

-- ScottHoge - 25 Aug 2006

-- TWikiGuest - 28 Aug 2006

Thank you for your answer. However, adding the line

<input type="hidden" name="style" value="%BIBSTYLE%" />
changes the style of the skin used (I am using NatSkin).

-- TWikiGuest - 28 Aug 2006

I'm not familiar with the NatSkin. Would changing the bibtex style to bibstyle solve this problem?

-- ScottHoge - 28 Aug 2006

what do you mean exactly?

-- FlorianSimatos - 28 Aug 2006

Well...

Changing the bibsearch form, in particular adding a line with a hidden parameter, should have no effect on the skin you are using. NatSkin uses CSS pretty heavily, so my suspicion is that the style declared in the bibsearch form is somehow causing confusion for the NatSkin css files.

So, if the line you add to the bibsearch form has bibstyle inplace of style, does the NatSkin rendering still change? Making such a change through the BibtexPlugin would be straightforward.

I'm not up for installing NatSkin anytime soon. So if switching style to bibstyle does not solve the skin-switching problem, then maybe attach a screen shot and/or HTML source files (created by twiki) to this topic and I'll take a look.

-- ScottHoge - 28 Aug 2006

I have added the following hidden form to the search template:

<input type="hidden" name="bibstyle" value="%BIBSTYLE%" />

I create the form with the following command in TWiki:

%BIBTEX{form="on" style="plain"}%

I have kept the line you told me to add:

$text =~ s/%BIBSTYLE%/$theStyle/o;

Then (I apologize for my lack of competence, I am really not familiar with scripts) I tried to modify the BibtexPlugin.pm file by replacing

my $theStyle = &TWiki::Func::extractNameValuePair($theAttributes, "style")
on lines 369 and 399 by
my $theStyle = &TWiki::Func::extractNameValuePair($theAttributes, "bibstyle")

Then the skin is conserved, but the output does not use the plain style (both when the form is displayed before any query is made and to show the results to a query).

I have attached the source created by twiki for a page that answers to a given query, I hope this is what you were expecting.

-- TWikiGuest - 29 Aug 2006

No need to apologize. The style is set in multiple places...

To switch the parameter setting from style to bibstyle, the following lines need to be changed:

bin/bibsearch:

L99:   my $theStyle = $query->param("bibstyle");

lib/TWiki/Plugins/BibtexPlugin.pm:

L375:  my $theStyle = &TWiki::Func::extractNameValuePair($theAttributes, "bibstyle");

L402:  my $theStyle = &TWiki::Func::extractNameValuePair($theAttributes, "bibstyle");

data/TWiki/BibtexSearchTemplate.txt:

L10: <input type="hidden" name="bibstyle" value="%BIBSTYLE%" />
In each case, "style" has been replaced by "bibstyle". If this doesn't work, we'll probably have to ask Micha to look in to it.

-- ScottHoge - 29 Aug 2006

Everything seems to work fine now, thanks a lot!

-- FlorianSimatos - 29 Aug 2006

You're welcome. I'm glad we were able to track down the problem. wink

-- ScottHoge - 29 Aug 2006

Change status to:
Topic attachments
I Attachment History Action Size Date Who Comment
HTMLhtm SearchPublicationsConferences.htm r1 manage 10.0 K 2006-08-29 - 09:03 TWikiGuest source file of a page created by twiki that answers a bibtex query
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2006-08-29 - ScottHoge
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.