Was this page helpful?

Converting Wiki.Contributors into a list of users

    Table of contents
    No headers

    The following code converts the results of the wiki.contributors function into a list of user objects.

    var contrib = wiki.contributors();
    var users = []; 
    foreach(var user in contrib["//a[@class='link-user']"]) { 
        var link = xml.text(user, "@href");
        var username = string.substr(link, string.lastindexof(link, ":") + 1);
        let users ..= [ wiki.getuser(username) ];
    }
    
    // users now contain the user objects returned by wiki.contributors
    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by