Skip to content

Commit

Permalink
commented and cross-linked src/prf_col.js and sample-extensions/synta…
Browse files Browse the repository at this point in the history
…x-in-comments.js
  • Loading branch information
Nick committed Nov 4, 2016
1 parent 6861378 commit 8bd4ab1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<link rel=stylesheet href='style/jstree/style.css'>
<link rel=stylesheet href='node_modules/golden-layout/src/css/goldenlayout-base.css'>
<link rel=stylesheet href='node_modules/golden-layout/src/css/goldenlayout-light-theme.css'>
<style id=col_stl></style>
<style id=col_sample_stl></style>
<style id=col_stl></style><!--src/prf_col.js injects css here-->
<style id=col_sample_stl></style><!--and here-->
</head>
<body>
<noscript>JavaScript is not enabled.</noscript>
Expand Down
10 changes: 7 additions & 3 deletions sample-extensions/syntax-in-comments.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// To use this extension:
// export RIDE_JS=/path/to/file.js
// before running RIDE.
//To use this extension:
// export RIDE_JS=/path/to/file.js
//before starting RIDE.
//Go to Preferences>Colours, select Token Type: ACME Number and style it.
//Open an editor and type
// ⍝1: abc 123
//"123" should appear different.
CodeMirror.defineMIME('text/apl-comments','acme')
CodeMirror.defineMode('acme',function(){ // https://codemirror.net/doc/manual.html#modeapi
return{
Expand Down
4 changes: 3 additions & 1 deletion src/prf_col.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//Preferences > Colours
//Here we generate CSS based on the user's preferences and put it in <style id=col_stl> (see ../index.html)
//Same for <style id=col_sample_stl> - this one controls the display of the sample text, before pressing Apply or OK.
;(function(){'use strict'

var G=[],H={} //G:syntax highlighting groups; H:reverse lookup dict for G
var q //dict of DOM elements whose ids start with "col_", keyed by the rest of the id
//D.addSynGrps(...) is the API for extensions, see ../sample-extensions/syntax-in-comments.js
D.addSynGrps=function(x){G=G.concat(x);H={};for(var i=0;i<G.length;i++)H[G[i].t]=i;SCMS&&updStl()}
D.addSynGrps([
//t: token type, a short key for storing customisations
Expand Down

0 comments on commit 8bd4ab1

Please sign in to comment.