First Steps in Grav CMS

Let's see, how it is working. Unicode, MathJax, Highlighting, etc.

Mar 20

First try. Checking the utf8 support with hungarian accents in "árvíztűrő tükörfúrógép" and in uppercase: "ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP." How to operate the MathJax plugin. I will test processing.js later.

Next, let's see the MathJax. You can type inline expressions, like \(\sin\alpha=\frac{1}{x^2}\), and we can use a display mode:

\[ R_{\mu \nu} - {1 \over 2} g_{\mu \nu}\,R + g_{\mu \nu} \Lambda = {8 \pi G \over c^4} T_{\mu \nu}\]

And now, try to insert a little ruby code:

#!/usr/bin/ruby

ARGV.each do |assfile|
  lines=0
  outfile=File.open(assfile.gsub(/ass$/,"srt"),"w")
  File.open(assfile).each do |line|
    if ( line =~ /^Dialogue:/ )
      lines=lines+1
      fields=line.split(',')
      outfile.puts lines
      outfile.puts "0"+fields[1]+"0 --> 0"+fields[2]+"0"
      outfile.puts fields.drop(4).join(',').gsub(/\\N/,"\n").chomp
      outfile.puts
    end
  end
  outfile.close
end

Syntax highlighting works in LaTex source, but you need a customized highlight.js. You can create this yourself on highlightjs.org.

\documentclass[12pt,a4paper,draft]{article}
\usepackage{t1enc}
\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel}

\title{Reguláris kifejezések}
\author{Gergi Miklós}
\addtolength{\textheight}{10mm}

\begin{document}

\section*{Mi a regexp?}
A reguláris kifejezésnek, angolul \texttt{regular expressions}, röviden
\texttt{regexp} egy olyan minta, amivel karaktersorozatok (stringek) egy
halmazát tudjuk megadni. A megadás elemi mintákból, és rájuk vonatkozó
műveletekből áll.

And finally a small bash script:

DEST="${@:$#}"
DESTHOST="${DEST%:*}"
DESTDIR="${DEST#*:}"
SPEED="7M"
if [ ${1:0:1} = "-" ] ; then
  SPEED="${1#-}";
  shift
fi
echo $@
#tar -cf - "${@:1:$[$#-1]}" | pv -br -L $SPEED | ssh "$DESTHOST" 'cd '"$DESTDIR"';tar -xf -'

The mathjax and the highlighting plugins can be enabled globally, and you can disable them on pages whose do not need it:

mathjax: false
highlight:
    enabled: false

Next Post Previous Post