9999years / latex-changelog

LaTeX package for typesetting changelogs
https://ctan.org/pkg/changelog
LaTeX Project Public License v1.3c
9 stars 3 forks source link

Does this support pandoc to markdown compilation? #12

Closed cloudyluna closed 2 months ago

cloudyluna commented 3 months ago

Hi, thanks for this project! It has been very useful to me on creating changelogs to a bunch of PDFs.

I tried to compile the same input to markdown (gfm flavored) format this time, but the output it produced wasn't what I was expecting for a markdown format.

pandoc -t gfm -s input.tex -o output.md

input.tex

\documentclass[a4paper,12pt]{article}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{changelog}

\author{Cloudyluna}

\makeatletter

\begin{document}

\begin{changelog}[author=Cloudyluna, sectioncmd=\section*]
    \begin{version}[version=0.4.1]
        \added \item Provide a minimal translated string for keybind HUD message.

        \fixed \item Properly use food ID instead of their qualified version (which may start with something like (O)91 for banana). Now, we use just number 91 to block from eating bananas, which doesn't contradict the given example in the config menu
    \end{version}

    \begin{version}[version=0.4.0]
        \added
        \item Show HUD message when mod's is toggled on/off with the keybind while playing.
        \item Player condition interval check now has an option to check every 1/3 of a second. Set this to 0 to make this check occuring far more often.

        \changed
        \item Forbidden list to take (global) qualified item ids only, which I believe is much more accurate to represent item type. One of the site to browse the item ids can be found here - https://stardewids.com/.

        \fixed \item Cheapest food option priority. A silly typo broke this whole logic. My silly self has fixed and added a bit more code to prevent this from happening again.
    \end{version}

    \begin{version}[version=0.3.0]
        \added
        \item New feature to entirely skip eating animation (and the world pauses that comes with it) for you to eat food on the go, automatically. Configurable.

        \fixed \item Stay in the last facing direction option. I forgot to handle this internally..
    \end{version}

    \begin{version}[version=0.2.1]
        \fixed
        \item Forbidden list name when spaces are in use.
    \end{version}

    \begin{version}[version=0.2.0]

        \added
        \item Option to select cheapest food to eat.
        \item Improve Generic Config Menu settings page with more usage explanations.

        \fixed
        \item Minor performance improvements.
        \item Forbidden list input now can deal with stray whitespaces and commas. Also the names doesn't have to be case-sensitive.

        \removed
        \item (Breaking): prioritized food input list and instead I made the active inventory row as the as the highest food prioritization for consuming (left to right, depending on your configured "eating priority" setting).

    \end{version}

    \shortversion{version=0.1.0,changes=Initial release.}
\end{changelog}

\end{document}

output.md

---
author:
- Cloudyluna
---

<div class="changelog">

<div class="version">

Provide a minimal translated string for keybind HUD message.

Properly use food ID instead of their qualified version (which may start
with something like (O)91 for banana). Now, we use just number 91 to
block from eating bananas, which doesn’t contradict the given example in
the config menu

</div>

<div class="version">

Show HUD message when mod’s is toggled on/off with the keybind while
playing.

Player condition interval check now has an option to check every 1/3 of
a second. Set this to 0 to make this check occuring far more often.

Forbidden list to take (global) qualified item ids only, which I believe
is much more accurate to represent item type. One of the site to browse
the item ids can be found here - https://stardewids.com/.

Cheapest food option priority. A silly typo broke this whole logic. My
silly self has fixed and added a bit more code to prevent this from
happening again.

</div>

<div class="version">

New feature to entirely skip eating animation (and the world pauses that
comes with it) for you to eat food on the go, automatically.
Configurable.

Stay in the last facing direction option. I forgot to handle this
internally..

</div>

<div class="version">

Forbidden list name when spaces are in use.

</div>

<div class="version">

Option to select cheapest food to eat.

Improve Generic Config Menu settings page with more usage explanations.

Minor performance improvements.

Forbidden list input now can deal with stray whitespaces and commas.
Also the names doesn’t have to be case-sensitive.

(Breaking): prioritized food input list and instead I made the active
inventory row as the as the highest food prioritization for consuming
(left to right, depending on your configured "eating priority" setting).

</div>

</div>

Did I do something wrong with pandoc or changelog package? (I'm also quite new to latex, admittedly).

Thanks.

9999years commented 2 months ago

Pandoc only supports a subset of LaTeX input. Even just parsing TeX is turing complete, so Pandoc just parses a LaTeX-like grammar and does its best. The changelog package is not in the subset that Pandoc supports:

https://github.com/jgm/pandoc/blob/f048d8110e672148619094642f411d7ea223a17f/src/Text/Pandoc/Readers/LaTeX.hs#L1009-L1051

Not really much you can do here. You could rewrite the TeX document in a format Pandoc can understand (e.g. using \section* and \begin{itemize}...\end{itemize} and similar directly).