Skip to content

Restore ex:converter-type functionality to exhibit3 #113

@karger

Description

@karger

E2 allowed a link tag to specify an ex:converter, which named a javascript function that would transform fetched data (into exhibit format) before loading it into the database. In particular, google spreadsheets data was imported into exhibit using such a converter. In E3, the converter argument has been removed; now there is a google spreadsheets importer registered to a google spreadsheets link type.

With this new approach, anyone who wants to import json data of an unusual schema needs to create and register their own importer. This requires far deeper understanding of exhibit than just writing a js function and passing it as a converter argument.

I'd like to bring back the converter option. In particular, I propose 3 optional arguments in a link tag: getter, parser, and converter. The getter is either json or jsonp, representing the two ways exhibit can fetch a text blob from a source. A parser takes a text blob and returns a js object. And a converter takes a json object and produces a different one (presumably exhibit compatible). An importer is a combination of getter, parser, and converter associated with a particular data type, so e.g. application/json has importer=json, parser=json.parse, and converter null. But any one of the three elements can be overridden by an explicit argument, and if all three are explicitly given then no type needs to be specified.

In absence of objection, I'll plan to implement this in the simile-widgets branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions