Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub Actions for site building and format conversion. #25

Open
Hsins opened this issue Jul 31, 2021 · 8 comments
Open

Use GitHub Actions for site building and format conversion. #25

Hsins opened this issue Jul 31, 2021 · 8 comments

Comments

@Hsins
Copy link
Contributor

Hsins commented Jul 31, 2021

There are a bunch of static site generator that creates HTML pages from templates or components and the given content source. Besides, we can also automate, customize, and execute workflows right in the repository with GitHub Actions.

The OI Wiki Project is an example:

  1. The contents are written in Markdown.
  2. Then the build and build-pdf workflows are triggered whenever there is any push or pull request event.
    • build workflow runs mkdocs for creating HTML pages from *.md files.
    • build-pdf workflow coverted *.md files to *.tex files (by running this JavaScript script) and compiled them to output.pdf.

Besides, the site 《大家來學 LaTeX》 is another site created with Hugo and use utteranc as the comment system. It would be a possible solution to use pandoc for coverting *.tex to *.md.

@jserv
Copy link
Contributor

jserv commented Jul 31, 2021

make4ht is used for HTML generation (#20), and I would like to stick to LaTeX script at present.

@Hsins
Copy link
Contributor Author

Hsins commented Jul 31, 2021

Sure that we can keep the source files in *.tex format but find out another solution for HTML/EPUB generating. It's not really convenient to use TeX4ht with custom HTML template although it's enough at present.

@fennecJ
Copy link
Collaborator

fennecJ commented Jul 31, 2021

I think build a markdown file then convert it into html sounds promising.
However pandoc doesn't support some extensions used in lkmpg.tex and caused several code blocks to be omitted.

@Hsins
Copy link
Contributor Author

Hsins commented Jul 31, 2021

More packages make more possible dependency issue but we don't have bunch of packages.

I've check that currently the format conversion of code block from tex to md would be like something below:

LaTeX Markdown
\subsection{Kernel module package}
\label{sec:packages}

Linux distributions provide the commands 
\emph{modprobe}, \emph{insmod} and \emph{depmod} 
within a package.

On Ubuntu/Debian:
\begin{codebash}
sudo apt-get install build-essential kmod
\end{codebash}
## Kernel module package {#sec:packages}

Linux distributions provide the commands 
*modprobe*, *insmod* and *depmod* 
within a package.

On Ubuntu/Debian:

::: codebash
sudo apt-get install build-essential kmod
:::

It seems that we can do something tricky: TeX -> Markdown -> HTML. Just replace ":::" with "```" and "codebash" (or something else programming languages) with "bash" before converting to HTML from Markdown.

@Hsins
Copy link
Contributor Author

Hsins commented Jul 31, 2021

Also, I found that we can use listings package instead of minted in LaTeX and pandoc handle the lstlisting environment well.

image

@Hsins
Copy link
Contributor Author

Hsins commented Jul 31, 2021

After creating and running with a custom pandoc filter for minted package. Now it can handle the code block environment with minted package well:

image

It may take me some time for creating the pandoc filter to deal with the \newminted[codebash] environment that @jserv created.

@fennecJ
Copy link
Collaborator

fennecJ commented Aug 1, 2021

Consider using \begin{minted}[linenos]{c} instead of \begin{minted}{c} so the line number can be shown.

@Hsins
Copy link
Contributor Author

Hsins commented Aug 4, 2021

There is a POC (Proof of Concept) site building with Pandoc + Hugo (theme: book) could be check at here. It seems that:

  • The lua-filters minted given by Pandoc officially could not deal with the [linenos] options well. And I need to modify it for custom use.
  • The \samplec{} macro for including *.c source code into document is not work when converting with pandoc. This could be resolve with hardcoded replacing before converting.

Now, waiting for #26 resolved so that I could split one page into several chapters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants