In the payload from Bookends to tbx, how to include the Notes stream from Bookends

Hello,

I have annotated and added couple note cards to a .pdf associated with one of the reference in my Bookends file. Is there a way to add the ’NoteStream’ (&Notestream) of the reference to the payload when I Opt + Cmd + Drag that reference to Tinderbox. I would the want the $NoteStream to the $Text.

Thank you!

The parts of this are here: Bookends. If you edit the default RIS fields in Bookends’ Format Manager you can pass additional fields into $ReferenceData.

Bookends doesn’t have a ‘NoteStream’ formatting field. Of the options available, I assume you’re after ‘Notes’ (formatting code n):

If you add that to Bookends RIS and/or your current Bookends active format, and it is used as described in the link above.

@mwra Thank you!

I seem to have the RIS firing corrupted:

  1. Original when I draged a reference (ALT+CMD), into Tinderbox, the text in the note pane was a formatted reference.

  2. Then I added for the abstract to be added. With this I had formated reference and abstract appear in the Note pane. Worked nicely

  3. Then I tried to add the notes from Bookends to the formatted reference and abstract (using a code from Claude). Now I am getting the whole RIS.

  4. Even when I deleted the code in the action pane, whenever I drag a reference from Bookends it is now firing RIS (all the fields are appearing on thetext pane)

  5. Even when I open a new Tinderbox document (without altering the Reference prototype), still when I drag a reference from Bookends to Obsidian, all the fields from RIS appear on the text pane (no the formatted reference which originally appeared before I tried chaging to get the notes from Bookends to appear in the Note pane).

    What I am getting is:

    TY  - JOUR
    
    AU  - Fariyike, Olubunmi A.
    
    AU  - Blackwell, Laura S.
    
    AU  - Frassanito, Paolo
    
    AU  - Holmgren, Rafael T.
    
    AU  - Chakrabarty, Amit
    
    AU  - De Maria, Lucio
    
    AU  - Sinha, Virenda Deo
    
    AU  - Trivedi, Jai
    
    AU  - Johnson, Garlynd
    
    AU  - Gupta, Deepak K.
    
    AU  - Walson, Emma C.
    
    AU  - Fainberg, Nina
    
    AU  - Muhammad, Maria
    
    AU  - Velasquez, Leslie
    
    AU  - Khan, Myer
    
    AU  - Brahma, Saya P.
    
    AU  - Chern, Bethany
    
    AU  - Baer, Anna V.
    
    AU  - Lepard, Jacob R.
    
    AU  - Zohdy, Youssef M.
    
    AU  - Laxpati, Nealen
    
    AU  - Verma, Meena S.
    
    AU  - Javed, Mahwish
    
    AU  - Lippa, Laura
    
    AU  - Oluwamayowa, Opara
    
    AU  - Van He, Dong
    
    AU  - Adeleye, Amos O.
    
    AU  - Lucena, Lynne Lourdes N.
    
    AU  - Janssen, Insa Katrin
    
    AU  - Adelson, P. David
    
    AU  - Rostami, Elham
    
    AU  - Iaccarino, Corrado
    
    AU  - Reisner, Andrew
    
    T1  - Developmental Considerations in Hydrocephalus after Traumatic Brain Injury in Children: A Narrative Review
    
    KW  - Cerebrospinal fluid dynamics,decompressive craniectomy,developmental pediatrics,global health,shunt,traumatic brain injury
    
    PY  - 2026 mar
    
    JA  - Brain Inj
    
    SP  - 1-8
    
    
    
    
    
    
    
    AB  - INTRODUCTION: Posttraumatic hydrocephalus (PTH) is an uncommon but serious complication of traumatic brain injury (TBI). Although extensively studied in adults, important developmental differences in the pediatric central nervous system contribute to differing PTH pathophysiology, with important differences in diagnosis, clinical course, and treatment. OBJECTIVE: This review synthesizes current evidence regarding pediatric PTH, with specific attention to the influence of pediatric developmental pathophysiology on disease susceptibility, diagnosis, and outcomes. KEY TAKEAWAYS: Pediatric-specific data on PTH remain limited; however, recent studies suggest that younger age - particularly under five years at injury - as well as injury severity are the two strongest predictors of PTH development. Clinically, PTH may present acutely with neurological deterioration or chronically with delayed recovery and neurodevelopmental regression. Early recognition is critical, as untreated PTH can lead to lifelong neurological dysfunction and even death, yet diagnosis is often delayed by symptom overlap with other posttraumatic conditions and difficulties in distinguishing true hydrocephalus from ventriculomegaly. Management is primarily surgical and centers on cerebrospinal fluid (CSF) diversion, most commonly with external ventricular drainage (EVD) in the acute phase and permanent shunting or ventriculostomy in select cases. Despite timely intervention, long-term morbidity remains substantial, underscoring the importance of prevention, early detection, and multidisciplinary follow-up.
    
    N1  - # The physiology of children that make hydrocephalus presentaion different is 10 compliant skull, 2) evoving CSF dynamics and 3) inflammatory response tjat is different at different ages.
    
    
    
    Infants have a higher risk of developing PTH.
    
    
    
    
    
    Head injurin children is disporportiantely grater in children.
    
    
    
    # Why children might be susceptible to hydrocpehalus
    
    
    
    The increased complaince of the imammaure white mamter and skull might dampen the intracraanial pressure from hydrocpewhalus and decrease its clearence through arachnoid granualtions athan dural venou ssinus. More the relatively greater fetal haemoglobin (imapir oxygen transfer) and immature CSF dynamics) make children mre susceptible to hydrocpehalus
    
    
    
    obsidian://open?vault=journal-club&file=Bookends%2FFariyikeEtAl2026
    
    
    
    obsidian://open?vault=journal-club&file=neurosurgical-oncology%2FLectures%2FPaediatric_post_traumatic_hydrocephalus%2FBookends%2FFariyikeEtAl2026
    
    
    
    obsidian://open?vault=journal-club&file=Bookends%2FFariyikeEtAl2026
    
    
    
    obsidian://open?vault=neurosurgical-oncology&file=Lectures%2FPaediatric_post_traumatic_hydrocephalus%2FFariyikeEtAl2026
    
    
    
    obsidian://open?vault=neurosurgical-oncology&file=Lectures%2FPaediatric_post_traumatic_hydrocephalus%2FReferences%2FFariyikeEtAl2026
    
    
    
    ER  - 
    

    What I want in the Text pane are: 1) formatted reference (as had appeared originally) + abstract and the notes from Bookends.

    Thank you!

