moioci

I always wanted to have an easy way to count the number of items returned by a Trunk Notes list function, especially {{tagged}} and {{action}}. It turned out to be easier to accomplish in lua than I expected. Note that the script below uses the wiki.exprl function, with an 'L', not a '1'.

Count.lua:

fn_name = args[1]
fn_args = args[2]

my_list = wiki.exprl(fn_name, fn_args)

count = #my_list
return count

So, to find out how many pages are tagged with ".Project", I use:

{{lua Count.lua, tagged, .Project}}

Script returns: 82 (Yikes)

One limitation: the tagged function accepts more than one tag and will return a list of those pages with tag1 AND tag2 AND ... tagn. This script only works with one tag.
With some finagling, I can make it work with up to two tags:

fn_name = args[1]
fn_arg1 = args[2]
fn_arg2 = args[3]

my_list = wiki.exprl(fn_name, fn_arg1, fn_arg2)

count = #my_list
return count

This works properly with the above invocation and with the following:

{{lua Count.lua, tagged, .Project, .ThisWeek}}

and returns 14. (That's a little better.) I don't think I'll need more than two
arguments here, but you can see how to extend it if needed.

posted in Trunk Notes Discussion read more
moioci

@srhyse Thanks, that helps me with the syntax for my other question, but here I want to sort by the date I've spelled out in the entry, which I thought was the default behavior for action, but it doesn't seem to be happening properly. Oddly, if I put a time in the entry, even though I'm using a date-only date format, it seems to throw the date sort off, depending on the time of day when the function is executed.

posted in Trunk Notes Help read more
moioci

I'm used to the output from the action function being returned in date order. Currently I am seeing things returned in reverse order by date edited, I think. I'm using the MM/DD/YYYY date format.

A typical line looks like:
@tag (priority) 03/09/2016 Whatever goes here

I'm on iPhone 6+, ios 9.2.1, TN 4.3.0

posted in Trunk Notes Help read more
moioci

I see mention in the what's new page of a customized sort order for certain functions, including {{action}}. I can't find the syntax and which functions it applies to. Am I missing something, or did that get rolled back?

posted in Trunk Notes Help read more
moioci

As far as the first point goes, a snippet is your friend here.

Make a new page titled Snippet:rb (for red box)
Add your HTML. Here's an example:

<p style="border:1px solid #FF0000">**</p>

Note the ** will be the insertion point when the snippet is executed.
To do so, just type rbxx.

As to your other point, I think the app is what it is. Matthew has fixed a crasher in the past few months, but I don't think we can expect any new features. I for one would be willing to pay for a TN2 if such a thing were to appear, but I'm not holding my breath.

posted in Trunk Notes Discussion read more
moioci

Solarized Light Style:

body {
font: medium "Verdana";
font-size:18px;
background: #fdf6e3;
color: #586e75;
margin:0;
}

h1 {
font-weight: bold;
font-size: 20px;
color: #d33682;
}

h2 {
font-weight: bold;
font-size: 18px;
color: #6c71c4;
}

h3 {
font-weight: bold;
font-size: 18px;
color: #2aa198;
}

#info {
font: medium Arial;
background: #CFCFCF;
font-size: 12px;
padding-left: 4px;
margin-bottom: 0px;
padding-top: 2px;
padding-bottom: 2px;
height: 14px;
}

.highlight {
background-color: yellow;
}

.highlight-selected {
background-color: #dc322f;
}

#contents {
margin-top: 0px;
padding-left: 8px;
padding-right: 8px;
}

table {
margin: 1em;
border-collapse: collapse;
width: 90%;
}

td, th {
padding: .3em;
border: 1px #ccc solid;
}

thead {
background: #ccc;
}

a {
text-decoration: none;
}

a.wiki-link {
text-decoration: underline;
border-bottom: none;
color: #268bd2;
}

a.missing-wiki-link {
color: #dc322f;
}

html {
-webkit-text-size-adjust: none;
}

ul {
line-height: 1.3
}
li {
padding:0.5em 0;
}

posted in Trunk Notes Help read more
moioci

Oh, the injustice! Caught by the "new user" timeout, after all these years.

Solarized Dark Style:

body {
font: medium "Verdana";
font-size:18px;
background: #002b36;
color: #93a1a1;
margin:0;
}

h1 {
font-weight: bold;
font-size: 20px;
color: #cb4b16;
}

h2 {
font-weight: bold;
font-size: 18px;
color: #b58900;
}

h3 {
font-weight: bold;
font-size: 18px;
color: #859900;
}

#info {
font: medium Arial;
background: #CFCFCF;
font-size: 12px;
padding-left: 4px;
margin-bottom: 0px;
padding-top: 2px;
padding-bottom: 2px;
height: 14px;
}

.highlight {
background-color: yellow;
}

.highlight-selected {
background-color: #dc322f;
}

#contents {
margin-top: 0px;
padding-left: 8px;
padding-right: 8px;
}

table {
margin: 1em;
border-collapse: collapse;
width: 90%;
}

td, th {
padding: .3em;
border: 1px #ccc solid;
}

thead {
background: #ccc;
}

a {
text-decoration: none;
}

a.wiki-link {
text-decoration: underline;
border-bottom: none;
color: #268bd2;
}

a.missing-wiki-link {
color: #dc322f;
}

html {
-webkit-text-size-adjust: none;
}

ul {
line-height: 1.3
}
li {
padding:0.5em 0;
}

posted in Trunk Notes Help read more
moioci

I thought I'd share these style sheets I threw together modeled after Ethan Schoonover's Solarized theme, available on almost every text editor out there. It' s visually appealing and designed to be easy to read. There's a dark version and a light version. The various colors are intended to be used for syntax highlighting, but I thought they'd work well for differentiating heading levels. I'll put them in as comments below.

posted in Trunk Notes Help read more
moioci

iPhone 6+, ios 8.4, MBP Yosemite, Firefox

When I delete a page while in wifi sharing mode, it puts me back to the home page. Then I have to navigate back where I was. I would prefer to be taken back one step in the page history. Is that fixable?

posted in Trunk Notes Help read more
moioci

I haven't tried this in a long time, but I think it's possible to zip up a number of files and then upload the zip archive all at once. Please email yourself a backup before you try it, though. Good luck!

posted in Trunk Notes Help read more
moioci

I've found dueinnext to be fairly brittle. Two things worth checking:

  1. Extra spaces. Any extra space between the beginning of the line and the date will mess it up.
  2. Date format: Check Trunk Note preferences to see what date format is active. This is what dueinnext will be looking for. This means that if you have a date and time format selected, dueinnext won't find any entries with a date but not a time.
    I found myself having to enter something like
    @todo 7/25/2015 0800 Do something
    This worked, but was kind of heinous, so I changed the date format.

As for the behavior with dates in the past, I can see why it's programmed to work this way. If you miss a due date, perhaps while on vacation, you wouldn't want those to-do items to silently disappear. Rather than delete a completed task, I'll often add a space to "break" the tag, thereby preventing it from showing up in a dueinnext (or action) search.

@to do 7/25/2015 Do something
But it will pop right up with {{action @to do}}, should I want to track it down.

By the way, these same issues apply with {{action}} as far as sorting the returned items by priority and/or due date.

posted in Trunk Notes Discussion read more
moioci

...while you're working on the port?

posted in Trunk Notes Help read more