module Tidylib
Ruby wrapper for HTML Tidy Library Project (tidy.sf.net).
Public Instance Methods
buf_free(buf)
click to toggle source
tidyBufFree
# File lib/tidy/tidylib.rb, line 34 def buf_free(buf) tidyBufFree(buf) end
clean_and_repair(doc)
click to toggle source
tidyCleanAndRepair
# File lib/tidy/tidylib.rb, line 46 def clean_and_repair(doc) tidyCleanAndRepair(doc) end
create()
click to toggle source
tidyCreate
# File lib/tidy/tidylib.rb, line 40 def create tidyCreate end
load(path)
click to toggle source
Load the library.
# File lib/tidy/tidylib.rb, line 11 def load(path) begin dlload(path) rescue raise LoadError, "Unable to load #{path}" end extern "void *tidyCreate()" extern "void tidyBufFree(void*)" extern "int tidyCleanAndRepair(void*)" extern "int tidyLoadConfig(void*, char*)" extern "int tidyOptGetIdForName(char*)" extern "char tidyOptGetValue(void*, unsigned int)" extern "int tidyOptParseValue(void*, char*, char*)" extern "int tidyParseString(void*, char*)" extern "void tidyRelease(void*)" extern "char* tidyReleaseDate()" extern "int tidyRunDiagnostics(void*)" extern "int tidySaveBuffer(void*, void*)" extern "int tidySetErrorBuffer(void*, void*)" end
load_config(doc, file)
click to toggle source
tidyLoadConfig
# File lib/tidy/tidylib.rb, line 52 def load_config(doc, file) tidyLoadConfig(doc, file.to_s) end
opt_get_value(doc, name)
click to toggle source
tidyOptGetValue (returns true/false instead of 1/0)
# File lib/tidy/tidylib.rb, line 64 def opt_get_value(doc, name) value = tidyOptGetValue(doc, tidyOptGetIdForName(translate_name(name))) Tidy.to_b(value) end
opt_parse_value(doc, name, value)
click to toggle source
tidyOptParseValue
# File lib/tidy/tidylib.rb, line 58 def opt_parse_value(doc, name, value) tidyOptParseValue(doc, translate_name(name), value.to_s) end
parse_string(doc, str)
click to toggle source
tidyParseString
# File lib/tidy/tidylib.rb, line 71 def parse_string(doc, str) tidyParseString(doc, str.to_s) end
release(doc)
click to toggle source
tidyRelease
# File lib/tidy/tidylib.rb, line 77 def release(doc) tidyRelease(doc) end
release_date()
click to toggle source
tidyReleaseDate
# File lib/tidy/tidylib.rb, line 83 def release_date tidyReleaseDate end
run_diagnostics(doc)
click to toggle source
tidyRunDiagnostics
# File lib/tidy/tidylib.rb, line 89 def run_diagnostics(doc) tidyRunDiagnostics(doc) end
save_buffer(doc, buf)
click to toggle source
tidySaveBuffer
# File lib/tidy/tidylib.rb, line 95 def save_buffer(doc, buf) tidySaveBuffer(doc, buf) end
set_error_buffer(doc, buf)
click to toggle source
tidySetErrorBuffer
# File lib/tidy/tidylib.rb, line 101 def set_error_buffer(doc, buf) tidySetErrorBuffer(doc, buf) end
translate_name(name)
click to toggle source
Convert to string, replace underscores with dashes (:output_xml => 'output-xml').
# File lib/tidy/tidylib.rb, line 107 def translate_name(name) name.to_s.gsub('_', '-') end