reverse order lists

72 views
Skip to first unread message

sbramin

unread,
Jun 2, 2010, 9:16:03 AM6/2/10
to Bonsai
hello there,

i stumbled across bonsai last night and find it truly delightful. i
have been playing around with it all this morning and have run in to
something of a brick wall.

is it possible to reverse the order of a list created by children?

{{# children}}
<li><a href="{{permalink}}">{{name}}</a></li>
{{/ children}}


using the default numbering system for folders. 1.myfolder
2.otherfolder etc

this loads them in the order of 1,2,3 etc which makes sense, but as i
don't know how many folders there will be in the end, having them load
6, 5, 4, 3, 2, 1 would make more sense for my purposes.

i will happily kick myself if this is dead obvious, i have never
touched a drop of ruby before and to be honest my general programming
skills are limited. i am usually pretty good as reverse engineering
basic code but in bonsai don't really know where to begin looking.

also, as there is a system for making links [name of link](http://
whatever.com) is there also a system for adding images?

i read through all the supplied documentation but didn't notice any
specific mention to existing tags apart from pre-defined meta
variables.

thank you for creating bonsai.

sbramin.

sbramin

unread,
Jun 2, 2010, 10:09:44 AM6/2/10
to Bonsai
actually i figured out a relatively easy way to solve the problem.

numbered my first folder 999.folder, the next 998.folder etc

this also solves a problem where 11.folder would be fore 2.folder as
its using the alphabetical order of each character not an actual
number.

and i dont think i will use 999 folders in one place, though if i do i
suppose i could just add an extra number. 0001 would come before 001
i believe.

good day,

sbramin.

Ben Schwarz

unread,
Jun 2, 2010, 10:12:04 AM6/2/10
to tiny...@googlegroups.com
Hi,
I haven't specifically come up with a way of backwards ordering the
children array because I've simply not required it before. Having said
that if you wanted to use something other than mustache, you could
then call `.reverse` (a ruby array method) on the children array.
Just an idea, otherwise, mustache leaves you in the cold.
As for the embedding of an image, you can go two ways, using the meta
variables (described on http://tinytree.info/managing-pages/) or
alternately you could simply hard-link to the files, using markdown.
Markdown is applied to all text areas within your .yml that is more
than a single line of text - simple.
So, an image in markdown?

![alt text](/path/to/img.jpg "Title")

Good luck. Glad you're enjoying bonsai.

sbramin

unread,
Jun 4, 2010, 12:02:39 PM6/4/10
to Bonsai
less has always been my mantra and as bonsai doesn't have much to
start with its been very pleasant to work with.

http://sbramin.com

now that i have the site down i need to populate it with a little more
content.

thanks for the clean and simple living.

sbr.
Reply all
Reply to author
Forward
0 new messages