Syntax similar to JSX

オープン
#918 コメント 21 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, python, react
領域
frontend, web-dev

調査の方向性

Start by reading the linked tagstr transpiler issue and the example implementation in tagstr/examples/htmldom.py. Clarify whether the work targets the interim transpiler, the tag string PEP, or both, then define the html tag function's expected behavior from the JSX examples. Done means an agreed implementation path with working transpiler support and an html tag usable by the shown example.

索引モデルが issue の本文から書いたものです。

説明

priority-2-moderate
Current Situation

ReactJS has a method of HTML templating called JSX. We currently do not have an equivalent. We should create a Python-based JSX equivalent that operates similarly to how it is used in ReactJS (Javascript).

The key difference here is we will not use a dedicated file extension (such as .psx) in order to not break existing toolchains. Instead, we will rely on the tag string PEP that adds template literals to Python. Here is an example of the tag string syntax:

from reactpy import html

button_style = {"font_style": "bold"}
button_text = "Click me!"
view = html(t"<button on_click={lambda event: ...} style={button_text}>{button_text}</button>")

While we wait for the tag string PEP to be merged, we could potentially use an interim transpiler to use a similar syntax. The interim transpiler syntax would look something like this:

from reactpy import html

button_style = {"font_style": "bold"}
button_text = "Click me!"
view = html @ f"<button on_click={lambda event: ...} style={button_text}>{button_text}</button>"
Proposed Actions

Aid in the development of this proposed transpiler and then develop an html tag function. An initial implementation of an html tag can be found here.

News: There is now a VSCode Extension to add syntax highlighting for inline HTML. (and a second one)

主要言語
Python
スター
8.1k
フォーク
332
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

reactive-python/reactpy のほかの issue

reactive-python/reactpy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。