cooperhewitt / label-book

Generates a markdown file for use with InDesign
1 stars 0 forks source link

A few comments #3

Open straup opened 9 years ago

straup commented 9 years ago

Keeping in mind that things are still "in motion", yeah?

micahwalter commented 9 years ago

@straup & @AYTAGH ---

  1. @AYTAGH has converted the crazy inline html code to use Flask's built in Jinja2 template engine. The inline html thing was just a first pass, and to learn how Flask works before trying t understand Jinja2.
  2. Yes, of course, escape everything. That said, I was reading on the Flask docs a few things, and wondered if you had thoughts. See http://flask.pocoo.org/docs/0.10/templating/ and:
Unless customized, Jinja2 is configured by Flask as follows:

* autoescaping is enabled for all templates ending in .html, .htm, .xml as well as .xhtml
* a template has the ability to opt in/out autoescaping with the {% autoescape %} tag.
* Flask inserts a couple of global functions and helpers into the Jinja2 context, additionally to the values that are present by default.

I am guessing you were just trying to encourage best practices, so even if the above ... it looks like he can also do.

 {{ myvariable|safe }}

or from the Jinja2 docs - http://jinja.pocoo.org/docs/dev/templates/#html-escaping

 {{ myvariable|e }}

Curious to hear @straup thoughts on this...

  1. Pagination is something he is planning to work on as a next round feature
  2. Command line version would be good, and probably easy to re-work the code to accommodate.
  3. Yes, doc type stuff - @AYTAGH see the rest of the Jinja2 docs - http://jinja.pocoo.org/docs/dev/templates/

Lastly though, we should get this up and running somewhere like Heroku so others can poke at it too.

-m

copea commented 9 years ago

If Jinga has a built-in escaping function (like Smarty) so much the better.

Pagination is really simple. And then it won't be forgotten (because it will be). It's a "while" loop. You can probably just copy/paste from the visit exports code.

As for a CLI version move all the fetching/rendering logic in to a separate function that is invoked by your "routing" function. Make sure it works. Then move that function in to a library. Then invoke that function from a command line tool which is basically a different "route".

crouching keyboard / hidden typos

On Jul 6, 2015, at 10:51, Micah Walter notifications@github.com<mailto:notifications@github.com> wrote:

@strauphttps://github.com/straup & @AYTAGHhttps://github.com/AYTAGH ---

  1. @AYTAGHhttps://github.com/AYTAGH has converted the crazy inline html code to use Flask's built in Jinja2 template engine. The inline html thing was just a first pass, and to learn how Flask works before trying t understand Jinja2.
  2. Yes, of course, escape everything. That said, I was reading on the Flask docs a few things, and wondered if you had thoughts. See http://flask.pocoo.org/docs/0.10/templating/ and:

Unless customized, Jinja2 is configured by Flask as follows:

I am guessing you were just trying to encourage best practices, so even if the above ... it looks like he can also do.

{{ myvariable|safe }}

or from the Jinja2 docs - http://jinja.pocoo.org/docs/dev/templates/#html-escaping

{{ myvariable|e }}

Curious to hear @strauphttps://github.com/straup thoughts on this...

  1. Pagination is something he is planning to work on as a next round feature
  2. Command line version would be good, and probably easy to re-work the code to accommodate.
  3. Yes, doc type stuff - @AYTAGHhttps://github.com/AYTAGH see the rest of the Jinja2 docs - http://jinja.pocoo.org/docs/dev/templates/

Lastly though, we should get this up and running somewhere like Heroku so others can poke at it too.

-m

— Reply to this email directly or view it on GitHubhttps://github.com/cooperhewitt/label-book/issues/3#issuecomment-118937844.