Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 33 additions and 2 deletions.
  1. +2 −2 CTidy/AppDelegate.m
  2. +31 −0 README.md
View
4 CTidy/AppDelegate.m
@@ -25,8 +25,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
NSString* html = @"<html><body><br><br><p>Hello</p></body></html>";
NSString* xhtml = [[CTidy tidy] tidyString:html
- inputFormat:TidyFormat_HTML
- outputFormat:TidyFormat_XHTML
+ inputFormat:CTidyFormatHTML
+ outputFormat:CTidyFormatXHTML
encoding:@"UTF8"
diagnostics:&diag
error:&error];
View
31 README.md
@@ -2,6 +2,37 @@
Standalone CTidy library extracted from [TouchXML](https://github.com/TouchCode/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:
+
+````html
+<!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>
+````
+
## Credit
Based on [TouchXML](https://github.com/TouchCode/TouchXML)

No commit comments for this range

Something went wrong with that request. Please try again.