Skip to content

Commit 1d4cd97

Browse files
authored
Upgrade Scroll and ScrollSDK (#628)
* Format * Upgrade Scroll
1 parent afcea5b commit 1d4cd97

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+133
-198
lines changed

Computer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,9 +1583,7 @@ class Tables {
15831583
return this._top
15841584
}
15851585

1586-
get pldb() {
1587-
return require("./pldb.json")
1588-
}
1586+
pldb = require("./pldb.json")
15891587

15901588
_getFileAtRank(rank, ranks) {
15911589
rank = rank - 1
@@ -1608,7 +1606,7 @@ class Tables {
16081606
this._conceptPageCache[file.id] = page
16091607
this._conceptPages.push(page)
16101608
})
1611-
console.log(`Loaded ${this.pldb.length} langs`)
1609+
console.log(`Computer.js loaded ${this.pldb.length} langs from pldb.json`)
16121610
}
16131611

16141612
getConceptPage(id) {

blog/header.scroll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ importOnly
22

33
settings.scroll
44
../header.scroll
5+
../code/scrollExtensions.parsers
56
keyboardNav

code/conceptPage.scroll

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
importOnly
22
replace BASE_URL ..
33

4-
// testStrict
4+
testStrict
55
temporarily disable until we can figure out problem with examples
66

77
tags All
88

99
measures.parsers
1010

11-
../header.scroll
12-
13-
replaceJs TEMPLATE_PAGE
14-
{
15-
const path = require("path")
16-
const filePath = particle.root.filePath
17-
const {Tables} = require(path.join(path.dirname(filePath), "..", "Computer.js"))
18-
Tables.getLanguageTemplate(filePath);
19-
}
20-
TEMPLATE_PAGE
21-
22-
../footer.scroll
11+
evalJs
12+
const path = require("path")
13+
const filePath = particle.root.filePath
14+
const {Tables} = require(path.join(path.dirname(filePath), "..", "Computer.js"))
15+
Tables.getLanguageTemplate(filePath);

code/measures.parsers

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
// todo: move out of here
2+
monacoEditorParser
3+
cueFromId
4+
extends abstractScrollParser
5+
description A Monaco code editor.
6+
baseParser blobParser
7+
example
8+
monacoEditor javascript
9+
// Hello world
10+
javascript
11+
buildHtml() {
12+
return `<div id="monacoContainer"></div>
13+
<script defer src="../node_modules/monaco-editor/min/vs/loader.js"></script>
14+
<script>
15+
document.addEventListener("DOMContentLoaded", function () {
16+
require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } })
17+
require(["vs/editor/editor.main"], function() {
18+
monaco.editor.create(document.getElementById('monacoContainer'), {
19+
value: \`${this.subparticlesToString().replace(/\n/g, "\\n")}\`,
20+
language: '${this.getAtom(1)}',
21+
minimap: {
22+
enabled: false
23+
},
24+
scrollbar: {
25+
vertical:"hidden",
26+
horizontal: "hidden",
27+
handleMouseWheel:false,
28+
},
29+
overviewRulerLanes: 0,
30+
hideCursorInOverviewRuler: true,
31+
overviewRulerBorder: false,
32+
wordWrap: 'on',
33+
//lineNumbers: 'off',
34+
glyphMargin: false,
35+
folding: false,
36+
// Undocumented see https://github.com/Microsoft/vscode/issues/30795#issuecomment-410998882
37+
lineDecorationsWidth: 10,
38+
lineNumbersMinChars: 2
39+
});
40+
});
41+
})
42+
</script>`
43+
}
44+
145
// Common Measures
246

347
abstractHashMapMeasureParser

code/scrollExtensions.parsers

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ohayoCodeParser
2+
extends codeParser
3+
cueFromId
4+
description Provide a direct link to analyze this data in Ohayo.
5+
javascript
6+
buildHtml() {
7+
const link = `https://ohayo.breckyunits.com?filename=${this.root.permalink}.ohayo&data=${encodeURIComponent(this.subparticlesToString())}`
8+
return `<div class="scrollQuote">Analyze this data yourself in <a href="${link}">Ohayo</a></div>`
9+
}
10+
observableParser
11+
extends abstractScrollParser
12+
cueFromId
13+
atoms cueAtom urlAtom
14+
description Provide a direct link to analyze this data in Observable.
15+
javascript
16+
buildHtml() {
17+
return `<div class="scrollQuote">Analyze this data yourself in <a href="${this.getAtom(1)}">Observable</a></div>`
18+
}
19+
bashParser
20+
cueFromId
21+
description Run a bash oneliner via nodejs and dumps stdout to pre tag.
22+
catchAllAtomType stringAtom
23+
extends abstractScrollParser
24+
javascript
25+
buildHtml() {
26+
const command = this.content
27+
const cwd = this.root.folderPath
28+
const output = require("child_process").execSync(command, {cwd})
29+
return `<div class="codeWithHeader"><div class="codeHeader">${command}</div><code class="scrollCodeBlock">${output.toString().trim()}</code></div>`
30+
}
31+

concepts/activevfp.scroll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ wikipedia https://en.wikipedia.org/wiki/ActiveVFP
6969
ENDPROC
7070

7171
PROCEDURE getemployees && custom method (&& GET www.hostname.com/app/customers/getemployee/<id>
72-
7372
oJSON=NEWOBJECT('json','json.prg')
7473

7574
SET PATH TO oProp.AppStartPath+'data\AVFPdemo41\'

concepts/apex.scroll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ linguistGrammarRepo https://github.com/textmate/java.tmbundle
118118
billingpostalcode='9',billingcountry='us');
119119
insert a;
120120
system.assertEquals( 'main,springfield,il,9,us',accountAddressString( a) );
121-
122121
}
123122
}
124123

concepts/atomese.scroll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ example
2626
(VariableNode "$var")
2727
)
2828
)
29-
3029
;; Run the above pattern
3130
(cog-bind find-animals)
3231

concepts/bitbake.scroll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ example
2525
# v5.2.1 + 168 commits
2626
SRCREV = "08cbbde61778276ccdda73d89fd64d02c623779f"
2727

28-
2928

3029
lineCommentToken #
3130

concepts/brightscript-lang.scroll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ example
1515
REM The game of Snake
1616
REM demonstrates BrightScript programming concepts
1717
REM June 22, 2008
18-
1918
REM
2019
REM Every BrightScript program must have a single Main()
2120
REM
22-
2321
Sub Main()
2422

2523
game_board=newGameBoard()

0 commit comments

Comments
 (0)