Skip to content

Commit

Permalink
Added printAuthor keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
Breck Yunits authored and Breck Yunits committed May 19, 2024
1 parent 8ebf5ea commit 38e0752
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 17 deletions.
3 changes: 2 additions & 1 deletion blog/counterpoints.scroll
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
author https://github.com/breck7 Breck Yunits
date 4/13/2023
groups All
title Counterpoints: A new tool for thought in the Scroll Language

import header.scroll
printTitle
byLine https://github.com/breck7 Breck Yunits
printAuthor
keyboardNav
copyButtons

Expand Down
4 changes: 2 additions & 2 deletions blog/indented-heredocs.scroll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
author https://github.com/breck7 Breck Yunits
date 2021.08.23
groups All
replace GrammarLinked <a href="https://jtree.treenotation.org/designer/#standard%20grammar">Grammar</a>
Expand All @@ -10,8 +11,7 @@ import header.scroll
mediumColumns 1

printTitle

byLine https://github.com/breck7 Breck Yunits
printAuthor

keyboardNav

Expand Down
3 changes: 2 additions & 1 deletion blog/introducingBlink.scroll
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
author https://github.com/breck7 Breck Yunits
date 2022.10.02
groups All
title Introducing the Blink Tag

import header.scroll
printTitle
byLine https://github.com/breck7 Breck Yunits
printAuthor
printDate

mediumColumns 1
Expand Down
3 changes: 2 additions & 1 deletion blog/programLinks.scroll
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
author https://github.com/breck7 Breck Yunits
date 5/08/2023
groups All
title Introducing Program Links

import header.scroll
printTitle
byLine https://github.com/breck7 Breck Yunits
printAuthor

keyboardNav
copyButtons
Expand Down
3 changes: 2 additions & 1 deletion blog/scrollsets.scroll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
author https://breckyunits.com Breck Yunits
date 4/21/2024
groups All
title ScrollSets: source code for CSVs
Expand All @@ -9,7 +10,7 @@ import header.scroll
keyboardNav
mediumColumns 1
printTitle
byLine https://breckyunits.com Breck Yunits
printAuthor

image scrollsets.png
caption More examples of ScrollSets from sets.scroll.pub.
Expand Down
3 changes: 2 additions & 1 deletion blog/textFiles.scroll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
author https://breckyunits.com Breck Yunits
date 4/29/2024
groups All
title Scroll now generates text files
Expand All @@ -6,7 +7,7 @@ import header.scroll
keyboardNav
printTitle

byLine https://breckyunits.com/ Breck Yunits
printAuthor

thinColumns 1

Expand Down
26 changes: 18 additions & 8 deletions grammar/author.grammar
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
byLineParser
printAuthorParser
description Prints a byline with the author's name and optionally a link to them.
extends abstractScrollParser
cruxFromId
cells keywordCell urlCell
catchAllCellType personNameCell
// todo: we need pattern matching added to Grammar to support having no params or a url and personNameCell
cells keywordCell
catchAllCellType anyCell
example
// With Link:
byLine https://breckyunits.com Breck Yunits
printAuthor https://breckyunits.com Breck Yunits
// No link:
byLine Breck Yunits
printAuthor Breck Yunits
javascript
compile() {
const link = this.getWord(1)
return `<div class="scrollByLine">by <a ${link ? `href="${link}"` : ""}>${this.name}</a></div>`
const {link, name} = this
return `<div class="scrollByLine">by <a ${link ? `href="${link}"` : ""}>${name}</a></div>`
}
get link() {
return this.getWord(1) || this.parent.getNode("author")?.getWord(1)
}
get name() {
return this.getWordsFrom(2).join(" ") || this.parent.get("author")
return this.getWordsFrom(2).join(" ") || this.parent.getNode("author")?.getWordsFrom(2).join(" ")
}
compileTextVersion() {
return `by ${this.name}`
}

byLineParser
extends printAuthorParser
boolean isDeprecated true
description DEPRECATED! Use "printAuthor" instead.

authorParser
cells keywordCell urlCell
catchAllCellType personNameCell
description Set the author(s) for a post. Prints nothing by itself, but is printed with the title in text mode and in various metadata outputs.
extends abstractTopLevelSingleMetaParser
1 change: 1 addition & 0 deletions grammar/pageFooter.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ pageFooterParser

gazetteFooterParser
extends pageFooterParser
boolean isDeprecated true
description DEPRECATED! Use "pageFooter" instead.
1 change: 1 addition & 0 deletions grammar/pageHeader.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ pageHeaderParser

gazetteHeaderParser
extends pageHeaderParser
boolean isDeprecated true
description DEPRECATED! Use "pageHeader" instead.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scroll-cli",
"version": "90.5.0",
"version": "91.0.0",
"description": "A language for scientists of all ages. A curated collection of tools for refining and sharing thoughts.",
"main": "scroll.js",
"engines": {
Expand Down
4 changes: 4 additions & 0 deletions releaseNotes.scroll
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ printTitle

thinColumns

# 91.0.0 5/19/2024
- 🎉 `printAuthor` keyword prints the author defined by `author`. `byLine` has been deprecated--replace with `printAuthor`.
- ⚠️ BREAKING: `author` keyword now takes a URL.

# 90.5.0 5/19/2024
- 🎉 added `printDate` keyword

Expand Down
3 changes: 2 additions & 1 deletion tests/kitchenSink/top-sinks.scroll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
author https://breckyunits.com Breck Yunits
date 1/11/2019
groups index all
replace NUM_SINKS 283
Expand All @@ -17,7 +18,7 @@ import header.scroll

printTitle

byLine https://breckyunits.com Breck Yunits
printAuthor

keyboardNav

Expand Down

0 comments on commit 38e0752

Please sign in to comment.