help-librejs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-librejs] LibreJS as a standalone library (and program)


From: Nik Nyby
Subject: Re: [Help-librejs] LibreJS as a standalone library (and program)
Date: Sun, 10 May 2015 09:14:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 5/6/15 6:33 PM, Fabio Pesari wrote:
> As a library, at the very least, LibreJS should implement a function
> like this:
> 
> LibreJS.check_html(data)
> 
> which would return this JSON data:
> 
> {
>   // "10" is the line number of the nonfree code
>   "10": {
>              "content": "...", // or null
>              "source":  "...", // or null
>              "reason":  "...",
>              ...                     // other metadata
>            },
>   ...
> }
> 
> As a command line program, LibreJS should be able to generate both the
> JSON data described above (with a --json flag) and human-readable output
> (and maybe other formats, like CSV), such as:
> 
> $ librejs libre-page.html
> 
>> (no output)
> 
> $ librejs bad-page.html
> 
>> bad-page.html: nonfree code detected
>> 10: innerHTML identifier (...item.innerHTML = 'blah';...)
>> 25: external script (http://...)
> 
> Maybe you can pass it the name of an HTML file containing the web labels:
> 
> $ librejs bad-page.html --labels labels.html
> 
> or maybe you can make it output the "good" matches, too:
> 
> $ librejs bad-page.html --verbose
>> 2: [Libre] (function clean() { a = 5; ... })
>> 10: [Nonfree] ...

These are all great ideas. When laying out some of the foundations for
librejs-cli, I wasn't clear how I wanted the output reports to look. It
could be flexible, of course, and we could have a JSON output format
just like you suggest.

I like the idea of attaching the web labels page to the main one with a
--labels command line flag. However, the main page will also be attached
to the labels page by containing a link with the data-jslicense=1 or
rel="jslicense" attribute, so we should support that as well.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]