Skip to content

Rationalize Templates #147

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

Closed
wants to merge 1 commit into from

Conversation

themiurgo
Copy link
Contributor

This is a first attempt at rationalising folium templates, leveraging Jinja's awesome features (http://jinja.pocoo.org/docs/dev/templates/#template-inheritance) and avoid code duplication and bugs (such as #105).

@ocefpaf could you take a look at this once you come back from SciPy? 😃

I have tested the simple folium template and it seems to be working as normal. We should also test the geojson and see if it has any problems.

@themiurgo
Copy link
Contributor Author

(Btw the PR obviously is not ready yet, just submitted to have a head start ;) )

@BibMartin
Copy link
Contributor

This much more elegant than the render_html methods etc.

I'm a bit afraid of two things :

  • Jinja stuff is quite frightening ; won't it discourage begginners (like I) to get into programming plugins ?

  • I cannot figure out how the code would behave if I wanted to combine several plugins. Like for example:

    map = folium.Map()
    map.add_plugin(MarkerCluster(...))
    map.add_plugin(ScrollZoomToggler(...))
    map._repr_html_()
    

@themiurgo
Copy link
Contributor Author

Jinja stuff is quite frightening ; won't it discourage begginners (like I) to get into programming plugins ?

Jinja was made for desiners and in general it was made to be simpler than Python coding. I think it should be enough to write that docs page

I cannot figure out how the code would behave if I wanted to combine several plugins. Like for example:

The code I've pushed does not deal with plugins so I can't answer that. I will answer your question about how to deal with plugins leveraging Jinja in the other thread.

@ocefpaf
Copy link
Member

ocefpaf commented Aug 4, 2015

I like the idea of having a base and injecting that into the geojson and any other plugins. However, I am unsure how the current plugin plan fit in here. @themiurgo can you rebase this?

@BibMartin can you take a second pass at this in light of your plugin branch?

@themiurgo
Copy link
Contributor Author

I'll take a look at it this or the coming weekend (sorry, deadlines and holidays to sort out first) 😝

@ocefpaf
Copy link
Member

ocefpaf commented Aug 16, 2015

How are we on this? Is it worth re-basing and merging or does #170 changed the game?

I am sorry for not participating on this as much as I should. But I got some free time and I want to fix that 😉

@ocefpaf ocefpaf added this to the v0.2.0 milestone Aug 20, 2015
@ocefpaf
Copy link
Member

ocefpaf commented Nov 3, 2015

ping!

@themiurgo
Copy link
Contributor Author

It's probably good to see what @BibMartin has to say about this, whether this PR still makes sense to be merged and how it relates to the last changes in the codebase.

@ocefpaf
Copy link
Member

ocefpaf commented Nov 27, 2015

@BibMartin I guess that this does not fit in the latest code, correct?

@themiurgo are you OK closing this?

PS: Before closing let's just check if we can steal any ideas 😉

@BibMartin
Copy link
Contributor

It does not fit in the lastest code, but the concern of rationalizing templates is still relevant.

In the latest code, most template code is written inside python code (with triple quotes) and most templates are either not used or used in tests only. Though this is not uniformely true. I think a coming question is : do we want to generalize this mindset, or to separate python code and templates ?

@ocefpaf
Copy link
Member

ocefpaf commented Nov 27, 2015

I think a coming question is : do we want to generalize this mindset, or to separate python code and templates ?

I like the templates inside the code like you are doing. Life is much easier that way 😉

Unless someone brings a good reason not to do so let's move in that direction.

We need a PR to remove the unused templates and/or updated the tests.

Closing this.

@ocefpaf ocefpaf closed this Nov 27, 2015
@themiurgo
Copy link
Contributor Author

Yes, I was ok closing this. Perhaps in the future we'll do again something similar.

@ocefpaf
Copy link
Member

ocefpaf commented Nov 30, 2015

Perhaps in the future we'll do again something similar.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants