Skip to content

Commit

Permalink
Fix - Add 'component_name' as a parameter to __init__ method, fixed m…
Browse files Browse the repository at this point in the history
…istype on README file. (#64)
  • Loading branch information
SuelenKarbivnychyy authored Jul 20, 2023
1 parent b832461 commit 3d366ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Python version 3.10

1. Fork this [repo](https://github.com/sparckles/starfyre)
2. Clone this repo - `git clone https://github.com/sparckles/starfyre`
3. Go in to the starfire directory - `cd starfyre`
3. Go in to the starfyre directory - `cd starfyre`
4. Download poetry `curl -sSL https://install.python-poetry.org/ | python3 -`
5. Install the dependencies `poetry install`
6. Activate poetry virtual enviromente `poetry shell`
Expand Down
31 changes: 15 additions & 16 deletions starfyre/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,9 @@ class RootParser(HTMLParser):
# this is the grammar for the parser
# we need cover all the grammar rules

def __init__(self, component_local_variables, component_global_variables, css, js):
def __init__(self, component_local_variables, component_global_variables, css, js, component_name):
super().__init__()
self.stack: list[Component] = []

generic_tags = {
"html", "div", "p", "b", "span", "i", "button", "head", "link", "meta", "style", "title",
"body", "section", "nav", "main", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6",
"header", "footer", "aside", "article", "address", "blockquote", "dd", "dl", "dt",
"figcaption", "figure", "hr", "li", "ol", "ul", "menu", "pre", "a", "abbr", "bdi",
"bdo", "br", "cite", "code", "data", "em", "mark", "q", "s", "small", "strong", "sub",
"sup", "time", "u", "area", "audio", "img", "map", "track", "video", "embed", "iframe",
"picture", "object", "portal", "svg", "math", "canvas", "script", "noscript", "caption",
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "datalist",
"fieldlist", "form", "input", "label", "legend", "meter", "optgroup", "option", "output",
"progress", "select", "textarea", "details", "dialog", "summary"
}

self.current_depth = 0
self.css = css
self.js = js
Expand All @@ -52,7 +38,20 @@ def __init__(self, component_local_variables, component_global_variables, css, j
)
# populate the dict with the components
self.component_name = component_name


generic_tags = {
"html", "div", "p", "b", "span", "i", "button", "head", "link", "meta", "style", "title",
"body", "section", "nav", "main", "hgroup", "h1", "h2", "h3", "h4", "h5", "h6",
"header", "footer", "aside", "article", "address", "blockquote", "dd", "dl", "dt",
"figcaption", "figure", "hr", "li", "ol", "ul", "menu", "pre", "a", "abbr", "bdi",
"bdo", "br", "cite", "code", "data", "em", "mark", "q", "s", "small", "strong", "sub",
"sup", "time", "u", "area", "audio", "img", "map", "track", "video", "embed", "iframe",
"picture", "object", "portal", "svg", "math", "canvas", "script", "noscript", "caption",
"col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "datalist",
"fieldlist", "form", "input", "label", "legend", "meter", "optgroup", "option", "output",
"progress", "select", "textarea", "details", "dialog", "summary"
}


def extract_components(self, local_functions):
components = {}
Expand Down
4 changes: 2 additions & 2 deletions test-application/parent.fyre
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def ssr_request():
<span>

<div>
<h1> THIS IS MY first text node </h1>
<h1> THIS IS MY FIRST HTML NODE </h1>
{ssr_request()}
<p> THIS IS MY 2second text node </p>
<p> THIS IS MY SECOND HTML NODE </p>
{ssr_request()}
</div>
<b>
Expand Down

0 comments on commit 3d366ef

Please sign in to comment.