Rootbuzz / shpaml

Load shpaml (haml-like html alternative) templates in django seamlessly. Should work fine extending normal HTML templates and being extended by them.
http://shpaml.com
BSD 3-Clause "New" or "Revised" License
46 stars 9 forks source link

Make Shpaml usable outside of Django #14

Closed cool-RR closed 9 years ago

cool-RR commented 9 years ago

I'm making a simple static site now, and it would be great if I could write it in Shpaml and have a script to build the HTML. I don't want anything that requires a complex setup since this is a simple site. It would be nice if we had a solution for this. I saw there's a package shpaml on PyPI: https://pypi.python.org/pypi/shpaml But it seems to not have been updated for years, and there isn't a clear entry point to using it. In fact its "docs" don't mention at all how to use it.

jiaaro commented 9 years ago

Should work:

from shpaml.shpaml import convert_text

convert_text("# a headline")

Excuse the brevity, Im replying from an iPad

cool-RR commented 9 years ago

I tried that, but it's a problem because importing shpaml also tries to import django, which doesn't work when the environment variables aren't installed. (Like when you're not in a virtualenv of a Django project.)

On Mon, Dec 29, 2014 at 7:22 AM, James Robert notifications@github.com wrote:

from shpaml.shpaml import convert_text

convert_text("# a headline")

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68233170.

jiaaro commented 9 years ago

ah got it, does it work for you from master now? should be:

from shpaml import convert_text
cool-RR commented 9 years ago

Yep! Works and shows your warning.

On Mon, Dec 29, 2014 at 5:56 PM, James Robert notifications@github.com wrote:

ah got it, does it work for you from master now? should be:

from shpaml import convert_text

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68269024.

cool-RR commented 9 years ago

Hmm, actually it works only if Django isn't installed, if Django is installed it fails because of the missing environment variables.

On Mon, Dec 29, 2014 at 6:25 PM, Ram Rachum ram@rachum.com wrote:

Yep! Works and shows your warning.

On Mon, Dec 29, 2014 at 5:56 PM, James Robert notifications@github.com wrote:

ah got it, does it work for you from master now? should be:

from shpaml import convert_text

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68269024.

cool-RR commented 9 years ago

In case it might be useful for anyone, here's a watchdog script I made for Shpaml:

https://gist.github.com/cool-RR/a3e9b74a7b0ef9cedcf7

It's on a strictly "works for me" basis, i.e. not tested across different scenarios, Python versions or operating systems. (Which is why it's shared in a gist rather than a repo.)

On Mon, Dec 29, 2014 at 7:31 PM, Ram Rachum ram@rachum.com wrote:

Hmm, actually it works only if Django isn't installed, if Django is installed it fails because of the missing environment variables.

On Mon, Dec 29, 2014 at 6:25 PM, Ram Rachum ram@rachum.com wrote:

Yep! Works and shows your warning.

On Mon, Dec 29, 2014 at 5:56 PM, James Robert notifications@github.com wrote:

ah got it, does it work for you from master now? should be:

from shpaml import convert_text

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68269024.

jiaaro commented 9 years ago

I’m hesistant to suppress that error because if you are using django and that message bubbled up through shpaml, you probably want to know about it. obviously it would have been a better idea to just import everything via submodules instead of pulling it in to the init.py - but it’s too late to undo that :/

On Mon, Dec 29, 2014 at 12:32 PM, Ram Rachum notifications@github.com wrote:

Hmm, actually it works only if Django isn't installed, if Django is installed it fails because of the missing environment variables. On Mon, Dec 29, 2014 at 6:25 PM, Ram Rachum ram@rachum.com wrote:

Yep! Works and shows your warning.

On Mon, Dec 29, 2014 at 5:56 PM, James Robert notifications@github.com wrote:

ah got it, does it work for you from master now? should be:

from shpaml import convert_text

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68269024.


Reply to this email directly or view it on GitHub: https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68278223

cool-RR commented 9 years ago

Makes sense. I think it's a good compromise.

On Tue, Dec 30, 2014 at 5:35 PM, James Robert notifications@github.com wrote:

I’m hesistant to suppress that error because if you are using django and that message bubbled up through shpaml, you probably want to know about it. obviously it would have been a better idea to just import everything via submodules instead of pulling it in to the init.py - but it’s too late to undo that :/

On Mon, Dec 29, 2014 at 12:32 PM, Ram Rachum notifications@github.com wrote:

Hmm, actually it works only if Django isn't installed, if Django is installed it fails because of the missing environment variables. On Mon, Dec 29, 2014 at 6:25 PM, Ram Rachum ram@rachum.com wrote:

Yep! Works and shows your warning.

On Mon, Dec 29, 2014 at 5:56 PM, James Robert notifications@github.com

wrote:

ah got it, does it work for you from master now? should be:

from shpaml import convert_text

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68269024.


Reply to this email directly or view it on GitHub: https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68278223

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#issuecomment-68366082.

cool-RR commented 9 years ago

Hi James,

Have you made a release with this feature?

jiaaro commented 9 years ago

v1.3.0 (as of today)

cool-RR commented 9 years ago

Thanks!

On Fri, Mar 6, 2015 at 7:18 PM, James Robert notifications@github.com wrote:

Closed #14 https://github.com/Rootbuzz/shpaml/issues/14.

— Reply to this email directly or view it on GitHub https://github.com/Rootbuzz/shpaml/issues/14#event-247641353.