fortran-lang/webpage

feature suggest: best practices with .pdf export

nbehrnd opened this issue · 2 comments

Though the content likely is equally available via GitHub, I would like to suggest that the compilation of «Fortran Best Practices» equally becomes available as export to .pdf. This is an option seen e.g., with «normal» entries in the Wikipedia, as well as for their wikibooks:

2022-10-21_fortran_lang_suggest

(screenphoto of https://en.wikibooks.org/wiki/Fortran/Printable_version)

The example of wikipedia demonstrates that the already present discern between the documentation per sé and snippets of code -- including syntax highlighting -- may be preserved.

Sphinx can export to LaTeX and subsequently to PDF, most of the styling features, like bootstrap CSS, however won't be available there, but we are not using many fancy directives in the learn section. Also, I believe it would export the whole page as one PDF by default, so we would have to exclude everything but the learn section if we are using the PDF backend (similar in idea in #173 to append to the exclude list based on the builder).

I just recognize pandoc and (g)roff might be used to generate .pdf out of .md (an example). The syntax highlighting (pandoc --list-highlighted-languages) offered has got separate entries fortranfixed and fortranfree, so per sé one could imagine something in line of

#!/usr/bin/bash

for file in *.md;
do
  base=$(basename "$file");
  output=${base//\.md/};
  echo 'work on file' "$file";

  pandoc -Tpdf -t ms "$file" -o "$output".pdf;
done

To build a .pdf as e.g., the .zip below about the .md of section «best_practices». True, there however are at least two points already seen which would require improvement:

  • instead of a concatenation of individual .pdf (e.g., pdftk), I would like to merge the content already on the level of the individual .md files.
  • according to the log (included) some input characters are not properly recognized (yet). This is e.g., about the superscript minus in exponents of floating_point.md when describing the numeric ranges.
  • adjustment of the the format (ISO A4 as a complementary format to letter US, etc.)

2022-10-25_best_practices.zip