Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Bibliography Export (Read 9749 times)
Lew Friedland
Full Member
*
Offline



Posts: 50

Bibliography Export
Jan 12th, 2008, 12:52pm
 
Has anyone created a bibliography export template?  I am trying to export several types of reference from TBX. Just to keep it simple, I have the following fields:  Author; Title; Publisher; PubDate; Pages.  I'd like to export them in a single line rather than with a break after each field.

I have read the Endnote Import section of the Wiki, but don't quite understand it.

If anyone responds to this would you be willing to annotate your template? i.e. let me know precisely what each line means, including the meaning of carets ^ and expressions in parentheses?  

Thanks.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Bibliography Export
Reply #1 - Jan 12th, 2008, 6:34pm
 
Can you clarify - are you doing text export or HTML export?  You mention Endnote so I guess then where you want the exported data to end up.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lew Friedland
Full Member
*
Offline



Posts: 50

Re: Bibliography Export
Reply #2 - Jan 12th, 2008, 8:55pm
 
Actually, both. It's for a syllabus, so I need to export text. But also would like to export it to HTML to have it online for students.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Bibliography Export
Reply #3 - Jan 13th, 2008, 2:48pm
 
To understand the code see the manual and/or aTbRef. The lattter especially will explain how the codes work in a way that per-line comments can't. As you don't specify, I've assumed in the following that all your attributes are the default (string or text) type.

First, create a folder for you templates. In TextEdit, start a new document and make sure it is plain text format (Cmd+Shift+T). Now paste in this code:
Code:
^get(Name)^

^Text^

Author: ^get(Author)^
Pages: ^get(Pages)^
PubDate: ^get(PubDate)^
Publisher: ^get(Publisher)^
Title: ^get(Title)^ 


Save the page in your templates folder and call it "note text export.txt" and once saved close it. Make a new plain text file, save it in the same folder and call it "note html export.html". Paste in this code:
Code:
<h1>^get(Name)^</h1>
^Text^
<p>Footnotes:<br/>
Author: ^get(Author)^<br/>
Pages: ^get(Pages)^<br/>
PubDate: ^get(PubDate)^<br/>
Publisher: ^get(Publisher)^<br/>
Title: ^get(Title)^</p> 


Save and close. Now switch to your TBX file, open Edit menu -> Document Preferences.... On the 'HTML' pane, click the 'HTML template file: ' button, navigate to your templates folder and select the "note html export.html" you just made.  Now switch to the document preference 'Text Export' pane and click the main button doing the same process but selecting your "note text export.txt" file, Click OK to close the preferences. Tinderbox know know both where to look for export templates for either HTML or Text Export (as you could have used separate folders for each) and within the folder(s) which file is the default template for that export method.

Now to test. Select and/or open a note you'd like to export. Open a new Nakakoji (Text Export) view - Cmd+shift+N - and you should see something like this:

My article

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur ut nunc quis enim porttitor ullamcorper. Donec ut risus.
Quisque enim. Curabitur dui. Suspendisse euismod, urna ornare rhoncus commodo, mi augue convallis elit, vitae mollis mauris elit sit amet quam.
Nulla ac lorem. In adipiscing laoreet orci. Sed porttitor nulla eu tellus. Morbi commodo mattis risus.

Author: Fred Smith
Pages: 4
PubDate: 12 Nov 1998
Publisher: Flarb
Title: A Ref title


Open an HTML view  - Cmd+shift+H - and you should see something like this:
Code:
<h1>My article</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur ut nunc quis enim porttitor ullamcorper. Donec ut risus. </p>
<p>Quisque enim. Curabitur dui. Suspendisse euismod, urna ornare rhoncus commodo, mi augue convallis elit, vitae mollis mauris elit sit amet quam. </p>
<p>Nulla ac lorem. In adipiscing laoreet orci. Sed porttitor nulla eu tellus. Morbi commodo mattis risus.</p>
<p>Footnotes:<br/>
Author: Fred Smith<br/>
Pages: 4<br/>
PubDate: 12 Nov 1998<br/>
Publisher: Flarb<br/>
Title: A Ref title</p> 



There are some important differences to note.  In text export, line breaks/empty lines are reflected in the export except within the ^Text^ section.  In HTML export, although you could use ^get(Text)^ to export the note's body copy, if you try this you'll notice the text's paragraph breaks aren't correctly reflected in the HTML output.

At this point, whilst learning the export process I strongly advise ignoring notes about omitting the closing ^ on export codes - that's a convenience best left until you understand the export process better.

Anyway, there's enough to try for now.  Do work through the process top-to-bottom before trying any variations otherwise you'll miss out on the important building blocks of learning how to do export.  Things like recursive templates won't make sense until one's got the basics working.

Don't worry at this point about the exact layout of the footnotes - without a description of how they're to be output, I've just guessed. Still, you should still be able to see how data is written to the correct place in export.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lew Friedland
Full Member
*
Offline



