Get system generated filename without path infos during export

Is there a way to get the filename of a note which is generated during export but without path information?

In my current project I exported a bunch of notes into a folder A. Instead of recreating the same notes as files for each agent I just want to reference the files in folder A.

^file^ doesn’t work for my purpose as it gives me the filename plus the absolut path. I would need just the (system generated) file name.

HTMLExportFileName cannot be evaluated during export if not set manually (what I would like to avoid). Is there any other options?

Forgive me, I’m not quite sure what this means. Can you give examples of what you are getting and what you are expecting. Is this HTML export or some other format? I sense too, that while the question refers to the exported filename that actual issue maybe about cross-linking between the exported notes when the notes are exported from an agent rather than their original (outline) location.

It may be quicker just to make a small demo file with 3 or 4 exported notes that shows the problem.

I think what you are asking is likely do-able … once we’ve clarified the exact problem (lest we solve the wrong problem!).

1 Like

Thanks Marc for your prompt reply.

Cross-linking, thats the word for it :o)

Just in case I attached an example file.

Created links in “Agent1.html” refer to files in folder “Agent1” - what is correct and expected.
Created links in Agent2.html refer to files in folder “Agent2” - what is also correct according TBX logic … but what I would like to change by cross-linking to folder “Agent1”.

test.tbx (166.7 KB)

1 Like

Thanks. I’ve added back some prototypes and tried some things. I think (new) agent ‘Agent4’ is what you want, as in:

<h2>The Arc</h2>

<hr/>

<hr/>
<p>Example Headline</p> 
<p>&bull; <a href="Note_1.html">Note 1</a></p>  
<p>&bull; <a href="Note_2.html">Note 2</a></p> 
<hr/>
<p>Example Headline next here ...</p> 
<p>&bull; <a href="Note_3.html">Note 3</a></p>  
<p>&bull; <a href="Note_4.html">Note 4</a></p>  
<p>&bull; <a href="Note_5.html">Note 5</a></p> 
<hr/>
<p>Example Headline next here ...</p> 
<p>&bull; <a href="Note_6.html">Note 6</a></p>  
<p>&bull; <a href="Note_7.html">Note 7</a></p> 
<hr/>
<p>Example Headline next here ...</p> 
<p>&bull; <a href="Note_8.html">Note 8</a></p>  
<p>&bull; <a href="Note_9.html">Note 9</a></p>  
<p>&bull; <a href="Note_10.html">Note 10</a></p> 
</div>

The clue is found here.

Note that <p/> doesn’t do anything. I think you mean to use an HTML line-break as in <br/>. Thus your ‘Arc’ template text line becomes:

^if($Text)^<p>^value($Text.replace("\n","<br/>"))^</p>^endIf^

The ^if^ wrapper is needed as otherwise if—as here—the agent has no $Text, then an empty <p></p> tag pair is emitted.

I’ve added new templates for both the tests ‘Agent3’ and ‘Agent4’ that I created.

Anyway see ‘Agent4’ in the attached file: test-ed.tbx (255.6 KB)

1 Like

Thanks Marc for your effort and the great hint.

$HTMLExportPath.split("/").at(-1)

Your code snippet from the doc works pretty well and was exactly what I was looking for.

I am not sure if I understand you correctly but <p/> works fine for my purpose. As I need quite a lot of paragraphs in my templates I like to use the short tag instead using <p>some text</p>. When I export I see line breaks in Safari where I want to have them.

1 Like

Understood. If the <p/> works for you, that’s fine!