Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Last div not properly closed #18

Open
claes opened this Issue · 3 comments

2 participants

@claes

I have found an issue where the last div is not properly closed in a markdown template defined using several headings.

I added this to the demo website index.yaml:

- url      : bug.html
  title    : Bug
  template : bug.html.st
  requires : bug.st

bug.html.st contains:

<!-- Begin -->
$bug()$
<!-- End -->

bug.st contains:

# Heading 1

Lorem ipsur

# Heading 2

Lorem ipsur

The resulting page contains the following html:

      <div id="maincol" class="yui-b">
<!-- Begin --><div id="heading-1"
><h1
  >Heading 1</h1
  ><p
  >Lorem ipsur</p
  ></div
><div id="heading-2"
><h1
  >Heading 2</h1
  >Lorem ipsur<!-- End -->
</div
>
      </div>

I would have expect the div with id heading-2 to be closed prior to the end comment. It seems in this case it is closed later but in other circumstances it causes a big problem with the end comment is replaced with actual markup .

@jgm
Owner

This is the expected behavior. The templates are all applied before pandoc is used to transform the markdown. So pandoc is seeing this:

<!-- begin -->

# Heading 1

Lorem ipsur

# Heading 2

Lorem ipsur

<!-- end -->

It has no way of knowing that the <!-- end --> is not supposed to be in the section.
Maybe what you're expecting is for pandoc to be run individually for each template. That's not what happens, and in general, it's not what you want (think about footnotes, table of contents, etc.).

If you have a case where the div doesn't get closed at all, that would be a bug. But you haven't provided such a case, so I can't comment on that.

Also, please see http://code.google.com/p/pandoc/issues/detail?id=230.
Have you compiled your yst against the latest version of pandoc?

@claes

Yes I thought that pandoc was only run on markdown templates, and that a template with suffix ".html.st" would be left "unprocessed". But I see now also the effect of markdown syntax in this template. Perhaps I need to do this differently, I haven't used the "layout" field for example.

I installed yst using cabal this weekend as in the installation instructions. My pandoc version is 1.6.

@claes

Regarding issue 230 above, I don't mind the pandoc behavior (the div-wrapping). I think it is pretty convenient in itself. I am just trying to figure out how to adjust my layouts to work with it. If it would not be the div issue, it would be something else. Now when I realize that my html template is parsed by pandoc I need to experiment more to learn how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.