6 Commits

Author SHA1 Message Date
rentzsch 518fdfe2e6 Merge pull request #10 from vojto/markdownlive
---

Things you should know:

1. Im not using your subclasses of NSTextView/NSLayoutManager/etc. Felt like whatever it did wasnt too important. Sorry, didnt want to spend too much time integrating.

2. It highlight the whole thing whenever you press a key. Didnt try it with large documents and I would expect problems. Maybe better solution would be to highlight only current line, visible range, etc.

3. Markdown syntax is incomplete, but can be easily configured from the plist. 

Thanks!
2011-09-02 19:13:48 -05:00
Vojto Rinik be6c76831a Adding link to Lion build 2011-09-02 19:38:02 -04:00
Vojto Rinik e24a91fa08 Adding 'about fork' section 2011-09-02 19:34:40 -04:00
Vojto Rinik 1dae696cb7 adding screenshot 2011-09-02 19:24:24 -04:00
Vojto Rinik 5d5dfe5da6 Using RKSyntaxView for syntax highlighting 2011-09-02 19:20:49 -04:00
rentzsch 21f4bf11ae Merge branch 'hotfix/1.7.1' into develop 2011-07-21 21:06:54 -05:00
86 changed files with 2028 additions and 2850 deletions
+8 -17
View File
@@ -1,18 +1,9 @@
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
## Ignore incredibly annoying .DS_Store files
.DS_Store
/build/
/*.xcodeproj/*.mode1v3
/*.xcodeproj/*.mode2v3
/*.xcodeproj/*.pbxuser
/*.xcodeproj/xcuserdata/*
/*.xcodeproj/*.perspectivev3
/*.xcodeproj/project.xcworkspace/*
*~.nib
+1 -1
View File
@@ -13,7 +13,7 @@
NSFont *font;
}
@property (nonatomic, strong) NSFont *font;
@property (nonatomic, retain) NSFont *font;
- (CGFloat)lineHeight;
+5
View File
@@ -18,11 +18,16 @@
if ((self = [super init])) {
EditPaneTypesetter *typeSetter = [[EditPaneTypesetter alloc] init];
[self setTypesetter:typeSetter];
[typeSetter release];
[self setUsesFontLeading:NO];
}
return self;
}
- (void)dealloc {
self.font = nil;
[super dealloc];
}
- (CGFloat)lineHeight {
return floor([self defaultLineHeightForFont:font] + 1.5);
+2 -3
View File
@@ -7,13 +7,12 @@
//
#import <Foundation/Foundation.h>
extern NSString * const kEditPaneTextViewChangedNotification;
#define kEditPaneTextViewChangedNotification @"EditPaneTextViewChangedNotification"
@class EditPaneLayoutManager;
@interface EditPaneTextView : NSTextView {
__weak EditPaneLayoutManager *layoutMan;
EditPaneLayoutManager *layoutMan;
}
- (void)updateColors;
+13 -28
View File
@@ -11,8 +11,6 @@
#import "PreferencesManager.h"
#import "PreferencesController.h"
NSString * const kEditPaneTextViewChangedNotification = @"EditPaneTextViewChangedNotification";
NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNotification";
@implementation EditPaneTextView
@@ -27,49 +25,36 @@ NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNot
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneForegroundColor]
options:0
context:(__bridge void *)kEditPaneColorChangedNotification];
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
options:0
context:(__bridge void *)kEditPaneColorChangedNotification];
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
options:0
context:(__bridge void *)kEditPaneColorChangedNotification];
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
options:0
context:(__bridge void *)kEditPaneColorChangedNotification];
context:@"ColorChange"];
[self setUsesFontPanel:NO];
NSTextContainer *textContainer = [[NSTextContainer alloc] init];
[textContainer setContainerSize:[[self textContainer] containerSize]];
[textContainer setWidthTracksTextView:YES];
layoutMan = [[EditPaneLayoutManager alloc] init];
[self replaceTextContainer:textContainer];
EditPaneLayoutManager *lManager = [[EditPaneLayoutManager alloc] init];
[textContainer replaceLayoutManager:lManager];
layoutMan = lManager;
[textContainer replaceLayoutManager:layoutMan];
[textContainer release];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[defaultsController removeObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneForegroundColor]
context:(__bridge void *)kEditPaneColorChangedNotification];
[defaultsController removeObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
context:(__bridge void *)kEditPaneColorChangedNotification];
[defaultsController removeObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
context:(__bridge void *)kEditPaneColorChangedNotification];
[defaultsController removeObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
context:(__bridge void *)kEditPaneColorChangedNotification];
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self];
[layoutMan release];
[super dealloc];
}
- (void)keyDown:(NSEvent *)aEvent {
@@ -82,7 +67,7 @@ NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNot
selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange {
id resultString;
if ([aString isKindOfClass:[NSAttributedString class]]) {
resultString = [aString mutableCopy];
resultString = [[aString mutableCopy] autorelease];
selectedRange = NSMakeRange(0, [resultString length]);
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName,
@@ -119,8 +104,8 @@ NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNot
#pragma unused(keyPath)
#pragma unused(object)
#pragma unused(change)
if ([(__bridge NSString *)context isEqualToString:kEditPaneColorChangedNotification]) {
if ([(NSString *)context isEqualToString:@"ColorChange"]) {
[self updateColors];
}
}
+207 -298
View File
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<string key="IBDocument.SystemVersion">10J4138</string>
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
<string key="IBDocument.AppKitVersion">1038.35</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">1617</string>
<string key="NS.object.0">1306</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -722,39 +722,6 @@
</object>
</object>
</object>
<object class="NSMenuItem" id="81456092">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">Format</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="1033313550"/>
<reference key="NSMixedImage" ref="310636482"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="374611422">
<string key="NSTitle">Format</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="144703386">
<reference key="NSMenu" ref="374611422"/>
<string key="NSTitle">Bold</string>
<string key="NSKeyEquiv">b</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="1033313550"/>
<reference key="NSMixedImage" ref="310636482"/>
</object>
<object class="NSMenuItem" id="535290006">
<reference key="NSMenu" ref="374611422"/>
<string key="NSTitle">Italic</string>
<string key="NSKeyEquiv">i</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="1033313550"/>
<reference key="NSMixedImage" ref="310636482"/>
</object>
</object>
</object>
</object>
<object class="NSMenuItem" id="713487014">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">Window</string>
@@ -849,9 +816,8 @@
<string key="NSWindowTitle">Preferences</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="755094886">
<nil key="NSNextResponder"/>
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -862,7 +828,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSView" id="54308797">
<reference key="NSNextResponder" ref="396535826"/>
<int key="NSvFlags">274</int>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTextField" id="943641235">
@@ -1107,6 +1073,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{381, 6}, {90, 32}}</string>
<reference key="NSSuperview" ref="54308797"/>
<reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="185535899">
<int key="NSCellFlags">67239424</int>
@@ -1155,12 +1122,12 @@
</object>
</object>
<string key="NSFrame">{{7, 11}, {519, 222}}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="396535826"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1440}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
<string key="NSFrameAutosaveName">PreferencesPanel</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSUserDefaultsController" id="36957087">
<bool key="NSSharedInstance">YES</bool>
@@ -1168,32 +1135,6 @@
<object class="NSCustomObject" id="682236088">
<string key="NSClassName">PreferencesController</string>
</object>
<object class="NSCustomObject" id="643165181">
<string key="NSClassName">MLAppDelegate</string>
</object>
<object class="NSMenuItem" id="107959551">
<string key="NSTitle">View</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="1033313550"/>
<reference key="NSMixedImage" ref="310636482"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="889830452">
<string key="NSTitle">View</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="1023261756">
<reference key="NSMenu" ref="889830452"/>
<string key="NSTitle">Enter Full Screen</string>
<string key="NSKeyEquiv">f</string>
<int key="NSKeyEquivModMask">1310720</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="1033313550"/>
<reference key="NSMixedImage" ref="310636482"/>
</object>
</object>
</object>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -1702,46 +1643,6 @@
</object>
<int key="connectionID">586</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleFullScreen:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="1023261756"/>
</object>
<int key="connectionID">592</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">viewMenu</string>
<reference key="source" ref="643165181"/>
<reference key="destination" ref="107959551"/>
</object>
<int key="connectionID">594</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="643165181"/>
</object>
<int key="connectionID">595</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">bold:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="144703386"/>
</object>
<int key="connectionID">601</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">italic:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="535290006"/>
</object>
<int key="connectionID">602</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1780,7 +1681,6 @@
<reference ref="952259628"/>
<reference ref="379814623"/>
<reference ref="1050483726"/>
<reference ref="81456092"/>
</object>
<reference key="parent" ref="0"/>
</object>
@@ -2531,63 +2431,6 @@
<reference key="object" ref="185535899"/>
<reference key="parent" ref="158581621"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">593</int>
<reference key="object" ref="643165181"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">587</int>
<reference key="object" ref="107959551"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="889830452"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">588</int>
<reference key="object" ref="889830452"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1023261756"/>
</object>
<reference key="parent" ref="107959551"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">589</int>
<reference key="object" ref="1023261756"/>
<reference key="parent" ref="889830452"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">596</int>
<reference key="object" ref="81456092"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="374611422"/>
</object>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">597</int>
<reference key="object" ref="374611422"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="144703386"/>
<reference ref="535290006"/>
</object>
<reference key="parent" ref="81456092"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">598</int>
<reference key="object" ref="144703386"/>
<reference key="parent" ref="374611422"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">599</int>
<reference key="object" ref="535290006"/>
<reference key="parent" ref="374611422"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2598,60 +2441,131 @@
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>112.IBPluginDependency</string>
<string>112.ImportedFromIB2</string>
<string>124.IBPluginDependency</string>
<string>124.ImportedFromIB2</string>
<string>125.IBPluginDependency</string>
<string>125.ImportedFromIB2</string>
<string>125.editorWindowContentRectSynchronizationRect</string>
<string>126.IBPluginDependency</string>
<string>126.ImportedFromIB2</string>
<string>129.IBPluginDependency</string>
<string>129.ImportedFromIB2</string>
<string>130.IBPluginDependency</string>
<string>130.ImportedFromIB2</string>
<string>130.editorWindowContentRectSynchronizationRect</string>
<string>131.IBPluginDependency</string>
<string>131.ImportedFromIB2</string>
<string>134.IBPluginDependency</string>
<string>134.ImportedFromIB2</string>
<string>136.IBPluginDependency</string>
<string>136.ImportedFromIB2</string>
<string>143.IBPluginDependency</string>
<string>143.ImportedFromIB2</string>
<string>144.IBPluginDependency</string>
<string>144.ImportedFromIB2</string>
<string>145.IBPluginDependency</string>
<string>145.ImportedFromIB2</string>
<string>149.IBPluginDependency</string>
<string>149.ImportedFromIB2</string>
<string>150.IBPluginDependency</string>
<string>150.ImportedFromIB2</string>
<string>19.IBPluginDependency</string>
<string>19.ImportedFromIB2</string>
<string>195.IBPluginDependency</string>
<string>195.ImportedFromIB2</string>
<string>196.IBPluginDependency</string>
<string>196.ImportedFromIB2</string>
<string>197.IBPluginDependency</string>
<string>197.ImportedFromIB2</string>
<string>198.IBPluginDependency</string>
<string>198.ImportedFromIB2</string>
<string>199.IBPluginDependency</string>
<string>199.ImportedFromIB2</string>
<string>200.IBEditorWindowLastContentRect</string>
<string>200.IBPluginDependency</string>
<string>200.ImportedFromIB2</string>
<string>200.editorWindowContentRectSynchronizationRect</string>
<string>201.IBPluginDependency</string>
<string>201.ImportedFromIB2</string>
<string>202.IBPluginDependency</string>
<string>202.ImportedFromIB2</string>
<string>203.IBPluginDependency</string>
<string>203.ImportedFromIB2</string>
<string>204.IBPluginDependency</string>
<string>204.ImportedFromIB2</string>
<string>205.IBEditorWindowLastContentRect</string>
<string>205.IBPluginDependency</string>
<string>205.ImportedFromIB2</string>
<string>205.editorWindowContentRectSynchronizationRect</string>
<string>206.IBPluginDependency</string>
<string>206.ImportedFromIB2</string>
<string>207.IBPluginDependency</string>
<string>207.ImportedFromIB2</string>
<string>208.IBPluginDependency</string>
<string>208.ImportedFromIB2</string>
<string>209.IBPluginDependency</string>
<string>209.ImportedFromIB2</string>
<string>210.IBPluginDependency</string>
<string>210.ImportedFromIB2</string>
<string>211.IBPluginDependency</string>
<string>211.ImportedFromIB2</string>
<string>212.IBEditorWindowLastContentRect</string>
<string>212.IBPluginDependency</string>
<string>212.ImportedFromIB2</string>
<string>212.editorWindowContentRectSynchronizationRect</string>
<string>213.IBPluginDependency</string>
<string>213.ImportedFromIB2</string>
<string>214.IBPluginDependency</string>
<string>214.ImportedFromIB2</string>
<string>215.IBPluginDependency</string>
<string>215.ImportedFromIB2</string>
<string>216.IBPluginDependency</string>
<string>216.ImportedFromIB2</string>
<string>217.IBPluginDependency</string>
<string>217.ImportedFromIB2</string>
<string>218.IBPluginDependency</string>
<string>218.ImportedFromIB2</string>
<string>219.IBPluginDependency</string>
<string>219.ImportedFromIB2</string>
<string>220.IBEditorWindowLastContentRect</string>
<string>220.IBPluginDependency</string>
<string>220.ImportedFromIB2</string>
<string>220.editorWindowContentRectSynchronizationRect</string>
<string>221.IBPluginDependency</string>
<string>221.ImportedFromIB2</string>
<string>23.IBPluginDependency</string>
<string>23.ImportedFromIB2</string>
<string>236.IBPluginDependency</string>
<string>236.ImportedFromIB2</string>
<string>239.IBPluginDependency</string>
<string>239.ImportedFromIB2</string>
<string>24.IBEditorWindowLastContentRect</string>
<string>24.IBPluginDependency</string>
<string>24.ImportedFromIB2</string>
<string>24.editorWindowContentRectSynchronizationRect</string>
<string>29.IBEditorWindowLastContentRect</string>
<string>29.IBPluginDependency</string>
<string>29.ImportedFromIB2</string>
<string>29.WindowOrigin</string>
<string>29.editorWindowContentRectSynchronizationRect</string>
<string>346.IBPluginDependency</string>
<string>346.ImportedFromIB2</string>
<string>348.IBPluginDependency</string>
<string>348.ImportedFromIB2</string>
<string>349.IBEditorWindowLastContentRect</string>
<string>349.IBPluginDependency</string>
<string>349.ImportedFromIB2</string>
<string>349.editorWindowContentRectSynchronizationRect</string>
<string>350.IBPluginDependency</string>
<string>350.ImportedFromIB2</string>
<string>351.IBPluginDependency</string>
<string>351.ImportedFromIB2</string>
<string>354.IBPluginDependency</string>
<string>354.ImportedFromIB2</string>
<string>419.IBPluginDependency</string>
<string>449.IBPluginDependency</string>
<string>450.IBEditorWindowLastContentRect</string>
<string>450.IBPluginDependency</string>
<string>451.IBPluginDependency</string>
<string>452.IBPluginDependency</string>
@@ -2663,10 +2577,13 @@
<string>464.IBPluginDependency</string>
<string>465.IBPluginDependency</string>
<string>491.IBPluginDependency</string>
<string>492.IBEditorWindowLastContentRect</string>
<string>492.IBPluginDependency</string>
<string>493.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>5.ImportedFromIB2</string>
<string>530.IBPluginDependency</string>
<string>530.ImportedFromIB2</string>
<string>532.IBPluginDependency</string>
<string>532.NSWindowTemplate.visibleAtLaunch</string>
<string>533.IBPluginDependency</string>
@@ -2685,7 +2602,11 @@
<string>558.IBPluginDependency</string>
<string>559.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
<string>57.IBPluginDependency</string>
<string>57.ImportedFromIB2</string>
<string>57.editorWindowContentRectSynchronizationRect</string>
<string>573.IBPluginDependency</string>
<string>574.IBPluginDependency</string>
<string>575.IBPluginDependency</string>
@@ -2693,29 +2614,36 @@
<string>578.IBPluginDependency</string>
<string>579.IBPluginDependency</string>
<string>58.IBPluginDependency</string>
<string>58.ImportedFromIB2</string>
<string>583.IBPluginDependency</string>
<string>584.IBPluginDependency</string>
<string>585.IBPluginDependency</string>
<string>587.IBPluginDependency</string>
<string>588.IBPluginDependency</string>
<string>589.IBPluginDependency</string>
<string>593.IBPluginDependency</string>
<string>596.IBPluginDependency</string>
<string>597.IBPluginDependency</string>
<string>598.IBPluginDependency</string>
<string>599.IBPluginDependency</string>
<string>72.IBPluginDependency</string>
<string>72.ImportedFromIB2</string>
<string>73.IBPluginDependency</string>
<string>73.ImportedFromIB2</string>
<string>74.IBPluginDependency</string>
<string>74.ImportedFromIB2</string>
<string>75.IBPluginDependency</string>
<string>75.ImportedFromIB2</string>
<string>77.IBPluginDependency</string>
<string>77.ImportedFromIB2</string>
<string>78.IBPluginDependency</string>
<string>78.ImportedFromIB2</string>
<string>79.IBPluginDependency</string>
<string>79.ImportedFromIB2</string>
<string>80.IBPluginDependency</string>
<string>80.ImportedFromIB2</string>
<string>81.IBEditorWindowLastContentRect</string>
<string>81.IBPluginDependency</string>
<string>81.ImportedFromIB2</string>
<string>81.editorWindowContentRectSynchronizationRect</string>
<string>82.IBPluginDependency</string>
<string>82.ImportedFromIB2</string>
<string>83.IBPluginDependency</string>
<string>83.ImportedFromIB2</string>
<string>92.IBPluginDependency</string>
<string>92.ImportedFromIB2</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2723,60 +2651,131 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{522, 812}, {146, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{436, 809}, {64, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{656, 201}, {275, 113}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {275, 83}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{581, 83}, {255, 303}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{197, 734}, {243, 243}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{656, 211}, {164, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {167, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{642, 251}, {238, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {241, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{784, 313}, {194, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{525, 802}, {197, 73}}</string>
<string>{{404, 386}, {469, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
<string>{{11, 977}, {478, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{642, 181}, {220, 133}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {215, 63}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{786, 257}, {170, 63}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2788,10 +2787,13 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{855, 363}, {246, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2810,6 +2812,11 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{416, 203}, {275, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{23, 794}, {245, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2817,30 +2824,36 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{582, 183}, {196, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{155, 774}, {199, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -2855,19 +2868,11 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">602</int>
<int key="maxID">586</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">EditPaneTextView</string>
<string key="superclassName">NSTextView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/EditPaneTextView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<object class="NSMutableDictionary" key="actions">
@@ -2886,114 +2891,18 @@
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MLAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">viewMenu</string>
<string key="NS.object.0">NSMenuItem</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">viewMenu</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">viewMenu</string>
<string key="candidateClassName">NSMenuItem</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MLAppDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">MyDocument</string>
<string key="superclassName">NSDocument</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>blockQuote:</string>
<string>bold:</string>
<string>boldItalic:</string>
<string>copyGeneratedHTMLAction:</string>
<string>header1:</string>
<string>header2:</string>
<string>header3:</string>
<string>italic:</string>
<string>numberedList:</string>
<string>unorderedList:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
<string key="NS.key.0">copyGeneratedHTMLAction:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>blockQuote:</string>
<string>bold:</string>
<string>boldItalic:</string>
<string>copyGeneratedHTMLAction:</string>
<string>header1:</string>
<string>header2:</string>
<string>header3:</string>
<string>italic:</string>
<string>numberedList:</string>
<string>unorderedList:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">blockQuote:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">bold:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">boldItalic:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">copyGeneratedHTMLAction:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">header1:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">header2:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">header3:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">italic:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">numberedList:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">unorderedList:</string>
<string key="candidateClassName">id</string>
</object>
<string key="NS.key.0">copyGeneratedHTMLAction:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">copyGeneratedHTMLAction:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -3006,7 +2915,7 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>WebView</string>
<string>EditPaneTextView</string>
<string>NSTextView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -3024,7 +2933,7 @@
</object>
<object class="IBToOneOutletInfo">
<string key="name">markdownSourceTextView</string>
<string key="candidateClassName">EditPaneTextView</string>
<string key="candidateClassName">NSTextView</string>
</object>
</object>
</object>
+706 -279
View File
@@ -1,279 +1,706 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7528.3" systemVersion="14C1514" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7528.3"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="7528.3"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MyDocument">
<connections>
<outlet property="htmlPreviewWebView" destination="yvR-jY-pgQ" id="rjt-Mv-nRW"/>
<outlet property="markdownSourceTextView" destination="aj1-He-Kr3" id="bqD-ZO-gOO"/>
<outlet property="window" destination="QvC-M9-y7g" id="Anx-om-x6K"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="860" height="600"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="860" height="600"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<splitView dividerStyle="paneSplitter" vertical="YES" id="Zgp-iU-hNM">
<rect key="frame" x="0.0" y="0.0" width="860" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="fLN-II-lzn">
<rect key="frame" x="0.0" y="0.0" width="427" height="600"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="h82-Zg-cXh">
<rect key="frame" x="0.0" y="0.0" width="427" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView drawsBackground="NO" importsGraphics="NO" richText="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="aj1-He-Kr3" customClass="EditPaneTextView">
<rect key="frame" x="0.0" y="0.0" width="439" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="427" height="600"/>
<size key="maxSize" width="1240" height="10000000"/>
<color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="427" height="600"/>
<size key="maxSize" width="1240" height="10000000"/>
<connections>
<outlet property="delegate" destination="-2" id="Zxy-cw-5wC"/>
</connections>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="Swy-cM-Mg1">
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="7oj-GM-IDc">
<rect key="frame" x="284" y="1" width="15" height="198"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<webView id="yvR-jY-pgQ">
<rect key="frame" x="437" y="0.0" width="423" height="600"/>
<autoresizingMask key="autoresizingMask"/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" plugInsEnabled="NO" javaEnabled="NO" javaScriptEnabled="NO" javaScriptCanOpenWindowsAutomatically="NO"/>
<connections>
<outlet property="frameLoadDelegate" destination="-2" id="8ng-oJ-umk"/>
<outlet property="policyDelegate" destination="-2" id="Czz-Iv-moD"/>
</connections>
</webView>
</subviews>
<holdingPriorities>
<real value="250"/>
<real value="250"/>
</holdingPriorities>
</splitView>
</subviews>
</view>
<toolbar key="toolbar" implicitIdentifier="63AAD0C3-12A4-439A-B70A-F7C16C0A3236" explicitIdentifier="DocumentToolbar" displayMode="iconOnly" sizeMode="regular" id="hDJ-tF-e1W" userLabel="Toolbar">
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="17DF6AEF-78A0-41C5-9B33-BF45916A17A9" label="Bold" paletteLabel="Bold" toolTip="Bold" id="xpq-CN-6eJ">
<size key="minSize" width="25" height="25"/>
<size key="maxSize" width="25" height="25"/>
<button key="view" verticalHuggingPriority="750" id="UE7-XI-J11">
<rect key="frame" x="3" y="14" width="25" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="B" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yG3-iK-GYh">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="14" name="Times-Bold"/>
</buttonCell>
<connections>
<action selector="bold:" target="-2" id="ntB-EF-pTf"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="E999AFFB-BBB5-44C1-85E2-A2D755AD92AD" label="Italic" paletteLabel="Italic" toolTip="Italic" id="azJ-dN-SnV">
<size key="minSize" width="25" height="25"/>
<size key="maxSize" width="25" height="25"/>
<button key="view" verticalHuggingPriority="750" id="Gvd-vx-2OU">
<rect key="frame" x="4" y="14" width="25" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="I" bezelStyle="texturedRounded" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3qG-as-Fik">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="14" name="Times-Italic"/>
</buttonCell>
<connections>
<action selector="italic:" target="-2" id="PDv-sx-QpZ"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="13F92DD8-B2DF-41F2-8F1A-9A0AC987F639" label="Header 1" paletteLabel="Header 1" toolTip="Header Level 1" id="nTE-GW-Bdl">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="Q0E-bB-grY">
<rect key="frame" x="15" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="h1" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mMl-6X-vEh">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="Times-Bold"/>
</buttonCell>
<connections>
<action selector="header1:" target="-2" id="kvb-9m-ZKO"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="E48952C9-A345-48AE-8843-1944645ECB98" label="Header 2" paletteLabel="Header 2" toolTip="Header Level 2" id="uIL-iC-VUu">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="yL4-KI-hfn">
<rect key="frame" x="15" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="h2" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ofa-tL-PBL">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="Times-Bold"/>
</buttonCell>
<connections>
<action selector="header2:" target="-2" id="dzB-41-n2D"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="202619C3-7340-41BE-8FF0-4FAEF94A4277" label="Header 3" paletteLabel="Header 3" toolTip="Header Level 3" id="hZU-9o-jIz">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="b41-H5-glK">
<rect key="frame" x="15" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="h3" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="KIr-PW-vxK">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="Times-Bold"/>
</buttonCell>
<connections>
<action selector="header3:" target="-2" id="OS5-xw-tdc"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="2867E869-BEA4-48C0-813F-3580FED1AED7" label="Block Quote" paletteLabel="Block Quote" toolTip="Block Quote" image="Quote Template" id="3kj-qj-maG">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="nfg-4m-quf">
<rect key="frame" x="23" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Quote Template" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="PFc-nn-6yg">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="blockQuote:" target="-2" id="EPY-m5-g7m"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="51A0DA9C-15A1-4394-8CA4-678AA234CD4B" label="Code" paletteLabel="Code" toolTip="Code Section" id="rhk-qI-8t6">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="z7Q-Q3-hjc">
<rect key="frame" x="4" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" title="C" bezelStyle="texturedRounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="CMU-mU-D9N">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="14" name="Courier"/>
</buttonCell>
<connections>
<action selector="codeSection:" target="-2" id="Jg8-ng-PTZ"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="7294EEE5-5683-474F-BDF0-DDE6D9CB9160" label="Unordered List" paletteLabel="Unordered List" toolTip="Unordered List" image="Unordered List Template" id="7me-vS-Z2c">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="3Ld-Kb-CD4">
<rect key="frame" x="30" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Unordered List Template" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3Ug-Xm-NCy">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="unorderedList:" target="-2" id="3E1-wL-5hN"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="13B7EF99-D81B-4536-B173-F8D7BFF3FF64" label="Ordered List" paletteLabel="Ordered List" toolTip="Ordered List" image="Ordered List Template" id="q8c-Ow-Xe0">
<size key="minSize" width="27" height="25"/>
<size key="maxSize" width="27" height="25"/>
<button key="view" verticalHuggingPriority="750" id="con-sz-ClF">
<rect key="frame" x="23" y="14" width="27" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Ordered List Template" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="blT-Ua-z8y">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="numberedList:" target="-2" id="ytr-da-nbv"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="835DEA41-6DE9-4847-85FB-29E0DC9D82BA" label="Link" paletteLabel="Link" toolTip="Link" image="Link Template" id="yh1-XY-Qxz">
<size key="minSize" width="34" height="25"/>
<size key="maxSize" width="34" height="25"/>
<button key="view" verticalHuggingPriority="750" id="1WN-Kl-Qpg">
<rect key="frame" x="0.0" y="14" width="34" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Link Template" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3Wd-W6-BRg">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="link:" target="-2" id="jz3-To-jdg"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="66678FE0-D8E2-4F0D-BC42-E39D854989D9" label="Image" paletteLabel="Image" toolTip="Image" image="Image Template" id="985-sv-Ud0">
<size key="minSize" width="34" height="25"/>
<size key="maxSize" width="34" height="25"/>
<button key="view" verticalHuggingPriority="750" id="7Y5-e1-5rz">
<rect key="frame" x="3" y="14" width="34" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="Image Template" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Kf7-Jc-2sC">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="image:" target="-2" id="Z0r-YM-YyS"/>
</connections>
</button>
</toolbarItem>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="DiD-sW-Sfo"/>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="ayX-as-8Jf"/>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="xpq-CN-6eJ"/>
<toolbarItem reference="azJ-dN-SnV"/>
<toolbarItem reference="ayX-as-8Jf"/>
<toolbarItem reference="nTE-GW-Bdl"/>
<toolbarItem reference="uIL-iC-VUu"/>
<toolbarItem reference="hZU-9o-jIz"/>
<toolbarItem reference="3kj-qj-maG"/>
<toolbarItem reference="rhk-qI-8t6"/>
<toolbarItem reference="ayX-as-8Jf"/>
<toolbarItem reference="7me-vS-Z2c"/>
<toolbarItem reference="q8c-Ow-Xe0"/>
<toolbarItem reference="ayX-as-8Jf"/>
<toolbarItem reference="yh1-XY-Qxz"/>
<toolbarItem reference="985-sv-Ud0"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="delegate" destination="-2" id="Zcc-dh-Gqy"/>
</connections>
</window>
</objects>
<resources>
<image name="Image Template" width="15" height="12"/>
<image name="Link Template" width="14" height="14"/>
<image name="Ordered List Template" width="14" height="14"/>
<image name="Quote Template" width="14" height="14"/>
<image name="Unordered List Template" width="14" height="14"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>1617</string>
<string>518</string>
</object>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSView</string>
<string>NSSplitView</string>
<string>NSScrollView</string>
<string>NSWindowTemplate</string>
<string>WebView</string>
<string>NSTextView</string>
<string>NSScroller</string>
<string>NSCustomObject</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="512844837">
<string key="NSClassName">MyDocument</string>
</object>
<object class="NSCustomObject" id="613418571">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSWindowTemplate" id="275939982">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{148, 238}, {860, 600}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSViewClass">View</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{94, 86}</string>
<object class="NSView" key="NSWindowView" id="568628114">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSplitView" id="202269651">
<reference key="NSNextResponder" ref="568628114"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSScrollView" id="60428165">
<reference key="NSNextResponder" ref="202269651"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSClipView" id="934421653">
<reference key="NSNextResponder" ref="60428165"/>
<int key="NSvFlags">2304</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTextView" id="521201844">
<reference key="NSNextResponder" ref="934421653"/>
<int key="NSvFlags">2322</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple HTML pasteboard type</string>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple PNG pasteboard type</string>
<string>Apple URL pasteboard type</string>
<string>CorePasteboardFlavorType 0x6D6F6F76</string>
<string>NSColor pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NSStringPboardType</string>
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
<string>NeXT RTFD pasteboard type</string>
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
<string>NeXT font pasteboard type</string>
<string>NeXT ruler pasteboard type</string>
<string>WebURLsWithTitlesPboardType</string>
<string>public.url</string>
</object>
</object>
<string key="NSFrameSize">{439, 44}</string>
<reference key="NSSuperview" ref="934421653"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="106470570"/>
<object class="NSTextContainer" key="NSTextContainer" id="515139633">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
<object class="NSMutableString" key="NSString">
<characters key="NS.bytes"/>
</object>
<nil key="NSDelegate"/>
</object>
<object class="NSMutableArray" key="NSTextContainers">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="515139633"/>
</object>
<int key="NSLMFlags">134</int>
<nil key="NSDelegate"/>
</object>
<reference key="NSTextView" ref="521201844"/>
<double key="NSWidth">439</double>
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
<int key="NSFlags">67120867</int>
<int key="NSTextCheckingTypes">0</int>
<nil key="NSMarkedAttributes"/>
<object class="NSColor" key="NSBackgroundColor" id="144579518">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSDictionary" key="NSSelectedAttributes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSBackgroundColor</string>
<string>NSColor</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">selectedTextBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">selectedTextColor</string>
<object class="NSColor" key="NSColor" id="1000513654">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
<reference key="NSInsertionColor" ref="1000513654"/>
<object class="NSDictionary" key="NSLinkAttributes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSColor</string>
<string>NSCursor</string>
<string>NSUnderline</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDEAA</bytes>
</object>
<object class="NSCursor">
<string key="NSHotSpot">{8, -8}</string>
<int key="NSCursorType">13</int>
</object>
<integer value="1"/>
</object>
</object>
<nil key="NSDefaultParagraphStyle"/>
<nil key="NSTextFinder"/>
<int key="NSPreferredTextFinderStyle">1</int>
</object>
<int key="NSTVFlags">6</int>
<string key="NSMaxSize">{463, 10000000}</string>
<string key="NSMinize">{223, 44}</string>
<nil key="NSDelegate"/>
</object>
</object>
<string key="NSFrameSize">{439, 600}</string>
<reference key="NSSuperview" ref="60428165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="521201844"/>
<reference key="NSDocView" ref="521201844"/>
<reference key="NSBGColor" ref="144579518"/>
<object class="NSCursor" key="NSCursor">
<string key="NSHotSpot">{4, 5}</string>
<object class="NSImage" key="NSImage">
<int key="NSImageFlags">12582912</int>
<object class="NSMutableArray" key="NSReps">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym
SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA
AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA
AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA
AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
</object>
</object>
</object>
</object>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
</object>
</object>
<int key="NScvFlags">4</int>
</object>
<object class="NSScroller" id="106470570">
<reference key="NSNextResponder" ref="60428165"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{284, 1}, {15, 198}}</string>
<reference key="NSSuperview" ref="60428165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="583055138"/>
<reference key="NSTarget" ref="60428165"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
<double key="NSPercent">0.85256409645080566</double>
</object>
<object class="NSScroller" id="497745035">
<reference key="NSNextResponder" ref="60428165"/>
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
<reference key="NSSuperview" ref="60428165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="934421653"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="60428165"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
<double key="NSPercent">0.94565218687057495</double>
</object>
</object>
<string key="NSFrameSize">{439, 600}</string>
<reference key="NSSuperview" ref="202269651"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="497745035"/>
<int key="NSsFlags">133648</int>
<reference key="NSVScroller" ref="106470570"/>
<reference key="NSHScroller" ref="497745035"/>
<reference key="NSContentView" ref="934421653"/>
</object>
<object class="WebView" id="583055138">
<reference key="NSNextResponder" ref="202269651"/>
<int key="NSvFlags">256</int>
<object class="NSMutableSet" key="NSDragTypes">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="set.sortedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>Apple HTML pasteboard type</string>
<string>Apple PDF pasteboard type</string>
<string>Apple PICT pasteboard type</string>
<string>Apple URL pasteboard type</string>
<string>Apple Web Archive pasteboard type</string>
<string>NSColor pasteboard type</string>
<string>NSFilenamesPboardType</string>
<string>NSStringPboardType</string>
<string>NeXT RTFD pasteboard type</string>
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
<string>NeXT TIFF v4.0 pasteboard type</string>
<string>WebURLsWithTitlesPboardType</string>
<string>public.png</string>
<string>public.url</string>
<string>public.url-name</string>
</object>
</object>
<string key="NSFrame">{{449, 0}, {411, 600}}</string>
<reference key="NSSuperview" ref="202269651"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="FrameName"/>
<string key="GroupName"/>
<object class="WebPreferences" key="Preferences">
<string key="Identifier"/>
<object class="NSMutableDictionary" key="Values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>WebKitDefaultFixedFontSize</string>
<string>WebKitDefaultFontSize</string>
<string>WebKitMinimumFontSize</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="12"/>
<integer value="12"/>
<integer value="1"/>
</object>
</object>
</object>
<bool key="UseBackForwardList">YES</bool>
<bool key="AllowsUndo">YES</bool>
</object>
</object>
<string key="NSFrameSize">{860, 600}</string>
<reference key="NSSuperview" ref="568628114"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="60428165"/>
<bool key="NSIsVertical">YES</bool>
<int key="NSDividerStyle">3</int>
</object>
</object>
<string key="NSFrameSize">{860, 600}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="202269651"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{94, 108}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="796877042">
<string key="NSClassName">NSApplication</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="275939982"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">17</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="275939982"/>
</object>
<int key="connectionID">18</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">htmlPreviewWebView</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="583055138"/>
</object>
<int key="connectionID">100028</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">frameLoadDelegate</string>
<reference key="source" ref="583055138"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">100029</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="521201844"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">100030</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">policyDelegate</string>
<reference key="source" ref="583055138"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">100033</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">markdownSourceTextView</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="521201844"/>
</object>
<int key="connectionID">100034</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="580458321"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="512844837"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="613418571"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="275939982"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="568628114"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">Window</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="568628114"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="202269651"/>
</object>
<reference key="parent" ref="275939982"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="796877042"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">100026</int>
<reference key="object" ref="202269651"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="60428165"/>
<reference ref="583055138"/>
</object>
<reference key="parent" ref="568628114"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100021</int>
<reference key="object" ref="60428165"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="521201844"/>
<reference ref="497745035"/>
<reference ref="106470570"/>
</object>
<reference key="parent" ref="202269651"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100024</int>
<reference key="object" ref="521201844"/>
<reference key="parent" ref="60428165"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100023</int>
<reference key="object" ref="497745035"/>
<reference key="parent" ref="60428165"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100022</int>
<reference key="object" ref="106470570"/>
<reference key="parent" ref="60428165"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100025</int>
<reference key="object" ref="583055138"/>
<reference key="parent" ref="202269651"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>100021.IBPluginDependency</string>
<string>100022.IBPluginDependency</string>
<string>100023.IBPluginDependency</string>
<string>100024.CustomClassName</string>
<string>100024.IBPluginDependency</string>
<string>100025.IBPluginDependency</string>
<string>100026.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>5.IBWindowTemplateEditedContentRect</string>
<string>5.NSWindowTemplate.visibleAtLaunch</string>
<string>6.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>RKSyntaxView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{597, 57}, {769, 667}}</string>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">100034</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">MyDocument</string>
<string key="superclassName">NSDocument</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">copyGeneratedHTMLAction:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">copyGeneratedHTMLAction:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">copyGeneratedHTMLAction:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>htmlPreviewWebView</string>
<string>markdownSourceTextView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>WebView</string>
<string>EditPaneTextView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>htmlPreviewWebView</string>
<string>markdownSourceTextView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">htmlPreviewWebView</string>
<string key="candidateClassName">WebView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">markdownSourceTextView</string>
<string key="candidateClassName">EditPaneTextView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MyDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSDocument</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>printDocument:</string>
<string>revertDocumentToSaved:</string>
<string>runPageLayout:</string>
<string>saveDocument:</string>
<string>saveDocumentAs:</string>
<string>saveDocumentTo:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>printDocument:</string>
<string>revertDocumentToSaved:</string>
<string>runPageLayout:</string>
<string>saveDocument:</string>
<string>saveDocumentAs:</string>
<string>saveDocumentTo:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBActionInfo">
<string key="name">printDocument:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">revertDocumentToSaved:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">runPageLayout:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">saveDocument:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">saveDocumentAs:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
<string key="name">saveDocumentTo:</string>
<string key="candidateClassName">id</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">RKSyntaxView</string>
<string key="superclassName">NSTextView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/RKSyntaxView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">WebView</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">reloadFromOrigin:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">reloadFromOrigin:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">reloadFromOrigin:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/WebView.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-15
View File
@@ -1,15 +0,0 @@
//
// MLAppDelegate.m
// MarkdownLive
//
// Created by David Beck on 9/23/11.
// Copyright 2011 David Beck. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
//
#import <Foundation/Foundation.h>
@interface MLAppDelegate : NSObject <NSApplicationDelegate>
@property (nonatomic, strong) IBOutlet NSMenuItem *viewMenu;
@end
-22
View File
@@ -1,22 +0,0 @@
//
// MLAppDelegate.m
// MarkdownLive
//
// Created by David Beck on 9/23/11.
// Copyright 2011 David Beck. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
//
#import "MLAppDelegate.h"
@implementation MLAppDelegate
@synthesize viewMenu = _viewMenu;
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
if ([NSWindow instancesRespondToSelector:@selector(toggleFullScreen:)]) {
[[NSApp mainMenu] insertItem:self.viewMenu atIndex:3];
}
}
@end
+59 -81
View File
@@ -3,19 +3,12 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
11EF12E0142D24BB0086C77F /* MLAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 11EF12DF142D24BB0086C77F /* MLAppDelegate.m */; };
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyDocument.xib */; };
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
3D6A8BBC15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */; };
3D6A8BE115F0F33C002C8B62 /* Ordered List Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */; };
3D6A8BE215F0F33C002C8B62 /* Quote Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */; };
3D6A8BE315F0F33C002C8B62 /* Unordered List Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */; };
3D8BA23315F160FD000555C7 /* Image Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D8BA23115F160FD000555C7 /* Image Template.pdf */; };
3D8BA23415F160FD000555C7 /* Link Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D8BA23215F160FD000555C7 /* Link Template.pdf */; };
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */; };
795F6CCD105D741100D1F90A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 795F6CCC105D741100D1F90A /* WebKit.framework */; };
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
@@ -23,6 +16,10 @@
8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */; settings = {ATTRIBUTES = (); }; };
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
9958D88F14119A22004F7DF1 /* RKSyntaxView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9958D88E14119A22004F7DF1 /* RKSyntaxView.m */; };
9958D89214119A8D004F7DF1 /* NSColor+HexRGB.m in Sources */ = {isa = PBXBuildFile; fileRef = 9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */; };
9958D89514119B85004F7DF1 /* PageScheme.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9958D89314119B85004F7DF1 /* PageScheme.plist */; };
9958D89614119B85004F7DF1 /* PageSyntax.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9958D89414119B85004F7DF1 /* PageSyntax.plist */; };
ABE8DDF913CA38B5005852B5 /* styles.css in Resources */ = {isa = PBXBuildFile; fileRef = 226936E612E7CDC500171322 /* styles.css */; };
ABECD8C713C8B90E00B77CFD /* mkdio.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C4E105D6EC400D1F90A /* mkdio.c */; };
ABECD8C813C8B92900B77CFD /* markdown.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C50105D6ECE00D1F90A /* markdown.c */; };
@@ -79,8 +76,6 @@
/* Begin PBXFileReference section */
089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
11EF12DE142D24BB0086C77F /* MLAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLAppDelegate.h; sourceTree = "<group>"; };
11EF12DF142D24BB0086C77F /* MLAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLAppDelegate.m; sourceTree = "<group>"; };
13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MyDocument.xib; sourceTree = "<group>"; };
1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -100,18 +95,6 @@
2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = "<group>"; };
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
3D6A8BBA15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextView+EditPlainTextWithUndo.h"; sourceTree = "<group>"; };
3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTextView+EditPlainTextWithUndo.m"; sourceTree = "<group>"; };
3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Ordered List Template.pdf"; sourceTree = "<group>"; };
3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Quote Template.pdf"; sourceTree = "<group>"; };
3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Unordered List Template.pdf"; sourceTree = "<group>"; };
3D8BA23115F160FD000555C7 /* Image Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Image Template.pdf"; sourceTree = "<group>"; };
3D8BA23215F160FD000555C7 /* Link Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Link Template.pdf"; sourceTree = "<group>"; };
3DD161871431FCED0003F6C7 /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = "<group>"; };
3DD161881431FCF40003F6C7 /* EditPaneTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneTypesetter.h; sourceTree = "<group>"; };
3DD161891431FCFC0003F6C7 /* EditPaneTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneTextView.h; sourceTree = "<group>"; };
3DD1618A1431FD030003F6C7 /* EditPaneLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneLayoutManager.h; sourceTree = "<group>"; };
3DD1618B1431FD0B0003F6C7 /* PreferencesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesManager.h; sourceTree = "<group>"; };
795F6C4E105D6EC400D1F90A /* mkdio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mkdio.c; sourceTree = "<group>"; };
795F6C50105D6ECE00D1F90A /* markdown.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = markdown.c; sourceTree = "<group>"; };
795F6C52105D6ED800D1F90A /* generate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = generate.c; sourceTree = "<group>"; };
@@ -128,6 +111,12 @@
795F6DB9105D75D300D1F90A /* mkdioWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkdioWrapper.h; sourceTree = "<group>"; };
8D15AC360486D014006FF6A4 /* MarkdownLive-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MarkdownLive-Info.plist"; sourceTree = "<group>"; };
8D15AC370486D014006FF6A4 /* MarkdownLive.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarkdownLive.app; sourceTree = BUILT_PRODUCTS_DIR; };
9958D88D14119A22004F7DF1 /* RKSyntaxView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSyntaxView.h; sourceTree = "<group>"; };
9958D88E14119A22004F7DF1 /* RKSyntaxView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSyntaxView.m; sourceTree = "<group>"; };
9958D89014119A8D004F7DF1 /* NSColor+HexRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+HexRGB.h"; sourceTree = "<group>"; };
9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+HexRGB.m"; sourceTree = "<group>"; };
9958D89314119B85004F7DF1 /* PageScheme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageScheme.plist; sourceTree = "<group>"; };
9958D89414119B85004F7DF1 /* PageSyntax.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageSyntax.plist; sourceTree = "<group>"; };
ABCE3DDF13C8DFFF00DF3CD0 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORCDiscount.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ABECD8C313C8B8CA00B77CFD /* ORCDiscount-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ORCDiscount-Info.plist"; sourceTree = "<group>"; };
@@ -189,13 +178,23 @@
name = Products;
sourceTree = "<group>";
};
22ECEEC512E7C258003B50DC /* discount-config */ = {
isa = PBXGroup;
children = (
226936B912E7C8B600171322 /* mkdio.h */,
22ECEEC612E7C258003B50DC /* config.h */,
);
path = "discount-config";
sourceTree = "<group>";
};
2A37F4AAFDCFA73011CA2CEA /* MarkdownLive */ = {
isa = PBXGroup;
children = (
9958D88B14119A18004F7DF1 /* RK */,
ABECD96113C8D1C200B77CFD /* ORCDiscount */,
2A37F4ABFDCFA73011CA2CEA /* Classes */,
3D6A8BBD15F0D919002C8B62 /* Categories */,
795F6C4D105D6EA500D1F90A /* discount */,
22ECEEC512E7C258003B50DC /* discount-config */,
795F6DB3105D75D300D1F90A /* discount_wrappers */,
2A37F4AFFDCFA73011CA2CEA /* Other Sources */,
2A37F4B8FDCFA73011CA2CEA /* Resources */,
@@ -210,17 +209,10 @@
2A37F4ABFDCFA73011CA2CEA /* Classes */ = {
isa = PBXGroup;
children = (
11EF12DE142D24BB0086C77F /* MLAppDelegate.h */,
11EF12DF142D24BB0086C77F /* MLAppDelegate.m */,
3DD1618A1431FD030003F6C7 /* EditPaneLayoutManager.h */,
ABF75D6E13CDEBBA00B5E7AB /* EditPaneLayoutManager.m */,
3DD161891431FCFC0003F6C7 /* EditPaneTextView.h */,
ABF75D6F13CDEBBA00B5E7AB /* EditPaneTextView.m */,
3DD161881431FCF40003F6C7 /* EditPaneTypesetter.h */,
ABF75D7013CDEBBA00B5E7AB /* EditPaneTypesetter.m */,
3DD161871431FCED0003F6C7 /* PreferencesController.h */,
ABF75D7113CDEBBA00B5E7AB /* PreferencesController.m */,
3DD1618B1431FD0B0003F6C7 /* PreferencesManager.h */,
ABF75D7213CDEBBA00B5E7AB /* PreferencesManager.m */,
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */,
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */,
@@ -240,7 +232,6 @@
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
3D6A8BD915F0F33C002C8B62 /* Images */,
226936E612E7CDC500171322 /* styles.css */,
795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */,
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
@@ -248,6 +239,8 @@
089C165FFE840EACC02AAC07 /* InfoPlist.strings */,
1DDD58280DA1D0D100B32029 /* MyDocument.xib */,
1DDD582A0DA1D0D100B32029 /* MainMenu.xib */,
9958D89314119B85004F7DF1 /* PageScheme.plist */,
9958D89414119B85004F7DF1 /* PageSyntax.plist */,
);
name = Resources;
sourceTree = "<group>";
@@ -261,27 +254,6 @@
name = Frameworks;
sourceTree = "<group>";
};
3D6A8BBD15F0D919002C8B62 /* Categories */ = {
isa = PBXGroup;
children = (
3D6A8BBA15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.h */,
3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */,
);
name = Categories;
sourceTree = "<group>";
};
3D6A8BD915F0F33C002C8B62 /* Images */ = {
isa = PBXGroup;
children = (
3D8BA23115F160FD000555C7 /* Image Template.pdf */,
3D8BA23215F160FD000555C7 /* Link Template.pdf */,
3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */,
3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */,
3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */,
);
path = Images;
sourceTree = "<group>";
};
795F6C4D105D6EA500D1F90A /* discount */ = {
isa = PBXGroup;
children = (
@@ -297,8 +269,6 @@
2269369F12E7C6BE00171322 /* tags.h */,
2269369E12E7C6BE00171322 /* tags.c */,
226936C912E7CA2800171322 /* setup.c */,
226936B912E7C8B600171322 /* mkdio.h */,
22ECEEC612E7C258003B50DC /* config.h */,
);
path = discount;
sourceTree = "<group>";
@@ -316,6 +286,17 @@
path = discount_wrappers;
sourceTree = "<group>";
};
9958D88B14119A18004F7DF1 /* RK */ = {
isa = PBXGroup;
children = (
9958D89014119A8D004F7DF1 /* NSColor+HexRGB.h */,
9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */,
9958D88D14119A22004F7DF1 /* RKSyntaxView.h */,
9958D88E14119A22004F7DF1 /* RKSyntaxView.m */,
);
name = RK;
sourceTree = "<group>";
};
ABECD96113C8D1C200B77CFD /* ORCDiscount */ = {
isa = PBXGroup;
children = (
@@ -386,11 +367,8 @@
/* Begin PBXProject section */
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
};
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MarkdownLive" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
@@ -419,11 +397,8 @@
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */,
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */,
3D6A8BE115F0F33C002C8B62 /* Ordered List Template.pdf in Resources */,
3D6A8BE215F0F33C002C8B62 /* Quote Template.pdf in Resources */,
3D6A8BE315F0F33C002C8B62 /* Unordered List Template.pdf in Resources */,
3D8BA23315F160FD000555C7 /* Image Template.pdf in Resources */,
3D8BA23415F160FD000555C7 /* Link Template.pdf in Resources */,
9958D89514119B85004F7DF1 /* PageScheme.plist in Resources */,
9958D89614119B85004F7DF1 /* PageSyntax.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -449,8 +424,8 @@
ABF75D7513CDEBBB00B5E7AB /* EditPaneTypesetter.m in Sources */,
ABF75D7613CDEBBB00B5E7AB /* PreferencesController.m in Sources */,
ABF75D7713CDEBBB00B5E7AB /* PreferencesManager.m in Sources */,
11EF12E0142D24BB0086C77F /* MLAppDelegate.m in Sources */,
3D6A8BBC15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m in Sources */,
9958D88F14119A22004F7DF1 /* RKSyntaxView.m in Sources */,
9958D89214119A8D004F7DF1 /* NSColor+HexRGB.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -525,14 +500,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
@@ -544,6 +518,7 @@
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = NO;
};
@@ -553,14 +528,13 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = "ORCDiscount-Info.plist";
@@ -571,6 +545,7 @@
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = YES;
ZERO_LINK = NO;
@@ -581,18 +556,19 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
INFOPLIST_FILE = "MarkdownLive-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = MarkdownLive;
SDKROOT = macosx;
};
name = Debug;
};
@@ -600,16 +576,16 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
INFOPLIST_FILE = "MarkdownLive-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = MarkdownLive;
SDKROOT = macosx;
};
name = Release;
};
@@ -619,6 +595,7 @@
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -632,9 +609,9 @@
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
PREBINDING = NO;
SDKROOT = macosx10.6;
};
name = Debug;
};
@@ -646,6 +623,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
@@ -658,8 +636,8 @@
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
PREBINDING = NO;
SDKROOT = macosx10.6;
SEPARATE_STRIP = YES;
STRIP_INSTALLED_PRODUCT = YES;
};
+2 -14
View File
@@ -7,12 +7,13 @@
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import "RKSyntaxView.h"
@class EditPaneTextView;
@class EditPaneLayoutManager;
@interface MyDocument : NSDocument {
IBOutlet EditPaneTextView *markdownSourceTextView;
IBOutlet RKSyntaxView *markdownSourceTextView;
IBOutlet WebView *htmlPreviewWebView;
NSTextStorage *markdownSource;
@@ -27,17 +28,4 @@
- (IBAction)copyGeneratedHTMLAction:(id)sender;
- (IBAction)boldItalic:(id)sender;
- (IBAction)bold:(id)sender;
- (IBAction)italic:(id)sender;
- (IBAction)header1:(id)sender;
- (IBAction)header2:(id)sender;
- (IBAction)header3:(id)sender;
- (IBAction)blockQuote:(id)sender;
- (IBAction)codeSection:(id)sender;
- (IBAction)unorderedList:(id)sender;
- (IBAction)numberedList:(id)sender;
- (IBAction)link:(id)sender;
- (IBAction)image:(id)sender;
@end
+21 -267
View File
@@ -7,27 +7,14 @@
#import "ORCDiscount.h"
#import "MyDocument.h"
#import "EditPaneLayoutManager.h"
#import "EditPaneTextView.h"
#import "NSTextView+EditPlainTextWithUndo.h"
#import "PreferencesController.h"
#import "PreferencesManager.h"
#include "discountWrapper.h"
NSString * const kNumberedListTemplate = @"%lu. ";
NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
@interface MyDocument ()
- (void)_surroundSelectionWithString:(NSString *)string;
- (void)_surroundSelectionWithPrefixString:(NSString *)prefixString
suffixString:(NSString *)suffixString
selectionOffset:(NSInteger)selectionOffset;
- (void)_addStringBeforeSelectedLines:(NSString *)string
skippingEmptyLines:(BOOL)skipEmptyLines;
@end
// class extension
@interface MyDocument ()
@@ -63,11 +50,10 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
}
- (void)dealloc {
[htmlPreviewTimer invalidate]; htmlPreviewTimer = nil;
[markdownSource release]; markdownSource = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)windowWillClose:(NSNotification *)notification {
[htmlPreviewTimer invalidate];
[super dealloc];
}
- (NSString *)windowNibName {
@@ -86,13 +72,12 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
// If you use IB to set an NSTextView's font, the font doesn't stick,
// even if you've turned off the text view's richText setting.
[markdownSourceTextView updateFont];
[markdownSourceTextView updateColors];
if ([controller_.window respondsToSelector:@selector(toggleFullScreen:)]) {
controller_.window.collectionBehavior &= !NSWindowCollectionBehaviorFullScreenAuxiliary;
controller_.window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
}
//[markdownSourceTextView updateFont];
//[markdownSourceTextView updateColors];
[markdownSourceTextView loadScheme:@"PageScheme"];
[markdownSourceTextView loadSyntax:@"PageSyntax"];
[markdownSourceTextView highlight];
[super windowControllerDidLoadNib:controller_];
}
@@ -117,16 +102,16 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
NSURL *markdownFileURL = [self fileURL];
NSURL *htmlFileURL = [[markdownFileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"html"];
if ([[NSFileManager defaultManager] fileExistsAtPath:[htmlFileURL path]]) {
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithContentsOfURL:htmlFileURL
NSXMLDocument *doc = [[[NSXMLDocument alloc] initWithContentsOfURL:htmlFileURL
options:NSXMLNodePreserveAll|NSXMLDocumentTidyXML
error:nil];
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]]
NSXMLDocument *markdownDoc = [[[NSXMLDocument alloc] initWithXMLString:[ORCDiscount markdown2HTML:[markdownSource string]]
options:NSXMLDocumentTidyHTML
error:nil];
error:nil] autorelease];
NSArray *markdownNodes = [markdownDoc nodesForXPath:@"/html/body/*" error:nil];
[markdownNodes makeObjectsPerformSelector:@selector(detach)];
[node setChildren:markdownNodes];
@@ -156,6 +141,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
error:&error];
if (!error) {
NSAssert(markdownSourceString, nil);
[markdownSource release];
markdownSource = [[NSTextStorage alloc] initWithString:markdownSourceString];
NSAssert(markdownSource, nil);
whenToUpdatePreview = [NSDate timeIntervalSinceReferenceDate] + 0.5;
@@ -170,7 +156,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
- (NSView *)printableView {
NSRect frame = [[self printInfo] imageablePageBounds];
frame.size.height = 0;
NSTextView *printView = [[NSTextView alloc] initWithFrame:frame];
NSTextView *printView = [[[NSTextView alloc] initWithFrame:frame] autorelease];
[printView setVerticallyResizable:YES];
[printView setHorizontallyResizable:NO];
@@ -183,6 +169,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
[[printView textStorage] beginEditing];
[[printView textStorage] appendAttributedString:printStr];
[printStr release];
[[printView textStorage] endEditing];
[printView sizeToFit];
@@ -210,7 +197,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
NSView *docView = [[[htmlPreviewWebView mainFrame] frameView] documentView];
NSView *parent = [docView superview];
if (parent) {
NSAssert([parent isKindOfClass:[NSClipView class]], @"");
NSAssert([parent isKindOfClass:[NSClipView class]], nil);
savedOrigin = [parent bounds].origin;
// This line from Darin from http://lists.apple.com/archives/webkitsdk-dev/2003/Dec/msg00004.html :
savedAtBottom = [docView isFlipped]
@@ -224,30 +211,6 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
[[htmlPreviewWebView mainFrame] loadHTMLString:html baseURL:[self fileURL]];
}
- (void)updateContentOnUndo {
NSUndoManager *undoManager = [self undoManager];
[undoManager registerUndoWithTarget:self
selector:@selector(updateContentOnUndo)
object:nil];
if ([undoManager isUndoing]) {
[self updateContent];
}
}
- (void)updateContentIncludingOnRedo {
NSUndoManager *undoManager = [self undoManager];
[undoManager registerUndoWithTarget:self
selector:@selector(updateContentIncludingOnRedo)
object:nil];
if ([undoManager isUndoing] == NO) {
[self updateContent];
}
}
- (void)htmlPreviewTimer:(NSTimer*)timer_ {
#pragma unused(timer_)
@@ -288,7 +251,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
NSURL *stdUrl = [url URLByStandardizingPath];
NSURL *docUrl = [[self fileURL] URLByStandardizingPath];
if ([[url scheme] isEqualToString:@"applewebdata"] ||
([stdUrl isFileURL] && [stdUrl isEqualTo:docUrl])) {
[stdUrl isFileURL] && [stdUrl isEqualTo:docUrl]) {
[listener use];
} else {
[[NSWorkspace sharedWorkspace] openURL:url];
@@ -305,213 +268,4 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
[[NSPasteboard generalPasteboard] setString:[ORCDiscount markdown2HTML:[markdownSource string]] forType:NSStringPboardType];
}
- (void)_surroundSelectionWithString:(NSString *)string {
[self _surroundSelectionWithPrefixString:string
suffixString:string
selectionOffset:0];
}
- (void)_surroundSelectionWithPrefixString:(NSString *)prefixString
suffixString:(NSString *)suffixString
selectionOffset:(NSInteger)selectionOffset {
[self updateContentOnUndo];
NSMutableArray *newSelection = [[NSMutableArray alloc] init];
NSUInteger prefixStringLength = prefixString.length;
NSUInteger suffixStringLength = suffixString.length;
NSUInteger insertedStringLength = prefixStringLength + suffixStringLength;
NSUInteger insertedCharacters = 0;
NSArray *selectedRanges = [markdownSourceTextView selectedRanges];
BOOL multipleSelections = (selectedRanges.count != 1);
for (NSValue *rangeInfo in selectedRanges) {
NSRange range = [rangeInfo rangeValue];
range.location += insertedCharacters;
[markdownSourceTextView insertText:suffixString atIndex:NSMaxRange(range)];
[markdownSourceTextView insertText:prefixString atIndex:range.location];
insertedCharacters += insertedStringLength;
if (multipleSelections || selectionOffset == 0) {
range.location += prefixStringLength;
} else {
// We use the selectionOffset only if there is a single selection.
if (selectionOffset < 0) {
// Negative offsets are relative to the end of the resulting range.
range.location += range.length + insertedStringLength + selectionOffset;
} else {
// Positive offsets are relative to the start of the resulting range.
range.location += selectionOffset;
}
range.length = 0;
}
[newSelection addObject:[NSValue valueWithRange:range]];
}
[markdownSourceTextView setSelectedRangesWithUndo:newSelection];
[self updateContentIncludingOnRedo];
}
- (void)_addStringBeforeSelectedLines:(NSString *)string
skippingEmptyLines:(BOOL)skipEmptyLines {
[self updateContentOnUndo];
NSMutableString *mutableString = markdownSourceTextView.textStorage.mutableString;
NSMutableArray *newSelection = [[NSMutableArray alloc] init];
NSUInteger stringLength = string.length;
NSUInteger insertedCharacters = 0;
for (NSValue *rangeInfo in [markdownSourceTextView selectedRanges]) {
NSRange range = [rangeInfo rangeValue];
range.location += insertedCharacters;
NSUInteger rangeEnd = NSMaxRange(range);
NSUInteger currentIndex = range.location;
NSUInteger insertionCounter = 0;
while (currentIndex < (rangeEnd + insertedCharacters)
&& currentIndex < mutableString.length) {
NSUInteger startIndex, lineEndIndex, contentsEndIndex;
[mutableString getLineStart:&startIndex
end:&lineEndIndex
contentsEnd:&contentsEndIndex
forRange:NSMakeRange(currentIndex, 0)];
BOOL lineHasContent = (startIndex < contentsEndIndex);
if ((skipEmptyLines == NO) || lineHasContent) {
// Prefix line with string.
if (string == kNumberedListTemplate) {
NSString *currentString = [NSString stringWithFormat:string, (unsigned long)(insertionCounter + 1)];
[markdownSourceTextView insertText:currentString atIndex:startIndex];
stringLength = currentString.length;
}
else {
[markdownSourceTextView insertText:string atIndex:startIndex];
}
insertedCharacters += stringLength;
currentIndex = stringLength + lineEndIndex;
insertionCounter++;
}
else {
// startIndex == contentsEndIndex => the line is empty. Do nothing and go to next line.
currentIndex = lineEndIndex;
}
}
if (insertionCounter == 1) {
// If this was within a single line, we keep the previously selected characters selected.
range.location += stringLength;
range.length += insertedCharacters - stringLength;
}
else {
// If this selection went across multiple lines, we extend the selection to all the lines that were touched.
range.length += insertedCharacters;
}
[newSelection addObject:[NSValue valueWithRange:range]];
}
[markdownSourceTextView setSelectedRangesWithUndo:newSelection];
[self updateContentIncludingOnRedo];
}
- (IBAction)boldItalic:(NSSegmentedControl *)sender {
//NSLog(@"sender: %ld", sender.selectedSegment);
switch (sender.selectedSegment) {
case 0: { //bold
[self bold:sender];
break;
}
case 1: { //italic
[self italic:sender];
break;
}
}
}
- (void)_undoBold:(NSString *)string
{
NSLog(@"string: %@", string);
}
- (IBAction)bold:(id)sender
{
[self _surroundSelectionWithString:@"**"];
}
- (IBAction)italic:(id)sender
{
[self _surroundSelectionWithString:@"*"];
}
- (IBAction)header1:(id)sender
{
[self _addStringBeforeSelectedLines:@"# "
skippingEmptyLines:YES];
}
- (IBAction)header2:(id)sender
{
[self _addStringBeforeSelectedLines:@"## "
skippingEmptyLines:YES];
}
- (IBAction)header3:(id)sender
{
[self _addStringBeforeSelectedLines:@"### "
skippingEmptyLines:YES];
}
- (IBAction)blockQuote:(id)sender
{
[self _addStringBeforeSelectedLines:@"> "
skippingEmptyLines:NO];
}
- (IBAction)codeSection:(id)sender
{
[self _addStringBeforeSelectedLines:@" "
skippingEmptyLines:NO];
}
- (IBAction)unorderedList:(id)sender
{
[self _addStringBeforeSelectedLines:@"* "
skippingEmptyLines:YES];
}
- (IBAction)numberedList:(id)sender
{
[self _addStringBeforeSelectedLines:kNumberedListTemplate
skippingEmptyLines:YES];
}
- (IBAction)link:(id)sender
{
[self _surroundSelectionWithPrefixString:@"[" suffixString:@"]()"
selectionOffset:-1];
}
- (IBAction)image:(id)sender
{
[self _surroundSelectionWithPrefixString:@"![" suffixString:@"]()"
selectionOffset:-1];
}
@end
+16
View File
@@ -0,0 +1,16 @@
//
// NSColor+HexRGB.h
// TextDo
//
// Created by Vojto Rinik on 28.6.2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSColor (NSColor_HexRGB)
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString;
@end
+35
View File
@@ -0,0 +1,35 @@
//
// NSColor+HexRGB.m
// TextDo
//
// Created by Vojto Rinik on 28.6.2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "NSColor+HexRGB.h"
@implementation NSColor (NSColor_HexRGB)
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString {
NSColor *result = nil;
unsigned int colorCode = 0;
unsigned char redByte, greenByte, blueByte;
if (nil != inColorString)
{
NSScanner *scanner = [NSScanner scannerWithString:inColorString];
(void) [scanner scanHexInt:&colorCode]; // ignore error
}
redByte = (unsigned char) (colorCode >> 16);
greenByte = (unsigned char) (colorCode >> 8);
blueByte = (unsigned char) (colorCode); // masks off high bits
result = [NSColor
colorWithCalibratedRed: (float)redByte / 0xff
green: (float)greenByte/ 0xff
blue: (float)blueByte / 0xff
alpha:1.0];
return result;
}
@end
-24
View File
@@ -1,24 +0,0 @@
//
// NSTextView+EditPlainTextWithUndo.h
// MarkdownLive
//
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
//
// Based on DrewThalers post at http://www.cocoadev.com/index.pl?UndoSupportForNSTextStorage
#import <Foundation/Foundation.h>
@interface NSTextView (EditPlainTextWithUndo)
- (void)setSelectedRangeWithUndo:(NSRange)range;
- (void)setSelectedRangesWithUndo:(NSArray *)ranges;
- (BOOL)setText:(NSString *)string;
- (BOOL)replaceCharactersInRange:(NSRange)range withText:(NSString *)string;
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index;
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index checkIndex:(BOOL)checkIndex;
- (BOOL)insertText:(NSString *)string;
@end
-102
View File
@@ -1,102 +0,0 @@
//
// NSTextView+EditPlainTextWithUndo.m
// MarkdownLive
//
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
//
// Based on DrewThalers post at http://www.cocoadev.com/index.pl?UndoSupportForNSTextStorage
#import "NSTextView+EditPlainTextWithUndo.h"
@implementation NSTextView (EditPlainTextWithUndo)
- (void)setSelectedRangeWithUndo:(NSRange)range;
{
[self setSelectedRange:range];
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:range];
}
- (void)setSelectedRangesWithUndo:(NSArray *)ranges;
{
[self setSelectedRanges:ranges];
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangesWithUndo:ranges];
}
- (BOOL)setText:(NSString *)string;
{
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:self.selectedRange];
NSTextStorage *textStorage = [self textStorage];
if ([self shouldChangeTextInRange:NSMakeRange(0, [textStorage length])
replacementString:string]) {
[textStorage.mutableString setString:string];
[self didChangeText];
[self setSelectedRangeWithUndo:NSMakeRange(0, 0)];
return YES;
}
else {
return NO;
}
}
- (BOOL)replaceCharactersInRange:(NSRange)range withText:(NSString *)string;
{
NSString *selectedText = [[self string] substringWithRange:range];
NSString *stringForDelegate = string;
// If only attributes are changing, pass nil.
if ([string isEqualToString:selectedText]) {
stringForDelegate = nil;
}
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:self.selectedRange];
// Call delegate methods to force undo recording
if ([self shouldChangeTextInRange:range
replacementString:stringForDelegate]) {
[self.textStorage.mutableString replaceCharactersInRange:range
withString:string];
[self didChangeText];
[self setSelectedRangeWithUndo:NSMakeRange(range.location + [string length], 0)];
return YES;
}
else {
return NO;
}
}
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index;
{
NSRange range = NSMakeRange(index, 0);
return [self replaceCharactersInRange:range withText:string];
}
- (BOOL)insertText:(NSString *)attributedString atIndex:(NSUInteger)index checkIndex:(BOOL)checkIndex;
{
NSUInteger textLength = [self.textStorage length];
if (checkIndex && (index == NSNotFound || !(index <= textLength))) {
index = textLength; // AFTER the last character in textStorage
}
return [self insertText:attributedString atIndex:index];
}
- (BOOL)insertText:(NSString *)attributedString;
{
NSRange range = [self selectedRange];
return [self replaceCharactersInRange:range withText:attributedString];
}
@end
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>colors</key>
<dict>
<key>title3</key>
<string>6C71C4</string>
<key>em</key>
<string>859900</string>
<key>strong</key>
<string>48595f</string>
<key>code</key>
<string>2AA198</string>
<key>codeBackground</key>
<string>EEE8D5</string>
<key>highlight</key>
<string>EEE8D5</string>
<key>background</key>
<string>FDF6E3</string>
<key>checked</key>
<string>8e8e8e</string>
<key>default</key>
<string>586E75</string>
<key>subtitle</key>
<string>268BD2</string>
<key>title</key>
<string>DC322F</string>
<key>zone</key>
<string>f21bea</string>
</dict>
<key>font</key>
<string>Menlo</string>
</dict>
</plist>
+92
View File
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>todo-zone</key>
<dict>
<key>color</key>
<string>zone</string>
<key>pattern</key>
<string>^●\s*.*$</string>
</dict>
<key>todo-checked</key>
<dict>
<key>color</key>
<string>checked</string>
<key>pattern</key>
<string>^✓\s*.*$</string>
</dict>
<key>todo-unchecked</key>
<dict>
<key>color</key>
<string>default</string>
<key>pattern</key>
<string>^☐\s*.*$</string>
</dict>
<key>list-item</key>
<dict>
<key>color</key>
<string>default</string>
<key>pattern</key>
<string>^\*\s+.*$</string>
</dict>
<key>markdown-header-1</key>
<dict>
<key>size</key>
<integer>14</integer>
<key>isBold</key>
<true/>
<key>color</key>
<string>title</string>
<key>pattern</key>
<string>^(# )(.*?)($| #+$)</string>
</dict>
<key>markdown-header-2</key>
<dict>
<key>color</key>
<string>subtitle</string>
<key>isBold</key>
<true/>
<key>pattern</key>
<string>^(## )(.*?)($| #+$)</string>
</dict>
<key>markdown-em</key>
<dict>
<key>color</key>
<string>em</string>
<key>patternGroup</key>
<integer>2</integer>
<key>pattern</key>
<string>(^|[^\*])(\*[^\s\*]([^\*\n]+)\*)</string>
</dict>
<key>markdown-strong</key>
<dict>
<key>isBold</key>
<true/>
<key>color</key>
<string>strong</string>
<key>pattern</key>
<string>\*{2}(.+?)\*{2}</string>
</dict>
<key>markdown-header-3</key>
<dict>
<key>color</key>
<string>title3</string>
<key>isBold</key>
<true/>
<key>pattern</key>
<string>^(### )(.*?)($| #+$)</string>
</dict>
<key>code</key>
<dict>
<key>patternGroup</key>
<integer>1</integer>
<key>backgroundColor</key>
<string>codeBackground</string>
<key>color</key>
<string>code</string>
<key>pattern</key>
<string>^ {4}(.*?)$</string>
</dict>
</dict>
</plist>
+1 -1
View File
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
extern NSString * const kEditPaneFontNameChangedNotification;
#define kEditPaneFontNameChangedNotification @"EditPaneFontNameChangedNotification"
@interface PreferencesController : NSObject {
IBOutlet NSWindow *prefWindow;
+3 -4
View File
@@ -9,9 +9,8 @@
#import "PreferencesController.h"
#import "PreferencesManager.h"
NSString * const kEditPaneFontNameChangedNotification = @"EditPaneFontNameChangedNotification";
#define FONT_DISPLAY_FORMAT @"%@ %g pt."
NSString * const kFontDisplayFormat = @"%@ %g pt.";
@interface PreferencesController (Private)
@@ -36,7 +35,7 @@ NSString * const kFontDisplayFormat = @"%@ %g pt.";
- (void)updateFontDisplay {
NSString *fontName = [PreferencesManager editPaneFontName];
float fontSize = [PreferencesManager editPaneFontSize];
[fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
}
- (IBAction)resetEditPanePreferences:(id)sender {
@@ -57,7 +56,7 @@ NSString * const kFontDisplayFormat = @"%@ %g pt.";
if (newFont && fontName) {
[PreferencesManager setEditPaneFontName:fontName];
[PreferencesManager setEditPaneFontSize:fontSize];
[fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
object:nil];
+7 -6
View File
@@ -8,12 +8,13 @@
#import <Foundation/Foundation.h>
extern NSString * const kEditPaneFontName;
extern NSString * const kEditPaneFontSize;
extern NSString * const kEditPaneForegroundColor;
extern NSString * const kEditPaneBackgroundColor;
extern NSString * const kEditPaneSelectionColor;
extern NSString * const kEditPaneCaretColor;
#define kEditPaneFontName @"EditPaneFontName"
#define kEditPaneFontSize @"EditPaneFontSize"
#define kEditPaneForegroundColor @"EditPaneForegroundColor"
#define kEditPaneBackgroundColor @"EditPaneBackgroundColor"
#define kEditPaneSelectionColor @"EditPaneSelectionColor"
#define kEditPaneCaretColor @"EditPaneCaretColor"
@interface PreferencesManager : NSObject {
-7
View File
@@ -8,13 +8,6 @@
#import "PreferencesManager.h"
NSString * const kEditPaneFontName = @"EditPaneFontName";
NSString * const kEditPaneFontSize = @"EditPaneFontSize";
NSString * const kEditPaneForegroundColor = @"EditPaneForegroundColor";
NSString * const kEditPaneBackgroundColor = @"EditPaneBackgroundColor";
NSString * const kEditPaneSelectionColor = @"EditPaneSelectionColor";
NSString * const kEditPaneCaretColor = @"EditPaneCaretColor";
@interface PreferencesManager (Private)
+ (NSColor *)colorForKey:(NSString *)key;
+11
View File
@@ -1,3 +1,14 @@
## About my fork
Adds beautiful syntax highlighting to MarkdownLive.
![screenshot](https://github.com/vojto/markdownlive/raw/master/sshot.png)
[Grab Lion build](https://github.com/downloads/vojto/markdownlive/MarkdownLive.zip)
Like it? Buy [one of my apps](http://rinik.net/apps).
## MarkdownLive
A Cocoa markdown preview editor using [Discount][discount].
+45
View File
@@ -0,0 +1,45 @@
//
// RKSyntaxView.h
//
//
// Created by Vojto Rinik on 8/24/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
@interface RKSyntaxView : NSTextView {
NSDictionary *_scheme;
NSDictionary *_syntax;
NSMutableAttributedString *_content;
}
@property (retain) NSDictionary *scheme;
@property (retain) NSDictionary *syntax;
@property (retain) NSMutableAttributedString *content;
- (void) _setup;
#pragma mark - Handling text change
- (void) _textDidChange:(NSNotification *)notif;
#pragma mark - Highlighting
- (void) highlight;
- (void) highlightRange:(NSRange)range;
#pragma mark - Scheme
- (void) loadScheme:(NSString *)schemeFilename;
- (NSColor *) _colorFor:(NSString *)key;
- (NSFont *) _font;
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold;
#pragma mark - Syntax
- (void) loadSyntax:(NSString *)syntaxFilename;
#pragma mark - Changing text attributes
- (void) _setTextColor:(NSColor *)color range:(NSRange)range;
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range;
- (void) _setFont:(NSFont *)font range:(NSRange)range;
- (void) _reflect;
@end
+169
View File
@@ -0,0 +1,169 @@
//
// RKSyntaxView.m
//
//
// Created by Vojto Rinik on 8/24/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "RKSyntaxView.h"
#import "NSColor+HexRGB.h"
@implementation RKSyntaxView
@synthesize scheme=_scheme;
@synthesize syntax=_syntax;
@synthesize content=_content;
#pragma mark - Lifecycle
- (id)init {
if ((self = [super init])) {
[self _setup];
}
return self;
}
- (void)awakeFromNib {
[self _setup];
}
- (void)_setup {
self.content = [[[NSMutableAttributedString alloc] init] autorelease];
[self setTextContainerInset:NSMakeSize(10.0, 10.0)];
[self highlight];
[self addObserver:self forKeyPath:@"string" options:0 context:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_textDidChange:) name:NSTextDidChangeNotification object:self];
}
- (void) dealloc {
self.content = nil;
[super dealloc];
}
#pragma mark - Handling text changes
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
[self highlight];
}
- (void)_textDidChange:(NSNotification *)notif {
[self highlight];
}
#pragma mark - Scheme
- (void)loadScheme:(NSString *)schemeFilename {
NSString *schemePath = [[NSBundle mainBundle] pathForResource:schemeFilename ofType:@"plist" inDirectory:nil];
self.scheme = [NSDictionary dictionaryWithContentsOfFile:schemePath];
}
- (NSColor *) _colorFor:(NSString *)key {
NSString *colorCode = [[self.scheme objectForKey:@"colors"] objectForKey:key];
if (!colorCode) return nil;
NSColor *color = [NSColor colorFromHexRGB:colorCode];
return color;
}
- (NSFont *) _font {
return [self _fontOfSize:12 bold:NO];
}
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold {
NSString *fontName = [self.scheme objectForKey:@"font"];
NSFont *font = [NSFont fontWithName:fontName size:size];
if (!font) font = [NSFont systemFontOfSize:size];
if (wantsBold) {
NSFontTraitMask traits = NSBoldFontMask;
NSFontManager *manager = [NSFontManager sharedFontManager];
font = [manager fontWithFamily:fontName traits:traits weight:5.0 size:size];
}
return font;
}
#pragma mark - Syntax
- (void)loadSyntax:(NSString *)syntaxFilename {
NSString *schemePath = [[NSBundle mainBundle] pathForResource:syntaxFilename ofType:@"plist" inDirectory:nil];
self.syntax = [NSDictionary dictionaryWithContentsOfFile:schemePath];
}
#pragma mark - Highlighting
- (void) highlight {
self.content = [[NSMutableAttributedString alloc] initWithString:[self string]];
[self.content release];
NSColor *background = [self _colorFor:@"background"];
[self setBackgroundColor:background];
[(NSScrollView *)self.superview setBackgroundColor:background];
[self setTextColor:[self _colorFor:@"default"]];
return [self highlightRange:NSMakeRange(0, [self.content length])];
}
- (void) highlightRange:(NSRange)range {
NSColor *defaultColor = [self _colorFor:@"default"];
NSInteger defaultSize = [(NSNumber *)[self.scheme objectForKey:@"size"] integerValue];
if (!defaultSize) defaultSize = 12;
NSFont *defaultFont = [self _fontOfSize:defaultSize bold:NO];
[self _setFont:defaultFont range:range];
[self _setTextColor:defaultColor range:range];
[self _setBackgroundColor:[NSColor clearColor] range:range];
NSString *string = [self.content string];
for (NSString *type in [self.syntax allKeys]) {
NSDictionary *params = [self.syntax objectForKey:type];
NSString *pattern = [params objectForKey:@"pattern"];
NSString *colorName = [params objectForKey:@"color"];
NSColor *color = [self _colorFor:colorName];
NSString *backgroundColorName = [params objectForKey:@"backgroundColor"];
NSColor *backgroundColor = [self _colorFor:backgroundColorName];
NSInteger size = [(NSNumber *)[params objectForKey:@"size"] integerValue];
BOOL isBold = [(NSNumber *)[params objectForKey:@"isBold"] boolValue];
NSFont *font = [self _fontOfSize:(size?size:defaultSize) bold:isBold];
NSInteger patternGroup = [(NSNumber *)[params objectForKey:@"patternGroup"] integerValue];
NSError *error = nil;
NSRegularExpression *expr = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive|NSRegularExpressionAnchorsMatchLines error:&error];
NSArray *matches = [expr matchesInString:string options:0 range:range];
for (NSTextCheckingResult *match in matches) {
NSRange range = patternGroup ? [match rangeAtIndex:patternGroup] : [match range];
[self _setTextColor:color range:range];
if (backgroundColor) [self _setBackgroundColor:backgroundColor range:range];
[self _setFont:font range:range];
}
}
[self _reflect];
}
#pragma mark - Changing text attributes
- (void) _setTextColor:(NSColor *)color range:(NSRange)range {
if (!color) return;
[self.content addAttribute:NSForegroundColorAttributeName value:color range:range];
}
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range {
[self.content addAttribute:NSBackgroundColorAttributeName value:color range:range];
}
- (void) _setFont:(NSFont *)font range:(NSRange)range {
[self.content addAttribute:NSFontAttributeName value:font range:range];
}
- (void) _reflect {
NSTextStorage *storage = [self textStorage];
NSAttributedString *content = self.content;
NSRange range = NSMakeRange(0, [content length]);
[content enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop){
[storage setAttributes:attributes range:range];
}];
}
@end
@@ -1,6 +1,6 @@
/*
* configuration for markdown, generated Wed Apr 8 00:13:17 CDT 2015
* by vino@achilleus.local
* configuration for markdown, generated Mon 11 Jul 2011 22:16:51 BST
* by Jonathan@macbook-pro.local
*/
#ifndef __AC_MARKDOWN_D
#define __AC_MARKDOWN_D 1
@@ -8,8 +8,6 @@
#define OS_DARWIN 1
#define USE_DISCOUNT_DL 1
#define while(x) while( (x) != 0 )
#define if(x) if( (x) != 0 )
#define DWORD unsigned int
#define WORD unsigned short
#define BYTE unsigned char
+1 -8
View File
@@ -12,11 +12,6 @@ typedef unsigned int mkd_flag_t;
MMIOT *mkd_in(FILE*,mkd_flag_t); /* assemble input from a file */
MMIOT *mkd_string(const char*,int,mkd_flag_t); /* assemble input from a buffer */
/* line builder for github flavoured markdown
*/
MMIOT *gfm_in(FILE*,mkd_flag_t); /* assemble input from a file */
MMIOT *gfm_string(const char*,int,mkd_flag_t); /* assemble input from a buffer */
void mkd_basename(MMIOT*,char*);
void mkd_initialize();
@@ -26,7 +21,7 @@ void mkd_shlib_destructor();
/* compilation, debugging, cleanup
*/
int mkd_compile(MMIOT*, mkd_flag_t);
void mkd_cleanup(MMIOT*);
int mkd_cleanup(MMIOT*);
/* markup functions
*/
@@ -89,7 +84,6 @@ void mkd_ref_prefix(MMIOT*, char*);
#define MKD_TAGTEXT 0x00000020 /* process text inside an html tag; no
* <em>, no <bold>, no html or [] expansion */
#define MKD_NO_EXT 0x00000040 /* don't allow pseudo-protocols */
#define MKD_NOEXT MKD_NO_EXT /* ^^^ (aliased for user convenience) */
#define MKD_CDATA 0x00000080 /* generate code for xml ![CDATA[...]] */
#define MKD_NOSUPERSCRIPT 0x00000100 /* no A^B */
#define MKD_NORELAXED 0x00000200 /* emphasis happens /everywhere/ */
@@ -105,7 +99,6 @@ void mkd_ref_prefix(MMIOT*, char*);
#define MKD_NOALPHALIST 0x00080000 /* forbid alphabetic lists */
#define MKD_NODLIST 0x00100000 /* forbid definition lists */
#define MKD_EXTRA_FOOTNOTE 0x00200000 /* enable markdown extra-style footnotes */
#define MKD_NOSTYLE 0x00400000 /* don't extract <style> blocks */
#define MKD_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
/* special flags for mkd_in() and mkd_string()
+2 -3
View File
@@ -13,13 +13,12 @@ status_msg "Running configure.sh..."
cd `dirname $0`/../discount/
./configure.sh
make blocktags
status_msg "Copying important files..."
if head -n 1 config.h | grep -q "^/\*$"; then
# remove generated comments in config.h
sed -i '1,/^ *\*\/ *$/ { d; }' <config.h
sed '1,/^ *\*\/ *$/ { d; }' <config.h >../discount-config/config.h && echo 'config.h'
else
cp config.h ../discount-config/config.h && echo 'config.h'
error_msg "Can't locate config.h comments!"
@@ -29,6 +28,6 @@ cp mkdio.h ../discount-config/mkdio.h && echo 'mkdio.h'
status_msg "Clean files from working directory..."
git clean -df -e blocktags -e 'config.h' -e 'mkdio.h'
git clean -f
status_msg "Done!"
+40 -23
View File
@@ -1,30 +1,47 @@
->Copyright (C) 2007 David Loren Parsons.
All rights reserved.<-
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicence, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
1. Redistributions of works must retain the original copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the original copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither my name (David L Parsons) nor the names of contributors to
this code may be used to endorse or promote products derived
from this work without specific prior written permission.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution, and in the same place and form as other
copyright, license and disclaimer information.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment:
This product includes software developed by
David Loren Parsons <http://www.pell.portland.or.us/~orc>
in the same place and form as other third-party acknowledgments.
Alternately, this acknowledgment may appear in the software
itself, in the same form and location as other such third-party
acknowledgments.
4. Except as contained in this notice, the name of David Loren
Parsons shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Software without prior
written authorization from David Loren Parsons.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
+1 -3
View File
@@ -2,7 +2,7 @@ Discount is primarily my work, but it has only reached the point
where it is via contributions, critiques, and bug reports from a
host of other people, some of which are listed before. If your
name isn't on this list, please remind me
-david parsons (orc@pell.portland.or.us)
-david parsons (orc@pell.chi.il.us)
Josh Wood -- Plan9 support.
@@ -29,7 +29,5 @@ Andrew White -- bug reports about the format of generated urls.
Steve Huff -- bug reports about Makefile portability (for Fink)
Ignacio Burgue?o-- bug reports about `>%class%`
Henrik Nyh -- bug reports about embedded html handling.
John J. Foerch -- bug reports about incorrect `&ndash;` and `&mdash;`
translations.
+1 -1
View File
@@ -54,7 +54,7 @@ Csreparse(Cstring *iot, char *buf, int size, int flags)
{
MMIOT f;
___mkd_initmmiot(&f, 0);
___mkd_reparse(buf, size, 0, &f, 0);
___mkd_reparse(buf, size, 0, &f);
___mkd_emblock(&f);
SUFFIX(*iot, T(f.out), S(f.out));
___mkd_freemmiot(&f, 0);
+33 -44
View File
@@ -1,5 +1,4 @@
CC=@CC@ -I.
LFLAGS=-L.
CC=@CC@ -I. -L.
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@
@@ -16,85 +15,75 @@ MKDLIB=libmarkdown
OBJS=mkdio.o markdown.o dumptree.o generate.o \
resource.o docheader.o version.o toc.o css.o \
xml.o Csio.o xmlpage.o basename.o emmatch.o \
github_flavoured.o setup.o tags.o html5.o flags.o @AMALLOC@
setup.o tags.o html5.o flags.o @AMALLOC@
TESTFRAMEWORK=echo cols
MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3
all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK)
install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR)
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)$(BINDIR)
./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR)
@INSTALL_DATA@ mkdio.h $(DESTDIR)$(INCDIR)
install: $(PGMS) $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(LIBDIR) $(DESTDIR)/$(INCDIR)
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)/$(BINDIR)
./librarian.sh install libmarkdown VERSION $(DESTDIR)/$(LIBDIR)
@INSTALL_DATA@ mkdio.h $(DESTDIR)/$(INCDIR)
install.everything: install install.samples install.man
install.samples: $(SAMPLE_PGMS) install $(DESTDIR)$(BINDIR)
@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man1
for x in $(SAMPLE_PGMS); do \
@INSTALL_PROGRAM@ $$x $(DESTDIR)$(BINDIR)/$(SAMPLE_PFX)$$x; \
@INSTALL_DATA@ $$x.1 $(DESTDIR)$(MANDIR)/man1/$(SAMPLE_PFX)$$x.1; \
done
install.samples: $(SAMPLE_PGMS) install $(DESTDIR)/$(BINDIR)
@INSTALL_PROGRAM@ $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
@INSTALL_DATA@ theme.1 makepage.1 mkd2html.1 $(DESTDIR)/$(MANDIR)/man1
install.man:
@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man3
@INSTALL_DATA@ $(MAN3PAGES) $(DESTDIR)$(MANDIR)/man3
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man3
@INSTALL_DATA@ $(MAN3PAGES) $(DESTDIR)/$(MANDIR)/man3
for x in mkd_line mkd_generateline; do \
( echo '.\"' ; echo ".so man3/mkd-line.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3;\
( echo '.\"' ; echo ".so man3/mkd-line.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3;\
done
for x in mkd_in mkd_string; do \
( echo '.\"' ; echo ".so man3/markdown.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3;\
( echo '.\"' ; echo ".so man3/markdown.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3;\
done
for x in mkd_compile mkd_css mkd_generatecss mkd_generatehtml mkd_cleanup mkd_doc_title mkd_doc_author mkd_doc_date; do \
( echo '.\"' ; echo ".so man3/mkd-functions.3" ) > $(DESTDIR)$(MANDIR)/man3/$$x.3; \
( echo '.\"' ; echo ".so man3/mkd-functions.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3; \
done
@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man7
@INSTALL_DATA@ markdown.7 mkd-extensions.7 $(DESTDIR)$(MANDIR)/man7
@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man1
@INSTALL_DATA@ markdown.1 $(DESTDIR)$(MANDIR)/man1
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man7
@INSTALL_DATA@ markdown.7 mkd-extensions.7 $(DESTDIR)/$(MANDIR)/man7
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
@INSTALL_DATA@ markdown.1 $(DESTDIR)/$(MANDIR)/man1
install.everything: install install.man
$(DESTDIR)$(BINDIR):
@INSTALL_DIR@ $(DESTDIR)$(BINDIR)
$(DESTDIR)/$(BINDIR):
@INSTALL_DIR@ $(DESTDIR)/$(BINDIR)
$(DESTDIR)$(INCDIR):
@INSTALL_DIR@ $(DESTDIR)$(INCDIR)
$(DESTDIR)/$(INCDIR):
@INSTALL_DIR@ $(DESTDIR)/$(INCDIR)
$(DESTDIR)$(LIBDIR):
@INSTALL_DIR@ $(DESTDIR)$(LIBDIR)
$(DESTDIR)/$(LIBDIR):
@INSTALL_DIR@ $(DESTDIR)/$(LIBDIR)
version.o: version.c VERSION
$(CC) $(CFLAGS) -DVERSION=\"`cat VERSION`\" -c version.c
VERSION:
@true
tags.o: tags.c blocktags
blocktags: mktags
./mktags > blocktags
$(CC) -DVERSION=\"`cat VERSION`\" -c version.c
# example programs
@THEME@theme: theme.o $(MKDLIB) mkdio.h
@THEME@ $(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
@THEME@ $(CC) -o theme theme.o -lmarkdown @LIBS@
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
$(CC) $(CFLAGS) $(LFLAGS) -o mkd2html mkd2html.o -lmarkdown @LIBS@
$(CC) -o mkd2html mkd2html.o -lmarkdown @LIBS@
markdown: main.o pgm_options.o $(MKDLIB)
$(CC) $(CFLAGS) $(LFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
$(CC) $(CFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
makepage: makepage.c pgm_options.o $(MKDLIB) mkdio.h
$(CC) $(CFLAGS) $(LFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
$(CC) $(CFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
pgm_options.o: pgm_options.c mkdio.h config.h
$(CC) $(CFLAGS) -I. -c pgm_options.c
$(CC) -I. -c pgm_options.c
main.o: main.c mkdio.h config.h
$(CC) $(CFLAGS) -I. -c main.c
$(CC) -I. -c main.c
$(MKDLIB): $(OBJS)
./librarian.sh make $(MKDLIB) VERSION $(OBJS)
@@ -117,7 +106,7 @@ clean:
rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`
distclean spotless: clean
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags ./librarian.sh
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@
Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
amalloc.o: amalloc.c
+1 -1
View File
@@ -5,7 +5,7 @@ language as described in
and passes the Markdown test suite at
<http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>
DISCOUNT is free software written by David Parsons <orc@pell.portland.or.us>;
DISCOUNT is free software written by David Parsons <orc@pell.chi.il.us>;
it is released under a BSD-style license that allows you to do
as you wish with it as long as you don't attempt to claim it as
your own work.
+1 -1
View File
@@ -1 +1 @@
2.1.8
2.1.0
-33
View File
@@ -1,33 +0,0 @@
static struct kw blocktags[] = {
{ "P", 1, 0 },
{ "DL", 2, 0 },
{ "H1", 2, 0 },
{ "H2", 2, 0 },
{ "H3", 2, 0 },
{ "H4", 2, 0 },
{ "H5", 2, 0 },
{ "H6", 2, 0 },
{ "HR", 2, 1 },
{ "OL", 2, 0 },
{ "UL", 2, 0 },
{ "BDO", 3, 0 },
{ "DFN", 3, 0 },
{ "DIV", 3, 0 },
{ "MAP", 3, 0 },
{ "PRE", 3, 0 },
{ "WBR", 3, 0 },
{ "XMP", 3, 0 },
{ "NOBR", 4, 0 },
{ "STYLE", 5, 0 },
{ "TABLE", 5, 0 },
{ "CENTER", 6, 0 },
{ "IFRAME", 6, 0 },
{ "OBJECT", 6, 0 },
{ "SCRIPT", 6, 0 },
{ "ADDRESS", 7, 0 },
{ "LISTING", 7, 0 },
{ "PLAINTEXT", 9, 0 },
{ "BLOCKQUOTE", 10, 0 },
};
#define NR_blocktags 29
+67 -123
View File
@@ -193,8 +193,8 @@ AC_CHECK_FUNCS () {
B=`echo "$1" | sed -e 's/(.*)//'`
case "$B" in
"$1") F="$1()"; need_proto=1 ;;
*) F="$1" ; unset need_proto ;;
"$1") F="$1()" ;;
*) F="$1" ;;
esac
shift
@@ -205,10 +205,6 @@ AC_CHECK_FUNCS () {
shift
done
if [ "$need_proto" ]; then
echo "void $F;" >> ngc$$.c
fi
cat >> ngc$$.c << EOF
main()
{
@@ -389,13 +385,8 @@ EOF
TLOGN " ($AC_CC)"
if [ $status -eq 0 ]; then
if $AC_CC -x c /dev/null -dM -E 2>&1 | grep '__clang__' >/dev/null; then
TLOG " yuck, you're using clang"
IS_CLANG=T
IS_BROKEN_CC=T
elif $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; then
if $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; then
TLOG " oh ick, it looks like gcc"
IS_GCC=T
IS_BROKEN_CC=T
else
TLOG " ok"
@@ -431,6 +422,8 @@ EOF
AC_FAIL " does not compile code properly"
fi
AC_SUB 'CC' "$AC_CC"
__remove ngc$$ ngc$$.c ngc$$.o
return $status
@@ -833,7 +826,9 @@ EOF
# AC_C_VOLATILE checks to see if the compiler supports the volatile keyword
#
AC_C_VOLATILE () {
echo 'f() { volatile char me=1; }' > ngc$$.c
cat > ngc$$.c << EOF
f() { volatile char me=1; }
EOF
LOGN "checking for \"volatile\" keyword"
if __MAKEDOTO ngc$$.c; then
@@ -847,39 +842,10 @@ AC_C_VOLATILE () {
}
#
# AC_C_INLINE checks to see if compiler supports the inline keyword
#
AC_C_INLINE() {
echo 'inline int foo() { return 1; }' > ngc$$.c
LOGN 'Checking for "inline" keyword'
if __MAKEDOTO ngc$$.c; then
rc=0
else
AC_DEFINE inline '/**/'
rc=1
fi
__remove ngc$$.c
return $rc
}
#
# AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints.
#
AC_SCALAR_TYPES () {
rc=1
LOGN "defining WORD & DWORD scalar types"
if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
# windows machine; BYTE, WORD, DWORD already
# defined
echo "#include <WinDef.h>" >> $__cwd/config.h
TLOG " (defined in WinDef.h)"
return 0
fi
cat > ngc$$.c << EOF
#include <stdio.h>
#include <string.h>
@@ -893,6 +859,7 @@ say(char *w, char *v)
: "s:@%s@:%s:g\n", w, v);
}
void
main(argc, argv)
char **argv;
{
@@ -920,6 +887,8 @@ char **argv;
exit(0);
}
EOF
rc=1
LOGN "defining WORD & DWORD scalar types"
if $AC_CC ngc$$.c -o ngc$$; then
while [ "$1" ]; do
case "$1" in
@@ -943,7 +912,6 @@ EOF
0) TLOG "" ;;
*) AC_FAIL " ** FAILED **" ;;
esac
return $rc
}
@@ -955,7 +923,6 @@ AC_OUTPUT () {
AC_SUB 'LIBS' "$AC_LIBS"
AC_SUB 'CONFIGURE_FILES' "$__config_files"
AC_SUB 'GENERATED_FILES' "$*"
AC_SUB 'CC' "$AC_CC"
AC_SUB 'CFLAGS' "$AC_CFLAGS"
AC_SUB 'LDFLAGS' "$AC_LDFLAGS"
AC_SUB 'srcdir' "$AC_SRCDIR"
@@ -1184,8 +1151,6 @@ AC_CHECK_BASENAME() {
cat > ngc$$.c << EOF
#include <string.h>
extern char *basename(char*);
main()
{
char *a = basename("/a/test");
@@ -1197,7 +1162,7 @@ main()
EOF
if $AC_CC -o ngc$$ ngc$$.c $LIBS; then
if ./ngc$$; then
if ngc$$; then
TLOG "(found)"
AC_DEFINE 'HAVE_BASENAME' 1
AC_CHECK_HEADERS libgen.h
@@ -1232,58 +1197,28 @@ AC_COMPILER_PIC () {
return $__rc
}
# generate a macosX librarian
#
__AC_MACOS_LIBRARIAN() {
AC_SUB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
__config_files="$__config_files librarian.sh"
cat > librarian.sh << EOF
#! /bin/sh
# AC_CC_SHLIBS checks if the C compiler can produce shared libraries
# and if it can writes a librarian that handles those libraries for us.
#
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
AC_CC_SHLIBS () {
AC_PROG_CC || AC_FAIL "Need a C compiler to build shared libraries"
AC_PROG_LN_S || AC_FAIL "Need to be able to make symbolic links for shared libraries"
AC_PROG_INSTALL || AC_FAIL "Need an install program to install shared libraries"
LOGN "checking whether the C compiler can build shared libraries "
ACTION=\$1; shift
LIBRARY=\$1; shift
eval \`awk -F. '{ printf "MAJOR=%d\n", \$1;
printf "VERSION=%d.%d.%d\n", \$1, \$2, \$3; }' \$1\`
shift
echo "int some_variable = 0;" > ngc$$.c
LIBNAME=\$LIBRARY.dylib
FULLNAME=\$LIBNAME
case "\$ACTION" in
make) FLAGS="$AC_CFLAGS -dynamiclib"
VFLAGS="-current_version \$VERSION -compatibility_version \$MAJOR"
rm -f \$LIBRARY
if $AC_CC \$FLAGS \$VFLAGS -o \$FULLNAME "\$@"; then
$PROG_LN_S \$FULLNAME \$LIBRARY
if $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
AC_SUB LD_LIBRARY_PATH LD_LIBRARY_PATH
# -Wl option probably works, but be paranoid anyway
_VFLAGS="$AC_PICFLAG -shared -Wl,-soname,ngc$$.so.1"
if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then
USE_SONAME=T
fi
;;
files) echo "\$FULLNAME"
;;
install)$PROG_INSTALL -c \$FULLNAME "\$1"
;;
esac
EOF
chmod +x librarian.sh
}
# Generate an ELF librarian (for Linux, freebsd)
#
__AC_ELF_LIBRARIAN() {
AC_SUB LD_LIBRARY_PATH LD_LIBRARY_PATH
# -Wl option probably works, but be paranoid anyway
_VFLAGS="$AC_PICFLAG -shared -Wl,-soname,ngc$$.so.1"
if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then
USE_SONAME=T
fi
LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
__config_files="$__config_files librarian.sh"
cat > librarian.sh << EOF
LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
__config_files="$__config_files librarian.sh"
cat > librarian.sh << EOF
#! /bin/sh
#
# Build ELF shared libraries, hiding (some) ickiness from the makefile
@@ -1319,37 +1254,46 @@ install)$PROG_INSTALL -c \$FULLNAME "\$1"
;;
esac
EOF
chmod +x librarian.sh
}
#
# AC_CC_SHLIBS checks if the C compiler can produce shared libraries
# and if it can writes a librarian that handles those libraries for us.
#
AC_CC_SHLIBS () {
AC_PROG_CC || AC_FAIL "Need a C compiler to build shared libraries"
AC_PROG_LN_S || AC_FAIL "Need to be able to make symbolic links for shared libraries"
AC_PROG_INSTALL || AC_FAIL "Need an install program to install shared libraries"
LOGN "checking whether the C compiler can build shared libraries "
echo "int some_variable = 0;" > ngc$$.c
if uname -a | grep Darwin >/dev/null; then
# Claims to be macos?
if $AC_CC $AC_PICFLAG -dynamiclib -o ngc$$.so ngc$$.c; then
__AC_MACOS_LIBRARIAN
LOG "(yes; macos dylib)"
__rc=0
else
LOG "(no)"
__rc=1
fi
elif $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
__AC_ELF_LIBRARIAN
chmod +x librarian.sh
LOG "(yes; -shared)"
__rc=0
elif $AC_CC $AC_PICFLAG -dynamiclib -o ngc$$.so ngc$$.c; then
# macosx
AC_SUB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
__config_files="$__config_files librarian.sh"
cat > librarian.sh << EOF
#! /bin/sh
#
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
ACTION=\$1; shift
LIBRARY=\$1; shift
eval \`awk -F. '{ printf "MAJOR=%d\n", \$1;
printf "VERSION=%d.%d.%d\n", \$1, \$2, \$3; }' \$1\`
shift
LIBNAME=\$LIBRARY.dylib
FULLNAME=\$LIBNAME
case "\$ACTION" in
make) FLAGS="$AC_CFLAGS -dynamiclib"
VFLAGS="-current_version \$VERSION -compatibility_version \$MAJOR"
rm -f \$LIBRARY
if $AC_CC \$FLAGS \$VFLAGS -o \$FULLNAME "\$@"; then
$PROG_LN_S \$FULLNAME \$LIBRARY
fi
;;
files) echo "\$FULLNAME"
;;
install)$PROG_INSTALL -c \$FULLNAME "\$1"
;;
esac
EOF
chmod +x librarian.sh
LOG "(yes; macos dylib)"
__rc=0
else
LOG "(no)"
__rc=1
+4 -24
View File
@@ -12,8 +12,6 @@ ac_help='--enable-amalloc Enable memory allocation debugging
--with-dl=X Use Discount, Extra, or Both types of definition list
--with-id-anchor Use id= anchors for table-of-contents links
--with-github-tags Allow `_` and `-` in <> tags
--with-fenced-code Allow fenced code blocks
--with-urlencoded-anchor Use url-encoded chars to multibyte chars in toc links
--enable-all-features Turn on all stable optional features
--shared Build shared libraries (default is static)'
@@ -37,9 +35,6 @@ locals() {
;;
--ENABLE-*) enable=`echo $K | sed -e 's/--ENABLE-//' | tr '-' '_'`
echo WITH_${enable}=T ;;
--DEBIAN-GLITCH)
echo DEBIAN_GLITCH=T
;;
esac
}
@@ -58,38 +53,23 @@ BOTH) AC_DEFINE 'USE_EXTRA_DL' 1
*) AC_FAIL "Unknown value <$WITH_DL> for --with-dl (want 'discount', 'extra', or 'both')" ;;
esac
test "$WITH_FENCED_CODE" && AC_DEFINE "WITH_FENCED_CODE" 1
test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1
test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 1
test "$WITH_URLENCODED_ANCHOR" && AC_DEFINE 'WITH_URLENCODED_ANCHOR' 1
test "$DEBIAN_GLITCH" && AC_DEFINE 'DEBIAN_GLITCH' 1
AC_PROG_CC
test "$TRY_SHARED" && AC_COMPILER_PIC && AC_CC_SHLIBS
if [ "IS_BROKEN_CC" ]; then
case "$AC_CC $AC_CFLAGS" in
*-pedantic*) ;;
*) # hack around deficiencies in gcc and clang
#
AC_DEFINE 'while(x)' 'while( (x) != 0 )'
AC_DEFINE 'if(x)' 'if( (x) != 0 )'
if [ "$IS_CLANG" ]; then
AC_CC="$AC_CC -Wno-implicit-int"
elif [ "$IS_GCC" ]; then
AC_CC="$AC_CC -Wno-return-type -Wno-implicit-int"
fi ;;
esac
fi
case "$AC_CC $AC_CFLAGS" in
*-Wall*) AC_DEFINE 'while(x)' 'while( (x) != 0 )'
AC_DEFINE 'if(x)' 'if( (x) != 0 )' ;;
esac
AC_PROG ar || AC_FAIL "$TARGET requires ar"
AC_PROG ranlib
AC_C_VOLATILE
AC_C_CONST
AC_C_INLINE
AC_SCALAR_TYPES sub hdr
AC_CHECK_BASENAME
+2 -2
View File
@@ -27,9 +27,9 @@
#define DELETE(x) ALLOCATED(x) ? (free(T(x)), S(x) = (x).alloc = 0) \
: ( S(x) = 0 )
#define CLIP(t,i,sz) \
S(t) -= ( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
(memmove(&T(t)[i], &T(t)[i+sz], (S(t)-(i+sz)+1)*sizeof(T(t)[0])), \
(sz)) : 0
S(t) -= (sz)) : -1
#define RESERVE(x, sz) T(x) = ((x).alloc > S(x) + (sz) \
? T(x) \
+1 -1
View File
@@ -22,7 +22,7 @@
* of html has been generated.
*
* It should create MarkdownTest_1.0 (and _1.0.3)
* compatible emphasis for non-pathological cases
* compatable emphasis for non-pathological cases
* and it should fail in a standards-compliant way
* when someone attempts to feed it junk.
*
-1
View File
@@ -29,7 +29,6 @@ static struct flagnames flagnames[] = {
{ MKD_NOALPHALIST, "!ALPHALIST" },
{ MKD_NODLIST, "!DLIST" },
{ MKD_EXTRA_FOOTNOTE, "FOOTNOTE" },
{ MKD_NOSTYLE, "!STYLE" },
};
#define NR(x) (sizeof x/sizeof x[0])
+80 -160
View File
@@ -38,19 +38,9 @@ push(char *bfr, int size, MMIOT *f)
}
/*
* push a character into the generator input buffer
*/
static void
pushc(char c, MMIOT *f)
{
EXPAND(f->in) = c;
}
/* look <i> characters ahead of the cursor.
*/
static inline int
static int
peek(MMIOT *f, int i)
{
@@ -62,7 +52,7 @@ peek(MMIOT *f, int i)
/* pull a byte from the input buffer
*/
static inline int
static int
pull(MMIOT *f)
{
return ( f->isp < S(f->in) ) ? T(f->in)[f->isp++] : EOF;
@@ -71,27 +61,23 @@ pull(MMIOT *f)
/* return a pointer to the current position in the input buffer.
*/
static inline char*
static char*
cursor(MMIOT *f)
{
return T(f->in) + f->isp;
}
static inline int
static int
isthisspace(MMIOT *f, int i)
{
int c = peek(f, i);
if ( c == EOF )
return 1;
if ( c & 0x80 )
return 0;
return isspace(c) || (c < ' ');
return isspace(c) || (c == EOF);
}
static inline int
static int
isthisalnum(MMIOT *f, int i)
{
int c = peek(f, i);
@@ -100,7 +86,7 @@ isthisalnum(MMIOT *f, int i)
}
static inline int
static int
isthisnonword(MMIOT *f, int i)
{
return isthisspace(f, i) || ispunct(peek(f,i));
@@ -197,10 +183,9 @@ Qem(MMIOT *f, char c, int count)
/* generate html from a markup fragment
*/
void
___mkd_reparse(char *bfr, int size, int flags, MMIOT *f, char *esc)
___mkd_reparse(char *bfr, int size, int flags, MMIOT *f)
{
MMIOT sub;
struct escaped e;
___mkd_initmmiot(&sub, f->footnotes);
@@ -208,16 +193,8 @@ ___mkd_reparse(char *bfr, int size, int flags, MMIOT *f, char *esc)
sub.cb = f->cb;
sub.ref_prefix = f->ref_prefix;
if ( esc ) {
sub.esc = &e;
e.up = f->esc;
e.text = esc;
}
else
sub.esc = f->esc;
push(bfr, size, &sub);
pushc(0, &sub);
EXPAND(sub.in) = 0;
S(sub.in)--;
text(&sub);
@@ -229,23 +206,6 @@ ___mkd_reparse(char *bfr, int size, int flags, MMIOT *f, char *esc)
}
/*
* check the escape list for special cases
*/
static int
escaped(MMIOT *f, char c)
{
struct escaped *thing = f->esc;
while ( thing ) {
if ( strchr(thing->text, c) )
return 1;
thing = thing->up;
}
return 0;
}
/*
* write out a url, escaping problematic characters
*/
@@ -272,7 +232,7 @@ puturl(char *s, int size, MMIOT *f, int display)
Qstring("%22", f);
else if ( isalnum(c) || ispunct(c) || (display && isspace(c)) )
Qchar(c, f);
else if ( c == MKD_EOLN ) /* untokenize hard return */
else if ( c == 003 ) /* untokenize ^C */
Qstring(" ", f);
else
Qprintf(f, "%%%02X", c);
@@ -593,7 +553,7 @@ printlinkyref(MMIOT *f, linkytype *tag, char *link, int size)
puturl(link + tag->szpat, size - tag->szpat, f, 0);
}
else
___mkd_reparse(link + tag->szpat, size - tag->szpat, MKD_TAGTEXT, f, 0);
___mkd_reparse(link + tag->szpat, size - tag->szpat, MKD_TAGTEXT, f);
Qstring(tag->link_sfx, f);
@@ -625,10 +585,10 @@ extra_linky(MMIOT *f, Cstring text, Footnote *ref)
return 0;
if ( f->flags & IS_LABEL )
___mkd_reparse(T(text), S(text), linkt.flags, f, 0);
___mkd_reparse(T(text), S(text), linkt.flags, f);
else {
ref->flags |= REFERENCED;
ref->refnumber = ++ f->footnotes->reference;
ref->refnumber = ++ f->reference;
Qprintf(f, "<sup id=\"%sref:%d\"><a href=\"#%s:%d\" rel=\"footnote\">%d</a></sup>",
p_or_nothing(f), ref->refnumber,
p_or_nothing(f), ref->refnumber, ref->refnumber);
@@ -644,8 +604,7 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
{
linkytype *tag;
if ( image )
if ( image || (ref == 0) )
tag = &imaget;
else if ( tag = pseudo(ref->link) ) {
if ( f->flags & (MKD_NO_EXT|MKD_SAFELINK) )
@@ -665,7 +624,7 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
return 0;
if ( f->flags & IS_LABEL )
___mkd_reparse(T(text), S(text), tag->flags, f, 0);
___mkd_reparse(T(text), S(text), tag->flags, f);
else if ( tag->link_pfx ) {
printlinkyref(f, tag, T(ref->link), S(ref->link));
@@ -676,12 +635,12 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
if ( S(ref->title) ) {
Qstring(" title=\"", f);
___mkd_reparse(T(ref->title), S(ref->title), MKD_TAGTEXT, f, 0);
___mkd_reparse(T(ref->title), S(ref->title), MKD_TAGTEXT, f);
Qchar('"', f);
}
Qstring(tag->text_pfx, f);
___mkd_reparse(T(text), S(text), tag->flags, f, 0);
___mkd_reparse(T(text), S(text), tag->flags, f);
Qstring(tag->text_sfx, f);
}
else
@@ -741,14 +700,15 @@ linkylinky(int image, MMIOT *f)
S(key.tag) = S(name);
}
if ( ref = bsearch(&key, T(f->footnotes->note),
S(f->footnotes->note),
sizeof key, (stfu)__mkd_footsort) ) {
if ( ref = bsearch(&key, T(*f->footnotes), S(*f->footnotes),
sizeof key, (stfu)__mkd_footsort) ) {
if ( extra_footnote )
status = extra_linky(f,name,ref);
else
status = linkyformat(f, name, image, ref);
}
else if ( f->flags & IS_LABEL )
status = linkyformat(f, name, image, 0);
}
}
}
@@ -785,12 +745,8 @@ static void
mangle(char *s, int len, MMIOT *f)
{
while ( len-- > 0 ) {
#if DEBIAN_GLITCH
Qprintf(f, "&#02d;", *((unsigned char*)(s++)) );
#else
Qstring("&#", f);
Qprintf(f, COINTOSS() ? "x%02x;" : "%02d;", *((unsigned char*)(s++)) );
#endif
}
}
@@ -852,10 +808,8 @@ code(MMIOT *f, char *s, int length)
int i,c;
for ( i=0; i < length; i++ )
if ( (c = s[i]) == MKD_EOLN) /* ^C: expand back to 2 spaces */
if ( (c = s[i]) == 003) /* ^C: expand back to 2 spaces */
Qstring(" ", f);
else if ( c == '\\' && (i < length-1) && escaped(f, s[i+1]) )
cputc(s[++i], f);
else
cputc(c, f);
} /* code */
@@ -867,7 +821,7 @@ static void
delspan(MMIOT *f, int size)
{
Qstring("<del>", f);
___mkd_reparse(cursor(f)-1, size, 0, f, 0);
___mkd_reparse(cursor(f)-1, size, 0, f);
Qstring("</del>", f);
}
@@ -1059,14 +1013,13 @@ maybe_autolink(MMIOT *f)
/* greedily scan forward for the end of a legitimate link.
*/
for ( size=0; (c=peek(f, size+1)) != EOF; size++ ) {
for ( size=0; (c=peek(f, size+1)) != EOF; size++ )
if ( c == '\\' ) {
if ( peek(f, size+2) != EOF )
++size;
}
else if ( isspace(c) || strchr("'\"()[]{}<>`", c) || c == MKD_EOLN )
else if ( isspace(c) || strchr("'\"()[]{}<>`", c) )
break;
}
if ( (size > 1) && process_possible_link(f, size) ) {
shift(f, size);
@@ -1105,7 +1058,7 @@ islike(MMIOT *f, char *s)
int len;
int i;
if ( s[0] == '|' ) {
if ( s[0] == '<' ) {
if ( !isthisnonword(f, -1) )
return 0;
++s;
@@ -1114,7 +1067,7 @@ islike(MMIOT *f, char *s)
if ( !(len = strlen(s)) )
return 0;
if ( s[len-1] == '|' ) {
if ( s[len-1] == '>' ) {
if ( !isthisnonword(f,len-1) )
return 0;
len--;
@@ -1133,25 +1086,25 @@ static struct smarties {
char *entity;
int shift;
} smarties[] = {
{ '\'', "'s|", "rsquo", 0 },
{ '\'', "'t|", "rsquo", 0 },
{ '\'', "'re|", "rsquo", 0 },
{ '\'', "'ll|", "rsquo", 0 },
{ '\'', "'ve|", "rsquo", 0 },
{ '\'', "'m|", "rsquo", 0 },
{ '\'', "'d|", "rsquo", 0 },
{ '-', "---", "mdash", 2 },
{ '-', "--", "ndash", 1 },
{ '\'', "'s>", "rsquo", 0 },
{ '\'', "'t>", "rsquo", 0 },
{ '\'', "'re>", "rsquo", 0 },
{ '\'', "'ll>", "rsquo", 0 },
{ '\'', "'ve>", "rsquo", 0 },
{ '\'', "'m>", "rsquo", 0 },
{ '\'', "'d>", "rsquo", 0 },
{ '-', "--", "mdash", 1 },
{ '-', "<->", "ndash", 0 },
{ '.', "...", "hellip", 2 },
{ '.', ". . .", "hellip", 4 },
{ '(', "(c)", "copy", 2 },
{ '(', "(r)", "reg", 2 },
{ '(', "(tm)", "trade", 3 },
{ '3', "|3/4|", "frac34", 2 },
{ '3', "|3/4ths|", "frac34", 2 },
{ '1', "|1/2|", "frac12", 2 },
{ '1', "|1/4|", "frac14", 2 },
{ '1', "|1/4th|", "frac14", 2 },
{ '3', "<3/4>", "frac34", 2 },
{ '3', "<3/4ths>", "frac34", 2 },
{ '1', "<1/2>", "frac12", 2 },
{ '1', "<1/4>", "frac14", 2 },
{ '1', "<1/4th>", "frac14", 2 },
{ '&', "&#0;", 0, 3 },
} ;
#define NRSMART ( sizeof smarties / sizeof smarties[0] )
@@ -1193,7 +1146,7 @@ smartypants(int c, int *flags, MMIOT *f)
break;
else if ( c == '\'' && peek(f, j+1) == '\'' ) {
Qstring("&ldquo;", f);
___mkd_reparse(cursor(f)+1, j-2, 0, f, 0);
___mkd_reparse(cursor(f)+1, j-2, 0, f);
Qstring("&rdquo;", f);
shift(f,j+1);
return 1;
@@ -1213,14 +1166,11 @@ smartypants(int c, int *flags, MMIOT *f)
* let the caller figure it out.
*/
static int
tickhandler(MMIOT *f, int tickchar, int minticks, int allow_space, spanhandler spanner)
tickhandler(MMIOT *f, int tickchar, int minticks, spanhandler spanner)
{
int endticks, size;
int tick = nrticks(0, tickchar, f);
if ( !allow_space && isspace(peek(f,tick)) )
return 0;
if ( (tick >= minticks) && (size = matchticks(f,tickchar,tick,&endticks)) ) {
if ( endticks < tick ) {
size += (tick - endticks);
@@ -1259,8 +1209,7 @@ text(MMIOT *f)
switch (c) {
case 0: break;
case MKD_EOLN:
Qstring(tag_text(f) ? " " : "<br/>", f);
case 3: Qstring(tag_text(f) ? " " : "<br/>", f);
break;
case '>': if ( tag_text(f) )
@@ -1316,7 +1265,7 @@ text(MMIOT *f)
shift(f,len);
}
Qstring("<sup>",f);
___mkd_reparse(sup, len, 0, f, "()");
___mkd_reparse(sup, len, 0, f);
Qstring("</sup>", f);
}
break;
@@ -1345,27 +1294,18 @@ text(MMIOT *f)
}
break;
case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT)) || ! tickhandler(f,c,2,0, delspan) )
case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT)) || !tickhandler(f,c,2,delspan) )
Qchar(c, f);
break;
case '`': if ( tag_text(f) || !tickhandler(f,c,1,1,codespan) )
case '`': if ( tag_text(f) || !tickhandler(f,c,1,codespan) )
Qchar(c, f);
break;
case '\\': switch ( c = pull(f) ) {
case '&': Qstring("&amp;", f);
break;
case '<': c = peek(f,1);
if ( (c == EOF) || isspace(c) )
Qstring("&lt;", f);
else {
/* Markdown.pl does not escape <[nonwhite]
* sequences */
Qchar('\\', f);
shift(f, -1);
}
case '<': Qstring("&lt;", f);
break;
case '^': if ( f->flags & (MKD_STRICT|MKD_NOSUPERSCRIPT) ) {
Qchar('\\', f);
@@ -1384,16 +1324,16 @@ text(MMIOT *f)
Qchar(c, f);
break;
case EOF: Qchar('\\', f);
case '>': case '#': case '.': case '-':
case '+': case '{': case '}': case ']':
case '!': case '[': case '*': case '_':
case '\\':case '(': case ')':
case '`': Qchar(c, f);
break;
default: if ( escaped(f,c) ||
strchr(">#.-+{}]![*_\\()`", c) )
Qchar(c, f);
else {
Qchar('\\', f);
shift(f, -1);
}
default:
Qchar('\\', f);
if ( c != EOF )
shift(f,-1);
break;
}
break;
@@ -1454,9 +1394,8 @@ printheader(Paragraph *pp, MMIOT *f)
enum e_alignments { a_NONE, a_CENTER, a_LEFT, a_RIGHT };
static char* alignments[] = { "", " style=\"text-align:center;\"",
" style=\"text-align:left;\"",
" style=\"text-align:right;\"" };
static char* alignments[] = { "", " align=\"center\"", " align=\"left\"",
" align=\"right\"" };
typedef STRING(int) Istring;
@@ -1464,14 +1403,9 @@ static int
splat(Line *p, char *block, Istring align, int force, MMIOT *f)
{
int first,
idx = p->dle,
idx = 0,
colno = 0;
___mkd_tidy(&p->text);
if ( T(p->text)[S(p->text)-1] == '|' )
--S(p->text);
Qstring("<tr>\n", f);
while ( idx < S(p->text) ) {
first = idx;
@@ -1487,7 +1421,7 @@ splat(Line *p, char *block, Istring align, int force, MMIOT *f)
Qprintf(f, "<%s%s>",
block,
alignments[ (colno < S(align)) ? T(align)[colno] : a_NONE ]);
___mkd_reparse(T(p->text)+first, idx-first, 0, f, "|");
___mkd_reparse(T(p->text)+first, idx-first, 0, f);
Qprintf(f, "</%s>\n", block);
idx++;
colno++;
@@ -1509,27 +1443,22 @@ printtable(Paragraph *pp, MMIOT *f)
Line *hdr, *dash, *body;
Istring align;
int hcols,start;
int start;
int hcols;
char *p;
enum e_alignments it;
if ( !(pp->text && pp->text->next) )
return 0;
hdr = pp->text;
dash= hdr->next;
body= dash->next;
if ( T(hdr->text)[hdr->dle] == '|' ) {
/* trim leading pipe off all lines
*/
Line *r;
for ( r = pp->text; r; r = r->next )
r->dle ++;
}
/* figure out cell alignments */
/* first figure out cell alignments */
CREATE(align);
for (p=T(dash->text), start=dash->dle; start < S(dash->text); ) {
for (p=T(dash->text), start=0; start < S(dash->text); ) {
char first, last;
int end;
@@ -1542,10 +1471,8 @@ printtable(Paragraph *pp, MMIOT *f)
last = p[end];
}
}
it = ( first == ':' ) ? (( last == ':') ? a_CENTER : a_LEFT)
: (( last == ':') ? a_RIGHT : a_NONE );
EXPAND(align) = it;
EXPAND(align) = ( first == ':' ) ? (( last == ':') ? a_CENTER : a_LEFT)
: (( last == ':') ? a_RIGHT : a_NONE );
start = 1+end;
}
@@ -1584,14 +1511,13 @@ printblock(Paragraph *pp, MMIOT *f)
&& T(t->text)[S(t->text)-2] == ' '
&& T(t->text)[S(t->text)-1] == ' ' ) {
push(T(t->text), S(t->text)-2, f);
pushc(MKD_EOLN, f);
pushc('\n', f);
push("\003\n", 2, f);
}
else {
___mkd_tidy(&t->text);
push(T(t->text), S(t->text), f);
if ( t->next )
pushc('\n', f);
push("\n", 1, f);
}
}
t = t->next;
@@ -1604,17 +1530,11 @@ printblock(Paragraph *pp, MMIOT *f)
static void
printcode(Line *t, char *lang, MMIOT *f)
printcode(Line *t, MMIOT *f)
{
int blanks;
Qstring("<pre><code", f);
if (lang) {
Qstring(" class=\"", f);
Qstring(lang, f);
Qstring("\"", f);
}
Qstring(">", f);
Qstring("<pre><code>", f);
for ( blanks = 0; t ; t = t->next ) {
if ( S(t->text) > t->dle ) {
while ( blanks ) {
@@ -1678,7 +1598,7 @@ definitionlist(Paragraph *p, MMIOT *f)
for ( ; p ; p = p->next) {
for ( tag = p->text; tag; tag = tag->next ) {
Qstring("<dt>", f);
___mkd_reparse(T(tag->text), S(tag->text), 0, f, 0);
___mkd_reparse(T(tag->text), S(tag->text), 0, f);
Qstring("</dt>\n", f);
}
@@ -1727,7 +1647,7 @@ display(Paragraph *p, MMIOT *f)
break;
case CODE:
printcode(p->text, p->lang, f);
printcode(p->text, f);
break;
case QUOTE:
@@ -1776,14 +1696,14 @@ mkd_extra_footnotes(MMIOT *m)
int j, i;
Footnote *t;
if ( m->footnotes->reference == 0 )
if ( m->reference == 0 )
return;
Csprintf(&m->out, "\n<div class=\"footnotes\">\n<hr/>\n<ol>\n");
for ( i=1; i <= m->footnotes->reference; i++ ) {
for ( j=0; j < S(m->footnotes->note); j++ ) {
t = &T(m->footnotes->note)[j];
for ( i=1; i <= m->reference; i++ ) {
for ( j=0; j < S(*m->footnotes); j++ ) {
t = &T(*m->footnotes)[j];
if ( (t->refnumber == i) && (t->flags & REFERENCED) ) {
Csprintf(&m->out, "<li id=\"%s:%d\">\n<p>",
p_or_nothing(m), t->refnumber);
-100
View File
@@ -1,100 +0,0 @@
/*
* github_flavoured -- implement the obnoxious "returns are hard newlines"
* feature in github flavoured markdown.
*
* Copyright (C) 2012 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
/* build a Document from any old input.
*/
typedef int (*getc_func)(void*);
Document *
gfm_populate(getc_func getc, void* ctx, int flags)
{
Cstring line;
Document *a = __mkd_new_Document();
int c;
int pandoc = 0;
if ( !a ) return 0;
a->tabstop = (flags & MKD_TABSTOP) ? 4 : TABSTOP;
CREATE(line);
while ( (c = (*getc)(ctx)) != EOF ) {
if ( c == '\n' ) {
if ( pandoc != EOF && pandoc < 3 ) {
if ( S(line) && (T(line)[0] == '%') )
pandoc++;
else
pandoc = EOF;
}
if (pandoc == EOF) {
EXPAND(line) = ' ';
EXPAND(line) = ' ';
}
__mkd_enqueue(a, &line);
S(line) = 0;
}
else if ( isprint(c) || isspace(c) || (c & 0x80) )
EXPAND(line) = c;
}
if ( S(line) )
__mkd_enqueue(a, &line);
DELETE(line);
if ( (pandoc == 3) && !(flags & (MKD_NOHEADER|MKD_STRICT)) ) {
/* the first three lines started with %, so we have a header.
* clip the first three lines out of content and hang them
* off header.
*/
Line *headers = T(a->content);
a->title = headers; __mkd_header_dle(a->title);
a->author= headers->next; __mkd_header_dle(a->author);
a->date = headers->next->next; __mkd_header_dle(a->date);
T(a->content) = headers->next->next->next;
}
return a;
}
/* convert a block of text into a linked list
*/
Document *
gfm_string(const char *buf, int len, DWORD flags)
{
struct string_stream about;
about.data = buf;
about.size = len;
return gfm_populate((getc_func)__mkd_io_strget, &about, flags & INPUT_MASK);
}
/* convert a file into a linked list
*/
Document *
gfm_in(FILE *f, DWORD flags)
{
return gfm_populate((getc_func)fgetc, f, flags & INPUT_MASK);
}
+2
View File
@@ -10,6 +10,8 @@ mkd_with_html5_tags()
if ( populated ) return;
populated = 1;
mkd_prepare_tags();
mkd_define_tag("ASIDE", 0);
mkd_define_tag("FOOTER", 0);
mkd_define_tag("HEADER", 0);
+7 -25
View File
@@ -18,7 +18,6 @@
#include "config.h"
#include "amalloc.h"
#include "pgm_options.h"
#include "tags.h"
#if HAVE_LIBGEN_H
#include <libgen.h>
@@ -60,7 +59,7 @@ complain(char *fmt, ...)
}
int
float
main(int argc, char **argv)
{
int opt;
@@ -68,12 +67,9 @@ main(int argc, char **argv)
mkd_flag_t flags = 0;
int debug = 0;
int toc = 0;
int content = 1;
int version = 0;
int with_html5 = 0;
int styles = 0;
int use_mkd_line = 0;
int github_flavoured = 0;
char *extra_footnote_prefix = 0;
char *urlflags = 0;
char *text = 0;
@@ -88,7 +84,7 @@ main(int argc, char **argv)
pgm = basename(argv[0]);
opterr = 1;
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:Gno:s:St:TV")) != EOF ) {
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:o:s:t:TV")) != EOF ) {
switch (opt) {
case '5': with_html5 = 1;
break;
@@ -114,19 +110,13 @@ main(int argc, char **argv)
else if ( !set_flag(&flags, optarg) )
complain("unknown option <%s>", optarg);
break;
case 'G': github_flavoured = 1;
break;
case 'n': content = 0;
break;
case 's': text = optarg;
break;
case 'S': styles = 1;
break;
case 't': text = optarg;
use_mkd_line = 1;
break;
case 'T': toc = 1;
break;
case 's': text = optarg;
break;
case 'C': extra_footnote_prefix = optarg;
break;
case 'o': if ( ofile ) {
@@ -165,10 +155,7 @@ main(int argc, char **argv)
rc = mkd_generateline( text, strlen(text), stdout, flags);
else {
if ( text ) {
doc = github_flavoured ? gfm_string(text, strlen(text), flags)
: mkd_string(text, strlen(text), flags) ;
if ( !doc ) {
if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) {
perror(text);
exit(1);
}
@@ -178,9 +165,7 @@ main(int argc, char **argv)
perror(argv[0]);
exit(1);
}
doc = github_flavoured ? gfm_in(stdin,flags) : mkd_in(stdin,flags);
if ( !doc ) {
if ( (doc = mkd_in(stdin,flags)) == 0 ) {
perror(argc ? argv[0] : "stdin");
exit(1);
}
@@ -200,12 +185,9 @@ main(int argc, char **argv)
rc = 1;
if ( mkd_compile(doc, flags) ) {
rc = 0;
if ( styles )
mkd_generatecss(doc, stdout);
if ( toc )
mkd_generatetoc(doc, stdout);
if ( content )
mkd_generatehtml(doc, stdout);
mkd_generatehtml(doc, stdout);
mkd_cleanup(doc);
}
}
+1 -1
View File
@@ -42,4 +42,4 @@ utility exits 0 on success, and >0 if an error occurs.
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.portland.or.us
.Pq Li orc@pell.chi.il.us
+1
View File
@@ -22,6 +22,7 @@ basename(char *p)
char *pgm = "makepage";
float
main(argc, argv)
int argc;
char **argv;
+4 -12
View File
@@ -15,9 +15,7 @@
.Op Fl C Ar prefix
.Op Fl F Pa bitmap
.Op Fl f Ar flags
.Op Fl n
.Op Fl o Pa file
.Op Fl S
.Op Fl s Pa text
.Op Fl t Pa text
.Op Pa textfile
@@ -109,8 +107,6 @@ Allow alphabetic lists.
Allow definition lists.
.It Ar footnote
Allow markdown extra-style footnotes.
.It Ar styles
Extract <style> blocks from the output.
.El
.Pp
As an example, the option
@@ -127,13 +123,6 @@ described in
.Xr markdown 3
(the flag values are defined in
.Pa mkdio.h )
.It Fl n
Don't write generated html.
.It Fl o Pa file
Write the generated html to
.Pa file .
.It Fl S
output <style> blocks.
.It Fl V
Show the version# and compile-time configuration data.
.Pp
@@ -149,6 +138,9 @@ was configured to use the specified tabstop.
.It Fl VV
Show the version#, the compile-time configuration, and the
run-time configuration.
.It Fl o Pa file
Write the generated html to
.Pa file .
.It Fl t Ar text
Use
.Xr mkd_text 3
@@ -176,4 +168,4 @@ utility exits 0 on success, and >0 if an error occurs.
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.portland.or.us
.Pq Li orc@pell.chi.il.us
+151 -260
View File
@@ -22,9 +22,6 @@ typedef int (*stfu)(const void*,const void*);
typedef ANCHOR(Paragraph) ParagraphRoot;
static Paragraph *Pp(ParagraphRoot *, Line *, int);
static Paragraph *compile(Line *, int, MMIOT *);
/* case insensitive string sort for Footnote tags.
*/
int
@@ -80,7 +77,7 @@ mkd_firstnonblank(Line *p)
}
static inline int
static int
blankline(Line *p)
{
return ! (p && (S(p->text) > p->dle) );
@@ -176,79 +173,6 @@ splitline(Line *t, int cutpoint)
}
}
#define UNCHECK(l) ((l)->flags &= ~CHECKED)
#ifdef WITH_FENCED_CODE
# define UNLESS_FENCED(t) if (fenced) { \
other = 1; l->count += (c == ' ' ? 0 : -1); \
} else { t; }
#else
# define UNLESS_FENCED(t) t;
#endif
/*
* walk a line, seeing if it's any of half a dozen interesting regular
* types.
*/
static void
checkline(Line *l)
{
int eol, i;
int dashes = 0, spaces = 0,
equals = 0, underscores = 0,
stars = 0, tildes = 0, other = 0,
backticks = 0, fenced = 0;
l->flags |= CHECKED;
l->kind = chk_text;
l->count = 0;
if (l->dle >= 4) { l->kind=chk_code; return; }
for ( eol = S(l->text); eol > l->dle && isspace(T(l->text)[eol-1]); --eol )
;
for (i=l->dle; i<eol; i++) {
register int c = T(l->text)[i];
if ( c != ' ' ) l->count++;
switch (c) {
case '-': UNLESS_FENCED(dashes = 1); break;
case ' ': UNLESS_FENCED(spaces = 1); break;
case '=': equals = 1; break;
case '_': UNLESS_FENCED(underscores = 1); break;
case '*': stars = 1; break;
#if WITH_FENCED_CODE
case '~': if (other) return; fenced = 1; tildes = 1; break;
case '`': if (other) return; fenced = 1; backticks = 1; break;
#endif
default:
other = 1;
l->count--;
if (!fenced) return;
}
}
if ( dashes + equals + underscores + stars + tildes + backticks > 1 )
return;
if ( spaces ) {
if ( (underscores || stars || dashes) )
l->kind = chk_hr;
return;
}
if ( stars || underscores ) { l->kind = chk_hr; }
else if ( dashes ) { l->kind = chk_dash; }
else if ( equals ) { l->kind = chk_equal; }
#if WITH_FENCED_CODE
else if ( tildes ) { l->kind = chk_tilde; }
else if ( backticks ) { l->kind = chk_backtick; }
#endif
}
static Line *
commentblock(Paragraph *p, int *unclosed)
@@ -337,6 +261,47 @@ htmlblock(Paragraph *p, struct kw *tag, int *unclosed)
}
/* tables look like
* header|header{|header}
* ------|------{|......}
* {body lines}
*/
static int
istable(Line *t)
{
char *p;
Line *dashes, *body;
int l;
int dashed = 0;
/* three lines, first must contain |,
second must be ---|---,
third must contain |
*/
if ( !(t->flags & PIPECHAR) )
return 0;
dashes = t->next;
if ( !(dashes && (dashes->flags & PIPECHAR)) )
return 0;
body = dashes->next;
if ( !(body && (body->flags & PIPECHAR)) )
return 0;
/* second line must contain - or | and nothing
* else except for whitespace or :
*/
for ( p = T(dashes->text), l = S(dashes->text); l > 0; ++p, --l)
if ( *p == '-' )
dashed = 1;
else if ( ! ((*p == '|') || (*p == ':') || isspace(*p)) )
return 0;
return dashed;
}
/* footnotes look like ^<whitespace>{0,3}[stuff]: <content>$
*/
static int
@@ -357,46 +322,76 @@ isfootnote(Line *t)
}
static inline int
static int
isquote(Line *t)
{
return (t->dle < 4 && T(t->text)[t->dle] == '>');
int j;
for ( j=0; j < 4; j++ )
if ( T(t->text)[j] == '>' )
return 1;
else if ( !isspace(T(t->text)[j]) )
return 0;
return 0;
}
static inline int
static int
dashchar(char c)
{
return (c == '*') || (c == '-') || (c == '_');
}
static int
iscode(Line *t)
{
return (t->dle >= 4);
}
static inline int
static int
ishr(Line *t)
{
if ( ! (t->flags & CHECKED) )
checkline(t);
int i, count=0;
char dash = 0;
char c;
if ( t->count > 2 )
return t->kind == chk_hr || t->kind == chk_dash || t->kind == chk_equal;
return 0;
if ( iscode(t) ) return 0;
for ( i = 0; i < S(t->text); i++) {
c = T(t->text)[i];
if ( (dash == 0) && dashchar(c) )
dash = c;
if ( c == dash ) ++count;
else if ( !isspace(c) )
return 0;
}
return (count >= 3);
}
static int
issetext(Line *t, int *htyp)
{
Line *n;
/* check for setext-style HEADER
* ======
int i;
/* then check for setext-style HEADER
* ======
*/
if ( (n = t->next) ) {
if ( !(n->flags & CHECKED) )
checkline(n);
if ( t->next ) {
char *q = T(t->next->text);
int last = S(t->next->text);
if ( n->kind == chk_dash || n->kind == chk_equal ) {
if ( (*q == '=') || (*q == '-') ) {
/* ignore trailing whitespace */
while ( (last > 1) && isspace(q[last-1]) )
--last;
for (i=1; i < last; i++)
if ( q[0] != q[i] )
return 0;
*htyp = SETEXT;
return 1;
}
@@ -408,31 +403,28 @@ issetext(Line *t, int *htyp)
static int
ishdr(Line *t, int *htyp)
{
int i;
/* first check for etx-style ###HEADER###
*/
/* leading run of `#`'s ?
*/
for ( i=0; T(t->text)[i] == '#'; ++i)
;
/* ANY leading `#`'s make this into an ETX header
*/
if ( (t->dle == 0) && (S(t->text) > 1) && (T(t->text)[0] == '#') ) {
if ( i && (i < S(t->text) || i > 1) ) {
*htyp = ETX;
return 1;
}
/* And if not, maybe it's a SETEXT header instead
*/
return issetext(t, htyp);
}
static inline int
end_of_block(Line *t)
{
int dummy;
if ( !t )
return 0;
return ( (S(t->text) <= t->dle) || ishr(t) || ishdr(t, &dummy) );
}
static Line*
is_discount_dt(Line *t, int *clip)
{
@@ -466,12 +458,13 @@ static Line*
is_extra_dt(Line *t, int *clip)
{
#if USE_EXTRA_DL
int i;
if ( t && t->next && S(t->text) && T(t->text)[0] != '='
if ( t && t->next && T(t->text)[0] != '='
&& T(t->text)[S(t->text)-1] != '=') {
Line *x;
if ( iscode(t) || end_of_block(t) )
if ( iscode(t) || blankline(t) || ishdr(t,&i) || ishr(t) )
return 0;
if ( (x = skipempty(t->next)) && is_extra_dd(x) ) {
@@ -507,7 +500,7 @@ islist(Line *t, int *clip, DWORD flags, int *list_type)
int i, j;
char *q;
if ( end_of_block(t) )
if ( /*iscode(t) ||*/ blankline(t) || ishdr(t,&i) || ishr(t) )
return 0;
if ( !(flags & (MKD_NODLIST|MKD_STRICT)) && isdefinition(t,clip,list_type) )
@@ -535,7 +528,7 @@ islist(Line *t, int *clip, DWORD flags, int *list_type)
strtoul(T(t->text)+t->dle, &q, 10);
if ( (q > T(t->text)+t->dle) && (q == T(t->text) + (j-1)) ) {
j = nextnonblank(t,j);
*clip = j;
*clip = (j > 4) ? 4 : j;
*list_type = OL;
return AL;
}
@@ -578,7 +571,6 @@ headerblock(Paragraph *pp, int htyp)
++i;
CLIP(p->text, 0, i);
UNCHECK(p);
for (j=S(p->text); (j > 1) && (T(p->text)[j-1] == '#'); --j)
;
@@ -615,57 +607,6 @@ codeblock(Paragraph *p)
}
#ifdef WITH_FENCED_CODE
static int
iscodefence(Line *r, int size, line_type kind)
{
if ( !(r->flags & CHECKED) )
checkline(r);
if ( kind )
return (r->kind == kind) && (r->count >= size);
else
return (r->kind == chk_tilde || r->kind == chk_backtick) && (r->count >= size);
}
static Paragraph *
fencedcodeblock(ParagraphRoot *d, Line **ptr)
{
Line *first, *r;
Paragraph *ret;
first = (*ptr);
/* don't allow zero-length code fences
*/
if ( (first->next == 0) || iscodefence(first->next, first->count, 0) )
return 0;
/* find the closing fence, discard the fences,
* return a Paragraph with the contents
*/
for ( r = first; r && r->next; r = r->next )
if ( iscodefence(r->next, first->count, first->kind) ) {
(*ptr) = r->next->next;
ret = Pp(d, first->next, CODE);
if (S(first->text) - first->count > 0) {
char *lang_attr = T(first->text) + first->count;
while ( *lang_attr != 0 && *lang_attr == ' ' ) lang_attr++;
ret->lang = strdup(lang_attr);
}
else {
ret->lang = 0;
}
___mkd_freeLine(first);
___mkd_freeLine(r->next);
r->next = 0;
return ret;
}
return 0;
}
#endif
static int
centered(Line *first, Line *last)
{
@@ -689,18 +630,19 @@ endoftextblock(Line *t, int toplevelblock, DWORD flags)
{
int z;
if ( end_of_block(t) || isquote(t) )
if ( blankline(t)||isquote(t)||ishdr(t,&z)||ishr(t) )
return 1;
/* HORRIBLE STANDARDS KLUDGES:
* 1. non-toplevel paragraphs absorb adjacent code blocks
* 2. Toplevel paragraphs eat absorb adjacent list items,
* but sublevel blocks behave properly.
* (What this means is that we only need to check for code
* blocks at toplevel, and only check for list items at
* nested levels.)
/* HORRIBLE STANDARDS KLUDGE: non-toplevel paragraphs absorb adjacent
* code blocks
*/
return toplevelblock ? 0 : islist(t,&z,flags,&z);
if ( toplevelblock && iscode(t) )
return 1;
/* HORRIBLE STANDARDS KLUDGE: Toplevel paragraphs eat absorb adjacent
* list items, but sublevel blocks behave properly.
*/
return toplevelblock ? 0 : islist(t,&z,flags, &z);
}
@@ -748,7 +690,6 @@ isdivmarker(Line *p, int start, DWORD flags)
if ( flags & (MKD_NODIVQUOTE|MKD_STRICT) )
return 0;
start = nextnonblank(p, start);
last= S(p->text) - (1 + start);
s = T(p->text) + start;
@@ -772,7 +713,7 @@ isdivmarker(Line *p, int start, DWORD flags)
*
* one sick horrible thing about blockquotes is that even though
* it just takes ^> to start a quote, following lines, if quoted,
* assume that the prefix is ``> ''. This means that code needs
* assume that the prefix is ``>''. This means that code needs
* to be indented *5* spaces from the leading '>', but *4* spaces
* from the start of the line. This does not appear to be
* documented in the reference implementation, but it's the
@@ -797,7 +738,6 @@ quoteblock(Paragraph *p, DWORD flags)
if ( T(t->text)[qp] == ' ' )
qp++;
CLIP(t->text, 0, qp);
UNCHECK(t);
t->dle = mkd_firstnonblank(t);
}
@@ -830,6 +770,28 @@ quoteblock(Paragraph *p, DWORD flags)
}
/*
* A table block starts with a table header (see istable()), and continues
* until EOF or a line that /doesn't/ contain a |.
*/
static Line *
tableblock(Paragraph *p)
{
Line *t, *q;
for ( t = p->text; t && (q = t->next); t = t->next ) {
if ( !(t->flags & PIPECHAR) ) {
t->next = 0;
return q;
}
}
return 0;
}
static Paragraph *Pp(ParagraphRoot *, Line *, int);
static Paragraph *compile(Line *, int, MMIOT *);
typedef int (*linefn)(Line *);
@@ -848,15 +810,8 @@ listitem(Paragraph *p, int indent, DWORD flags, linefn check)
for ( t = p->text; t ; t = q) {
CLIP(t->text, 0, clip);
UNCHECK(t);
t->dle = mkd_firstnonblank(t);
/* even though we had to trim a long leader off this item,
* the indent for trailing paragraphs is still 4...
*/
if (indent > 4) {
indent = 4;
}
if ( (q = skipempty(t->next)) == 0 ) {
___mkd_freeLineRange(t,q);
return 0;
@@ -908,14 +863,13 @@ definition_block(Paragraph *top, int clip, MMIOT *f, int kind)
if ( (text = skipempty(q->next)) == 0 )
break;
if ( para = (text != q->next) )
if (( para = (text != q->next) ))
___mkd_freeLineRange(q, text);
q->next = 0;
if ( kind == 1 /* discount dl */ )
for ( q = labels; q; q = q->next ) {
CLIP(q->text, 0, 1);
UNCHECK(q);
S(q->text)--;
}
@@ -931,7 +885,7 @@ definition_block(Paragraph *top, int clip, MMIOT *f, int kind)
if ( (q = skipempty(text)) == 0 )
break;
if ( para = (q != text) ) {
if (( para = (q != text) )) {
Line anchor;
anchor.next = text;
@@ -1008,7 +962,7 @@ addfootnote(Line *p, MMIOT* f)
int c;
Line *np = p->next;
Footnote *foot = &EXPAND(f->footnotes->note);
Footnote *foot = &EXPAND(*f->footnotes);
CREATE(foot->tag);
CREATE(foot->link);
@@ -1023,7 +977,6 @@ addfootnote(Line *p, MMIOT* f)
j = nextnonblank(p, j+2);
if ( (f->flags & MKD_EXTRA_FOOTNOTE) && (T(foot->tag)[0] == '^') ) {
/* need to consume all lines until non-indented block? */
while ( j < S(p->text) )
EXPAND(foot->title) = T(p->text)[j++];
goto skip_to_end;
@@ -1122,7 +1075,6 @@ compile_document(Line *ptr, MMIOT *f)
while ( ptr ) {
if ( !(f->flags & MKD_NOHTML) && (tag = isopentag(ptr)) ) {
int blocktype;
/* If we encounter a html/style block, compile and save all
* of the cached source BEFORE processing the html/style.
*/
@@ -1132,12 +1084,7 @@ compile_document(Line *ptr, MMIOT *f)
p->down = compile(T(source), 1, f);
T(source) = E(source) = 0;
}
if ( f->flags & MKD_NOSTYLE )
blocktype = HTML;
else
blocktype = strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML;
p = Pp(&d, ptr, blocktype);
p = Pp(&d, ptr, strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML);
ptr = htmlblock(p, tag, &unclosed);
if ( unclosed ) {
p->typ = SOURCE;
@@ -1172,58 +1119,6 @@ compile_document(Line *ptr, MMIOT *f)
}
static int
first_nonblank_before(Line *j, int dle)
{
return (j->dle < dle) ? j->dle : dle;
}
static int
actually_a_table(MMIOT *f, Line *pp)
{
Line *r;
int j;
int c;
/* tables need to be turned on */
if ( f->flags & (MKD_STRICT|MKD_NOTABLES) )
return 0;
/* tables need three lines */
if ( !(pp && pp->next && pp->next->next) ) {
return 0;
}
/* all lines must contain |'s */
for (r = pp; r; r = r->next )
if ( !(r->flags & PIPECHAR) ) {
return 0;
}
/* if the header has a leading |, all lines must have leading |'s */
if ( T(pp->text)[pp->dle] == '|' ) {
for ( r = pp; r; r = r->next )
if ( T(r->text)[first_nonblank_before(r,pp->dle)] != '|' ) {
return 0;
}
}
/* second line must be only whitespace, -, |, or : */
r = pp->next;
for ( j=r->dle; j < S(r->text); ++j ) {
c = T(r->text)[j];
if ( !(isspace(c)||(c=='-')||(c==':')||(c=='|')) ) {
return 0;
}
}
return 1;
}
/*
* break a collection of markdown input into
* blocks of lists, code, html, and text to
@@ -1254,17 +1149,13 @@ compile(Line *ptr, int toplevel, MMIOT *f)
ptr = codeblock(p);
}
#if WITH_FENCED_CODE
else if ( iscodefence(ptr,3,0) && (p=fencedcodeblock(&d, &ptr)) )
/* yay, it's already done */ ;
#endif
else if ( ishr(ptr) ) {
p = Pp(&d, 0, HR);
r = ptr;
ptr = ptr->next;
___mkd_freeLine(r);
}
else if ( list_class = islist(ptr, &indent, f->flags, &list_type) ) {
else if (( list_class = islist(ptr, &indent, f->flags, &list_type) )) {
if ( list_class == DL ) {
p = Pp(&d, ptr, DL);
ptr = definition_block(p, indent, f, list_type);
@@ -1284,12 +1175,13 @@ compile(Line *ptr, int toplevel, MMIOT *f)
p = Pp(&d, ptr, HDR);
ptr = headerblock(p, hdr_type);
}
else if ( istable(ptr) && !(f->flags & (MKD_STRICT|MKD_NOTABLES)) ) {
p = Pp(&d, ptr, TABLE);
ptr = tableblock(p);
}
else {
p = Pp(&d, ptr, MARKUP);
ptr = textblock(p, toplevel, f->flags);
/* tables are a special kind of paragraph */
if ( actually_a_table(f, p->text) )
p->typ = TABLE;
}
if ( (para||toplevel) && !p->align )
@@ -1331,14 +1223,13 @@ mkd_compile(Document *doc, DWORD flags)
doc->ctx->flags = flags & USER_FLAGS;
CREATE(doc->ctx->in);
doc->ctx->footnotes = malloc(sizeof doc->ctx->footnotes[0]);
doc->ctx->footnotes->reference = 0;
CREATE(doc->ctx->footnotes->note);
CREATE(*doc->ctx->footnotes);
mkd_initialize();
doc->code = compile_document(T(doc->content), doc->ctx);
qsort(T(doc->ctx->footnotes->note), S(doc->ctx->footnotes->note),
sizeof T(doc->ctx->footnotes->note)[0],
qsort(T(*doc->ctx->footnotes), S(*doc->ctx->footnotes),
sizeof T(*doc->ctx->footnotes)[0],
(stfu)__mkd_footsort);
memset(&doc->content, 0, sizeof doc->content);
return 1;
+3 -47
View File
@@ -23,20 +23,12 @@ typedef struct footnote {
* that all tabs will be expanded to spaces!], and a pointer to
* the next line.
*/
typedef enum { chk_text, chk_code,
chk_hr, chk_dash,
chk_tilde, chk_backtick,
chk_equal } line_type;
typedef struct line {
Cstring text;
struct line *next;
int dle; /* leading indent on the line */
int flags; /* special attributes for this line */
#define PIPECHAR 0x01 /* line contains a | */
#define CHECKED 0x02
line_type kind;
int count;
} Line;
@@ -49,7 +41,6 @@ typedef struct paragraph {
struct paragraph *down; /* recompiled contents of this paragraph */
struct line *text; /* all the text in this paragraph */
char *ident; /* %id% tag for QUOTE */
char *lang; /* lang attribute for CODE */
enum { WHITESPACE=0, CODE, QUOTE, MARKUP,
HTML, STYLE, DL, UL, OL, AL, LISTITEM,
HDR, HR, TABLE, SOURCE } typ;
@@ -82,18 +73,6 @@ typedef struct callback_data {
} Callback_data;
struct escaped {
char *text;
struct escaped *up;
} ;
struct footnote_list {
int reference;
STRING(Footnote) note;
} ;
/* a magic markdown io thing holds all the data structures needed to
* do the backend processing of a markdown document
*/
@@ -102,9 +81,9 @@ typedef struct mmiot {
Cstring in;
Qblock Q;
int isp;
struct escaped *esc;
int reference;
char *ref_prefix;
struct footnote_list *footnotes;
STRING(Footnote) *footnotes;
DWORD flags;
#define MKD_NOLINKS 0x00000001
#define MKD_NOIMAGE 0x00000002
@@ -128,7 +107,6 @@ typedef struct mmiot {
#define MKD_NOALPHALIST 0x00080000
#define MKD_NODLIST 0x00100000
#define MKD_EXTRA_FOOTNOTE 0x00200000
#define MKD_NOSTYLE 0x00400000
#define IS_LABEL 0x08000000
#define USER_FLAGS 0x0FFFFFFF
#define INPUT_MASK (MKD_NOHEADER|MKD_TABSTOP)
@@ -137,9 +115,6 @@ typedef struct mmiot {
} MMIOT;
#define MKD_EOLN 3
/*
* the mkdio text input functions return a document structure,
* which contains a header (retrieved from the document if
@@ -164,16 +139,6 @@ typedef struct document {
} Document;
/*
* economy FILE-type structure for pulling characters out of a
* fixed-length string.
*/
struct string_stream {
const char *data; /* the unread data */
int size; /* and how much is there? */
} ;
extern int mkd_firstnonblank(Line *);
extern int mkd_compile(Document *, DWORD);
extern int mkd_document(Document *, char **);
@@ -195,9 +160,6 @@ extern void mkd_string_to_anchor(char*,int, mkd_sta_function_t, void*, int);
extern Document *mkd_in(FILE *, DWORD);
extern Document *mkd_string(const char*,int, DWORD);
extern Document *gfm_in(FILE *, DWORD);
extern Document *gfm_string(const char*,int, DWORD);
extern void mkd_initialize();
extern void mkd_shlib_destructor();
@@ -214,14 +176,8 @@ extern void ___mkd_initmmiot(MMIOT *, void *);
extern void ___mkd_freemmiot(MMIOT *, void *);
extern void ___mkd_freeLineRange(Line *, Line *);
extern void ___mkd_xml(char *, int, FILE *);
extern void ___mkd_reparse(char *, int, int, MMIOT*, char*);
extern void ___mkd_reparse(char *, int, int, MMIOT*);
extern void ___mkd_emblock(MMIOT*);
extern void ___mkd_tidy(Cstring *);
extern Document *__mkd_new_Document();
extern void __mkd_enqueue(Document*, Cstring *);
extern void __mkd_header_dle(Line *);
extern int __mkd_io_strget(struct string_stream *);
#endif/*_MARKDOWN_D*/
+1 -1
View File
@@ -49,4 +49,4 @@ utility exits 0 on success, and >0 if an error occurs.
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.portland.or.us
.Pq Li orc@pell.chi.il.us
+12 -18
View File
@@ -45,7 +45,7 @@ basename(char *path)
{
char *p;
if ( p = strrchr(path, '/') )
if (( p = strrchr(path, '/') ))
return 1+p;
return path;
}
@@ -65,6 +65,7 @@ fail(char *why, ...)
}
void
main(argc, argv)
char **argv;
{
@@ -81,7 +82,7 @@ char **argv;
CREATE(footers);
pgm = basename(argv[0]);
while ( argc > 1 ) {
while ( argc > 2 ) {
if ( strcmp(argv[1], "-css") == 0 ) {
EXPAND(css) = argv[2];
argc -= 2;
@@ -97,20 +98,14 @@ char **argv;
argc -= 2;
argv += 2;
}
else
break;
}
switch ( argc ) {
if ( argc > 1 ) {
char *p, *dot;
case 1:
input = stdin;
output = stdout;
break;
case 2:
case 3:
dest = malloc(strlen(argv[argc-1]) + 6);
source = malloc(strlen(argv[1]) + 6);
dest = malloc(strlen(argv[1]) + 6);
if ( !(source && dest) )
fail("out of memory allocating name buffers");
@@ -134,11 +129,10 @@ char **argv;
if ( (output = fopen(dest, "w")) == 0 )
fail("can't write to %s", dest);
break;
default:
fprintf(stderr, "usage: %s [opts] source [dest]\n", pgm);
exit(1);
}
else {
input = stdin;
output = stdout;
}
if ( (mmiot = mkd_in(input, 0)) == 0 )
@@ -159,7 +153,7 @@ char **argv;
" <meta name=\"GENERATOR\" content=\"mkd2html %s\">\n", markdown_version);
fprintf(output," <meta http-equiv=\"Content-Type\"\n"
" content=\"text/html; charset=utf-8\">");
" content=\"text/html; charset-us-ascii\">");
for ( i=0; i < S(css); i++ )
fprintf(output, " <link rel=\"stylesheet\"\n"
+24 -31
View File
@@ -18,13 +18,13 @@ typedef ANCHOR(Line) LineAnchor;
/* create a new blank Document
*/
Document*
__mkd_new_Document()
static Document*
new_Document()
{
Document *ret = calloc(sizeof(Document), 1);
if ( ret ) {
if ( ret->ctx = calloc(sizeof(MMIOT), 1) ) {
if (( ret->ctx = calloc(sizeof(MMIOT), 1) )) {
ret->magic = VALID_DOCUMENT;
return ret;
}
@@ -37,8 +37,8 @@ __mkd_new_Document()
/* add a line to the markdown input chain, expanding tabs and
* noting the presence of special characters as we go.
*/
void
__mkd_enqueue(Document* a, Cstring *line)
static void
queue(Document* a, Cstring *line)
{
Line *p = calloc(sizeof *p, 1);
unsigned char c;
@@ -75,8 +75,8 @@ __mkd_enqueue(Document* a, Cstring *line)
/* trim leading blanks from a header line
*/
void
__mkd_header_dle(Line *p)
static void
header_dle(Line *p)
{
CLIP(p->text, 0, 1);
p->dle = mkd_firstnonblank(p);
@@ -91,7 +91,7 @@ Document *
populate(getc_func getc, void* ctx, int flags)
{
Cstring line;
Document *a = __mkd_new_Document();
Document *a = new_Document();
int c;
int pandoc = 0;
@@ -109,7 +109,7 @@ populate(getc_func getc, void* ctx, int flags)
else
pandoc = EOF;
}
__mkd_enqueue(a, &line);
queue(a, &line);
S(line) = 0;
}
else if ( isprint(c) || isspace(c) || (c & 0x80) )
@@ -117,7 +117,7 @@ populate(getc_func getc, void* ctx, int flags)
}
if ( S(line) )
__mkd_enqueue(a, &line);
queue(a, &line);
DELETE(line);
@@ -128,9 +128,9 @@ populate(getc_func getc, void* ctx, int flags)
*/
Line *headers = T(a->content);
a->title = headers; __mkd_header_dle(a->title);
a->author= headers->next; __mkd_header_dle(a->author);
a->date = headers->next->next; __mkd_header_dle(a->date);
a->title = headers; header_dle(a->title);
a->author= headers->next; header_dle(a->author);
a->date = headers->next->next; header_dle(a->date);
T(a->content) = headers->next->next->next;
}
@@ -150,8 +150,14 @@ mkd_in(FILE *f, DWORD flags)
/* return a single character out of a buffer
*/
int
__mkd_io_strget(struct string_stream *in)
struct string_ctx {
const char *data; /* the unread data */
int size; /* and how much is there? */
} ;
static int
strget(struct string_ctx *in)
{
if ( !in->size ) return EOF;
@@ -166,12 +172,12 @@ __mkd_io_strget(struct string_stream *in)
Document *
mkd_string(const char *buf, int len, DWORD flags)
{
struct string_stream about;
struct string_ctx about;
about.data = buf;
about.size = len;
return populate((getc_func)__mkd_io_strget, &about, flags & INPUT_MASK);
return populate((getc_func)strget, &about, flags & INPUT_MASK);
}
@@ -215,9 +221,6 @@ void
mkd_string_to_anchor(char *s, int len, mkd_sta_function_t outchar,
void *out, int labelformat)
{
#if WITH_URLENCODED_ANCHOR
static const unsigned char hexchars[] = "0123456789abcdef";
#endif
unsigned char c;
int i, size;
@@ -225,25 +228,15 @@ mkd_string_to_anchor(char *s, int len, mkd_sta_function_t outchar,
size = mkd_line(s, len, &line, IS_LABEL);
#if !WITH_URLENCODED_ANCHOR
if ( labelformat && (size>0) && !isalpha(line[0]) )
(*outchar)('L',out);
#endif
for ( i=0; i < size ; i++ ) {
c = line[i];
if ( labelformat ) {
if ( isalnum(c) || (c == '_') || (c == ':') || (c == '-') || (c == '.' ) )
(*outchar)(c, out);
else
#if WITH_URLENCODED_ANCHOR
{
(*outchar)('%', out);
(*outchar)(hexchars[c >> 4 & 0xf], out);
(*outchar)(hexchars[c & 0xf], out);
}
#else
(*outchar)('.', out);
#endif
}
else
(*outchar)(c,out);
@@ -261,7 +254,7 @@ mkd_parse_line(char *bfr, int size, MMIOT *f, int flags)
{
___mkd_initmmiot(f, 0);
f->flags = flags & USER_FLAGS;
___mkd_reparse(bfr, size, 0, f, 0);
___mkd_reparse(bfr, size, 0, f);
___mkd_emblock(f);
}
+1 -8
View File
@@ -12,11 +12,6 @@ typedef @DWORD@ mkd_flag_t;
MMIOT *mkd_in(FILE*,mkd_flag_t); /* assemble input from a file */
MMIOT *mkd_string(const char*,int,mkd_flag_t); /* assemble input from a buffer */
/* line builder for github flavoured markdown
*/
MMIOT *gfm_in(FILE*,mkd_flag_t); /* assemble input from a file */
MMIOT *gfm_string(const char*,int,mkd_flag_t); /* assemble input from a buffer */
void mkd_basename(MMIOT*,char*);
void mkd_initialize();
@@ -26,7 +21,7 @@ void mkd_shlib_destructor();
/* compilation, debugging, cleanup
*/
int mkd_compile(MMIOT*, mkd_flag_t);
void mkd_cleanup(MMIOT*);
int mkd_cleanup(MMIOT*);
/* markup functions
*/
@@ -89,7 +84,6 @@ void mkd_ref_prefix(MMIOT*, char*);
#define MKD_TAGTEXT 0x00000020 /* process text inside an html tag; no
* <em>, no <bold>, no html or [] expansion */
#define MKD_NO_EXT 0x00000040 /* don't allow pseudo-protocols */
#define MKD_NOEXT MKD_NO_EXT /* ^^^ (aliased for user convenience) */
#define MKD_CDATA 0x00000080 /* generate code for xml ![CDATA[...]] */
#define MKD_NOSUPERSCRIPT 0x00000100 /* no A^B */
#define MKD_NORELAXED 0x00000200 /* emphasis happens /everywhere/ */
@@ -105,7 +99,6 @@ void mkd_ref_prefix(MMIOT*, char*);
#define MKD_NOALPHALIST 0x00080000 /* forbid alphabetic lists */
#define MKD_NODLIST 0x00100000 /* forbid definition lists */
#define MKD_EXTRA_FOOTNOTE 0x00200000 /* enable markdown extra-style footnotes */
#define MKD_NOSTYLE 0x00400000 /* don't extract <style> blocks */
#define MKD_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
/* special flags for mkd_in() and mkd_string()
-89
View File
@@ -1,89 +0,0 @@
/* block-level tags for passing html blocks through the blender
*/
#include <stdio.h>
#define __WITHOUT_AMALLOC 1
#include "cstring.h"
#include "tags.h"
STRING(struct kw) blocktags;
/* define a html block tag
*/
static void
define_one_tag(char *id, int selfclose)
{
struct kw *p = &EXPAND(blocktags);
p->id = id;
p->size = strlen(id);
p->selfclose = selfclose;
}
/* case insensitive string sort (for qsort() and bsearch() of block tags)
*/
static int
casort(struct kw *a, struct kw *b)
{
if ( a->size != b->size )
return a->size - b->size;
return strncasecmp(a->id, b->id, b->size);
}
/* stupid cast to make gcc shut up about the function types being
* passed into qsort() and bsearch()
*/
typedef int (*stfu)(const void*,const void*);
/* load in the standard collection of html tags that markdown supports
*/
main()
{
int i;
#define KW(x) define_one_tag(x, 0)
#define SC(x) define_one_tag(x, 1)
KW("STYLE");
KW("SCRIPT");
KW("ADDRESS");
KW("BDO");
KW("BLOCKQUOTE");
KW("CENTER");
KW("DFN");
KW("DIV");
KW("OBJECT");
KW("H1");
KW("H2");
KW("H3");
KW("H4");
KW("H5");
KW("H6");
KW("LISTING");
KW("NOBR");
KW("UL");
KW("P");
KW("OL");
KW("DL");
KW("PLAINTEXT");
KW("PRE");
KW("TABLE");
KW("WBR");
KW("XMP");
SC("HR");
KW("IFRAME");
KW("MAP");
qsort(T(blocktags), S(blocktags), sizeof(struct kw), (stfu)casort);
printf("static struct kw blocktags[] = {\n");
for (i=0; i < S(blocktags); i++)
printf(" { \"%s\", %d, %d },\n", T(blocktags)[i].id, T(blocktags)[i].size, T(blocktags)[i].selfclose );
printf("};\n\n");
printf("#define NR_blocktags %d\n", S(blocktags));
exit(0);
}
-138
View File
@@ -1,138 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2007-2011 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <mkdio.h>
#include <errno.h>
#include <string.h>
#include <stdarg.h>
#include "config.h"
#include "amalloc.h"
#if HAVE_LIBGEN_H
#include <libgen.h>
#endif
static struct _opt {
char *name;
char *desc;
int off;
int skip;
int sayenable;
mkd_flag_t flag;
} opts[] = {
{ "tabstop", "default (4-space) tabstops", 0, 0, 1, MKD_TABSTOP },
{ "image", "images", 1, 0, 1, MKD_NOIMAGE },
{ "links", "links", 1, 0, 1, MKD_NOLINKS },
{ "relax", "emphasis inside words", 1, 1, 1, MKD_STRICT },
{ "strict", "emphasis inside words", 0, 0, 1, MKD_STRICT },
{ "tables", "tables", 1, 0, 1, MKD_NOTABLES },
{ "header", "pandoc-style headers", 1, 0, 1, MKD_NOHEADER },
{ "html", "raw html", 1, 0, 1, MKD_NOHTML },
{ "ext", "extended protocols", 1, 0, 1, MKD_NO_EXT },
{ "cdata", "generate cdata", 0, 0, 0, MKD_CDATA },
{ "smarty", "smartypants", 1, 0, 1, MKD_NOPANTS },
{ "pants", "smartypants", 1, 1, 1, MKD_NOPANTS },
{ "toc", "tables of contents", 0, 0, 1, MKD_TOC },
{ "autolink", "autolinking", 0, 0, 1, MKD_AUTOLINK },
{ "safelink", "safe links", 0, 0, 1, MKD_SAFELINK },
{ "strikethrough", "strikethrough", 1, 0, 1, MKD_NOSTRIKETHROUGH },
{ "del", "strikethrough", 1, 1, 1, MKD_NOSTRIKETHROUGH },
{ "superscript", "superscript", 1, 0, 1, MKD_NOSUPERSCRIPT },
{ "emphasis", "emphasis inside words", 0, 0, 1, MKD_NORELAXED },
{ "divquote", ">%class% blockquotes", 1, 0, 1, MKD_NODIVQUOTE },
{ "alphalist", "alpha lists", 1, 0, 1, MKD_NOALPHALIST },
{ "definitionlist","definition lists", 1, 0, 1, MKD_NODLIST },
{ "1.0", "markdown 1.0 compatibility", 0, 0, 1, MKD_1_COMPAT },
{ "footnotes", "markdown extra footnotes", 0, 0, 1, MKD_EXTRA_FOOTNOTE },
{ "footnote", "markdown extra footnotes", 0, 1, 1, MKD_EXTRA_FOOTNOTE },
{ "style", "extract style blocks", 1, 0, 1, MKD_NOSTYLE },
} ;
#define NR(x) (sizeof x / sizeof x[0])
typedef int (*stfu)(const void *, const void *);
int
sort_by_name(struct _opt *a, struct _opt *b)
{
return strcmp(a->name,b->name);
}
int
sort_by_flag(struct _opt *a, struct _opt *b)
{
return a->flag - b->flag;
}
void
show_flags(int byname)
{
int i;
if ( byname ) {
qsort(opts, NR(opts), sizeof(opts[0]), (stfu)sort_by_name);
for (i=0; i < NR(opts); i++)
if ( ! opts[i].skip )
fprintf(stderr, "%16s : %s\n", opts[i].name, opts[i].desc);
}
else {
qsort(opts, NR(opts), sizeof(opts[0]), (stfu)sort_by_flag);
for (i=0; i < NR(opts); i++)
if ( ! opts[i].skip ) {
fprintf(stderr, "%08lx : ", (long)opts[i].flag);
if ( opts[i].sayenable )
fprintf(stderr, opts[i].off ? "disable " : "enable ");
fprintf(stderr, "%s\n", opts[i].desc);
}
}
}
int
set_flag(mkd_flag_t *flags, char *optionstring)
{
int i;
int enable;
char *arg;
for ( arg = strtok(optionstring, ","); arg; arg = strtok(NULL, ",") ) {
if ( *arg == '+' || *arg == '-' )
enable = (*arg++ == '+') ? 1 : 0;
else if ( strncasecmp(arg, "no", 2) == 0 ) {
arg += 2;
enable = 0;
}
else
enable = 1;
for ( i=0; i < NR(opts); i++ )
if ( strcasecmp(arg, opts[i].name) == 0 )
break;
if ( i < NR(opts) ) {
if ( opts[i].off )
enable = !enable;
if ( enable )
*flags |= opts[i].flag;
else
*flags &= ~opts[i].flag;
}
else
return 0;
}
return 1;
}
-9
View File
@@ -1,9 +0,0 @@
#ifndef PGM_OPTIONS_D
#define PGM_OPTIONS_D
#include <mkdio.h>
int set_flag(mkd_flag_t *flags, char *optionstring);
void show_flags(int byname);
#endif/*PGM_OPTIONS_D*/
+4 -6
View File
@@ -51,8 +51,6 @@ ___mkd_freeParagraph(Paragraph *p)
___mkd_freeLines(p->text);
if (p->ident)
free(p->ident);
if (p->lang)
free(p->lang);
free(p);
}
@@ -76,9 +74,9 @@ ___mkd_freefootnotes(MMIOT *f)
int i;
if ( f->footnotes ) {
for (i=0; i < S(f->footnotes->note); i++)
___mkd_freefootnote( &T(f->footnotes->note)[i] );
DELETE(f->footnotes->note);
for (i=0; i < S(*f->footnotes); i++)
___mkd_freefootnote( &T(*f->footnotes)[i] );
DELETE(*f->footnotes);
free(f->footnotes);
}
}
@@ -98,7 +96,7 @@ ___mkd_initmmiot(MMIOT *f, void *footnotes)
f->footnotes = footnotes;
else {
f->footnotes = malloc(sizeof f->footnotes[0]);
CREATE(f->footnotes->note);
CREATE(*f->footnotes);
}
}
}
+9 -1
View File
@@ -18,6 +18,7 @@
#include "amalloc.h"
#include "tags.h"
static int need_to_setup = 1;
static int need_to_initrng = 1;
void
@@ -28,12 +29,19 @@ mkd_initialize()
need_to_initrng = 0;
INITRNG(time(0));
}
if ( need_to_setup ) {
need_to_setup = 0;
mkd_prepare_tags();
}
}
void
mkd_shlib_destructor()
{
mkd_deallocate_tags();
if ( !need_to_setup ) {
need_to_setup = 1;
mkd_deallocate_tags();
}
}
+65 -36
View File
@@ -4,36 +4,19 @@
#include "cstring.h"
#include "tags.h"
STRING(struct kw) extratags;
/* the standard collection of tags are built and sorted when
* discount is configured, so all we need to do is pull them
* in and use them.
*
* Additional tags still need to be allocated, sorted, and deallocated.
*/
#include "blocktags"
STRING(struct kw) blocktags;
/* define an additional html block tag
/* define a html block tag
*/
void
mkd_define_tag(char *id, int selfclose)
{
struct kw *p;
struct kw *p = &EXPAND(blocktags);
/* only add the new tag if it doesn't exist in
* either the standard or extra tag tables.
*/
if ( !(p = mkd_search_tags(id, strlen(id))) ) {
/* extratags could be deallocated */
if ( S(extratags) == 0 )
CREATE(extratags);
p = &EXPAND(extratags);
p->id = id;
p->size = strlen(id);
p->selfclose = selfclose;
}
p->id = id;
p->size = strlen(id);
p->selfclose = selfclose;
}
@@ -54,41 +37,87 @@ casort(struct kw *a, struct kw *b)
typedef int (*stfu)(const void*,const void*);
/* sort the list of extra html block tags for later searching
/* sort the list of html block tags for later searching
*/
void
mkd_sort_tags()
{
qsort(T(extratags), S(extratags), sizeof(struct kw), (stfu)casort);
qsort(T(blocktags), S(blocktags), sizeof(struct kw), (stfu)casort);
}
/* look for a token in the html block tag list
*/
struct kw*
mkd_search_tags(char *pat, int len)
{
struct kw key;
struct kw *ret;
key.id = pat;
key.size = len;
if ( (ret=bsearch(&key,blocktags,NR_blocktags,sizeof key,(stfu)casort)) )
return ret;
if ( S(extratags) )
return bsearch(&key,T(extratags),S(extratags),sizeof key,(stfu)casort);
return 0;
return bsearch(&key, T(blocktags), S(blocktags), sizeof key, (stfu)casort);
}
/* destroy the extratags list (for shared libraries)
static int populated = 0;
/* load in the standard collection of html tags that markdown supports
*/
void
mkd_prepare_tags()
{
#define KW(x) mkd_define_tag(x, 0)
#define SC(x) mkd_define_tag(x, 1)
if ( populated ) return;
populated = 1;
KW("STYLE");
KW("SCRIPT");
KW("ADDRESS");
KW("BDO");
KW("BLOCKQUOTE");
KW("CENTER");
KW("DFN");
KW("DIV");
KW("OBJECT");
KW("H1");
KW("H2");
KW("H3");
KW("H4");
KW("H5");
KW("H6");
KW("LISTING");
KW("NOBR");
KW("UL");
KW("P");
KW("OL");
KW("DL");
KW("PLAINTEXT");
KW("PRE");
KW("TABLE");
KW("WBR");
KW("XMP");
SC("HR");
SC("BR");
KW("IFRAME");
KW("MAP");
mkd_sort_tags();
} /* mkd_prepare_tags */
/* destroy the blocktags list (for shared libraries)
*/
void
mkd_deallocate_tags()
{
if ( S(extratags) > 0 )
DELETE(extratags);
if ( S(blocktags) > 0 ) {
populated = 0;
DELETE(blocktags);
}
} /* mkd_deallocate_tags */
-5
View File
@@ -12,10 +12,5 @@ try -fautolink 'autolink url with trailing \' \
'http://a.com/\' \
'<p><a href="http://a.com/\">http://a.com/\</a></p>'
try 'backslashes before <text' '\<code>' '<p>\<code></p>'
try 'backslashes before <{EOF}' '\<' '<p>&lt;</p>'
try 'backslashes before <[space]' '\< j' '<p>&lt; j</p>'
summary $0
exit $rc
-131
View File
@@ -31,136 +31,5 @@ try 'backslashes in code(1)' ' printf "%s: \n", $1;' \
try 'backslashes in code(2)' '`printf "%s: \n", $1;`' \
'<p><code>printf "%s: \n", $1;</code></p>'
if ./markdown -V | grep FENCED-CODE >/dev/null; then
try 'fenced code block with blank lines' \
'~~~
code!
still code!
~~~' \
'<pre><code>code!
still code!
</code></pre>'
try 'fenced code block' \
'~~~
code!
~~~' \
'<pre><code>code!
</code></pre>'
try 'fenced code block in list' \
'1. ~~~
code block
~~~' \
'<ol>
<li><pre><code>code block
</code></pre></li>
</ol>'
try 'fenced code block in blockquote' \
'>~~~
code
~~~' \
'<blockquote><pre><code>code
</code></pre></blockquote>'
try 'unterminated fenced code block' \
'~~~
code' \
'<p>~~~
code</p>'
try 'fenced code block with tildes' \
'~~~~~
~~~
code with tildes
~~~
~~~~~' \
'<pre><code>~~~
code with tildes
~~~
</code></pre>'
try 'paragraph with trailing fenced block' \
'text text text
text text text
~~~
code code code?
~~~' \
'<p>text text text
text text text
~~~
code code code?
~~~</p>'
try 'fenced code blocks with backtick delimiters' \
'```
code
```' \
'<pre><code>code
</code></pre>'
try 'fenced code block with mismatched delimters' \
'```
code
~~~' \
'<p>```
code
~~~</p>'
try 'fenced code block with lang attribute' \
'```lang
code
```' \
'<pre><code class="lang">code
</code></pre>'
try 'fenced code block with lang-name attribute' \
'```lang-name
code
```' \
'<pre><code class="lang-name">code
</code></pre>'
try 'fenced code block with lang_name attribute' \
'```lang_name
code
```' \
'<pre><code class="lang_name">code
</code></pre>'
try 'fenced code block with lang attribute and space' \
'``` lang
code
```' \
'<pre><code class="lang">code
</code></pre>'
try 'fenced code block with lang attribute and multiple spaces' \
'``` lang
code
```' \
'<pre><code class="lang">code
</code></pre>'
try 'fenced code block with lang-name attribute and space' \
'``` lang-name
code
```' \
'<pre><code class="lang-name">code
</code></pre>'
try 'fenced code block with lang_name attribute and space' \
'``` lang_name
code
```' \
'<pre><code class="lang_name">code
</code></pre>'
fi
summary $0
exit $rc
-23
View File
@@ -1,23 +0,0 @@
. tests/functions.sh
title "reported defects"
rc=0
MARKDOWN_FLAGS=
try 'masses of non-block html' \
'<span>foo</span><br>
<br>
<span>bar</span><br>' \
'<p><span>foo</span><br>
<br>
<span>bar</span><br></p>'
try -fautolink -G 'autolink + github-flavoured markdown' \
'http://foo
bar' \
'<p><a href="http://foo">http://foo</a><br/>
bar</p>'
summary $0
exit $rc
+9 -4
View File
@@ -37,10 +37,15 @@ if [ "$DL" = "DISCOUNT" -o "$DL" = "BOTH" ]; then
try -fnodefinitionlist '=tag= does nothing' "$SRC" \
'<p>=this=
is an ugly
=test=
eh?</p>'
'<p>=this=</p>
<pre><code>is an ugly
</code></pre>
<p>=test=</p>
<pre><code>eh?
</code></pre>'
fi
if [ "$DL" = "EXTRA" -o "$DL" = "BOTH" ]; then
-85
View File
@@ -31,90 +31,5 @@ try -ffootnote -Cfoot 'footnotes (-ffootnote -Cfoot)' "$FOOTIE" \
try -fnofootnote 'footnotes (-fnofootnote)' "$FOOTIE" \
'<p>I haz a footnote<a href="yes?">^1</a></p>'
TSRC='Alpha[^AlphaF].
Column 1 | Column 2
---------------------------------|--------------------------
Beta[^BetaF] | cell
[^AlphaF]: Alpha Footnote
[^BetaF]: Beta Footnote'
TOUT='<p>Alpha<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>.</p>
<table>
<thead>
<tr>
<th>Column 1 </th>
<th> Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Beta<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> </td>
<td> cell</td>
</tr>
</tbody>
</table>
<div class="footnotes">
<hr/>
<ol>
<li id="fn:1">
<p>Alpha Footnote<a href="#fnref:1" rev="footnote">&#8617;</a></p></li>
<li id="fn:2">
<p>Beta Footnote<a href="#fnref:2" rev="footnote">&#8617;</a></p></li>
</ol>
</div>'
try -ffootnote 'footnotes inside table elements' "$TSRC" "$TOUT"
TSRC='[Test test[^test]](class:test)
<span class="test">
Test2[^testtwo]
</span>
Test3[^testthree]
<span class="test">
Test4[^testfour]
</span>
[^test]: Test footnote
[^testtwo]: Test2 footnote
[^testthree]: Test3 footnote
[^testfour]: Test4 footnote'
TOUT='<p><span class="test">Test test<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></span></p>
<p><span class="test">
Test2<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>
</span></p>
<p>Test3<sup id="fnref:3"><a href="#fn:3" rel="footnote">3</a></sup></p>
<p><span class="test">
Test4<sup id="fnref:4"><a href="#fn:4" rel="footnote">4</a></sup>
</span></p>
<div class="footnotes">
<hr/>
<ol>
<li id="fn:1">
<p>Test footnote<a href="#fnref:1" rev="footnote">&#8617;</a></p></li>
<li id="fn:2">
<p>Test2 footnote<a href="#fnref:2" rev="footnote">&#8617;</a></p></li>
<li id="fn:3">
<p>Test3 footnote<a href="#fnref:3" rev="footnote">&#8617;</a></p></li>
<li id="fn:4">
<p>Test4 footnote<a href="#fnref:4" rev="footnote">&#8617;</a></p></li>
</ol>
</div>'
try -ffootnote 'footnotes inside spans' "$TSRC" "$TOUT"
summary $0
exit $rc
+2 -7
View File
@@ -57,13 +57,8 @@ try() {
./echo
./echo "$1"
fi
./echo "source:"
./echo "$2" | sed -e 's/^/ /'
./echo "diff:"
(./echo "$3" >> $$.w
./echo "$Q" >> $$.g
diff $$.w $$.g ) | sed -e 's/^/ /'
rm -f $$.w $$.g
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
+9
View File
@@ -21,6 +21,15 @@ text' \
'<hr/>
<p>text</p>'
try 'self-closing block tags (br)' \
'<br>
text' \
'<br>
<p>text</p>'
try 'html comments' \
+3 -44
View File
@@ -61,9 +61,9 @@ try 'nested lists (2)' \
<li><p>A (list)</p>
<ol>
<li>Sub (list)</li>
<li>Two (items)</li>
<li>Here</li>
<li> Sub (list)</li>
<li> Two (items)</li>
<li> Here</li>
</ol>
@@ -151,46 +151,5 @@ try 'non-dl followed by dl' \
<dd>hi!</dd>
</dl>'
try 'long enumerated list tag' \
'10000. This is an item
and this is another paragraph in the same
item.
2. and this is another item.
' \
'<ol>
<li><p>This is an item</p>
<p>and this is another paragraph in the same
item.</p></li>
<li><p>and this is another item.</p></li>
</ol>'
try 'long enumerated list tag' \
'10000. This is an item
and this is another paragraph in the same
item.
200000. A longer number in an embedded list.
200001. Another longer and bigger number in an embedded list.
2. and this is another item.
' \
'<ol>
<li><p>This is an item</p>
<p>and this is another paragraph in the same
item.</p>
<ol>
<li>A longer number in an embedded list.</li>
<li>Another longer and bigger number in an embedded list.</li>
</ol>
</li>
<li><p>and this is another item.</p></li>
</ol>'
summary $0
exit $rc
+4 -2
View File
@@ -8,8 +8,10 @@ MARKDOWN_FLAGS=
try 'paragraph followed by code' \
'a
b' \
'<p>a
b</p>'
'<p>a</p>
<pre><code>b
</code></pre>'
try 'single-line paragraph' 'a' '<p>a</p>'
+1 -1
View File
@@ -13,7 +13,7 @@ try 'list followed by header .......... ' \
'<ul>
<li>AAA
<h2>- BBB</h2></li>
<h2>&ndash; BBB</h2></li>
</ul>'
try 'ul with mixed item prefixes' \
+1 -1
View File
@@ -6,7 +6,7 @@ rc=0
MARKDOWN_FLAGS=
try 'smiley faces?' '[8-9] <]:-( x ---> [4]' \
'<p>[8-9] &lt;]:-( x &mdash;> [4]</p>'
'<p>[8-9] &lt;]:&ndash;( x &mdash;&ndash;> [4]</p>'
try 'really long ETX headers' \
'#####################################################hi' \
+2 -3
View File
@@ -10,10 +10,9 @@ try '(r) -> &reg;' '(r)' '<p>&reg;</p>'
try '(tm) -> &trade;' '(tm)' '<p>&trade;</p>'
try '... -> &hellip;' '...' '<p>&hellip;</p>'
try '"?--" -> &ndash;' '?--' '<p>?&ndash;</p>'
try '"?---" -> &mdash;' '?---' '<p>?&mdash;</p>'
try '"--" -> &mdash;' '--' '<p>&mdash;</p>'
try '"--" -> &ndash;' 'regular --' '<p>regular &ndash;</p>'
try '"-" -> &ndash;' 'regular -' '<p>regular &ndash;</p>'
try 'A-B -> A-B' 'A-B' '<p>A-B</p>'
try '"fancy" -> &ldquo;fancy&rdquo;' '"fancy"' '<p>&ldquo;fancy&rdquo;</p>'
try "'fancy'" "'fancy'" '<p>&lsquo;fancy&rsquo;</p>'
-1
View File
@@ -10,7 +10,6 @@ try -fnodel '... with -fnodel' '~~deleted~~' '<p>~~deleted~~</p>'
try 'mismatched tildes' '~~~tick~~' '<p><del>~tick</del></p>'
try 'mismatched tildes(2)' '~~tick~~~' '<p>~~tick~~~</p>'
try 'single tildes' '~tick~' '<p>~tick~</p>'
try 'tildes wrapped in spaces' '~~~ ~~~' '<p>~~~ ~~~</p>'
summary $0
exit $rc
-2
View File
@@ -30,7 +30,5 @@ try 'multiple lines unclosed' "$UNCLOSED" "$RESULT"
try -fnohtml 'unclosed with -fnohtml' '<style>foo' '<p>&lt;style>foo</p>'
try -fnostyle 'disabling style blocks' "$ASK" "$ASK"
summary $0
exit $rc
+14 -79
View File
@@ -12,11 +12,13 @@ try 'single-column table' \
'<table>
<thead>
<tr>
<th></th>
<th>hello</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>sailor</td>
</tr>
</tbody>
@@ -31,7 +33,7 @@ hello|sailor' \
'<table>
<thead>
<tr>
<th>a </th>
<th> a </th>
<th> b</th>
</tr>
</thead>
@@ -73,7 +75,7 @@ hello|
'<table>
<thead>
<tr>
<th>a </th>
<th> a </th>
<th> b</th>
</tr>
</thead>
@@ -83,7 +85,7 @@ hello|
<td></td>
</tr>
<tr>
<td></td>
<td> </td>
<td>sailor</td>
</tr>
</tbody>
@@ -97,14 +99,14 @@ hello|sailor' \
'<table>
<thead>
<tr>
<th style="text-align:right;">a </th>
<th style="text-align:left;"> b</th>
<th align="right"> a </th>
<th align="left"> b</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:right;">hello</td>
<td style="text-align:left;">sailor</td>
<td align="right">hello</td>
<td align="left">sailor</td>
</tr>
</tbody>
</table>'
@@ -117,7 +119,7 @@ hello|sailor|boy' \
'<table>
<thead>
<tr>
<th>a </th>
<th> a </th>
<th> b</th>
</tr>
</thead>
@@ -135,7 +137,7 @@ try -fnotables 'tables with -fnotables' \
-|-
hello|sailor' \
'<p>a|b
-|-
&ndash;|&ndash;
hello|sailor</p>'
try 'deceptive non-table text' \
@@ -150,7 +152,7 @@ try 'table headers only' \
'a|b|c
-|-|-' \
'<p>a|b|c
-|-|-</p>'
&ndash;|&ndash;|&ndash;</p>'
try 'escaped title line' \
'A\|B
@@ -175,7 +177,7 @@ try 'escaped dashes line' \
-\|-
C |D' \
'<p>A |B
-|-
&ndash;|&ndash;
C |D</p>'
try 'escaped content line' \
@@ -202,75 +204,8 @@ try 'content line w/o dashes' \
--|-
CD' \
'<p>A |B
&ndash;|-
&mdash;|&ndash;
CD</p>'
try 'table followed by text' \
'
A|B
-|-
C|D
foo?' \
'<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>C</td>
<td>D</td>
</tr>
</tbody>
</table>
<p>foo?</p>'
try "table with flanking |'s" \
'
|A|B|
|-|-|
|D|C|' \
'<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>D</td>
<td>C</td>
</tr>
</tbody>
</table>'
try "table with leading |'s and alignment" \
'|AA|BB|CC
|:-|::|-:
|aa|bb|cc' \
'<table>
<thead>
<tr>
<th style="text-align:left;">AA</th>
<th style="text-align:center;">BB</th>
<th style="text-align:right;">CC</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">aa</td>
<td style="text-align:center;">bb</td>
<td style="text-align:right;">cc</td>
</tr>
</tbody>
</table>'
summary $0
exit $rc
+4 -8
View File
@@ -23,11 +23,9 @@ hi' \
try '-T -ftoc' 'toc item with link' \
'##[H2](H2) here' \
'<ul>
<li>
<ul>
<li><ul>
<li><a href="#H2.here">H2 here</a></li>
</ul>
</li>
</ul></li>
</ul>
<h2 id="H2.here"><a href="H2">H2</a> here</h2>'
@@ -58,11 +56,9 @@ hi' \
try '-T -ftoc' 'toc item with link' \
'##[H2](H2) here' \
'<ul>
<li>
<ul>
<li><ul>
<li><a href="#H2.here">H2 here</a></li>
</ul>
</li>
</ul></li>
</ul>
<a name="H2.here"></a>
<h2><a href="H2">H2</a> here</h2>'
+2 -20
View File
@@ -8,10 +8,7 @@
.Nd create a web page from a template file
.Sh SYNOPSIS
.Nm
.Op Fl C Pa option-flags
.Op Fl c Pa options
.Op Fl d Pa root
.Op Fl E
.Op Fl f
.Op Fl o Pa file
.Op Fl p Pa pagename
@@ -97,7 +94,7 @@ that this copy of theme was compiled with.
.El
.Pp
If input is coming from a file and the output was not set with the
.Fl o
.Ar o
option,
.Nm writes the output to
.Pa file-sans-text.html
@@ -118,21 +115,6 @@ Set the
.Em "document root"
to
.Ar root
.It Fl E
Normally
theme will not expand
.Pa "<?theme body?>"
or
.Pa "<?theme toc?>"
in the
.Pa "<head>"
section, or
.Pa "<?theme style?>"
in the
.Pa "<body>"
section, but the
.Fl E
option overrides this and allows expansions everywhere.
.It Fl f
Forcibly overwrite existing html files.
.It Fl o Pa filename
@@ -157,4 +139,4 @@ utility exits 0 on success, and >0 if an error occurs.
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.portland.or.us
.Pq Li orc@pell.chi.il.us
+6 -25
View File
@@ -10,7 +10,6 @@
* be distributed with this source code.
*/
#include "config.h"
#include "pgm_options.h"
#include <stdio.h>
#include <stdlib.h>
@@ -38,8 +37,6 @@ char *pgm = "theme";
char *output = 0;
char *pagename = 0;
char *root = 0;
int everywhere = 0; /* expand all <?theme elements everywhere */
#if HAVE_PWD_H
struct passwd *me = 0;
#endif
@@ -57,7 +54,7 @@ basename(char *path)
{
char *p;
if ( p = strrchr(path, '/') )
if (( p = strrchr(path, '/') ))
return 1+p;
return path;
}
@@ -469,7 +466,7 @@ spin(FILE *template, MMIOT *doc, FILE *output)
for (i=0; i < NR(keyword); i++)
if ( thesame(p, keyword[i].kw) ) {
if ( everywhere || (keyword[i].where & where) )
if ( keyword[i].where & where )
(*keyword[i].what)(doc,output,flags,where);
break;
}
@@ -500,6 +497,7 @@ spin(FILE *template, MMIOT *doc, FILE *output)
} /* spin */
void
main(argc, argv)
char **argv;
{
@@ -507,7 +505,6 @@ char **argv;
char *source = "stdin";
FILE *tmplfile;
int opt;
mkd_flag_t flags = MKD_TOC;
int force = 0;
MMIOT *doc;
struct stat sourceinfo;
@@ -515,32 +512,16 @@ char **argv;
opterr=1;
pgm = basename(argv[0]);
while ( (opt=getopt(argc, argv, "EfC:c:d:t:p:o:V")) != EOF ) {
while ( (opt=getopt(argc, argv, "fd:t:p:o:V")) != EOF ) {
switch (opt) {
case 'd': root = optarg;
break;
case 'E': everywhere = 1;
break;
case 'p': pagename = optarg;
break;
case 'f': force = 1;
break;
case 't': template = optarg;
break;
case 'C': if ( strcmp(optarg, "?") == 0 ) {
show_flags(0);
exit(0);
}
else
flags = strtol(optarg, 0, 0);
break;
case 'c': if ( strcmp(optarg, "?") == 0 ) {
show_flags(1);
exit(0);
}
else if ( !set_flag(&flags, optarg) )
fprintf(stderr,"%s: unknown option <%s>", pgm, optarg);
break;
case 'o': output = optarg;
break;
case 'V': printf("theme+discount %s\n", markdown_version);
@@ -592,7 +573,7 @@ char **argv;
strcat(q, ".html");
}
}
if ( output && strcmp(output, "-") ) {
if ( output ) {
if ( force )
unlink(output);
if ( !freopen(output, "w", stdout) )
@@ -615,7 +596,7 @@ char **argv;
fail("out of memory");
#endif
if ( !mkd_compile(doc, flags) )
if ( !mkd_compile(doc, MKD_TOC) )
fail("couldn't compile input");
if ( tmplfile )
+10 -21
View File
@@ -1,8 +1,7 @@
/*
* toc -- spit out a table of contents based on header blocks
*
* Copyright (C) 2008 Jjgod Jiang, David L Parsons
* portions Copyright (C) 2011 Stefano D'Angelo
* Copyright (C) 2008 Jjgod Jiang, David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
@@ -24,7 +23,6 @@ mkd_toc(Document *p, char **doc)
int last_hnumber = 0;
Cstring res;
int size;
int first = 1;
if ( !(doc && p && p->ctx) ) return -1;
@@ -40,23 +38,16 @@ mkd_toc(Document *p, char **doc)
for ( srcp = tp->down; srcp; srcp = srcp->next ) {
if ( srcp->typ == HDR && srcp->text ) {
while ( last_hnumber > srcp->hnumber ) {
if ( (last_hnumber - srcp->hnumber) > 1 )
Csprintf(&res, "\n");
Csprintf(&res, "</li>\n%*s</ul>\n%*s",
last_hnumber-1, "", last_hnumber-1, "");
--last_hnumber;
if ( last_hnumber >= srcp->hnumber ) {
while ( last_hnumber > srcp->hnumber ) {
Csprintf(&res, "%*s</ul></li>\n", last_hnumber-1,"");
--last_hnumber;
}
}
if ( last_hnumber == srcp->hnumber )
Csprintf(&res, "</li>\n");
else if ( (srcp->hnumber > last_hnumber) && !first )
Csprintf(&res, "\n");
while ( srcp->hnumber > last_hnumber ) {
Csprintf(&res, "%*s<ul>\n", last_hnumber, "");
if ( (srcp->hnumber - last_hnumber) > 1 )
Csprintf(&res, "%*s<li>\n", last_hnumber+1, "");
Csprintf(&res, "%*s%s<ul>\n", last_hnumber, "",
last_hnumber ? "<li>" : "");
++last_hnumber;
}
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
@@ -68,8 +59,7 @@ mkd_toc(Document *p, char **doc)
S(srcp->text->text),
(mkd_sta_function_t)Csputc, &res,0);
Csprintf(&res, "</a>");
first = 0;
Csprintf(&res, "</li>\n");
}
}
}
@@ -77,8 +67,7 @@ mkd_toc(Document *p, char **doc)
while ( last_hnumber > 0 ) {
--last_hnumber;
Csprintf(&res, "</li>\n%*s</ul>\n%*s",
last_hnumber, "", last_hnumber, "");
Csprintf(&res, last_hnumber ? "%*s</ul></li>\n" : "%*s</ul>\n", last_hnumber, "");
}
if ( (size = S(res)) > 0 ) {
-3
View File
@@ -23,8 +23,5 @@ char markdown_version[] = VERSION
#endif
#if WITH_GITHUB_TAGS
" GITHUB-TAGS"
#endif
#if WITH_FENCED_CODE
" FENCED-CODE"
#endif
;
+2 -2
View File
@@ -24,9 +24,9 @@ NSString* discountToHTML(NSString *markdown) {
char *htmlUTF8;
int htmlUTF8Len = mkd_document_wrapper(document, &htmlUTF8);
if (htmlUTF8Len != EOF) {
result = [[NSString alloc] initWithBytes:htmlUTF8
result = [[[NSString alloc] initWithBytes:htmlUTF8
length:htmlUTF8Len
encoding:NSUTF8StringEncoding];
encoding:NSUTF8StringEncoding] autorelease];
}
mkd_cleanup_wrapper(document);
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB