librelist archives

« back to archive

Markup / ~down woes

Markup / ~down woes

From:
James Abbott
Date:
2012-04-18 @ 11:33
Hi,-

I'm looking for a way to render my HTML markup in a Nesta markdown page
that is 100% true to the original markup. I've really tried to strip all
defaults off of page processing. The page template includes this line only:

~ @page.to_html(self)
>

The layout file just calls that template. And, here's the top of the .mdown
file I want to display:

Layout: art
> Template: basic_template
> Design: literate/screen
>
> - - plain HTML from here --
>

Still, the output isn't true to the original. Firstly, the header and the
footer are wrapped in p tags. Secondly, it wraps the contents of the header
in pre and code tags for some reason. Thirdly, the Markdown processor
inserts control / line feed strings (
) after each line inside my
legitimate pre code tags. As a result, the code samples aren't indented the
way they should be and the visual effect is lost.

So, is there a way to put one's markup in there and have it rendered
without *any* modification whatsoever?

Here's a link so you can see what I mean - view the source:

http://jamesabbottdd.com/programming/literate-code

Thanks, James

Re: [nesta] Markup / ~down woes

From:
Tommy Palmer
Date:
2012-04-18 @ 11:37
You should really be using HAML for your content and then calling 
:markdown where needed.


On Wednesday, 18 April 2012 at 12:33, James Abbott wrote:

> Hi,-
> 
> I'm looking for a way to render my HTML markup in a Nesta markdown page 
that is 100% true to the original markup. I've really tried to strip all 
defaults off of page processing. The page template includes this line 
only:
> 
> > ~ @page.to_html(self)
> 
> The layout file just calls that template. And, here's the top of the 
.mdown file I want to display:
> 
> > Layout: art
> > Template: basic_template
> > Design: literate/screen
> > 
> > - - plain HTML from here --
>  Still, the output isn't true to the original. Firstly, the header and 
the footer are wrapped in p tags. Secondly, it wraps the contents of the 
header in pre and code tags for some reason. Thirdly, the Markdown 
processor inserts control / line feed strings (
) after each line 
inside my legitimate pre code tags. As a result, the code samples aren't 
indented the way they should be and the visual effect is lost. 
> 
> So, is there a way to put one's markup in there and have it rendered 
without *any* modification whatsoever?
> 
> Here's a link so you can see what I mean - view the source:
> 
> http://jamesabbottdd.com/programming/literate-code
> 
> Thanks, James

Re: [nesta] Markup / ~down woes

From:
James Abbott
Date:
2012-04-18 @ 12:14
>
> You should really be using HAML for your content and then calling
> :markdown where needed.
>

Should I? So I should take this HTML file that is 284 lines long and
translate it, line by line, to HAML so that my CMS can understand it?
(Calling html2haml absolutely mangled that file).

In other words, should I create more manual work for myself instead of
looking for a simpler way to do things? And where does the "should" come
from, by the way? Is there anything wrong plain HTML?



On Wed, Apr 18, 2012 at 1:37 PM, Tommy Palmer <hi@tommyp.org> wrote:

>  You should really be using HAML for your content and then calling
> :markdown where needed.
>
> On Wednesday, 18 April 2012 at 12:33, James Abbott wrote:
>
> Hi,-
>
> I'm looking for a way to render my HTML markup in a Nesta markdown page
> that is 100% true to the original markup. I've really tried to strip all
> defaults off of page processing. The page template includes this line only:
>
> ~ @page.to_html(self)
>
>
> The layout file just calls that template. And, here's the top of the
> .mdown file I want to display:
>
> Layout: art
> Template: basic_template
> Design: literate/screen
>
> - - plain HTML from here --
>
>
> Still, the output isn't true to the original. Firstly, the header and the
> footer are wrapped in p tags. Secondly, it wraps the contents of the header
> in pre and code tags for some reason. Thirdly, the Markdown processor
> inserts control / line feed strings (
) after each line inside my
> legitimate pre code tags. As a result, the code samples aren't indented the
> way they should be and the visual effect is lost.
>
> So, is there a way to put one's markup in there and have it rendered
> without *any* modification whatsoever?
>
> Here's a link so you can see what I mean - view the source:
>
> http://jamesabbottdd.com/programming/literate-code
>
> Thanks, James
>
>
>

