inukshuk / jekyll-scholar

jekyll extensions for the blogging scholar
MIT License
1.14k stars 101 forks source link

Usage information? #1

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hello,

I'm interested in using jekyll-scholar for my publications. Would it be possible to have more information on the usage of jekyll-scholar?

Thanks for your help. -- Hiren

inukshuk commented 12 years ago

I've added simple instructions to the readme and pushed the gem to make it easier to try out.

So far, we've added support for bibliographies. Does this cover your requirements? Note that it should be relatively easy to add support for inline citations for individual blog posts, but I haven't looked into that yet.

Let me know if you run into any problems.

ghost commented 12 years ago

Great. Thanks for the simple usage.

I'm working on trying to get an output similar to (bibtex2web); here is an example: http://pmg.csail.mit.edu/pubs/. Could you guide me in what I would need to do in order to get jekyll-scholar to result in something similar?

inukshuk commented 12 years ago

It would be cool if we could exract general features from this to make it as useful as possible. Off the top of my head, I'd say we could add a couple of configuration options to:

Anything else?

ghost commented 12 years ago

Some suggestions:

Also, on a separate note, it'd be good if jekyll-scholar handled "{{" entries in the bibtex by using the :latex filter?

inukshuk commented 12 years ago

I imagine we could allow arbitrary sorting by simply having a configuration setting where you can put in any field name – that would be flexible. In that case the sub-heading would become a bit trickier though (is that important to you at the moment?).

How would the multiple download links work: multiple links in the URL field or separate fields? (I guess we should also link if there's a DOI field).

+1 on the LaTeX filter

ghost commented 12 years ago

The subheadings are not very important at the moment, but they are an elegant way to separate publications.

I think the multiple links in the URL might be tricky, and perhaps we should ignore it at the moment? The reason being that we'd want to use the same BibTeX file for the website as well as any LaTeX document. This only allows one url field. Encoding multiple links in the URL field might make it awkward when using the same file for a LaTeX document.

Having said that, there could be specific jekyll-scholar fields (url1, url2, url3 ... ?). In addition, I typically like to upload my presentation associated with a particular conference publication. This would have to be on its own field too (ppt ....) ?

The DOI field would certainly be useful.

ghost commented 12 years ago

I tried this out; however, it didn't sort by year for me ... =(

In my _config.yml I added:

citation:
  citation_style: _plugins/chicago-author-date.csl
  citation_language: en
  citation_sort_order: year

It shows up in the order specified in the bibtex file.

Also:

inukshuk commented 12 years ago

It's not implemented yet ;-)

About sort order: it's probably better if we use sort_by and sort_order in the configuration.

One thing that's a bit problematic is: if we're sorting the bibliography, should we retain any Markdown/HTML that is in the file between BibTeX entries? Or should we ignore everything that isn't BibTeX if sorting is active?

ghost commented 12 years ago

Oh heh -- sorry =)

I agree with sort-by and sort-order.

Could you provide an example that elaborates this problem?

inukshuk commented 12 years ago

The problem is this, say you have a file like this:

---
---

Some Markdown ....

@article{b1, ... }
@book{b2, ... }
@article{b3, ... }

 Some more Markdown ...

@article{b4, ... }
@book{b5, ... }
@article{b6, ... }

How should this be converted? Should we skip all the markdown and only print the bibliography b1 through b6 sorted. Or should we keep the markdown and treat the two sections with bibtex entries as two bibliographies, sorted individually?

I guess the problem comes down to how you would like to use the .bib file in your project. Is it a regular BibTex file that basically contains only your bibliography. Or is it more like a regular markdown page for the website with the added benefit that any contained BibTeX items can be formatted nicely.

inukshuk commented 12 years ago

Perhaps we should support both. We could distinguish by defining a new extension 'bhtml' or we could add a configuration option that you can put at the top of the file.

ghost commented 12 years ago

I get it.

My personal use case involves using a regular BibTeX file. Thus, I have no markdown in the BibTeX file.

If I did, then AFAIK the semantics of the Markdown before or after depends on the actual Markdown itself. For example, the Markdown could be a heading or a footer for the articles, but it'd be hard to know that without knowing the actual Markdown contents itself. My suggestion would be to ignore Markdown.

I don't know if this is possible, but it would be useful to have some form of an API (perhaps with Liquid) to do the above if required. For example:

---
---

Some Markdown ....