If $Text is getting RIS, it will be because you have that format selected as the active format in Bookends.

What format in Bookends were you using for the ‘formatted reference’? You need to, in Bookends:

  • find that format in Format Manager and duplicate it (as the edits you will make affect all use of the format, not just in
  • add the extra fields you want, e.g. the record’s notes, to the format (for all record types in the format (i.e. journal/book/etc.)
  • make sure this is the selected format in the main app.

Thus there are likely two Bookends formats you may wish to amend:

  • RIS as it controls the RIS format data passed into $ReferenceData
  • [other format] as it controls what is passed into $Text, i.e. the 'formatted reference

If stuck on the Bookends end or if you’ve messed up the formatting files in Bookends, check with Bookends’s tech support. Jon, the dev, is very responsive and helpful.

I’d also be careful throwing this task at Claude. Why? Because though you know the outcome you want you don’t know how that is achieved. As this is an edge case involving two apps and not heavily documented, Claude’s guessed solution may look correct but might screw up other things. I think this sort of task is better done by a human. Claude’s very good at ‘reading the handbook’ but IIRC from doing this exercise myself (and thus the aTbRRef notes) it involved some guesswork to figure out the rubric. It isn’t (directly) in the Bookends documentation.

@mwra Thank you! I agree that manually coding would be ideal. However. hopefully would be able to undertake complex manual coding sometime in the future.

However, I managed to find a solution.

I added the following code to the Edict of the Reference prototype. Then, I dragged a reference (with ALT + CMD) from Bookends and drop into a container in Tinderbox. The container has AddOn to apply the Reference prototype.

The note initially looks like RIS. However, when you click out and click on the note again, the magic happens: The $Text = Reference in Vancouver style → by abstract → notes

The code was done with Claude and the fine tuned by Gemini.

*** Could you please guide me to have two text panes of the same note. In one pane I want to view ‘text’ and the other the ‘preview’. Wish to to see both of them at the same time

if($Text.contains("TY\s+-\s")) {

   var:string vRIS = $Text;

   var:string vNotes = "";

   

   // Robust Notes extraction using Regex to handle varied spacing

   if(vRIS.contains("N1\s+-")) {

      // Split using a regular expression for the N1 tag

      vNotes = vRIS.split("N1\s+-\s+").at(1);

      

      // Cut off at the next RIS tag (Any newline + 2 chars + hyphen) or End of Record

      if(vNotes.contains("\n[A-Z0-9]{2}\s+-")) {

         vNotes = vNotes.split("\n[A-Z0-9]{2}\s+-").at(0);

      } else if (vNotes.contains("ER\s+-")) {

         vNotes = vNotes.split("ER\s+-").at(0);

      };

   };



   // Clean up Authors and Year

   var:string vAuthors = $Authors.replace("\.;", ";").replace(";", "; ");

   // This regex removes months regardless of case or position

   var:string vYear = $PublicationYear.replace("(?i)\s(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)", "");



   // Build Citation String

   var:string vCite = vAuthors + ". " + $Title + ". " + $Journal + ", " + vYear;

   if($Volume) { vCite = vCite + ";" + $Volume; };

   if($Issue) { vCite = vCite + "(" + $Issue + ")"; };

   if($Pages) { vCite = vCite + ": " + $Pages; };

   vCite = vCite + ".";

   if($DOI) { vCite = vCite + " https://doi.org/" + $DOI; };



   var:string vOut = vCite;



   // Format Abstract

   if($Abstract) {

      var:string vAbs = $Abstract;

      // This formats headers while preventing excessive empty lines

      vAbs = vAbs.replace("(?i)(INTRODUCTION|OBJECTIVE|METHODS|RESULTS|CONCLUSION|BACKGROUND|DISCUSSION|FINDINGS):", "\n<b>$1:</b>\n");

      vOut = vOut + "\n\n" + vAbs.trim();

   };



   // Append Notes with a clean // Append Notes if found

   if(vNotes != "" & vNotes != "undefined") { 

      // 1. If there is an ER tag left, split by it and take the first part

      if(vNotes.contains("ER  -")) {

         vNotes = vNotes.split("ER  -").at(0);

      };

      

      // 2. Final trim to remove any stray RIS formatting characters

      vNotes = vNotes.trim();

      

      vOut = vOut + "\n\n<b>NOTES:</b>\n" + vNotes; 

   };

   

   $Text = vOut;

};

Thank you

tinderbox_import_bookends_with_bibil_abstract_notes.tbx (195.9 KB)

1 Like

Please find an updated file. It adds space above the subtitles of an abstract. The code is in the Edict of the Reference prototype. Thanks

tinderbox_import_bookends_with_bibil_abstract_notes.tbx (198.5 KB)

Good, glad you have solution.

It’s hard to test your solution as there’s no note of the active format being used in Bookends. IOW, to what content are we appending $Text. As expected, Claude’s spaghetti guess-code gets there in a roundabout way.

More simply, having added the source Bookends’s record’s ‘nOte’ to the Bookends-generated RIS, the notes now come access to Tinderbox as RIS field N1. A bit messily as RIS is a format from a previous millennium and assumes short, singe-line(paragraph) strings.

Still, what we want, in cleaner code is to get the contents of RIS field N1 from $ReferenceData and append it to $Text (with a line break in between). A clearer model is to use stream parsing. Given that AI is supposed to read manuals better than humans, I’m surprised it seems unaware of stream parsing.

Bottom line, if you have code that works and it involves detail you don’t follow, use what you have. But for alter readers, I don’t think the code in the TBX above is a good start for a concise Tinderbox-style solutions stream paring instead as this is exactly the sort of scenario for which it is designed.

I’d dig in further but I’m travelling until the end of next week and time/bandwidth is limited. Not least I’m disappointed Claude didn’t do a better/cleaner job, and I am wondering why.

@mwra Thank you for pointing out that this can be accomplished more cleanly using stream parsing - I appreciate you sharing that insight.

Unfortunately, Claude wasn’t able to complete the entire task. I used the code it generated as a starting point and turned to Gemini to resolve the remaining issues.

Please find the Bookend file attached for your reference. I look forward to seeing your solution at your convenience.

Thank you again.

paediatric-post-traumatic-hydrocephalus.bdb.zip (906.3 KB)

Missing (for later testing): which is the Bookends format you use to generate the ‘styled reference’ the drag/drop inserts in to Tinderbox $Text?

Thanks for the file, but note that the format info you edit in Format’s Manager in Bookends is not stored in the ‘bdb’ file but locally on your Mac: the file may show the chosen format’s name but not any customisation of the format. The easiest way to tell the format selected is to look at the status bar of an open Bookends database. Here I use the format ‘BibTeX’;

Note: my choice above is irrelevant to the task at hand. But it helps to know where to find the name of what you have selected.

@mwra Thank you! I did not edit any of the existing formats. The RIS.fmt alreasdt had a tag for notes ($N1 - $n):

On my Bookends there is no mention of which format I am using:

Hope this answered your question. Otherwise, please let me know.
Thank you!

I’m on the road but anyone can fill in the stream parsing bit for @naren17

The rough parts:

  • take the RIS info code example upthread and paster it into $ReferenceData of a new note.
  • field N1 (the notes data) is IIRC last in the code except the closing ER tag.
    • so parse to paragraph starting N1 and save everything after the marker to the end to a string variable
    • find and remove the unwanted ER tag at the end
    • append the resulting string into the desired $Text

A nice weekend coding puzzle for someone.

Some hidden assumptions:

  • this uses customised RIS format in Bookends
  • the location of N1 data in the dropped RIS data is last but one. If not, adjust parse logic.
  • the notes are multi-line paragraph and RIS is from the old days so there’s little concept of a multi-line (paragraph) value. Thus to get all of N1 don’t capture the N1 field or you’ll only get para #1 of the notes.

This is only ‘complex’ if you assume it is simple, i.e. no edge-cases to work around. Tinderbox’s action code has all the tools needed.

If any later readers of this thread are asking, ‘why all this work?’, the answer is the OP wants a non-standard, i.e. not baked-in, variant to inter-app data transfer, and that necessarily involves changes both to Bookends data format configurations and adding some custom code in Tinderbox. Extra work? Sure, but is it worth the time of two dev’s to code this for one person? The fact this is pretty easy to do is a strength of apps like Tinderbox and Bookends.

1 Like

@mwra Thank you! I gave your advise to Gemini. It took you advise and revised the code.

if($Text.contains(“TY\s±\s”)) {
// Mark’s suggestion: Store raw data before we transform $Text
$ReferenceData = $Text;

var:string vRIS = $Text;
var:string vNotes = “”;

// 1. Extract Notes (N1) - Handling multi-line paragraphs
if(vRIS.contains(“N1\s±”)) {
vNotes = vRIS.split(“N1\s±\s+”).at(1);

  // Stop at the end of the record
  if(vNotes.contains("ER\s+-")) {
     vNotes = vNotes.split("ER\s+-").at(0);
  };
  
  // MARK'S FIX: Remove any redundant "N1 - " markers from multi-paragraph notes
  vNotes = vNotes.replace("\n?N1\s+-\s+", "\n\n");

};

// 2. Clean up Authors and Year
var:string vAuthors = $Authors.replace(“.;”, “;”).replace(“;”, “; “);
var:string vYear = $PublicationYear.replace(”(?i)\s(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)”, “”);

// 3. Build Citation
var:string vCite = vAuthors + ". " + $Title + ". " + $Journal + ", " + vYear;
if($Volume) { vCite = vCite + “;” + $Volume; };
if($Issue) { vCite = vCite + “(” + $Issue + “)”; };
if($Pages) { vCite = vCite + “: " + $Pages; };
vCite = vCite + “.”;
if($DOI) { vCite = vCite + " https://doi.org/” + $DOI; };

var:string vOut = vCite;

// 4. Format Abstract with Headers
if($Abstract) {
var:string vAbs = $Abstract;
var:string vHeaders = “KEY TAKEAWAYS|TAKEAWAYS|INTRODUCTION|BACKGROUND|OBJECTIVE|OBJECTIVES|PURPOSE|RATIONALE|HYPOTHESIS|METHODS|METHODOLOGY|DESIGN|SETTING|PATIENTS|PARTICIPANTS|INTERVENTIONS|INTERVENTION|EXPOSURES|MAIN OUTCOME MEASURES|MEASUREMENTS|RESULTS|FINDINGS|OUTCOMES|DISCUSSION|STRENGTHS|LIMITATIONS|CONCLUSIONS|CONCLUSION|SIGNIFICANCE|CLINICAL RELEVANCE|IMPLICATIONS|PRACTICE IMPLICATIONS|TRIAL REGISTRATION|FUNDING|DATA SOURCES|STUDY SELECTION”;

  vAbs = vAbs.replace("(?i)(" + vHeaders + "):", "\n\n<b>$1:</b>\n");
  vOut = vOut + "\n\n" + vAbs.trim();

};

// 5. Finalize Notes
if(vNotes != “” & vNotes != “undefined”) {
vNotes = vNotes.trim();
if(vNotes != “”) {
vOut = vOut + “\n\nNOTES:\n” + vNotes;
};
};

$Text = vOut;
};

tinderbox_import_bookends_with_bibil_abstract_notes_2.tbx (198.9 KB)

Attached the updated tbx file. 

Thank you and wishing youa smooth travel!

Good, and well done!

1 Like