Posts: 50

Re: Bibliography Export: Adding markup
Reply #4 - Jan 17th, 2008, 11:44am
 
This simple version is working for me.

^get(Author)
^get(Title)
^get(Publisher)
^get(PubDate)
^get(Pages)

^text


My question is, how to insert markup code, e.g. how to italicize title, insert commas between fields (e.g. author, title, publisher, pubdate) parenthesis for pubdate?


Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Bibliography Export
Reply #5 - Jan 17th, 2008, 2:11pm
 
Lew, it's important to remember that only within the output of ^text^ are paragraphs marked up.  Your list of attribute values will appear on one line.  The ^text will start on a new line, but only because its output starts with a <p> tag and your browser knows to start a new paragraph on a new line with some extra white space between it and the thing above it on the page.

Until you are a bit more familiar with both TB export code and HTML I strongly advise you don't omit the closing ^ on codes. Thus ^text = bad, ^text^ = good. Why? It will stop you getting odd, hard to figure issues with the browser output.  Putting the closing caret in both help TB not having to assess closures but will help you not to make coding errors where you mix HTML and TB code.

Copying your sample code, it looks like you're trying to put 2 spaces between each attribute.  Browsers collapse multiple white space to one space.  To have more, type '&nbsp;' for all spaces in a succession - or at least for the second one onwards and the browser will play ball.

Below is what I think you want. To help show the different space methods, each attribute value is followed - after the comma - by a 'normally typed' space character and then the HTML space entity (or tag if you prefer, though strictly not so).  I assume by parentheses you mean curved brackets? (It's an English/US English thing). Here's the code:
Code:
<p>^get(Author)^,&nbsp;
<i>^get(Title)^</i>,&nbsp;
^get(Publisher)^,&nbsp;
(^get(PubDate)^),&nbsp;
^get(Pages)^</p>
^text  


Although your browser will display that code as if is a web page, it isn't. Here's the above as a proper page such as you could (should!) put on your website:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>^get(Name)^</title>
</head>
<body>
<p>^get(Author)^,&nbsp;
<i>^get(Title)^</i>,&nbsp;
^get(Publisher)^,&nbsp;
(^get(PubDate)^),&nbsp;
^get(Pages)^</p>
^text^
</body>
</html> 


A page is supposed to have a title (what appears in the top of the actual browser's window (i.e. not in the HTML page). I've used the note's title  - we can use ^title^ instead of ^get(Name)^ but the latter makes it easier for you to put some other attribute there. You just swap 'Name' for some other attribute name.

Hope that helps  Smiley
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lew Friedland
Full Member
*
Offline



Posts: 50

Re: Bibliography Export:  closing gaps
Reply #6 - Jan 20th, 2008, 2:15pm
 
This template is working for me. I'm 90% of the way home. But there are some fields (e.g. page numbers) for which there is no data. So, for some notes I want to export as [author, title, publisher, date, pages]

Amar, America's Constitution: A Biography, Yale (2005), pp. 1-50.

For others (using the same example, where pages are missing) only:

Amar, America's Constitution: A Biography, Yale (2005)

But where values are in the middle, I am (of course) getting spaces and extra commas.

I assume that the correct way to amend this template would be to construct an "if" argument, e.g. if pages, get them, if not, omit.

I have just read through the Export Codes on TBRef several times. I don't understand how to construct this argument.

Thanks.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Bibliography Export
Reply #7 - Jan 20th, 2008, 4:38pm
 
Yes, you're on the right track with a 'if test'. We need to change this section:
Code:
(^get(PubDate)^),&nbsp;
^get(Pages)^</p> 


Why the first line - well, you don't want the comma+space if/when you're not writing the Page data. Try:
Code:
(^get(PubDate)^)^if(^get(Pages)^)^,&nbsp;
^get(Pages)^^endIf^</p> 


Huh?  What we're saying is if the 'Pages' info for this not is not empty (i.e. a value exists) only then do we write the Pages data.  This should work whether your Pages attribute is of String or Number data type.

There are more succinct ways of writing the syntax, but they're not ideal when trying to learn how to do this stuff. As you become more proficient you can prune the syntax if you so desire.

Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lew Friedland
Full Member
*
Offline



Posts: 50

Re: Bibliography Export
Reply #8 - Jan 20th, 2008, 4:50pm
 
Thanks Mark.  Can you point me to the section of TBRef or the Wiki where I might read up on these types of expressions?
Lew
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Bibliography Export
Reply #9 - Jan 20th, 2008, 4:56pm
 
This wiki page, this aTbRef page and of course the manual.

Don't get confused by references you may see to second, different, style of if/else/endif syntax. The latter is used for actions and rules.  In this scenario you do want the ^ - caret-delimited - syntax style.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print