Re: [nesta] Markup / ~down woes

From:
Tommy Palmer
Date:
2012-04-18 @ 12:19
I've never used HTML within Nesta other than through a HAML file, but I 
presume that if it's a markdown file, it expects with your metadata at the
top and markdown from then on. I guess you could use ERB. 

-- 
Tommy Palmer
@tommypalm
http://tommyp.org


On Wednesday, 18 April 2012 at 13:14, James Abbott wrote:

> ore manual work for myself instead of looking for a simpler way to do 
things? And where does the "should" come from, by the way? Is there 
anything wrong plain HTML? 

Re: [nesta] Markup / ~down woes

From:
James Abbott
Date:
2012-04-18 @ 12:52
Tommy,-

HAML and ERB (depending on one's taste) are great options in situations
where the ratio of dynamic page elements to plain markup is high. They are
great in web applications, for example.

My file, on the other hand, is a 100% plain design document - it has no
dynamic elements. I designed it in HTML and SCSS, not HAML, for that reason.

My only wish for Nesta is that it would treat plain HTML the way SCSS
treats CSS: just evaluate the thing to itself and let one move on.
*
*/ James*
*

On Wed, Apr 18, 2012 at 2:19 PM, Tommy Palmer <hi@tommyp.org> wrote:

> I've never used HTML within Nesta other than through a HAML file, but I
> presume that if it's a markdown file, it expects with your metadata at the
> top and markdown from then on. I guess you could use ERB.
>
> --
> Tommy Palmer
> @tommypalm
> http://tommyp.org
>
> On Wednesday, 18 April 2012 at 13:14, James Abbott wrote:
>
> ore manual work for myself instead of looking for a simpler way to do
> things? And where does the "should" come from, by the way? Is there
> anything wrong plain HTML?
>
>
>

Re: [nesta] Markup / ~down woes

From:
David Long
Date:
2012-04-18 @ 12:54
If it is just plain HTML, then you should be able to add .erb to the 
extension and it will just work. Otherwise place the HTML file into your 
public directory and, as Graham stated let the web server handle it, not 
the CMS.

-- 
David Long
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Wednesday, April 18, 2012 at 8:52 AM, James Abbott wrote:

> Tommy,-
> 
> HAML and ERB (depending on one's taste) are great options in situations 
where the ratio of dynamic page elements to plain markup is high. They are
great in web applications, for example.
> 
> My file, on the other hand, is a 100% plain design document - it has no 
dynamic elements. I designed it in HTML and SCSS, not HAML, for that 
reason.
> 
> My only wish for Nesta is that it would treat plain HTML the way SCSS 
treats CSS: just evaluate the thing to itself and let one move on. 
> 
> / James
> 
> 
> On Wed, Apr 18, 2012 at 2:19 PM, Tommy Palmer <hi@tommyp.org 
(mailto:hi@tommyp.org)> wrote:
> > I've never used HTML within Nesta other than through a HAML file, but 
I presume that if it's a markdown file, it expects with your metadata at 
the top and markdown from then on. I guess you could use ERB. 
> > 
> > -- 
> > Tommy Palmer
> > @tommypalm
> > http://tommyp.org
> > 
> > 
> > On Wednesday, 18 April 2012 at 13:14, James Abbott wrote:
> > 
> > 
> > > ore manual work for myself instead of looking for a simpler way to 
do things? And where does the "should" come from, by the way? Is there 
anything wrong plain HTML? 
> > 
> > 
> 

Re: [nesta] Markup / ~down woes

From:
Tommy Palmer
Date:
2012-04-18 @ 12:56

> If it is just plain HTML, then you should be able to add .erb to the 
extension and it will just work. Otherwise place the HTML file into your 
public directory and, as Graham stated let the web server handle it, not 
the CMS.
That's what I meant when I said use ERB.

Re: [nesta] Markup / ~down woes

From:
Graham Ashton
Date:
2012-04-18 @ 12:54
On 18 Apr 2012, at 13:52, James Abbott wrote:

> My file, on the other hand, is a 100% plain design document - it has no 
dynamic elements. I designed it in HTML and SCSS, not HAML, for that 
reason.

Oh; then you're putting it in the wrong place. Move it out of 
content/pages and stick it in views (as an erb file).

You'll have to set up an action in your app.rb file to serve it then 
though (and when I say "your app.rb" I mean add an app.rb file to your 
app's folder, next to the content folder).

Re: [nesta] Markup / ~down woes

From:
James Abbott
Date:
2012-04-18 @ 12:59
>
> Move it out of content/pages and stick it in views (as an erb file).
>
> You'll have to set up an action in your app.rb file to serve it then
> though (and when I say "your app.rb" I mean add an app.rb file to your
> app's folder, next to the content folder).
>

OK - will try.

/ James


On Wed, Apr 18, 2012 at 2:54 PM, Graham Ashton <graham@effectif.com> wrote:

> On 18 Apr 2012, at 13:52, James Abbott wrote:
>
> > My file, on the other hand, is a 100% plain design document - it has no
> dynamic elements. I designed it in HTML and SCSS, not HAML, for that reason.
>
> Oh; then you're putting it in the wrong place. Move it out of
> content/pages and stick it in views (as an erb file).
>
> You'll have to set up an action in your app.rb file to serve it then
> though (and when I say "your app.rb" I mean add an app.rb file to your
> app's folder, next to the content folder).
>

Re: [nesta] Markup / ~down woes

From:
Graham Ashton
Date:
2012-04-18 @ 13:28
On 18 Apr 2012, at 13:59, James Abbott wrote:

> OK - will try. 

If it's just HTML that doesn't need the layout wrapped around it, putting 
it in public as David suggested is a perfect solution (Nesta won't even 
see it, and Sinatra will deal with it). If you need the layout, make a new
template in views.

Re: [nesta] Markup / ~down woes

From:
James Abbott
Date:
2012-04-18 @ 13:55
Awesome! I look forward to playing with it.

Thanks,
James

On Wed, Apr 18, 2012 at 3:28 PM, Graham Ashton <graham@effectif.com> wrote:

> On 18 Apr 2012, at 13:59, James Abbott wrote:
>
> > OK - will try.
>
> If it's just HTML that doesn't need the layout wrapped around it, putting
> it in public as David suggested is a perfect solution (Nesta won't even see
> it, and Sinatra will deal with it). If you need the layout, make a new
> template in views.
>

Re: [nesta] Markup / ~down woes

From:
Graham Ashton
Date:
2012-04-18 @ 12:53
On 18 Apr 2012, at 13:14, James Abbott wrote:

> Should I? So I should take this HTML file that is 284 lines long and 
translate it, line by line, to HAML so that my CMS can understand it? 
(Calling html2haml absolutely mangled that file).

Serving HTML isn't a job for a CMS; it's a job for a web server.

I've never seen html2haml produce something that doesn't work.

> And where does the "should" come from, by the way? Is there anything 
wrong plain HTML?

If there were a "Nesta way", Tommy would have described it (i.e. that's 
what I'd do). But I'd rather you do it however works for you.

Try this (untested) in a Haml file:

Meta: data
Goes: here

%h1 Title of page

:markdown
  Hmm, this seems a bit convoluted...

:plain
  <html><in><here></here></in></html>

:markdown
  Hurray, I can see again!