JuliaIO / JuliaIO/JSON.jl

define a js_str macro for creating JSONText

Open
#433 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
360
Forks
113
Avg merge
5d 2h
Merged PRs (30d)
4

Description

I propose to define a js_str macro to generate JSONText with and without interpolation as below.

Besides a handy short form a big advantage is that in VSCode JS-Syntax-Highlighting can be achieved by triple-quoting, e.g.

js"""
console.log('This looks pretty!')
"""
Image

Many packages that handle js expressions, e.g. GenieFramework or Electron, would benefit (https://github.com/davidanthoff/Electron.jl/issues/154) (GenieFramework currently exports its own version)

js"""alert("Hello World")"""
# JSONText("alert(\"Hello World\")")

Interpolation could be supported via the i flag, such as

js"""alert("1 + 2 == $(1 + 2)")"""i
# JSONText("alert(\"1 + 2 == 3\")")

I'll happily file a PR.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing JSONText representation and the issue's proposed js"""...""" and interpolation examples. Determine how both non-interpolated and i-flag forms should construct JSONText, then verify that the demonstrated alert examples produce the stated results.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.