Zackio
3/21/2015 - 1:30 PM

tidy-html5.rb

class TidyHtml5 < Formula
  homepage "http://w3c.github.com/tidy-html5/"
  url "https://github.com/w3c/tidy-html5/archive/master.tar.gz"
  sha1 "e2ebab1cbad36350ed39470fab402643f8e35981"
  version "HEAD"

  patch :DATA

  def install
    ENV.deparallelizegm
    system "make", "runinst_prefix=#{prefix}", "devinst_prefix=#{prefix}", "-C", "build/cmake/"
    system "make", "install", "runinst_prefix=#{prefix}", "devinst_prefix=#{prefix}", "-C", "build/cmake/"
    man1.mkpath
    man1.install "htmldoc/tidy-html5.1"
  end
  
  def valid_html5
    <<-EOS
<!DOCTYPE html>
<html lang="en">
<head>
<title>Valid html5</title>
<meta charset="utf-8" />
</head>
<body>
<video src="movie.webm" poster="movie.jpg" controls>
	This is fallback content to display if the browser
	does not support the video element.
</video>
</body>
</html>
    EOS
  end
  
  test do
    system "echo '#{valid_html5}' | tidy-html5"
  end
end
__END__
--- a/build/cmake/Makefile	2014-12-17 16:46:23.000000000 -0800
+++ b/build/cmake/Makefile	2014-12-17 16:46:56.000000000 -0800
@@ -49,11 +49,11 @@
 
 SHELL=/bin/sh
 
-PROJECT=tidy
+PROJECT=tidy-html5
 
 # Installation variables.  Spaces OK, only dir create and file copy operations.
-runinst_prefix=/usr/local
-devinst_prefix=/usr/local
+runinst_prefix?=/usr/local
+devinst_prefix?=/usr/local
 
 bininst = ${runinst_prefix}/bin
 libinst = ${devinst_prefix}/lib
@@ -126,7 +126,7 @@
 
 EXES = $(BINDIR)/$(PROJECT) $(BINDIR)/tab2space
 
-DOCS = $(DOCDIR)/quickref.html $(DOCDIR)/tidy.1
+DOCS = $(DOCDIR)/quickref.html $(DOCDIR)/$(PROJECT).1
 
 CONFIGXML = $(DOCDIR)/tidy-config.xml
 HELPXML = $(DOCDIR)/tidy-help.xml
@@ -197,7 +197,7 @@
 $(DOCDIR)/quickref.html: $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
 	$(XSLTPROC) -o $@ $(DOCDIR)/quickref-html.xsl $(CONFIGXML)
 
-$(DOCDIR)/tidy.1: $(DOCDIR)/tidy1.xsl $(HELPXML) $(CONFIGXML)
+$(DOCDIR)/$(PROJECT).1: $(DOCDIR)/tidy1.xsl $(HELPXML) $(CONFIGXML)
 	$(XSLTPROC) -o $@ $(DOCDIR)/tidy1.xsl $(HELPXML)
 
 debug:
@@ -205,7 +205,7 @@
 
 clean:
 	rm -f $(OBJFILES) $(EXES) $(LIBRARY) $(DOCS) $(HELPXML) $(CONFIGXML) $(OBJDIR)/*.lo
-	rm -rf $(BINDIR)/tidy.dSYM $(BINDIR)/tab2space.dSYM
+	rm -rf $(BINDIR)/$(PROJECT).dSYM $(BINDIR)/tab2space.dSYM
 	if [ -d $(OBJDIR)/.libs ]; then rmdir $(OBJDIR)/.libs; fi
 	if [ -d $(LIBDIR)/.libs ]; then rmdir $(LIBDIR)/.libs; fi
 	if [ "$(OBJDIR)" != "$(TOPDIR)" -a -d $(OBJDIR) ]; then rmdir $(OBJDIR); fi
@@ -224,8 +224,8 @@
 	if [ ! -d "$(bininst)" ]; then mkdir -p "$(bininst)"; fi
 	cp -f $(EXES) "$(bininst)/"
 
-installmanpage: $(DOCDIR)/tidy.1
+installmanpage: $(DOCDIR)/$(PROJECT).1
 	if [ ! -d "$(maninst)/man1" ]; then mkdir -p "$(maninst)/man1"; fi;
-	cp -f $(DOCDIR)/tidy.1 "$(maninst)/man1/tidy.1";
+	cp -f $(DOCDIR)/$(PROJECT).1 "$(maninst)/man1/$(PROJECT).1";
 
 install: installhdrs installib installexes installmanpage