mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
Use Pandoc instead of txt2tags binary, much more configurable
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
%!target: html
|
||||
%!options: --no-headers
|
||||
%!encoding: UTF-8
|
||||
%!postproc(html): '<TABLE CELLPADDING="4">' '<TABLE class="table">'
|
||||
24
_post.html
24
_post.html
@@ -1,24 +0,0 @@
|
||||
</div><!-- .container -->
|
||||
|
||||
<footer class="bg-light mt-5 py-5">
|
||||
<div class="container mb-5">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<a href="/">Home</a>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-7811807-3");
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
16
_pre.html
16
_pre.html
@@ -1,16 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{HEAD1}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container my-5">
|
||||
<div class="mb-5">
|
||||
<img src="/doc/Logos/gf1.svg" class="float-md-right mb-3 mb-md-0" alt="GF Logo">
|
||||
<h1 class="display-4">{{HEAD1}}</h1>
|
||||
<h3>{{HEAD2}}</h3>
|
||||
<h4 class="text-muted">{{HEAD3}}</h4>
|
||||
</div>
|
||||
90
bin/_template.html
Normal file
90
bin/_template.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="$lang$" xml:lang="$lang$"$if(dir)$ dir="$dir$"$endif$>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
$for(author-meta)$
|
||||
<meta name="author" content="$author-meta$" />
|
||||
$endfor$
|
||||
$if(date-meta)$
|
||||
<meta name="dcterms.date" content="$date-meta$" />
|
||||
$endif$
|
||||
$if(keywords)$
|
||||
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
||||
$endif$
|
||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
$if(quotes)$
|
||||
q { quotes: "“" "”" "‘" "’"; }
|
||||
$endif$
|
||||
</style>
|
||||
$if(highlighting-css)$
|
||||
<style type="text/css">
|
||||
$highlighting-css$
|
||||
</style>
|
||||
$endif$
|
||||
$for(css)$
|
||||
<link rel="stylesheet" href="$css$" />
|
||||
$endfor$
|
||||
$if(math)$
|
||||
$math$
|
||||
$endif$
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
$endfor$
|
||||
</head>
|
||||
<body>
|
||||
<div class="container my-5">
|
||||
|
||||
$if(title)$
|
||||
<header id="title-block-header">
|
||||
<img src="$rel-root$/doc/Logos/gf1.svg" height="200px" class="float-md-right mb-3 mb-md-0" alt="GF Logo">
|
||||
<h1 class="title">$title$</h1>
|
||||
$if(subtitle)$
|
||||
<p class="subtitle">$subtitle$</p>
|
||||
$endif$
|
||||
$for(author)$
|
||||
<p class="author">$author$</p>
|
||||
$endfor$
|
||||
$if(date)$
|
||||
<p class="date">$date$</p>
|
||||
$endif$
|
||||
</header>
|
||||
$endif$
|
||||
$if(toc)$
|
||||
<nav id="$idprefix$TOC">
|
||||
$table-of-contents$
|
||||
</nav>
|
||||
$endif$
|
||||
$body$
|
||||
</div><!-- .container -->
|
||||
|
||||
<footer class="bg-light mt-5 py-5">
|
||||
<div class="container mb-5">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<a href="$rel-root$">Home</a>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-7811807-3");
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,38 +3,29 @@
|
||||
### This script finds all .t2t (txt2tags) files and updates the corresponding
|
||||
### .html file, if it is out-of-date.
|
||||
|
||||
config=".txt2tagsrc"
|
||||
pre="_pre.html"
|
||||
post="_post.html"
|
||||
tmp="tmp.html"
|
||||
# Path to this directory (not CWD)
|
||||
# https://stackoverflow.com/a/246128/98600
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
find . -name '*.t2t' | while read t2t ; do
|
||||
html="${t2t%.t2t}.html"
|
||||
if [ "$t2t" -nt "$html" ] ; then
|
||||
txt2tags --config-file="$config" --target=html "$t2t"
|
||||
cat $pre $html $post > $tmp
|
||||
mv $tmp $html
|
||||
head1=$(head -n 1 "$t2t")
|
||||
head2=$(tail -n+2 "$t2t" | head -n 1)
|
||||
head3=$(tail -n+3 "$t2t" | head -n 1)
|
||||
|
||||
# Replace "headers" from t2t in final HTML
|
||||
# Documentation here: https://txt2tags.org/userguide/headerarea
|
||||
if [ -n "$head1" ] ; then
|
||||
sed -i.bak "s/{{HEAD1}}/$head1/" "$html" && rm "$html.bak"
|
||||
echo "$t2t"
|
||||
relroot="$( dirname $t2t | sed -E 's/^.\///' | sed -E 's/[^/]+/../g' )"
|
||||
pandoc \
|
||||
--from=t2t \
|
||||
--to=html5 \
|
||||
--standalone \
|
||||
--template="$DIR/_template.html" \
|
||||
--css="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" \
|
||||
--variable="rel-root:$relroot" \
|
||||
"$t2t" \
|
||||
--output="$html"
|
||||
if [ -f "$html" ]; then
|
||||
sed -i.bak "s/<table>/<table class=\"table\">/" "$html" && rm "$html.bak"
|
||||
sed -i.bak -E "s/\`\`(.+)\`\`/<code>\1<\/code>/g" "$html" && rm "$html.bak"
|
||||
else
|
||||
sed -i.bak -E "s/<.+{{HEAD1}}.+>//" "$html" && rm "$html.bak"
|
||||
continue # empty headers
|
||||
fi
|
||||
if [ -n "$head2" ] ; then
|
||||
sed -i.bak "s/{{HEAD2}}/$head2/" "$html" && rm "$html.bak"
|
||||
else
|
||||
sed -i.bak -E "s/<.+{{HEAD2}}.+>//" "$html" && rm "$html.bak"
|
||||
fi
|
||||
if [ -n "$head3" ] ; then
|
||||
sed -i.bak "s/{{HEAD3}}/$head3/" "$html" && rm "$html.bak"
|
||||
else
|
||||
sed -i.bak -E "s/<.+{{HEAD3}}.+>//" "$html" && rm "$html.bak"
|
||||
echo "Error creating $html"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -18,8 +18,8 @@ grammars. It assumes basic knowledge of GF, which
|
||||
can be acquired from the
|
||||
[GF Tutorial http://www.grammaticalframework.org/doc/tutorial/gf-tutorial.html].
|
||||
Help on GF commands is obtained on line by the
|
||||
help command (``help``), and help on invoking
|
||||
GF with (``gf -help``).
|
||||
help command with ``help``, and help on invoking
|
||||
GF with ``gf -help``.
|
||||
|
||||
|
||||
===A complete example===
|
||||
@@ -490,4 +490,3 @@ and the result is written to ``foo.gf``.
|
||||
|
||||
A. Ranta, Grammatical Framework: A Type-Theoretical Grammar Formalism.
|
||||
//The Journal of Functional Programming//, vol. 14:2. 2004, pp. 145-189.
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ What's new? See the [Release notes release-3.9.html].
|
||||
| Ubuntu (32-bit) | [gf_3.9-1_i386.deb gf_3.9-1_i386.deb] | //GF+S+C+J+P// | ``sudo dpkg -i gf_3.9-1_i386.deb``
|
||||
| Ubuntu (64-bit) | [gf_3.9-1_amd64.deb gf_3.9-1_amd64.deb] | //GF+S+C+J+P// | ``sudo dpkg -i gf_3.9-1_amd64.deb``
|
||||
| Windows | [gf-3.9-bin-windows.zip gf-3.9-bin-windows.zip] | //GF+S// | ``unzip gf-3.9-bin-windows.zip``
|
||||
|
||||
%| MINGW | [gf-3.9-bin-i686-MINGW32_NT-6.1.tar.gz gf-3.9-bin-i686-MINGW32_NT-6.1.tar.gz] | //GF+S+C// | ``tar -C / gf-3.9-bin-i686-MINGW32_NT-6.1.tar.gz``
|
||||
%| ... | ... | ... | ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user