ickc / pandoc-amsthm

provide a syntax to use amsthm environments in pandoc, with output in LaTeX and HTML
https://ickc.github.io/pandoc-amsthm/
BSD 3-Clause "New" or "Revised" License
21 stars 7 forks source link

Bug in pandoc-latex-environment #2

Closed chdemko closed 8 years ago

chdemko commented 8 years ago

In my code https://github.com/chdemko/pandoc-latex-environment, the test currentClasses <= definedClasses was incorrect. It should be currentClasses >= definedClasses

PS: thanks to cite my code as stated in the CeCILL-B lience. See https://github.com/chdemko/pandoc-latex-environment/blob/master/README.md

ickc commented 8 years ago

Hi, @chdemko,

Thanks for letting me know.

I tried to update my code according to yours but it doesn't work in the way I need.

A difference between your YAML and mine is, e.g. test: [class1, class2], yours use test to be the LaTeX environment, but mine use class1, class2 as the environments.

I updated mine just now like this:

        for environment, definedClasses in getDefined(meta).items():
            for definedClass in definedClasses:
                # Is the classes correct?
                if definedClass in currentClasses:
                    value[1] = [RawBlock('tex', '\\begin{' + definedClass + '}')] + content + [RawBlock('tex', '\\end{' + definedClass + '}')]
                    break

The problem was that both the definedClasses and currentClasses are arrays and one might not be a strict superset of the other so either >= or <= does not work in my case. Looking at your wiki seems like the situation is the same in your case too.

About the license, I added a reference in the python script before and added it in the README just now. Please see if it's ok.