jekyll-scholar(my.bib,sort-by-year, [b1, b2, b3])

Some more Markdown ...

jekyll-scholar(my.bib,sort-by-year,[b4,b5,b6])

This would actually be very useful. In fact, for resumes, I already do this using BibLaTeX and it would seem useful for individual webpages where one wants to separate but order say conference publications, journals, presentations, etc. There could be better APIs too:


---
---

Some Markdown for journals ...

jekyll-scholar(my.bib, @articles, sort-by-year)

Some Markdown for conference publications ...

jekyll-scholar(my.bib, @inproceedings, sort-by-year)

Again, I don't know if this is possible and what one would have to do to get this to work, but it's an idea ...

inukshuk commented 12 years ago

I've added two tags {{ bibliography [filename] }} and {{ cite bibtex-key }} that generate citations and bibliographies. You can configure sorting and order options (I've moved everything to the 'scholar' namespace). I've only tested the functionality with cucumber and not an actual deployment so if you give it a spin it would be cool if you could let me know if it works as expected.

I've also updated the Readme file.

Citation references are not linked yet and I haven't included the URL or DOI links yet, because I'm not sure how best to configure them. If we add links after the reference string it would be good to use some kind of template in case you want to adjust the looks of the generated link. Any preferences on that front?

ghost commented 12 years ago

I tried this out. Please correct me if I'm wrong.

scholar:
   style: apa
   locale: en

   sort_by: year 
   order: descending

   source: ./_test
   bibliography: test.bib
---
---
Publications
=============
{% bibliography %}

A File System Design for the Aeolus Security Platform by F. Peter McKee. Masters thesis, MIT, (Cambridge, MA, USA), Sep. 2011. Details. Download: pdf.

Analyzing Audit Trails in the Aeolus Security Platform by Aaron Blankstein. Masters thesis, MIT, (Cambridge, MA, USA), June 2011. Details. Download: pdf.

inukshuk commented 12 years ago

I forgot to turn the bibliographies into lists. I pushed a new version and updated the Readme.

Basically, if you want to include regular bib files the best thing to do is to use the {% bibliography %} tag on normal pages or posts (i.e., you don't need to put the tags into a .bib file, it can be .md, .html or whatever converter you use).

ghost commented 12 years ago

Good. This works better now. Few more comments.

Thanks for your help.

inukshuk commented 12 years ago

Make sure that your pages are UTF-8, this is normally done by the server but you should also add it to your layout:

<meta charset="utf-8"/>

By selecting bibliographies by key, do you mean to pass a number of keys and generate a bibliography exclusively from these entries?

My plans are to add a block-form of the cite tag which generates a HTML blockquote complete with cite tags. Add page numbers to citations. And generally allow to pass in options to both the bibliography and the cite tags.

What sort of information would you like to generate? (The details file?)

ghost commented 12 years ago

Thanks fixed the utf-8 issue.

I do mean selecting entries exclusively. {% bibliography k1 k2 k6 k7 %} would be selecting keys 1,2,6, 7.

The details file would describe the following: (I wonder if it is possible to make this customizable btw)

ghost commented 12 years ago

Hello.

I added some simple code to generate the details files: https://github.com/hdpatel/jekyll-scholar/commit/dfb572afef55c47ec0e0a7314411fda3f7856ffe

If I want to use one of the layout files for each of the generated html pages, how would I change the code to do it?

inukshuk commented 12 years ago

Hej! I haven't had the time to look at this yet, but I think the best approach may be to use a generator for this.

You would require on individual page per entry, am I right? I.e., if you have ten entries in you bibliography you would expect to have ten detail pages?

inukshuk commented 12 years ago

This is not tested at all, but its a first rough sketch: perhaps we could implement the details generator like this.

The idea is, that you add a layout to your layouts directory and add the file name to your scholar settings as 'details_layout'; if this is set, the generator should pick it up and generate a page for each entry in you main bibliography. The entry should be added to the page data as 'entry', so if I understand this correctly you can access it in the details template as, for example {{ entry.title }} to print the title. etc.

As I said, this is just a first stab, will have to look at this more closely to figure it out, but I thought I'd push the code in case you have time to play around with it.

ghost commented 12 years ago

You have the correct idea, and thanks for giving me this example. A few comments:

inukshuk commented 12 years ago

@hdpatel you were absolutely right about these problems; I fixed those, along with some general misunderstandings I had about the way the liquid templates work. I tested this now, and it seems to work just fine. The idea is, if (and only if) you have a layout file that matches 'details_layout' in your configuration ('bibtex.html' by default) detail pages for each entry in the main bibliography will be generated according to the layout. In the layout you have access to each entry's fields so that gives you lots of options.

Stuff we may want to improve:

any other suggestions?

ghost commented 12 years ago

Hi,

I quickly tried this out on my setup, and it appears to be working. In addition to what you mentioned:

It seems like this is shaping up. I can give you more suggestions once I move my publication list to this.

ghost commented 12 years ago

Actually, one thing that might be useful is to have an additional field such as "public". This might be somewhat specific, but since I maintain one BibTeX file for all publications, I even put in the citations that haven't been published. Having a field to indicate whether to make that publication public would be a nice feature. This way I can just toggle that if I want it to be used ... ?

inukshuk commented 12 years ago

@hdpatel I've moved the query selector to the configuration file, so now you can directly control which entries are selected from your bibliography. I've also improved the query support in bibtex-ruby so you should install the latest gem in order to get full support in jekyll-scholar.

ghost commented 12 years ago

This is great. I upgraded bibtex-ruby and jekyll-scholar and tried it out. A few more comments:

inukshuk commented 12 years ago

@hdpatel, thanks for the continued feedback!

I was wondering about site.source, too, and I think that this isn't specific at all (after all, I'd assume it's quite common to have multiple deployments). Do you know how jekyll approaches this issue? I guess we'd have to check in the tag-render code where the current page is located relative to the site root: only then could we generate a relative URL.

Regarding the CSL question, this isn't possible because the concept of 'details page' is really beyond the scope of the cite processor. What sort of presentation for the links are you looking for? Could you give an example?

ghost commented 12 years ago

@inukshuk, thank you for continuing to listen and providing quick updates =)

