Permalink
Browse files

Merge branch 'release/1.7'

  • Loading branch information...
2 parents 8986390 + 3d34954 commit 5346b81a51f85ff0135feb36d8c6ca174a10dd8a @rentzsch committed Jul 20, 2011
View
@@ -44,9 +44,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.6</string>
+ <string>1.7</string>
<key>CFBundleShortVersionString</key>
- <string>1.6</string>
+ <string>1.7</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
View
@@ -1,6 +1,6 @@
/*******************************************************************************
MyDocument.h - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
View
@@ -1,6 +1,6 @@
/*******************************************************************************
MyDocument.m - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -88,6 +88,36 @@ - (BOOL)writeToURL:(NSURL*)absoluteURL_ ofType:(NSString*)typeName_ error:(NSErr
error:error_];
}
+ if (result && ![self hasUnautosavedChanges]) {
+ NSURL *markdownFileURL = [self fileURL];
+ NSURL *htmlFileURL = [[markdownFileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"html"];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:[htmlFileURL path]]) {
+ NSXMLDocument *doc = [[[NSXMLDocument alloc] initWithContentsOfURL:htmlFileURL
+ options:NSXMLNodePreserveAll|NSXMLDocumentTidyXML
+ error:nil] autorelease];
+ if (doc) {
+ NSArray *nodes = [doc nodesForXPath:@"//*[@id=\"markdownlive\"]" error:nil];
+ if ([nodes count] == 1) {
+ NSXMLElement *node = [nodes objectAtIndex:0];
+ NSXMLDocument *markdownDoc = [[[NSXMLDocument alloc] initWithXMLString:[ORCDiscount markdown2HTML:[markdownSource string]]
+ options:NSXMLDocumentTidyHTML
+ error:nil] autorelease];
+ NSArray *markdownNodes = [markdownDoc nodesForXPath:@"/html/body/*" error:nil];
+ [markdownNodes makeObjectsPerformSelector:@selector(detach)];
+ [node setChildren:markdownNodes];
+ NSString *htmlFileContent = [doc XMLStringWithOptions:NSXMLNodePrettyPrint];
+ if ([htmlFileContent hasPrefix:@"<?xml"]) {
+ NSUInteger index = [htmlFileContent rangeOfString:@"\n"].location;
+ htmlFileContent = [htmlFileContent substringFromIndex:index+1];
+ }
+ [htmlFileContent writeToURL:htmlFileURL
+ atomically:YES
+ encoding:NSUTF8StringEncoding
+ error:nil];
+ }
+ }
+ }
+ }
return result;
}
@@ -1,6 +1,6 @@
/*******************************************************************************
discountWrapper.h - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -1,6 +1,6 @@
/*******************************************************************************
discountWrapper.m - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -1,6 +1,6 @@
/*******************************************************************************
markdownWrapper.c - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -1,6 +1,6 @@
/*******************************************************************************
markdownWrapper.h - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -1,6 +1,6 @@
/*******************************************************************************
mkdioWrapper.c - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
@@ -1,6 +1,6 @@
/*******************************************************************************
mkdioWrapper.h - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
View
2 main.m
@@ -1,6 +1,6 @@
/*******************************************************************************
main.m - <http://github.com/rentzsch/MarkdownLive>
- Copyright (c) 2006-2010 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
+ Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/

0 comments on commit 5346b81

Please sign in to comment.