libtidy Objective-C wrapper
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1e8aa6e Jul 20, 2012
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CTidy.xcodeproj update project to specify target 5.0 Jun 21, 2012
CTidy
libtidy rename the API in tidy library and hope we can pass review Jun 21, 2012
motion/lib update gem to use latest pod version, that included patched libtidy Jul 20, 2012
CTidy.podspec update Podspec to latest version Jul 20, 2012
Gemfile add gem motion-tidy May 22, 2012
Gemfile.lock update project to specify target 5.0 Jun 21, 2012
LICENSE add license Jul 20, 2012
README.md
Rakefile
motion-tidy.gemspec update to latest motion-cocoapods Jul 18, 2012
motion-tidy.rb

README.md

CTidy

Standalone CTidy library extracted from TouchXML

Usage

Convert HTML data to valid XHTML:

NSString* html = @"<html><body><br><br><p>Hello</p></body></html>";
NSString* xhtml = [[CTidy tidy] tidyHTMLString:html
                                      encoding:@"UTF8"
                                         error:&error];
NSLog(@"%@", xhtml);

Output:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.4), see www.w3.org" />
<title></title>
</head>
<body>
<br />
<br />
<p>Hello</p>
</body>
</html>

RubyMotion

To use CTidy in RubyMotion, install following gem:

gem install motion-tidy

Add following to your Rakefile:

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
require 'motion-cocoapods'
require 'motion-tidy'

Motion::Project::App.setup do |app|
  app.name = 'sample' 

  # Only needed if you have not already specifying a pods dependency
  app.pods do
    pod 'CTidy', '>= 0.2.0'
  end
end

Credit

Based on TouchXML

License

This code is licensed under the 2-clause BSD license ("Simplified BSD License" or "FreeBSD License") license.