Markup Text in Evaluator Columns

Continuing the discussion from Directory Opus 13.13.8 (Beta):

For testing purposed, I'm trying to return markup text within one of my evaluator columns. I guess I've got some minor knowledged about how to achieve this since I dod not get any formated column values so far.

This is my test so far, trying to embed a given string into underlines which should give me and underlined username in my case.

if (is_dir) { return };

username = RegExS(name, ".*\((.*)\)(.*)", "\1" );
return "_" + username + "_";

However, I do get

_username_

instead.
The option "Support markup" is set for this column, btw.

Did I miss the obvious? Do I have to call a special function to return markup texts instead of trying manually as above?

Or is the missing link that the markup text must be requested explicitly as stated in the release notes. If yes, when does this happen for evaluator columns?

Yes.

This still leaves the question, when does this happen?

Or with other words: I've requested this feature for a long time for some basic formatting of columns.

So which prerequisites must be met for requesting markup text and how will I noticed this in my evaluator scripts/columns?

Try this:

if (is_dir) return;

username = RegExS(name, ".*\((.*)\)(.*)", "\1" );

operation == "markup" ? "Marked up! <b>" + username + "</b>" : username
XML
<?xml version="1.0"?>
<evalcolumn align="0" attrrefresh="no" autorefresh="no" customgrouping="no" foldertype="all" keyword="54863" maxstars="5" namerefresh="no" nocache="no" reversesort="no" supportmarkup="yes" title="54863" type="0">if (is_dir) return;

username = RegExS(name, &quot;.*\((.*)\)(.*)&quot;, &quot;\1&quot; );

operation == &quot;markup&quot; ? &quot;Marked up! &lt;b&gt;&quot; + username + &quot;&lt;/b&gt;&quot; : username</evalcolumn>

Thanks for this example, works with a little correction:

return operation == "markup" ? "<b>" + username + "</b>" : username;

Did not know there is a new (global) parameter: operation which does the job and btw, I've mixed up markup and markdown, hence I tried to use ** instead <b> </b> :wink:

Nevertheless, the lister does not make use of my bold formatted username so far :frowning:

Get a new lister :wink:

image

I have been tinkering with the thoughts in this thread a little.
Interesting that both <u> </u> and <a> </a> both underline.

<?xml version="1.0"?>
<evalcolumn align="0" attrrefresh="no" autorefresh="no" customgrouping="no" foldertype="all" keyword="54863" maxstars="5" namerefresh="no" nocache="no" reversesort="no" supportmarkup="yes" title="54863" type="0">if (is_dir) return;

username = RegEx(name, &quot;(.*)(\..*)&quot;, &quot;\1&quot; );
//operation == &quot;markup&quot; ? &quot;Marked up! &quot; + &quot;&lt;u&gt;&quot; + username + &quot;&lt;/u&gt;&quot; 
operation == &quot;markup&quot; ? &quot;Marked up! &quot; + &quot;&lt;a&gt;&quot; + username + &quot;&lt;/a&gt;&quot; 
</evalcolumn>

If I create a text file named www.resource.dopus.com.txt, an underlined www.resource.dopus.com is displayed, but the HTML hyperlink version is fictitious. It does not really do anything when clicked.

Strike through text doesn't work either, but what we have now is useful and interesting.
This is as far as I have on this as of tonight.
Sorry if I missed something major. :slight_smile:

Edit note: Why does adding a semicolon to the end of the operation code line kill that code line ?

https://docs.dopus.com/doku.php?id=evaluator:grammar

An implicit return must not end with a semi-colon, as a semi-colon terminates the clause and the result will be lost.

Thanks ! :grinning:

Kind of strange: When using this coding

if (is_dir) { return };

warranty_yrs = RegExS(name,"(.*)(\[)(\d+)(.*)", "\3");
if (warranty_yrs == name) { return };

invoice_date = RegExS(name,"(^\d{4}-\d{2}-\d{2}) (.*)", "\1");
expires_date: date = DatePart(invoice_date,"YYYY-MM-dd");

if (operation == "markup") 
  {  return "<b>" + expires_date + ( warranty_yrs + "y" ) as date + "</b>"  }
else
  { return expires_date + ( warranty_yrs + "y" ) as date }

The evalutor preview for a file like
2016-07-02 Globus Baumarkt LED Lampe (Wohnzimmer) [7 Jahre Garantie].pdf
shows the expected date

However, when activatiing the markup preview, I get this date


I expected the same date 02.07.2016 shown in bold digits.

What's wrong with my coding, especially with the new markup formatting?

I think you need brackets around the conversion to date, so it doesn't convert the wrong things:

  {  return "<b>" + (expires_date + ( warranty_yrs + "y" ) as date) + "</b>"  }

That works from my testing, at least.

Unfortunately this does not work either - I had those brackets in place already because I too thought that concatenating "" could rise some issues.

Anyway, I've copied and pasted your coding and still getting the date 01.01.1601

Silly me! If I setup this evaluator to return a date then this obviously causes some troubles when prefixing and postfixing a text.

So, It works now, when switching to type text - thanks for reading :wink:

1 Like