<div class="med-para">
I also worked on the somewhat popular and <b>very</b> useful <a href="{{site.base_url}}/wildrepos-in-gitolite/">wildrepos</a> feature that is available in gitolite.  Check it out!
</dev>
My Title
My Authors
The venue

Details.

Alternatively, I could want:

<a href="details page">My Title</a>
My Authors
The venue

What do you think?

inukshuk commented 12 years ago

The site.source was actually a dumb mistake; I removed it and – having consulted the Jekyll Wiki again – I noticed that there's actually a baseurl configuration option. Don't know if that is used by other Jekyll modules, but I'm using that now (I also added a fallback for base_url).

I'd be cautious about adding a separate style format layout (been down that road before…), because this tends to become far too complex quickly. For example, how would you format the authors? Last name, first name? Or First name, last name. How about initials? etc.

If you do require a specific style that adds links and other information you would not typically find in a classic citation style, I think it is actually easier to just write a separate tag (or edit the bibliography tag) than to work within liquid templates.

ghost commented 12 years ago

Yes, I agree. I'll try to write my own tags and customize the link presentation there, and get back to you.

ghost commented 12 years ago

I made a custom tag to format the bibliography according to my wishes. I was wondering if you could provide me with some input on what may be the best way to include the section headers (for the year) .. (I'm not extremely familiar with Ruby) ...

Something else I thought might be useful to allow for a mapping of publication venues to links...?

inukshuk commented 12 years ago

EDIT: just a quick caveat, I didn't test the code below. it should work. if it doesn't please let me know! EDIT: I've fixed the key sorting below.

Basically, the method #entries in your tag gives you a list of all the entries sorted according to the order you specified in the configuration. By section headers, I assume you mean that you want to partition your entries into separate groups (e.g., all the entries published in 2006 etc.). and give each group a section header?

Of course there's more than one way to do this, but here are some ideas that could help:

# sort the entries by year
entries.sort_by { |e| e.year }

# or just:
entries.sort_by(&:year)

# one way to partition the entries by year
years = entries.inject(Hash.new { |h,k| h[k] = [] }) { |s,a| s[a] << a; s }

# the above returns a hash of year => entries mappings;
# if you're new to ruby you may prefer to do this differently. for example:

# hash to collect the entries by year
years = {}

entries.each do |entry|
  if years.key?(entry)
    years[key] << entry
  else
    years[key] = [entry]
  end
end

# this accomplishes the same thing
# now you can iterate through the years (sort them first)
years.keys.sort.each do |year|
  puts year #print the header
  years[year].each do |entry|
    puts entry #print formatted entry etc.
  end
end

do you have the publication venues stored in the entry? (and where they link to?)

ghost commented 12 years ago

Thanks. I will try it out and get back to you.

I don't have publication venues sorted in the entry. I guess, what I had in mind was to have another hash that has the string of the publication venue, and its link. Then, when generating the bibliography, I can index the hash to obtain the link...

inukshuk commented 12 years ago

On May 4, 2012, at 4:02 PM, Hiren Patel wrote:

Thanks. I will try it out and get back to you.

I don't have publication venues sorted in the entry. I guess, what I had in mind was to have another hash that has the string of the publication venue, and its link. Then, when generating the bibliography, I can index the hash to obtain the link…

That should be pretty easy if you just want to add the link at the end. However, if the you're trying toadd the link inside the formatted citation that'll be a bit more difficult (right now it would probably be best to customize the CSL style and then replace the link for each entry; future versions of citeproc will hopefully support registering callbacks for individual fields)

ghost commented 12 years ago

I wanted to actually do it within the formatted citation. I'm already customizing the CSL somewhat. So, it's not possible to link the actual formatted citation at the moment?

inukshuk commented 12 years ago

CSL does not really (as far as I know) define any concept of a link (it can be used to generate output in other formats than HTML), so I'm not aware of a CSL-specific way to express this. However, you could work in two steps:

In your CSL style define a prefix and suffix for the part that you want to be a link, e.g., prefix="<a href=\"VENUELINK\">" then you can replace the pattern /VENUELINK/ in the formatted citation with the actual link.

However, I wonder if it may not be better for you to not use CSL at all if you want such specific formatting; I think the big advantage of CSL is that you can pick from a wide range of standard styles and need not worry about the formatting. If you do not require that, you could also format the citation yourself (bibtex-ruby can parse the personal names for you which are often the most difficult part to format).

On May 4, 2012, at 4:18 PM, Hiren Patel wrote:

I wanted to actually do it within the formatted citation. I'm already customizing the CSL somewhat. So, it's not possible to link the actual formatted citation at the moment?


Reply to this email directly or view it on GitHub: https://github.com/inukshuk/jekyll-scholar/issues/1#issuecomment-5511370

ghost commented 12 years ago

Hiya. I'm working on customizing my tag, but when I try to do the following:

reference << entry.booktitle.to_s

It gives me an error saying: Liquid error: undefined methodbooktitle' for #`; any hints?

inukshuk commented 12 years ago

It's generally safer to access field values using array accessor syntax:

entry[:booktitle] #=> returns nil if there is no field 'booktitle'
entry.booktitle #=> raises method missing if there is no field 'booktitle'

The rationale is that if we treated everything as fieldname then we would hide errors like:

entry.booktitleto_s #=> would not raise an error

Therefore, the ghost methods in bibtex-ruby are implemented to only apply if there is an appropriate field in the current entry (although writer methods always work, i.e. entry.booktitleto_s = 'foo' raises no error and adds the field 'booktitleto_s'). That is to say, you should only use it if you know that your entries provide the appropriate field. For example you could do something like this:

reference << entry.booktitle.to_s if entry.provides?(:booktitle)

Note that this will even work if entry does not have a field 'booktitle' but cross-references another entry that has either a 'title' or 'booktitle' set. In case you do not want to resolve references, you could use #field? instead of #provides?

Finally, as I said above, if you were to use:

reference << entry[:booktitle].to_s

This would not raise an error but it would append an empty string to reference if there is no booktitle.

ghost commented 12 years ago

Great. Thanks for the tips.

inukshuk commented 12 years ago

That's a good point! We didn't expose the raw BibTeX to the liquid generator. I just pushed a new version of the gem; using that, you should be able to access it as {{ page.entry.bibtex }}.

ghost commented 12 years ago

Thanks. I've put that in my own fork now.

inukshuk commented 12 years ago

Hmm, there's currently no way to negate the entry type; in bibtex-ruby it's easy to simply pass in a Ruby block, that's why more complicated queries were not covered by the query language. However, if you could formulate the query positively it should work like @book[public!=no], @article[public!=no], @incollection[public!=no] ...

ghost commented 12 years ago

I'm not sure if it is possible to say not @misc entries positively other than writing out all that I do want to allow ... ?

ghost commented 12 years ago

It's okay, I separated them into separate BibTeX files to get around this.

inukshuk commented 12 years ago

I'd say this depends a lot on how you manage your bibliographies going forward. I assume you're using some kind of bibliography management software so it might be a good idea to try to go with how attachments are handled there.

One approach that comes to mind would be to extend the details generator, extract all attachments from each entry there and copy the files to the public directory; you could then expose the file names to the entry hash that is exposed to the details layout.

One potential problem when splitting your bibliography: right now the details are generated only for the main bibliography. It may be a good idea to change the default behaviour to use all .bib files in the directory instead.

ghost commented 12 years ago

I typically use either BibDesk, JaBref or just a text editor to manage my bibliographies. A question regarding bibtex-ruby, does it parse the filenames generated using BibDesk? For example:

@article{Martin:2008kl,
    Author = {M. G. F. Martin},
    Date-Added = {2008-06-16 16:57:34 +0100},
    Date-Modified = {2008-06-16 17:00:38 +0100},
    Doi = {10.1111/j.1933-1592.2008.00163.x },
    Journal = {Philosophy and Phenomenological Research},
    Keywords = {perception},
    Month = {May},
    Number = {3},
    Pages = {674-681},
    Title = {Commentary on \emph{{A}ction in Perception}},
    Volume = {76},
    Year = {2008},
    Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGCQpYJHZlcnNpb25UJHRvcFkkYXJjaGl2ZXJYJG9iamVjdHMSAAGGoNEHCFRyb290gAFfEA9OU0tleWVkQXJjaGl2ZXKoCwwXGBkdJCVVJG51bGzTDQ4PEBEUViRjbGFzc1dOUy5rZXlzWk5TLm9iamVjdHOAB6ISE4ACgAOiFRaABIAGWWFsaWFzRGF0YVxyZWxhdGl2ZVBhdGjSDRobHFdOUy5kYXRhgAVPEQGoAAAAAAGoAAIAAAxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAAC+dTGdSCsAAAB4GgoIMjAwOC5wZGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALlzzcR8TKIAAAAAAAAAAAAEAAUAAAkgAAAAAAAAAAAAAAAAAAAABk1hcnRpbgAQAAgAAL51I40AAAARAAgAAMR8PpIAAAABABgAeBoKAHgEBAB35S4Ad7zvAHe82AAAaqIAAgBKTWFjaW50b3NoIEhEOlVzZXJzOm1hcmtlbGlrYWxkZXJvbjpEb2N1bWVudHM6VGhlSHViOlBhcGVyczpNYXJ0aW46MjAwOC5wZGYADgASAAgAMgAwADAAOAAuAHAAZABmAA8AGgAMAE0AYQBjAGkAbgB0AG8AcwBoACAASABEABIAPVVzZXJzL21hcmtlbGlrYWxkZXJvbi9Eb2N1bWVudHMvVGhlSHViL1BhcGVycy9NYXJ0aW4vMjAwOC5wZGYAABMAAS8AABUAAgAW//8AANIeHyAhWCRjbGFzc2VzWiRjbGFzc25hbWWjISIjXU5TTXV0YWJsZURhdGFWTlNEYXRhWE5TT2JqZWN0XxAzLi4vLi4vLi4vLi4vRG9jdW1lbnRzL1RoZUh1Yi9QYXBlcnMvTWFydGluLzIwMDgucGRm0h4fJieiJyNcTlNEaWN0aW9uYXJ5AAgAEQAaAB8AKQAyADcAOgA/AEEAUwBcAGIAaQBwAHgAgwCFAIgAigCMAI8AkQCTAJ0AqgCvALcAuQJlAmoCcwJ+AoICkAKXAqAC1gLbAt4AAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAAC6w==}}

Notice the Bdsk-File-1 field. I was wondering if you already support that?

inukshuk commented 12 years ago

This looks like a base64 encoded location. This is how you could access the contents using bibtex-ruby:

require 'bibtex'
require 'base64'

BibTeX.parse(DATA) do |b|
  puts Base64.decode64(b[0]['bdsk-file-1'])
end

__END__
@article{Martin:2008kl,
   Author = {M. G. F. Martin},
   Date-Added = {2008-06-16 16:57:34 +0100},
   Date-Modified = {2008-06-16 17:00:38 +0100},
   Doi = {10.1111/j.1933-1592.2008.00163.x },
   Journal = {Philosophy and Phenomenological Research},
   Keywords = {perception},
   Month = {May},
   Number = {3},
   Pages = {674-681},
   Title = {Commentary on \emph{{A}ction in Perception}},
   Volume = {76},
   Year = {2008},
   Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGCQpYJHZlcnNpb25UJHRvcFkkYXJjaGl2ZXJYJG9iamVjdHMSAAGGoNEHCFRyb290gAFfEA9OU0tleWVkQXJjaGl2ZXKoCwwXGBkdJCVVJG51bGzTDQ4PEBEUViRjbGFzc1dOUy5rZXlzWk5TLm9iamVjdHOAB6ISE4ACgAOiFRaABIAGWWFsaWFzRGF0YVxyZWxhdGl2ZVBhdGjSDRobHFdOUy5kYXRhgAVPEQGoAAAAAAGoAAIAAAxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAAC+dTGdSCsAAAB4GgoIMjAwOC5wZGYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALlzzcR8TKIAAAAAAAAAAAAEAAUAAAkgAAAAAAAAAAAAAAAAAAAABk1hcnRpbgAQAAgAAL51I40AAAARAAgAAMR8PpIAAAABABgAeBoKAHgEBAB35S4Ad7zvAHe82AAAaqIAAgBKTWFjaW50b3NoIEhEOlVzZXJzOm1hcmtlbGlrYWxkZXJvbjpEb2N1bWVudHM6VGhlSHViOlBhcGVyczpNYXJ0aW46MjAwOC5wZGYADgASAAgAMgAwADAAOAAuAHAAZABmAA8AGgAMAE0AYQBjAGkAbgB0AG8AcwBoACAASABEABIAPVVzZXJzL21hcmtlbGlrYWxkZXJvbi9Eb2N1bWVudHMvVGhlSHViL1BhcGVycy9NYXJ0aW4vMjAwOC5wZGYAABMAAS8AABUAAgAW//8AANIeHyAhWCRjbGFzc2VzWiRjbGFzc25hbWWjISIjXU5TTXV0YWJsZURhdGFWTlNEYXRhWE5TT2JqZWN0XxAzLi4vLi4vLi4vLi4vRG9jdW1lbnRzL1RoZUh1Yi9QYXBlcnMvTWFydGluLzIwMDgucGRm0h4
fJieiJyNcTlNEaWN0aW9uYXJ5AAgAEQAaAB8AKQAyADcAOgA/AEEAUwBcAGIAaQBwAHgAgwCFAIgAigCMAI8AkQCTAJ0AqgCvALcAuQJlAmoCcwJ+AoICkAKXAqAC1gLbAt4AAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAAC6w==}}

Judging from the output, I'm sure you could parse the file name and copy the file to the public directory. Then you'll be able to manage all the PDFs in Bibdesk and they'll be copied to your website every time you run jekyll.

ghost commented 12 years ago

I tried looking at this, but it appears that what I get when I parse using Base64 and I get the following:

1.9.2-p290 :010 > puts Base64.decode64(b[:test]['bdsk-file-1'])
bplist00&'T$topX$objectsX$versionY$archiver?Troot?? 
#U$null?

WNS.dataO||WNS.keysV$class???????YaliasData\relativePath?
           Macintosh HD?}?HI?cps_dac2011.pdf??
                                              ??     Deskto??;;
                                                                  II???2Macintosh HD:Users:hdpatel:Desktop:cps_dac2011.pdf cps_dac2011.pdf
                                     Macintosh HD%Users/hdpatel/Desktop/cps_dac2011.pdf/????X$classesZ$classname? !]NSMutableDataVNSDataXNSObject_&../../../../../Desktop/cps_dac2011.pdf?$%?%!\NSDictionary??_NSKeyedArchive(25:<EKR]eloqsvxz|???? "'0;?MT]?????(?
 => nil 

I'm not sure how I would really parse that. I'm thinking of deferring it to just adding simple fields file = {./pubs/filename.pdf} and then making sure that the file is where it needs to be. Any other suggestions?

inukshuk commented 12 years ago

One thing I would do is to put all the files into the same directory and then grep for the respective file names. That is to say, if you know that your files are stored in Users/hdpatel/Documents/ for example, you could do something like:

Base64.decode64(b[:test]['bdsk-file-1']).scan(/(\/Users\/hdpatel\/Documents\/\w+\.pdf)/)[0]

That's not very portable but it would have the benefit of not forcing you to keep the attached file name the extra field manually synced.