Skip to content

Commit

Permalink
For visual languages, a picture is worth a thousand words
Browse files Browse the repository at this point in the history
  • Loading branch information
Breck Yunits authored and Breck Yunits committed Sep 4, 2022
1 parent cd2d5ef commit b367296
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion code/LanguagePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,13 @@ pipeTable
}

toScroll() {
const { typeName, title, id } = this.file
const { file } = this
const { typeName, title, id } = file

if (title.includes("%20")) throw new Error("bad space in title: " + title)

const screenshot = file.get("screenshot")

return `title ${title}
import settings.scroll
Expand All @@ -259,6 +262,15 @@ ${this.tryNowRepls}
${this.monacoEditor}
${
screenshot
? `image ${screenshot.replace(
"https://pldb.com/",
"../"
)}\n caption A screenshot of ${title}.`
: ""
}
${this.descriptionSection}
${this.factsSection}
Expand Down
4 changes: 4 additions & 0 deletions database/grammar/screenshot.grammar
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
screenshotNode
description For visual languages, a picture is worth a thousand words. Provide the URL to the screenshot in the form: https://pldb.com/site/screenshots/[pldbId].png
extends abstractUrlNode
cruxFromId
1 change: 1 addition & 0 deletions database/things/explorer.pldb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title Explorer
appeared 2020
type visual
screenshot https://pldb.com/screenshots/explorer.png
creators Hannah Ritchie and Breck Yunits and Shahid Ahmad
description Programs are encoded as TSVs so are easy to read+write from a spreadsheet IDE, code, or plain text editor.
reference https://github.com/owid/owid-grapher/tree/master/explorer
Expand Down
1 change: 1 addition & 0 deletions database/things/scratch.pldb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title Scratch
appeared 2002
type visual
screenshot https://pldb.com/screenshots/scratch.png
website https://scratch.mit.edu/
fileExtensions scratch sb sprite sb2 sprite2
domainName scratch.mit.edu
Expand Down
Binary file added site/screenshots/explorer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/screenshots/scratch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b367296

Please sign in to comment.