DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:yql

yql Plugin

Compatible with DokuWiki

Anteater, Rincewind, Angua, Adora Belle, Weatherwax

plugin A plugin for embedding results of the Yahoo! YQL query API in a page

Last updated on
2016-01-16
Provides
Syntax
Repository
Source

Tagged with data, yahoo

This plugin allows to embed results from the YQL (Yahoo! Query Language) API of Yahoo! in a wiki page. The plugin only works for certain queries and certain query fields and has mainly been created because I needed to embed a certain query result. The plugin does not support queries that need authorization or return one single result (and not a list of results). It is recommended that you try out your query in the YQL Console in order to find the necessary parameters for the plugin. To learn if accessing a table requires authentication, execute SHOW TABLES and note that tables with security=ANY do not require YQL Authentication, whereas the others do.

The results of the query are displayed as list, the individual list items can be formatted using a simple format string and support text items and links.

The plugin does also works with different renderers (like odt or LaTeX) as it uses standard renderer functions for displaying the list of items.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Examples/Usage

A simple query to combine two RSS feeds:

<YQL>
select title,link,pubDate from rss
  where url in (
     'http://feeds.feedburner.com/dokuwiki',
     'http://feeds.feedburner.com/PlanetDokuwiki'
  ) | sort(field='pubDate',descending='true')|truncate(count=10)
</YQL>

And another query, displaying a list of Sushi restaurants in San Francisco using a custom display format:

<YQL format="%%Url|Title%% in %%MapUrl|Address%% (phone: %%Phone%%)" item_name="Result" refresh="28800">
select * from local.search where query="sushi" and location="san francisco, ca"
</YQL>

Here a screenshot of the output of the two examples:

Syntax

The basic syntax is:

<YQL>
your_query
</YQL>

where your_query is the query you want to execute. Within the <YQL>-tag further options can be specified in the form option=“value”:

  • format: The format is a combination of a simple string combined with the names of the result values that shall be displayed enclosed in “%%” as in the example. As in normal DokuWiki links you can create a link by separating the name of the url field and the title field by “|”.
  • item_name: Inside the results, the actual results items are in many cases inside a special field. The default is “item” which is also the output from the rss “table”, but in other cases it can also be “Result” as shown in the example or “event” for events.
  • refresh: The time for which the page should be cached in seconds, the default is as for rss feeds 4 hours (14400 seconds).

Development

There are many features that are currently missing, but everything I currently need works so most probably I won't put too much work into improving it. But if you have a special use case feel free to submit feature requests, bug reports or submit even patches or pull requests on GitHub.

Change Log

Known Bugs and Issues

The plugin currently only supports certain YQL results and doesn't output any information when an error occurs.

Discussion

:!: Please don't report any bugs or feature wishes here but use the issue tracker at GitHub.

plugin/yql.txt · Last modified: 2016-07-11 22:35 by polson