Skip to content
Browse files

Custom CSS support (experimental)

git-svn-id: http://readown.googlecode.com/svn/trunk@11 6adf6fe4-e8f3-11dd-9059-71fac19e68c6
  • Loading branch information...
1 parent 222de50 commit 97cc459e3f5bff938ef958c8142fc735b89465df suminb@gmail.com committed Jul 18, 2010
View
35 English.lproj/MarkdownDocument.nib/designable.nib
@@ -2,18 +2,18 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10D573</string>
+ <string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">789</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">789</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="21"/>
- <integer value="82"/>
+ <integer value="57"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -759,6 +759,14 @@
</object>
<int key="connectionID">107</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">close:</string>
+ <reference key="source" ref="550510351"/>
+ <reference key="destination" ref="813691012"/>
+ </object>
+ <int key="connectionID">108</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1401,7 +1409,7 @@
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
- <string>{{337, 776}, {364, 20}}</string>
+ <string>{{2328, 243}, {364, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1460,7 +1468,7 @@
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
- <string>{{433, 653}, {180, 123}}</string>
+ <string>{{2424, 120}, {180, 123}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1479,7 +1487,7 @@
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
- <string>{{613, 733}, {143, 23}}</string>
+ <string>{{2659, 170}, {143, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1560,7 +1568,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">107</int>
+ <int key="maxID">108</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1803,6 +1811,14 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">NSDrawer</string>
+ <string key="superclassName">NSResponder</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier" id="452411388">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">NSFormatter</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -2209,10 +2225,7 @@
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBFrameworkSource</string>
- <string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string>
- </object>
+ <reference key="sourceIdentifier" ref="452411388"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
View
BIN English.lproj/MarkdownDocument.nib/keyedobjects.nib
Binary file not shown.
View
20 MarkdownDocument.m
@@ -97,7 +97,7 @@ - (id)init
// Add your subclass-specific initialization here.
// If an error occurs here, send a [self release] message and return nil.
-
+
}
return self;
}
@@ -145,9 +145,23 @@ - (void)awakeFromNib
- (void)loadFromBaseURL {
text = [NSString stringWithContentsOfURL:baseURL encoding:NSUTF8StringEncoding error:nil];
- NSString *html = [NSString stringWithFormat:@"<html><body>%@</body></html>", [text stringWithMarkdownAndSmartyPants]];
+ NSString *html = nil;
+
+ NSString *filename = [[baseURL path] stringByDeletingPathExtension];
- //NSLog(@"%@", html);
+ // look for CSS file that has the same file name
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSString *cssPath = [filename stringByAppendingString:@".css"];
+ if([fileManager fileExistsAtPath:cssPath]) {
+ // TODO: need exception handlings
+ NSString *css = [NSString stringWithContentsOfFile:cssPath];
+
+ // TODO:
+ html = [NSString stringWithFormat:@"<html><head><style>%@</style></head><body>%@</body></html>", css, [text stringWithMarkdownAndSmartyPants]];
+ }
+ else {
+ html = [NSString stringWithFormat:@"<html><body>%@</body></html>", [text stringWithMarkdownAndSmartyPants]];
+ }
[[webView mainFrame] loadHTMLString:html baseURL:baseURL];
}

0 comments on commit 97cc459

Please sign in to comment.
Something went wrong with that request. Please try again.