Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested definitions fail #505

Closed
tlienart opened this issue May 31, 2020 · 1 comment · Fixed by #539
Closed

Nested definitions fail #505

tlienart opened this issue May 31, 2020 · 1 comment · Fixed by #539
Labels
bug Something isn't working low-priority md-def

Comments

@tlienart
Copy link
Owner

Works:

julia> s = """
       @def a = Dict(
           :x => 1,
           :y => 2,
           :z => 3)

       A""" |> fd2html
"<p>A</p>\n"

julia> s = """
       @def a = Dict(
           :x => (1,2,3),
           :y => (1,2,3))

       A""" |> fd2html
"<p>A</p>\n"
julia> s = """
       @def a = Dict(
           :a => (
               a = 5,
               b = 7,
               c = 10),
           :b => (
               a = 5,
               b = 6,
               c = 1))
       A""" |> fd2html

Fails:

julia> s = """
        @def i18n = Dict(
                  :download => (
                      en="Download",
                      cn="下载",
                      fr="Téléchargement",
                      ),
                  :documentation => (
                      en="Documentation",
                      cn="文档",
                      fr="Documentation",
                      ),
                  :blog => (
                      en="Blog",
                      cn="博客",
                      fr="Blog",
                      ),
                  :edit_on_github => (
                      en="Edit this page on GitHub",
                      cn="在GitHub上编辑",
                      fr="Editer cette page sur GitHub",
                      ),
                  )
           A""" |> fd2html
ERROR: Franklin.PageVariableError("An error (of type 'ErrorException') occurred when trying to evaluate '\$(Expr(:incomplete, \"incomplete: premature end of input\"))' in a page variable assignment.")

I'm not quite sure when it starts to break; must be a thing with Meta.parse. Note that in the case above, one can always have a julia file with the script and do something like

@def i18n = (include("i18.jl"); i18n) 

the advantage being that it always works and also that for big variable it's much better to do that bc you can test the variable in the julia script more easily.

@tlienart tlienart added bug Something isn't working low-priority md-def labels May 31, 2020
@tlienart
Copy link
Owner Author

ha no, it just doesn't take the last ) in the parsing... hmm

tlienart added a commit that referenced this issue Jun 27, 2020
@tlienart tlienart mentioned this issue Jun 29, 2020
tlienart added a commit that referenced this issue Jun 29, 2020
* closes #530

* closes #495

* closes #512

* whitespace

* closes #514

* closes #494 by modifying the python script a touch

* small fix

* small fix

* finally ok

* some more silliness

* closes #505

* fixing a few last things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low-priority md-def
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant