reasonml / reason-tools Goto Github PK
View Code? Open in Web Editor NEWAdds Reason to the browser
License: MIT License
Adds Reason to the browser
License: MIT License
False positive. This is the documentation for a static webpage generator, produced by said generator, so this might be producing lots of false positives around the web. But it's also the generator used by Bucklescript, which does not seem to be afftected.
It's also slow as hell to convert because it's one gigantic page, and the swap style button doesn't work on it.
When I go to the URL: https://www.tjson.org/spec/, the extension automatically swaps the stylesheet and detects the page to be an OCaml doc page.
This is a false positive.
The link in the readme points to 404
Either automatically or with a very easy command would be ideal.
See: https://ocaml.janestreet.com/ocaml-core/latest/doc/core/Std/Option.mod/
Edited to add:
For comparison:
It is much easier to scan the original page for the function you are interested in.
Reason-tools styles this URL as a Reason document: http://nim-lang.org/index.html.
Its converting
let newItem () => {
lastId := !lastId + 1;
{id: !lastId, title: "Click a button", completed: true};
};
to
let newItem = () => {
:=(lastId, lastId^ + 1);
{id: lastId^, title: "Click a button", completed: true}
};
when maybe it should be:
let newItem = () => {
lastId := lastId^ + 1;
{id: lastId^, title: "Click a button", completed: true}
};
It'll be better if formatting for pipe chaining will be like this
let prt_elems elems =>
elems
|> String.split on::':'
|> List.dedup compare::String.compare
|> List.iter f::print_endline;
than this
let prt_elems elems =>
elems |> String.split on::':' |> List.dedup compare::String.compare |> List.iter f::print_endline;
An example is the page https://caml.inria.fr/pub/docs/u3-ocaml/ocaml051.html which looks like this for me:
I'm trying to build the extension, but I'm getting an error cannot find reason-react
:
> npm run build:ext
> [email protected] build:ext /Users/ville/Projects/reason-tools
> eval $(dependencyEnv) && nopam && bsb -make-world
/Users/ville/Projects/reason-tools/node_modules/dependency-env/.bin/dependencyEnv.js:167
throw err;
^
cannot find reason-react in /Users/ville/Projects/reason-tools,/Users/ville/Projects/reason-tools
sh: Failed: command not found
npm ERR! Darwin 16.5.0
npm ERR! argv "/Users/ville/.nvm/versions/node/v7.8.0/bin/node" "/Users/ville/.nvm/versions/node/v7.8.0/bin/npm" "run" "build:ext"
npm ERR! node v7.8.0
npm ERR! npm v4.2.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] build:ext: `eval $(dependencyEnv) && nopam && bsb -make-world`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] build:ext script 'eval $(dependencyEnv) && nopam && bsb -make-world'.
The problem seems to be that the reason-react
version defined in the shrinkwrap file installs a package named rehydrate
(the old name of reason-react
), so dependencyEnv
doesn't find it. I tried to upgrade to the latest [email protected]
, which uses the new name, but ran into other dependency issues (some inconsistencies between package.json
and npm-shrinkwrap.json
). A little help getting the project to build would be appreciated.
Or some other way of easily converting code from the clipboard.
(Note to self)
Doesn't convert to ocaml and takes away some of the semantic meaning of the page:
Chrome store wants a single 440x280 and 1-5 1280x800 or 640x400 screen shots. A better descirption would probably be nice as well!
Not just for toggling off an autoconverted page, but to try conversion of one that isn't detected properly. E.g. like this page, which I think should be converted successfully if attempted:
http://caml.inria.fr/pub/docs/manual-ocaml/extn.html
See: http://ounit.forge.ocamlcore.org/api-ounit/
It somehow ends up checking .classList.contains
on a text node, which obviously fails.
If this doesn't add too much overhead to the build process. There are a few good bindings in here. Low pri though
http://ounit.forge.ocamlcore.org/api-ounit/index.html uses with nested
instead of
. We should respect this choice and be able to add inline
s into the result.
They currently don't autoconvert, and don't render quite right, although it's close. They're based on ocamldoc.
This page is shown in all one line, however when toggling the extension, it still has problems with the original text. It looks fine in a browser without the extension installed.
http://mwhittaker.github.io/distributed-systems-ocaml/code_MorePipes.html
Makes it easy to get a shareable link, and probably even makes local storage obsolete.
Every module in this index should be a clickable link. After conversion they're not, and there doesn't seem to be any way to get them back either:
https://ocaml.janestreet.com/ocaml-core/latest/doc/core/
Port to Safari
After I run npm build
I got this:
>tree _build
_build
├── ocamlfind
│ ├── bin
│ ├── doc
│ ├── etc
│ ├── lib
│ │ ├── findlib.conf
│ │ └── ocaml -> /Users/bobfang/projects/reason-tools/node_modules/ocaml/lib/ocaml
│ ├── man
│ ├── sbin
│ └── share
└── refmt
├── app.byte
├── app.js
├── app.map
├── reasonToolsRefmt.cmi
├── reasonToolsRefmt.cmo
└── reasonToolsRefmt.cmt
And there is no error message. Any reason you can guess? Thanks!
There are way too many of them.
No idea what RE and </> do
Which kinda sounds like a good thing, but it's really not. See this example:
http://ounit.forge.ocamlcore.org/api-ounit/index.html
The code listings here use <code>
elements, which are really inline elements (but who cares about semantics, it's not like these'll ever be interpreted by a machine, right?). They are however surrounded (not wrapped) by empty <pre>
elements (WTF?). This can probably be used to detect these special snowflakes and replace the <code>
elements with <pre>
s.
Port to Edge
It would be nice to have error messages other than just "Syntax error on line 1".
The purpose of this issue is to provide a better overview of conversion issues, and to provide test cases, both current and historic to prevent regressions.
Currently, when I click on the Re
button provided by the extension, it displays the same, whether the current syntax is Ocaml or Reason.
I would suggest making the button have some visual indicator of whether the displayed code is Ocaml or Reason.
For example, it might stay highlighted if the code is Reason, and have the current state if the code is Ocaml.
Low pri, since this only affects contributors. Rebel's install time is pretty brutal.
With the new hosted refmt page, both the page and popup should offer a share link to it
For the following cases:
- Webpages that aren't converting properly
(Then we just need to devise some machine learning algorithm to intelligently detect and convert the pages based on "big data", and we're home free!)
Right now Reason uses JS grammar highlighting. It works OK for impl - but really sucks for types. I tried using https://github.com/patrick-steele-idem/codemirror-atom-modes, with the official reason grammar, but things seemed to get worse - I think there needs to be a manual codemirror mapping.
I'd like for this extension to be entirely in Reason. Unfortunately, I'm not super excited about jsoo and I was having trouble setting up bs to work with this project.
ocamldoc refmt conversion doesn't have syntax highlighting.
Noticed this after #47b3991 - when I click the stylesheet swap button, I get the OCaml doc stylesheet but the button disappears so I cannot swap back to the Reason stylesheet.
I get this error when I try to do npm install
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
This is due to being shrinkwrapped on a mac. Removing the "fsevents" tree from "npm-shrinkwrap.json" seems to work. As would removing "npm-shrinkwrap.json" I suppose, but that would kind of defeat the purpose of shrinkwrapping. I don't know if npm is able to fix the missing fsevents on your machine though.
I'd like to get retop working inside of the popup. Also would be cool to add a dev tools section that looked like the chrome console that could run Reason.
Unless there's a new selection ofc.
Current refmt of ocamldoc removes markup, so the internal linking gets lost. ideally we'd keep the correct tokens linked.
Similar to OCaml documentation - lets do https://realworldocaml.org/ automatically so that learning Reason is painless.
Phase 1: Maintain a blacklist/whitelist of url patterns for pages it doesn't properly "detect".
Phase 2: Add UI to let users add their own url patterns to these lists (with intelligent suggestions)
Phase 3: Allow users to report/submit the patterns they add to either list, either as they add them, in bulk or as a configurable option to automatically submit (re #32)
Ideally there would be a single process watching and we'd have an incremental build flow from Reason into JS.
Right now, Rebel can't watch on OSX and there isn't a great way to integrate webpack and Rebel. Looking into ideas there.
Port to FF
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.