Class: Nagoro::Pipe::Tidy
Overview
Small wrapper that pipes the template through tidy.
For configuration see the FLAGS, it’s an array of arguments passed to the tidy command.
We are not using the ruby tidy library to avoid memory-leaks and dependencies. Please make sure you do have a binary called ‘tidy` in your `PATH` before using this library.
This pipe relies on open3 from the standard library.
Regarding Windows
There have been numerous reports that open3 doesn’t work on Windows, since it relies on Kernel#fork, as syscall that is not supported on that platform.
Two possible solutions exist:
-
There is a win32-popen implementation in RAA
-
Kernel#fork works in cygwin.
I don’t have a copy of windows, so it’s hard for me to try either of these options. Please send me a patch if you find a cross-platform way of implementing this functionality.
Constant Summary collapse
- FLAGS =
Possible flags can be found in ‘tidy -help` and `tidy -help-config`
%w[-utf8 -asxhtml -quiet -indent --tidy-mark no]
Instance Method Summary collapse
- #result ⇒ Object
-
#tidy(string) ⇒ String
Pipe given
string
through the tidy binary.
Methods inherited from Base
#append, #doctype, #initialize, #instruction, #tag, #tag_end, #tag_start, #tag_with, #text
Constructor Details
This class inherits a constructor from Nagoro::Pipe::Base
Instance Method Details
#result ⇒ Object
34 35 36 37 |
# File 'lib/nagoro/pipe/tidy.rb', line 34 def result @scanner.stream tidy(@body.join) end |