homebrew-core/Formula/pandoc-crossref.rb
2016-07-15 05:31:53 -07:00

43 lines
1.8 KiB
Ruby

require "language/haskell"
class PandocCrossref < Formula
include Language::Haskell::Cabal
desc "Pandoc filter for numbering and cross-referencing."
homepage "https://github.com/lierdakil/pandoc-crossref"
url "https://hackage.haskell.org/package/pandoc-crossref-0.2.2.1/pandoc-crossref-0.2.2.1.tar.gz"
sha256 "85da5dff663b578367ed75dcd71d8273a9cd92e8ae4a907ff0b83694d8417abd"
bottle do
cellar :any_skip_relocation
sha256 "48a2077a0ec3a4f51854eb183611dc1e9d4d1b7ee030939716dce5fe6940ebfd" => :el_capitan
sha256 "c5bf3548f56ce86cacf3f44b3ae18411e9ff9bc497967dabbe9d9e763fb3caf6" => :yosemite
sha256 "36ed9a8269ded642e8d3d607087991916eb261edd4817cf340888a552be7acc0" => :mavericks
end
depends_on "ghc" => :build
depends_on "cabal-install" => :build
depends_on "pandoc" => :run
def install
args = []
args << "--constraint=cryptonite -support_aesni" if MacOS.version <= :lion
install_cabal_package *args
end
test do
(testpath/"hello.md").write <<-EOS.undent
Demo for pandoc-crossref.
See equation @eq:eqn1 for cross-referencing.
Display equations are labelled and numbered
$$ P_i(x) = \sum_i a_i x^i $$ {#eq:eqn1}
EOS
(testpath/"expected.txt").write <<-EOS.undent
<p>Demo for pandoc-crossref. See equation eq.M-BM- 1 for cross-referencing. Display equations are labelled and numbered</p>$
<p><br /><span class="math display"><em>P</em><sub><em>i</em></sub>(<em>x</em>)=<em>u</em><em>m</em><sub><em>i</em></sub><em>a</em><sub><em>i</em></sub><em>x</em><sup><em>i</em></sup>M-bM-^@M-^AM-bM-^@M-^A(1)</span><br /></p>$
EOS
system Formula["pandoc"].bin/"pandoc", "-F", bin/"pandoc-crossref", "-o", "out.html", "hello.md"
assert_equal File.read("expected.txt"), pipe_output("/bin/cat -et", File.read("out.html"))
end
end