Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f22cac676 | |||
| fc8039010f | |||
| bdcd2d8a69 | |||
| cd55f40353 | |||
| 4df49785d2 | |||
| bed96f76ad | |||
| 6e0cba6f77 | |||
| 0b83cde16b | |||
| d947bc4973 | |||
| 3c094cabae | |||
| 7dada0fe9a | |||
| 417e4b9a10 | |||
| 4ff297358f | |||
| df917df6a3 | |||
| 63f5a1ff82 | |||
| 260e1b0a46 | |||
| 783fa83c5d | |||
| 3310439a20 | |||
| cb0e3d2394 | |||
| d05d2da9b9 | |||
| 35f20bc78c | |||
| 6185cfba6d | |||
| 2173098c41 | |||
| 46977d9c7a | |||
| 463734dfab | |||
| f8f6d8976b | |||
| 15287c0e85 | |||
| 28d8f5e73a | |||
| bf5850c112 | |||
| 1931abfa5c | |||
| 460b0cae9b | |||
| 867540f2a4 | |||
| 921c71b7da | |||
| 1d96a33c96 | |||
| a1b9ee2db6 | |||
| d8413c8708 |
+17
-8
@@ -1,9 +1,18 @@
|
||||
# Xcode
|
||||
/build/
|
||||
/*.xcodeproj/*.mode1v3
|
||||
/*.xcodeproj/*.mode2v3
|
||||
/*.xcodeproj/*.pbxuser
|
||||
/*.xcodeproj/xcuserdata/*
|
||||
/*.xcodeproj/*.perspectivev3
|
||||
/*.xcodeproj/project.xcworkspace/*
|
||||
*~.nib
|
||||
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
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
NSFont *font;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSFont *font;
|
||||
@property (nonatomic, strong) NSFont *font;
|
||||
|
||||
- (CGFloat)lineHeight;
|
||||
|
||||
|
||||
@@ -18,16 +18,11 @@
|
||||
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);
|
||||
|
||||
+3
-2
@@ -7,12 +7,13 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#define kEditPaneTextViewChangedNotification @"EditPaneTextViewChangedNotification"
|
||||
|
||||
extern NSString * const kEditPaneTextViewChangedNotification;
|
||||
|
||||
@class EditPaneLayoutManager;
|
||||
|
||||
@interface EditPaneTextView : NSTextView {
|
||||
EditPaneLayoutManager *layoutMan;
|
||||
__weak EditPaneLayoutManager *layoutMan;
|
||||
}
|
||||
|
||||
- (void)updateColors;
|
||||
|
||||
+28
-13
@@ -11,6 +11,8 @@
|
||||
#import "PreferencesManager.h"
|
||||
#import "PreferencesController.h"
|
||||
|
||||
NSString * const kEditPaneTextViewChangedNotification = @"EditPaneTextViewChangedNotification";
|
||||
NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNotification";
|
||||
|
||||
@implementation EditPaneTextView
|
||||
|
||||
@@ -25,36 +27,49 @@
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneForegroundColor]
|
||||
options:0
|
||||
context:@"ColorChange"];
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
|
||||
options:0
|
||||
context:@"ColorChange"];
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
|
||||
options:0
|
||||
context:@"ColorChange"];
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
|
||||
options:0
|
||||
context:@"ColorChange"];
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
|
||||
[self setUsesFontPanel:NO];
|
||||
|
||||
NSTextContainer *textContainer = [[NSTextContainer alloc] init];
|
||||
[textContainer setContainerSize:[[self textContainer] containerSize]];
|
||||
[textContainer setWidthTracksTextView:YES];
|
||||
layoutMan = [[EditPaneLayoutManager alloc] init];
|
||||
[self replaceTextContainer:textContainer];
|
||||
[textContainer replaceLayoutManager:layoutMan];
|
||||
[textContainer release];
|
||||
|
||||
EditPaneLayoutManager *lManager = [[EditPaneLayoutManager alloc] init];
|
||||
[textContainer replaceLayoutManager:lManager];
|
||||
layoutMan = lManager;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self];
|
||||
[layoutMan release];
|
||||
[super dealloc];
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent *)aEvent {
|
||||
@@ -67,7 +82,7 @@
|
||||
selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange {
|
||||
id resultString;
|
||||
if ([aString isKindOfClass:[NSAttributedString class]]) {
|
||||
resultString = [[aString mutableCopy] autorelease];
|
||||
resultString = [aString mutableCopy];
|
||||
selectedRange = NSMakeRange(0, [resultString length]);
|
||||
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName,
|
||||
@@ -104,8 +119,8 @@
|
||||
#pragma unused(keyPath)
|
||||
#pragma unused(object)
|
||||
#pragma unused(change)
|
||||
|
||||
if ([(NSString *)context isEqualToString:@"ColorChange"]) {
|
||||
|
||||
if ([(__bridge NSString *)context isEqualToString:kEditPaneColorChangedNotification]) {
|
||||
[self updateColors];
|
||||
}
|
||||
}
|
||||
|
||||
+298
-207
@@ -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">10J4138</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.35</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<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">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">1306</string>
|
||||
<string key="NS.object.0">1617</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -722,6 +722,39 @@
|
||||
</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>
|
||||
@@ -816,8 +849,9 @@
|
||||
<string key="NSWindowTitle">Preferences</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="755094886">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -828,7 +862,7 @@
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSView" id="54308797">
|
||||
<reference key="NSNextResponder" ref="396535826"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<int key="NSvFlags">274</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSTextField" id="943641235">
|
||||
@@ -1073,7 +1107,6 @@
|
||||
<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>
|
||||
@@ -1122,12 +1155,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}, {1680, 1028}}</string>
|
||||
<string key="NSMaxSize">{1e+13, 1e+13}</string>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1440}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<string key="NSFrameAutosaveName">PreferencesPanel</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
<object class="NSUserDefaultsController" id="36957087">
|
||||
<bool key="NSSharedInstance">YES</bool>
|
||||
@@ -1135,6 +1168,32 @@
|
||||
<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">
|
||||
@@ -1643,6 +1702,46 @@
|
||||
</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">
|
||||
@@ -1681,6 +1780,7 @@
|
||||
<reference ref="952259628"/>
|
||||
<reference ref="379814623"/>
|
||||
<reference ref="1050483726"/>
|
||||
<reference ref="81456092"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
@@ -2431,6 +2531,63 @@
|
||||
<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">
|
||||
@@ -2441,131 +2598,60 @@
|
||||
<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>
|
||||
@@ -2577,13 +2663,10 @@
|
||||
<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>
|
||||
@@ -2602,11 +2685,7 @@
|
||||
<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>
|
||||
@@ -2614,36 +2693,29 @@
|
||||
<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>
|
||||
@@ -2651,131 +2723,60 @@
|
||||
<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>
|
||||
@@ -2787,13 +2788,10 @@
|
||||
<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>
|
||||
@@ -2812,11 +2810,6 @@
|
||||
<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>
|
||||
@@ -2824,36 +2817,30 @@
|
||||
<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>
|
||||
<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>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
@@ -2868,11 +2855,19 @@
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">586</int>
|
||||
<int key="maxID">602</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">
|
||||
@@ -2891,18 +2886,114 @@
|
||||
<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">
|
||||
<string key="NS.key.0">copyGeneratedHTMLAction:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
<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>
|
||||
</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>
|
||||
<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>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
@@ -2915,7 +3006,7 @@
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>WebView</string>
|
||||
<string>NSTextView</string>
|
||||
<string>EditPaneTextView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
@@ -2933,7 +3024,7 @@
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">markdownSourceTextView</string>
|
||||
<string key="candidateClassName">NSTextView</string>
|
||||
<string key="candidateClassName">EditPaneTextView</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
+279
-683
@@ -1,683 +1,279 @@
|
||||
<?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">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">
|
||||
<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>1306</string>
|
||||
<string>30</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">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.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>
|
||||
<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="497745035"/>
|
||||
<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">12003</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"/>
|
||||
</object>
|
||||
<int key="NSTVFlags">6</int>
|
||||
<string key="NSMaxSize">{463, 1e+07}</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>
|
||||
<int key="NSCursorType">1</int>
|
||||
</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="934421653"/>
|
||||
<int key="NSsFlags">528</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="NSFrame">{{7, 11}, {860, 600}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="202269651"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
|
||||
<string key="NSMinSize">{94, 108}</string>
|
||||
<string key="NSMaxSize">{1e+13, 1e+13}</string>
|
||||
</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>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<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>-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.IBEditorWindowLastContentRect</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>5.IBWindowTemplateEditedContentRect</string>
|
||||
<string>5.ImportedFromIB2</string>
|
||||
<string>5.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>5.editorWindowContentRectSynchronizationRect</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>6.ImportedFromIB2</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>EditPaneTextView</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.WebKitIBPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{597, 57}, {769, 667}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{597, 57}, {769, 667}}</string>
|
||||
<integer value="1"/>
|
||||
<boolean value="NO"/>
|
||||
<string>{{201, 387}, {507, 413}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
</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">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">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">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>
|
||||
<?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>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// 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
|
||||
@@ -44,9 +44,9 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.7</string>
|
||||
<string>1.7.1</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.7</string>
|
||||
<string>1.7.1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSMainNibFile</key>
|
||||
|
||||
@@ -3,12 +3,19 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objectVersion = 46;
|
||||
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 */; };
|
||||
@@ -72,6 +79,8 @@
|
||||
/* 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>"; };
|
||||
@@ -91,6 +100,18 @@
|
||||
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>"; };
|
||||
@@ -168,22 +189,13 @@
|
||||
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 = (
|
||||
ABECD96113C8D1C200B77CFD /* ORCDiscount */,
|
||||
2A37F4ABFDCFA73011CA2CEA /* Classes */,
|
||||
3D6A8BBD15F0D919002C8B62 /* Categories */,
|
||||
795F6C4D105D6EA500D1F90A /* discount */,
|
||||
22ECEEC512E7C258003B50DC /* discount-config */,
|
||||
795F6DB3105D75D300D1F90A /* discount_wrappers */,
|
||||
2A37F4AFFDCFA73011CA2CEA /* Other Sources */,
|
||||
2A37F4B8FDCFA73011CA2CEA /* Resources */,
|
||||
@@ -198,10 +210,17 @@
|
||||
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 */,
|
||||
@@ -221,6 +240,7 @@
|
||||
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D6A8BD915F0F33C002C8B62 /* Images */,
|
||||
226936E612E7CDC500171322 /* styles.css */,
|
||||
795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */,
|
||||
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
|
||||
@@ -241,6 +261,27 @@
|
||||
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 = (
|
||||
@@ -256,6 +297,8 @@
|
||||
2269369F12E7C6BE00171322 /* tags.h */,
|
||||
2269369E12E7C6BE00171322 /* tags.c */,
|
||||
226936C912E7CA2800171322 /* setup.c */,
|
||||
226936B912E7C8B600171322 /* mkdio.h */,
|
||||
22ECEEC612E7C258003B50DC /* config.h */,
|
||||
);
|
||||
path = discount;
|
||||
sourceTree = "<group>";
|
||||
@@ -343,8 +386,11 @@
|
||||
/* Begin PBXProject section */
|
||||
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0600;
|
||||
};
|
||||
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MarkdownLive" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
@@ -373,6 +419,11 @@
|
||||
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 */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -398,6 +449,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 */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -472,13 +525,14 @@
|
||||
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 = "";
|
||||
@@ -490,9 +544,8 @@
|
||||
"-framework",
|
||||
AppKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = ORCDiscount;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -500,13 +553,14 @@
|
||||
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";
|
||||
@@ -517,7 +571,6 @@
|
||||
"-framework",
|
||||
AppKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = ORCDiscount;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
ZERO_LINK = NO;
|
||||
@@ -528,11 +581,12 @@
|
||||
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;
|
||||
@@ -546,9 +600,11 @@
|
||||
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";
|
||||
@@ -563,7 +619,6 @@
|
||||
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;
|
||||
@@ -575,11 +630,11 @@
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -591,7 +646,6 @@
|
||||
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;
|
||||
@@ -602,10 +656,10 @@
|
||||
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = YES;
|
||||
GCC_WARN_UNUSED_PARAMETER = NO;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
SDKROOT = macosx;
|
||||
SEPARATE_STRIP = YES;
|
||||
STRIP_INSTALLED_PRODUCT = YES;
|
||||
};
|
||||
|
||||
@@ -27,4 +27,17 @@
|
||||
|
||||
- (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
|
||||
|
||||
+274
-18
@@ -7,14 +7,27 @@
|
||||
|
||||
#import "ORCDiscount.h"
|
||||
#import "MyDocument.h"
|
||||
#import "EditPaneLayoutManager.h"
|
||||
#import "EditPaneTextView.h"
|
||||
#import "PreferencesController.h"
|
||||
#import "PreferencesManager.h"
|
||||
#import "NSTextView+EditPlainTextWithUndo.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 ()
|
||||
|
||||
@@ -50,10 +63,11 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[htmlPreviewTimer invalidate]; htmlPreviewTimer = nil;
|
||||
[markdownSource release]; markdownSource = nil;
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification {
|
||||
[htmlPreviewTimer invalidate];
|
||||
}
|
||||
|
||||
- (NSString *)windowNibName {
|
||||
@@ -75,11 +89,21 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
[markdownSourceTextView updateFont];
|
||||
[markdownSourceTextView updateColors];
|
||||
|
||||
if ([controller_.window respondsToSelector:@selector(toggleFullScreen:)]) {
|
||||
controller_.window.collectionBehavior &= !NSWindowCollectionBehaviorFullScreenAuxiliary;
|
||||
controller_.window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
}
|
||||
|
||||
[super windowControllerDidLoadNib:controller_];
|
||||
}
|
||||
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_ ofType:(NSString*)typeName_ error:(NSError**)error_ {
|
||||
BOOL result = NO;
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_
|
||||
ofType:(NSString*)typeName_
|
||||
forSaveOperation:(NSSaveOperationType)saveOperation_
|
||||
originalContentsURL:(NSURL*)absoluteOriginalContentsURL_
|
||||
error:(NSError **)error_
|
||||
{
|
||||
BOOL result = NO;
|
||||
if ([typeName_ isEqualToString:kMarkdownDocumentType]) {
|
||||
[markdownSourceTextView breakUndoCoalescing];
|
||||
result = [[markdownSource string] writeToURL:absoluteURL_
|
||||
@@ -88,20 +112,21 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
error:error_];
|
||||
|
||||
}
|
||||
if (result && ![self hasUnautosavedChanges]) {
|
||||
|
||||
if (result && saveOperation_ != NSAutosaveOperation) {
|
||||
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] autorelease];
|
||||
error:nil];
|
||||
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] autorelease];
|
||||
error:nil];
|
||||
NSArray *markdownNodes = [markdownDoc nodesForXPath:@"/html/body/*" error:nil];
|
||||
[markdownNodes makeObjectsPerformSelector:@selector(detach)];
|
||||
[node setChildren:markdownNodes];
|
||||
@@ -131,7 +156,6 @@ 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;
|
||||
@@ -146,7 +170,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
- (NSView *)printableView {
|
||||
NSRect frame = [[self printInfo] imageablePageBounds];
|
||||
frame.size.height = 0;
|
||||
NSTextView *printView = [[[NSTextView alloc] initWithFrame:frame] autorelease];
|
||||
NSTextView *printView = [[NSTextView alloc] initWithFrame:frame];
|
||||
[printView setVerticallyResizable:YES];
|
||||
[printView setHorizontallyResizable:NO];
|
||||
|
||||
@@ -159,7 +183,6 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
|
||||
[[printView textStorage] beginEditing];
|
||||
[[printView textStorage] appendAttributedString:printStr];
|
||||
[printStr release];
|
||||
[[printView textStorage] endEditing];
|
||||
|
||||
[printView sizeToFit];
|
||||
@@ -187,7 +210,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
NSView *docView = [[[htmlPreviewWebView mainFrame] frameView] documentView];
|
||||
NSView *parent = [docView superview];
|
||||
if (parent) {
|
||||
NSAssert([parent isKindOfClass:[NSClipView class]], nil);
|
||||
NSAssert([parent isKindOfClass:[NSClipView class]], @"");
|
||||
savedOrigin = [parent bounds].origin;
|
||||
// This line from Darin from http://lists.apple.com/archives/webkitsdk-dev/2003/Dec/msg00004.html :
|
||||
savedAtBottom = [docView isFlipped]
|
||||
@@ -201,6 +224,30 @@ 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_)
|
||||
@@ -241,7 +288,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];
|
||||
@@ -258,4 +305,213 @@ 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
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// NSTextView+EditPlainTextWithUndo.h
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
// Based on DrewThaler’s 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
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// NSTextView+EditPlainTextWithUndo.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
// Based on DrewThaler’s 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
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define kEditPaneFontNameChangedNotification @"EditPaneFontNameChangedNotification"
|
||||
extern NSString * const kEditPaneFontNameChangedNotification;
|
||||
|
||||
@interface PreferencesController : NSObject {
|
||||
IBOutlet NSWindow *prefWindow;
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
#import "PreferencesController.h"
|
||||
#import "PreferencesManager.h"
|
||||
|
||||
#define FONT_DISPLAY_FORMAT @"%@ %g pt."
|
||||
NSString * const kEditPaneFontNameChangedNotification = @"EditPaneFontNameChangedNotification";
|
||||
|
||||
NSString * const kFontDisplayFormat = @"%@ %g pt.";
|
||||
|
||||
@interface PreferencesController (Private)
|
||||
|
||||
@@ -35,7 +36,7 @@
|
||||
- (void)updateFontDisplay {
|
||||
NSString *fontName = [PreferencesManager editPaneFontName];
|
||||
float fontSize = [PreferencesManager editPaneFontSize];
|
||||
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
|
||||
[fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
|
||||
}
|
||||
|
||||
- (IBAction)resetEditPanePreferences:(id)sender {
|
||||
@@ -56,7 +57,7 @@
|
||||
if (newFont && fontName) {
|
||||
[PreferencesManager setEditPaneFontName:fontName];
|
||||
[PreferencesManager setEditPaneFontSize:fontSize];
|
||||
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
|
||||
[fontPreviewField setStringValue:[NSString stringWithFormat:kFontDisplayFormat, fontName, fontSize]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
|
||||
object:nil];
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define kEditPaneFontName @"EditPaneFontName"
|
||||
#define kEditPaneFontSize @"EditPaneFontSize"
|
||||
#define kEditPaneForegroundColor @"EditPaneForegroundColor"
|
||||
#define kEditPaneBackgroundColor @"EditPaneBackgroundColor"
|
||||
#define kEditPaneSelectionColor @"EditPaneSelectionColor"
|
||||
#define kEditPaneCaretColor @"EditPaneCaretColor"
|
||||
|
||||
extern NSString * const kEditPaneFontName;
|
||||
extern NSString * const kEditPaneFontSize;
|
||||
extern NSString * const kEditPaneForegroundColor;
|
||||
extern NSString * const kEditPaneBackgroundColor;
|
||||
extern NSString * const kEditPaneSelectionColor;
|
||||
extern NSString * const kEditPaneCaretColor;
|
||||
|
||||
@interface PreferencesManager : NSObject {
|
||||
|
||||
|
||||
@@ -8,6 +8,13 @@
|
||||
|
||||
#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;
|
||||
|
||||
@@ -13,12 +13,13 @@ 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 '1,/^ *\*\/ *$/ { d; }' <config.h >../discount-config/config.h && echo 'config.h'
|
||||
sed -i '1,/^ *\*\/ *$/ { d; }' <config.h
|
||||
else
|
||||
cp config.h ../discount-config/config.h && echo 'config.h'
|
||||
error_msg "Can't locate config.h comments!"
|
||||
@@ -28,6 +29,6 @@ cp mkdio.h ../discount-config/mkdio.h && echo 'mkdio.h'
|
||||
|
||||
status_msg "Clean files from working directory..."
|
||||
|
||||
git clean -f
|
||||
git clean -df -e blocktags -e 'config.h' -e 'mkdio.h'
|
||||
|
||||
status_msg "Done!"
|
||||
|
||||
+23
-40
@@ -1,47 +1,30 @@
|
||||
->Copyright (C) 2007 David Loren Parsons.
|
||||
All rights reserved.<-
|
||||
|
||||
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:
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
+3
-1
@@ -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.chi.il.us)
|
||||
-david parsons (orc@pell.portland.or.us)
|
||||
|
||||
|
||||
Josh Wood -- Plan9 support.
|
||||
@@ -29,5 +29,7 @@ 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 `–` and `—`
|
||||
translations.
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
___mkd_reparse(buf, size, 0, &f, 0);
|
||||
___mkd_emblock(&f);
|
||||
SUFFIX(*iot, T(f.out), S(f.out));
|
||||
___mkd_freemmiot(&f, 0);
|
||||
|
||||
+44
-33
@@ -1,4 +1,5 @@
|
||||
CC=@CC@ -I. -L.
|
||||
CC=@CC@ -I.
|
||||
LFLAGS=-L.
|
||||
CFLAGS=@CFLAGS@
|
||||
AR=@AR@
|
||||
RANLIB=@RANLIB@
|
||||
@@ -15,75 +16,85 @@ 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 \
|
||||
setup.o tags.o html5.o flags.o @AMALLOC@
|
||||
github_flavoured.o 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_PROGRAM@ $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
|
||||
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
|
||||
@INSTALL_DATA@ theme.1 makepage.1 mkd2html.1 $(DESTDIR)/$(MANDIR)/man1
|
||||
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.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) -DVERSION=\"`cat VERSION`\" -c version.c
|
||||
$(CC) $(CFLAGS) -DVERSION=\"`cat VERSION`\" -c version.c
|
||||
|
||||
VERSION:
|
||||
@true
|
||||
|
||||
tags.o: tags.c blocktags
|
||||
|
||||
blocktags: mktags
|
||||
./mktags > blocktags
|
||||
|
||||
# example programs
|
||||
@THEME@theme: theme.o $(MKDLIB) mkdio.h
|
||||
@THEME@ $(CC) -o theme theme.o -lmarkdown @LIBS@
|
||||
@THEME@ $(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
|
||||
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
|
||||
$(CC) -o mkd2html mkd2html.o -lmarkdown @LIBS@
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o mkd2html mkd2html.o -lmarkdown @LIBS@
|
||||
|
||||
markdown: main.o pgm_options.o $(MKDLIB)
|
||||
$(CC) $(CFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
makepage: makepage.c pgm_options.o $(MKDLIB) mkdio.h
|
||||
$(CC) $(CFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
pgm_options.o: pgm_options.c mkdio.h config.h
|
||||
$(CC) -I. -c pgm_options.c
|
||||
$(CC) $(CFLAGS) -I. -c pgm_options.c
|
||||
|
||||
main.o: main.c mkdio.h config.h
|
||||
$(CC) -I. -c main.c
|
||||
$(CC) $(CFLAGS) -I. -c main.c
|
||||
|
||||
$(MKDLIB): $(OBJS)
|
||||
./librarian.sh make $(MKDLIB) VERSION $(OBJS)
|
||||
@@ -106,7 +117,7 @@ clean:
|
||||
rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`
|
||||
|
||||
distclean spotless: clean
|
||||
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@
|
||||
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags ./librarian.sh
|
||||
|
||||
Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
|
||||
amalloc.o: amalloc.c
|
||||
|
||||
+1
-1
@@ -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.chi.il.us>;
|
||||
DISCOUNT is free software written by David Parsons <orc@pell.portland.or.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
@@ -1 +1 @@
|
||||
2.1.0
|
||||
2.1.8
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
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
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* configuration for markdown, generated Mon 11 Jul 2011 22:16:51 BST
|
||||
* by Jonathan@macbook-pro.local
|
||||
* configuration for markdown, generated Wed Apr 8 00:13:17 CDT 2015
|
||||
* by vino@achilleus.local
|
||||
*/
|
||||
#ifndef __AC_MARKDOWN_D
|
||||
#define __AC_MARKDOWN_D 1
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#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
|
||||
+121
-65
@@ -193,8 +193,8 @@ AC_CHECK_FUNCS () {
|
||||
B=`echo "$1" | sed -e 's/(.*)//'`
|
||||
|
||||
case "$B" in
|
||||
"$1") F="$1()" ;;
|
||||
*) F="$1" ;;
|
||||
"$1") F="$1()"; need_proto=1 ;;
|
||||
*) F="$1" ; unset need_proto ;;
|
||||
esac
|
||||
|
||||
shift
|
||||
@@ -205,6 +205,10 @@ AC_CHECK_FUNCS () {
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$need_proto" ]; then
|
||||
echo "void $F;" >> ngc$$.c
|
||||
fi
|
||||
|
||||
cat >> ngc$$.c << EOF
|
||||
main()
|
||||
{
|
||||
@@ -385,8 +389,13 @@ EOF
|
||||
TLOGN " ($AC_CC)"
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
if $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; 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
|
||||
TLOG " oh ick, it looks like gcc"
|
||||
IS_GCC=T
|
||||
IS_BROKEN_CC=T
|
||||
else
|
||||
TLOG " ok"
|
||||
@@ -422,8 +431,6 @@ EOF
|
||||
AC_FAIL " does not compile code properly"
|
||||
fi
|
||||
|
||||
AC_SUB 'CC' "$AC_CC"
|
||||
|
||||
__remove ngc$$ ngc$$.c ngc$$.o
|
||||
|
||||
return $status
|
||||
@@ -826,9 +833,7 @@ EOF
|
||||
# AC_C_VOLATILE checks to see if the compiler supports the volatile keyword
|
||||
#
|
||||
AC_C_VOLATILE () {
|
||||
cat > ngc$$.c << EOF
|
||||
f() { volatile char me=1; }
|
||||
EOF
|
||||
echo 'f() { volatile char me=1; }' > ngc$$.c
|
||||
LOGN "checking for \"volatile\" keyword"
|
||||
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
@@ -842,10 +847,39 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# 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>
|
||||
@@ -859,7 +893,6 @@ say(char *w, char *v)
|
||||
: "s:@%s@:%s:g\n", w, v);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
@@ -887,8 +920,6 @@ 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
|
||||
@@ -912,6 +943,7 @@ EOF
|
||||
0) TLOG "" ;;
|
||||
*) AC_FAIL " ** FAILED **" ;;
|
||||
esac
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
||||
@@ -923,6 +955,7 @@ 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"
|
||||
@@ -1151,6 +1184,8 @@ AC_CHECK_BASENAME() {
|
||||
cat > ngc$$.c << EOF
|
||||
#include <string.h>
|
||||
|
||||
extern char *basename(char*);
|
||||
|
||||
main()
|
||||
{
|
||||
char *a = basename("/a/test");
|
||||
@@ -1162,7 +1197,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
|
||||
@@ -1197,28 +1232,58 @@ AC_COMPILER_PIC () {
|
||||
return $__rc
|
||||
}
|
||||
|
||||
#
|
||||
# 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
|
||||
# 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
|
||||
#
|
||||
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
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
|
||||
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
|
||||
LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
;;
|
||||
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
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build ELF shared libraries, hiding (some) ickiness from the makefile
|
||||
@@ -1254,45 +1319,36 @@ install)$PROG_INSTALL -c \$FULLNAME "\$1"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
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
|
||||
chmod +x librarian.sh
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
|
||||
# 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 "
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
LOG "(yes; macos dylib)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(no)"
|
||||
__rc=1
|
||||
fi
|
||||
;;
|
||||
files) echo "\$FULLNAME"
|
||||
;;
|
||||
install)$PROG_INSTALL -c \$FULLNAME "\$1"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x librarian.sh
|
||||
LOG "(yes; macos dylib)"
|
||||
elif $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
|
||||
__AC_ELF_LIBRARIAN
|
||||
LOG "(yes; -shared)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(no)"
|
||||
|
||||
+24
-4
@@ -12,6 +12,8 @@ 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)'
|
||||
|
||||
@@ -35,6 +37,9 @@ locals() {
|
||||
;;
|
||||
--ENABLE-*) enable=`echo $K | sed -e 's/--ENABLE-//' | tr '-' '_'`
|
||||
echo WITH_${enable}=T ;;
|
||||
--DEBIAN-GLITCH)
|
||||
echo DEBIAN_GLITCH=T
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -53,23 +58,38 @@ 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
|
||||
|
||||
case "$AC_CC $AC_CFLAGS" in
|
||||
*-Wall*) AC_DEFINE 'while(x)' 'while( (x) != 0 )'
|
||||
AC_DEFINE 'if(x)' 'if( (x) != 0 )' ;;
|
||||
esac
|
||||
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
|
||||
|
||||
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
@@ -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) \
|
||||
( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
|
||||
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])), \
|
||||
S(t) -= (sz)) : -1
|
||||
(sz)) : 0
|
||||
|
||||
#define RESERVE(x, sz) T(x) = ((x).alloc > S(x) + (sz) \
|
||||
? T(x) \
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
* of html has been generated.
|
||||
*
|
||||
* It should create MarkdownTest_1.0 (and _1.0.3)
|
||||
* compatable emphasis for non-pathological cases
|
||||
* compatible emphasis for non-pathological cases
|
||||
* and it should fail in a standards-compliant way
|
||||
* when someone attempts to feed it junk.
|
||||
*
|
||||
|
||||
@@ -29,6 +29,7 @@ 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])
|
||||
|
||||
|
||||
+160
-80
@@ -38,9 +38,19 @@ 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 int
|
||||
static inline int
|
||||
peek(MMIOT *f, int i)
|
||||
{
|
||||
|
||||
@@ -52,7 +62,7 @@ peek(MMIOT *f, int i)
|
||||
|
||||
/* pull a byte from the input buffer
|
||||
*/
|
||||
static int
|
||||
static inline int
|
||||
pull(MMIOT *f)
|
||||
{
|
||||
return ( f->isp < S(f->in) ) ? T(f->in)[f->isp++] : EOF;
|
||||
@@ -61,23 +71,27 @@ pull(MMIOT *f)
|
||||
|
||||
/* return a pointer to the current position in the input buffer.
|
||||
*/
|
||||
static char*
|
||||
static inline char*
|
||||
cursor(MMIOT *f)
|
||||
{
|
||||
return T(f->in) + f->isp;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
isthisspace(MMIOT *f, int i)
|
||||
{
|
||||
int c = peek(f, i);
|
||||
|
||||
return isspace(c) || (c == EOF);
|
||||
if ( c == EOF )
|
||||
return 1;
|
||||
if ( c & 0x80 )
|
||||
return 0;
|
||||
return isspace(c) || (c < ' ');
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
isthisalnum(MMIOT *f, int i)
|
||||
{
|
||||
int c = peek(f, i);
|
||||
@@ -86,7 +100,7 @@ isthisalnum(MMIOT *f, int i)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
isthisnonword(MMIOT *f, int i)
|
||||
{
|
||||
return isthisspace(f, i) || ispunct(peek(f,i));
|
||||
@@ -183,9 +197,10 @@ Qem(MMIOT *f, char c, int count)
|
||||
/* generate html from a markup fragment
|
||||
*/
|
||||
void
|
||||
___mkd_reparse(char *bfr, int size, int flags, MMIOT *f)
|
||||
___mkd_reparse(char *bfr, int size, int flags, MMIOT *f, char *esc)
|
||||
{
|
||||
MMIOT sub;
|
||||
struct escaped e;
|
||||
|
||||
___mkd_initmmiot(&sub, f->footnotes);
|
||||
|
||||
@@ -193,8 +208,16 @@ ___mkd_reparse(char *bfr, int size, int flags, MMIOT *f)
|
||||
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);
|
||||
EXPAND(sub.in) = 0;
|
||||
pushc(0, &sub);
|
||||
S(sub.in)--;
|
||||
|
||||
text(&sub);
|
||||
@@ -206,6 +229,23 @@ ___mkd_reparse(char *bfr, int size, int flags, MMIOT *f)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
@@ -232,7 +272,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 == 003 ) /* untokenize ^C */
|
||||
else if ( c == MKD_EOLN ) /* untokenize hard return */
|
||||
Qstring(" ", f);
|
||||
else
|
||||
Qprintf(f, "%%%02X", c);
|
||||
@@ -553,7 +593,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);
|
||||
___mkd_reparse(link + tag->szpat, size - tag->szpat, MKD_TAGTEXT, f, 0);
|
||||
|
||||
Qstring(tag->link_sfx, f);
|
||||
|
||||
@@ -585,10 +625,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);
|
||||
___mkd_reparse(T(text), S(text), linkt.flags, f, 0);
|
||||
else {
|
||||
ref->flags |= REFERENCED;
|
||||
ref->refnumber = ++ f->reference;
|
||||
ref->refnumber = ++ f->footnotes->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);
|
||||
@@ -604,7 +644,8 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
|
||||
{
|
||||
linkytype *tag;
|
||||
|
||||
if ( image || (ref == 0) )
|
||||
|
||||
if ( image )
|
||||
tag = &imaget;
|
||||
else if ( tag = pseudo(ref->link) ) {
|
||||
if ( f->flags & (MKD_NO_EXT|MKD_SAFELINK) )
|
||||
@@ -624,7 +665,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);
|
||||
___mkd_reparse(T(text), S(text), tag->flags, f, 0);
|
||||
else if ( tag->link_pfx ) {
|
||||
printlinkyref(f, tag, T(ref->link), S(ref->link));
|
||||
|
||||
@@ -635,12 +676,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);
|
||||
___mkd_reparse(T(ref->title), S(ref->title), MKD_TAGTEXT, f, 0);
|
||||
Qchar('"', f);
|
||||
}
|
||||
|
||||
Qstring(tag->text_pfx, f);
|
||||
___mkd_reparse(T(text), S(text), tag->flags, f);
|
||||
___mkd_reparse(T(text), S(text), tag->flags, f, 0);
|
||||
Qstring(tag->text_sfx, f);
|
||||
}
|
||||
else
|
||||
@@ -700,15 +741,14 @@ linkylinky(int image, MMIOT *f)
|
||||
S(key.tag) = S(name);
|
||||
}
|
||||
|
||||
if ( ref = bsearch(&key, T(*f->footnotes), S(*f->footnotes),
|
||||
sizeof key, (stfu)__mkd_footsort) ) {
|
||||
if ( ref = bsearch(&key, T(f->footnotes->note),
|
||||
S(f->footnotes->note),
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,8 +785,12 @@ static void
|
||||
mangle(char *s, int len, MMIOT *f)
|
||||
{
|
||||
while ( len-- > 0 ) {
|
||||
#if DEBIAN_GLITCH
|
||||
Qprintf(f, "d;", *((unsigned char*)(s++)) );
|
||||
#else
|
||||
Qstring("&#", f);
|
||||
Qprintf(f, COINTOSS() ? "x%02x;" : "%02d;", *((unsigned char*)(s++)) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,8 +852,10 @@ code(MMIOT *f, char *s, int length)
|
||||
int i,c;
|
||||
|
||||
for ( i=0; i < length; i++ )
|
||||
if ( (c = s[i]) == 003) /* ^C: expand back to 2 spaces */
|
||||
if ( (c = s[i]) == MKD_EOLN) /* ^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 */
|
||||
@@ -821,7 +867,7 @@ static void
|
||||
delspan(MMIOT *f, int size)
|
||||
{
|
||||
Qstring("<del>", f);
|
||||
___mkd_reparse(cursor(f)-1, size, 0, f);
|
||||
___mkd_reparse(cursor(f)-1, size, 0, f, 0);
|
||||
Qstring("</del>", f);
|
||||
}
|
||||
|
||||
@@ -1013,13 +1059,14 @@ 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) )
|
||||
else if ( isspace(c) || strchr("'\"()[]{}<>`", c) || c == MKD_EOLN )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (size > 1) && process_possible_link(f, size) ) {
|
||||
shift(f, size);
|
||||
@@ -1058,7 +1105,7 @@ islike(MMIOT *f, char *s)
|
||||
int len;
|
||||
int i;
|
||||
|
||||
if ( s[0] == '<' ) {
|
||||
if ( s[0] == '|' ) {
|
||||
if ( !isthisnonword(f, -1) )
|
||||
return 0;
|
||||
++s;
|
||||
@@ -1067,7 +1114,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--;
|
||||
@@ -1086,25 +1133,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", 1 },
|
||||
{ '-', "<->", "ndash", 0 },
|
||||
{ '\'', "'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 },
|
||||
{ '.', "...", "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, 3 },
|
||||
} ;
|
||||
#define NRSMART ( sizeof smarties / sizeof smarties[0] )
|
||||
@@ -1146,7 +1193,7 @@ smartypants(int c, int *flags, MMIOT *f)
|
||||
break;
|
||||
else if ( c == '\'' && peek(f, j+1) == '\'' ) {
|
||||
Qstring("“", f);
|
||||
___mkd_reparse(cursor(f)+1, j-2, 0, f);
|
||||
___mkd_reparse(cursor(f)+1, j-2, 0, f, 0);
|
||||
Qstring("”", f);
|
||||
shift(f,j+1);
|
||||
return 1;
|
||||
@@ -1166,11 +1213,14 @@ smartypants(int c, int *flags, MMIOT *f)
|
||||
* let the caller figure it out.
|
||||
*/
|
||||
static int
|
||||
tickhandler(MMIOT *f, int tickchar, int minticks, spanhandler spanner)
|
||||
tickhandler(MMIOT *f, int tickchar, int minticks, int allow_space, 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);
|
||||
@@ -1209,7 +1259,8 @@ text(MMIOT *f)
|
||||
switch (c) {
|
||||
case 0: break;
|
||||
|
||||
case 3: Qstring(tag_text(f) ? " " : "<br/>", f);
|
||||
case MKD_EOLN:
|
||||
Qstring(tag_text(f) ? " " : "<br/>", f);
|
||||
break;
|
||||
|
||||
case '>': if ( tag_text(f) )
|
||||
@@ -1265,7 +1316,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;
|
||||
@@ -1294,18 +1345,27 @@ text(MMIOT *f)
|
||||
}
|
||||
break;
|
||||
|
||||
case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT)) || !tickhandler(f,c,2,delspan) )
|
||||
case '~': if ( (f->flags & (MKD_NOSTRIKETHROUGH|MKD_TAGTEXT|MKD_STRICT)) || ! tickhandler(f,c,2,0, delspan) )
|
||||
Qchar(c, f);
|
||||
break;
|
||||
|
||||
case '`': if ( tag_text(f) || !tickhandler(f,c,1,codespan) )
|
||||
case '`': if ( tag_text(f) || !tickhandler(f,c,1,1,codespan) )
|
||||
Qchar(c, f);
|
||||
break;
|
||||
|
||||
case '\\': switch ( c = pull(f) ) {
|
||||
case '&': Qstring("&", f);
|
||||
break;
|
||||
case '<': Qstring("<", f);
|
||||
case '<': c = peek(f,1);
|
||||
if ( (c == EOF) || isspace(c) )
|
||||
Qstring("<", f);
|
||||
else {
|
||||
/* Markdown.pl does not escape <[nonwhite]
|
||||
* sequences */
|
||||
Qchar('\\', f);
|
||||
shift(f, -1);
|
||||
}
|
||||
|
||||
break;
|
||||
case '^': if ( f->flags & (MKD_STRICT|MKD_NOSUPERSCRIPT) ) {
|
||||
Qchar('\\', f);
|
||||
@@ -1324,16 +1384,16 @@ text(MMIOT *f)
|
||||
Qchar(c, f);
|
||||
break;
|
||||
|
||||
case '>': case '#': case '.': case '-':
|
||||
case '+': case '{': case '}': case ']':
|
||||
case '!': case '[': case '*': case '_':
|
||||
case '\\':case '(': case ')':
|
||||
case '`': Qchar(c, f);
|
||||
case EOF: Qchar('\\', f);
|
||||
break;
|
||||
default:
|
||||
Qchar('\\', f);
|
||||
if ( c != EOF )
|
||||
shift(f,-1);
|
||||
|
||||
default: if ( escaped(f,c) ||
|
||||
strchr(">#.-+{}]![*_\\()`", c) )
|
||||
Qchar(c, f);
|
||||
else {
|
||||
Qchar('\\', f);
|
||||
shift(f, -1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1394,8 +1454,9 @@ printheader(Paragraph *pp, MMIOT *f)
|
||||
|
||||
enum e_alignments { a_NONE, a_CENTER, a_LEFT, a_RIGHT };
|
||||
|
||||
static char* alignments[] = { "", " align=\"center\"", " align=\"left\"",
|
||||
" align=\"right\"" };
|
||||
static char* alignments[] = { "", " style=\"text-align:center;\"",
|
||||
" style=\"text-align:left;\"",
|
||||
" style=\"text-align:right;\"" };
|
||||
|
||||
typedef STRING(int) Istring;
|
||||
|
||||
@@ -1403,9 +1464,14 @@ static int
|
||||
splat(Line *p, char *block, Istring align, int force, MMIOT *f)
|
||||
{
|
||||
int first,
|
||||
idx = 0,
|
||||
idx = p->dle,
|
||||
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;
|
||||
@@ -1421,7 +1487,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++;
|
||||
@@ -1443,22 +1509,27 @@ printtable(Paragraph *pp, MMIOT *f)
|
||||
|
||||
Line *hdr, *dash, *body;
|
||||
Istring align;
|
||||
int start;
|
||||
int hcols;
|
||||
int hcols,start;
|
||||
char *p;
|
||||
|
||||
if ( !(pp->text && pp->text->next) )
|
||||
return 0;
|
||||
enum e_alignments it;
|
||||
|
||||
hdr = pp->text;
|
||||
dash= hdr->next;
|
||||
body= dash->next;
|
||||
|
||||
/* first figure out cell alignments */
|
||||
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 */
|
||||
|
||||
CREATE(align);
|
||||
|
||||
for (p=T(dash->text), start=0; start < S(dash->text); ) {
|
||||
for (p=T(dash->text), start=dash->dle; start < S(dash->text); ) {
|
||||
char first, last;
|
||||
int end;
|
||||
|
||||
@@ -1471,8 +1542,10 @@ printtable(Paragraph *pp, MMIOT *f)
|
||||
last = p[end];
|
||||
}
|
||||
}
|
||||
EXPAND(align) = ( first == ':' ) ? (( last == ':') ? a_CENTER : a_LEFT)
|
||||
: (( last == ':') ? a_RIGHT : a_NONE );
|
||||
it = ( first == ':' ) ? (( last == ':') ? a_CENTER : a_LEFT)
|
||||
: (( last == ':') ? a_RIGHT : a_NONE );
|
||||
|
||||
EXPAND(align) = it;
|
||||
start = 1+end;
|
||||
}
|
||||
|
||||
@@ -1511,13 +1584,14 @@ 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);
|
||||
push("\003\n", 2, f);
|
||||
pushc(MKD_EOLN, f);
|
||||
pushc('\n', f);
|
||||
}
|
||||
else {
|
||||
___mkd_tidy(&t->text);
|
||||
push(T(t->text), S(t->text), f);
|
||||
if ( t->next )
|
||||
push("\n", 1, f);
|
||||
pushc('\n', f);
|
||||
}
|
||||
}
|
||||
t = t->next;
|
||||
@@ -1530,11 +1604,17 @@ printblock(Paragraph *pp, MMIOT *f)
|
||||
|
||||
|
||||
static void
|
||||
printcode(Line *t, MMIOT *f)
|
||||
printcode(Line *t, char *lang, MMIOT *f)
|
||||
{
|
||||
int blanks;
|
||||
|
||||
Qstring("<pre><code>", f);
|
||||
Qstring("<pre><code", f);
|
||||
if (lang) {
|
||||
Qstring(" class=\"", f);
|
||||
Qstring(lang, f);
|
||||
Qstring("\"", f);
|
||||
}
|
||||
Qstring(">", f);
|
||||
for ( blanks = 0; t ; t = t->next ) {
|
||||
if ( S(t->text) > t->dle ) {
|
||||
while ( blanks ) {
|
||||
@@ -1598,7 +1678,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);
|
||||
___mkd_reparse(T(tag->text), S(tag->text), 0, f, 0);
|
||||
Qstring("</dt>\n", f);
|
||||
}
|
||||
|
||||
@@ -1647,7 +1727,7 @@ display(Paragraph *p, MMIOT *f)
|
||||
break;
|
||||
|
||||
case CODE:
|
||||
printcode(p->text, f);
|
||||
printcode(p->text, p->lang, f);
|
||||
break;
|
||||
|
||||
case QUOTE:
|
||||
@@ -1696,14 +1776,14 @@ mkd_extra_footnotes(MMIOT *m)
|
||||
int j, i;
|
||||
Footnote *t;
|
||||
|
||||
if ( m->reference == 0 )
|
||||
if ( m->footnotes->reference == 0 )
|
||||
return;
|
||||
|
||||
Csprintf(&m->out, "\n<div class=\"footnotes\">\n<hr/>\n<ol>\n");
|
||||
|
||||
for ( i=1; i <= m->reference; i++ ) {
|
||||
for ( j=0; j < S(*m->footnotes); j++ ) {
|
||||
t = &T(*m->footnotes)[j];
|
||||
for ( i=1; i <= m->footnotes->reference; i++ ) {
|
||||
for ( j=0; j < S(m->footnotes->note); j++ ) {
|
||||
t = &T(m->footnotes->note)[j];
|
||||
if ( (t->refnumber == i) && (t->flags & REFERENCED) ) {
|
||||
Csprintf(&m->out, "<li id=\"%s:%d\">\n<p>",
|
||||
p_or_nothing(m), t->refnumber);
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
@@ -10,8 +10,6 @@ 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);
|
||||
|
||||
+25
-7
@@ -18,6 +18,7 @@
|
||||
#include "config.h"
|
||||
#include "amalloc.h"
|
||||
#include "pgm_options.h"
|
||||
#include "tags.h"
|
||||
|
||||
#if HAVE_LIBGEN_H
|
||||
#include <libgen.h>
|
||||
@@ -59,7 +60,7 @@ complain(char *fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
@@ -67,9 +68,12 @@ 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;
|
||||
@@ -84,7 +88,7 @@ main(int argc, char **argv)
|
||||
pgm = basename(argv[0]);
|
||||
opterr = 1;
|
||||
|
||||
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:o:s:t:TV")) != EOF ) {
|
||||
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:Gno:s:St:TV")) != EOF ) {
|
||||
switch (opt) {
|
||||
case '5': with_html5 = 1;
|
||||
break;
|
||||
@@ -110,13 +114,19 @@ 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 ) {
|
||||
@@ -155,7 +165,10 @@ main(int argc, char **argv)
|
||||
rc = mkd_generateline( text, strlen(text), stdout, flags);
|
||||
else {
|
||||
if ( text ) {
|
||||
if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) {
|
||||
doc = github_flavoured ? gfm_string(text, strlen(text), flags)
|
||||
: mkd_string(text, strlen(text), flags) ;
|
||||
|
||||
if ( !doc ) {
|
||||
perror(text);
|
||||
exit(1);
|
||||
}
|
||||
@@ -165,7 +178,9 @@ main(int argc, char **argv)
|
||||
perror(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if ( (doc = mkd_in(stdin,flags)) == 0 ) {
|
||||
|
||||
doc = github_flavoured ? gfm_in(stdin,flags) : mkd_in(stdin,flags);
|
||||
if ( !doc ) {
|
||||
perror(argc ? argv[0] : "stdin");
|
||||
exit(1);
|
||||
}
|
||||
@@ -185,9 +200,12 @@ 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);
|
||||
mkd_generatehtml(doc, stdout);
|
||||
if ( content )
|
||||
mkd_generatehtml(doc, stdout);
|
||||
mkd_cleanup(doc);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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.chi.il.us
|
||||
.Pq Li orc@pell.portland.or.us
|
||||
|
||||
@@ -22,7 +22,6 @@ basename(char *p)
|
||||
|
||||
char *pgm = "makepage";
|
||||
|
||||
float
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
+12
-4
@@ -15,7 +15,9 @@
|
||||
.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
|
||||
@@ -107,6 +109,8 @@ 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
|
||||
@@ -123,6 +127,13 @@ 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
|
||||
@@ -138,9 +149,6 @@ 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
|
||||
@@ -168,4 +176,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.chi.il.us
|
||||
.Pq Li orc@pell.portland.or.us
|
||||
|
||||
+260
-151
@@ -22,6 +22,9 @@ 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
|
||||
@@ -77,7 +80,7 @@ mkd_firstnonblank(Line *p)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
blankline(Line *p)
|
||||
{
|
||||
return ! (p && (S(p->text) > p->dle) );
|
||||
@@ -173,6 +176,79 @@ 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)
|
||||
@@ -261,47 +337,6 @@ 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
|
||||
@@ -322,76 +357,46 @@ isfootnote(Line *t)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
isquote(Line *t)
|
||||
{
|
||||
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;
|
||||
return (t->dle < 4 && T(t->text)[t->dle] == '>');
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dashchar(char c)
|
||||
{
|
||||
return (c == '*') || (c == '-') || (c == '_');
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
iscode(Line *t)
|
||||
{
|
||||
return (t->dle >= 4);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static inline int
|
||||
ishr(Line *t)
|
||||
{
|
||||
int i, count=0;
|
||||
char dash = 0;
|
||||
char c;
|
||||
if ( ! (t->flags & CHECKED) )
|
||||
checkline(t);
|
||||
|
||||
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);
|
||||
if ( t->count > 2 )
|
||||
return t->kind == chk_hr || t->kind == chk_dash || t->kind == chk_equal;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
issetext(Line *t, int *htyp)
|
||||
{
|
||||
int i;
|
||||
/* then check for setext-style HEADER
|
||||
* ======
|
||||
Line *n;
|
||||
|
||||
/* check for setext-style HEADER
|
||||
* ======
|
||||
*/
|
||||
|
||||
if ( t->next ) {
|
||||
char *q = T(t->next->text);
|
||||
int last = S(t->next->text);
|
||||
if ( (n = t->next) ) {
|
||||
if ( !(n->flags & CHECKED) )
|
||||
checkline(n);
|
||||
|
||||
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;
|
||||
if ( n->kind == chk_dash || n->kind == chk_equal ) {
|
||||
*htyp = SETEXT;
|
||||
return 1;
|
||||
}
|
||||
@@ -403,28 +408,31 @@ 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 ( i && (i < S(t->text) || i > 1) ) {
|
||||
if ( (t->dle == 0) && (S(t->text) > 1) && (T(t->text)[0] == '#') ) {
|
||||
*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)
|
||||
{
|
||||
@@ -458,13 +466,12 @@ static Line*
|
||||
is_extra_dt(Line *t, int *clip)
|
||||
{
|
||||
#if USE_EXTRA_DL
|
||||
int i;
|
||||
|
||||
if ( t && t->next && T(t->text)[0] != '='
|
||||
if ( t && t->next && S(t->text) && T(t->text)[0] != '='
|
||||
&& T(t->text)[S(t->text)-1] != '=') {
|
||||
Line *x;
|
||||
|
||||
if ( iscode(t) || blankline(t) || ishdr(t,&i) || ishr(t) )
|
||||
if ( iscode(t) || end_of_block(t) )
|
||||
return 0;
|
||||
|
||||
if ( (x = skipempty(t->next)) && is_extra_dd(x) ) {
|
||||
@@ -500,7 +507,7 @@ islist(Line *t, int *clip, DWORD flags, int *list_type)
|
||||
int i, j;
|
||||
char *q;
|
||||
|
||||
if ( /*iscode(t) ||*/ blankline(t) || ishdr(t,&i) || ishr(t) )
|
||||
if ( end_of_block(t) )
|
||||
return 0;
|
||||
|
||||
if ( !(flags & (MKD_NODLIST|MKD_STRICT)) && isdefinition(t,clip,list_type) )
|
||||
@@ -528,7 +535,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 > 4) ? 4 : j;
|
||||
*clip = j;
|
||||
*list_type = OL;
|
||||
return AL;
|
||||
}
|
||||
@@ -571,6 +578,7 @@ 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)
|
||||
;
|
||||
@@ -607,6 +615,57 @@ 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)
|
||||
{
|
||||
@@ -630,19 +689,18 @@ endoftextblock(Line *t, int toplevelblock, DWORD flags)
|
||||
{
|
||||
int z;
|
||||
|
||||
if ( blankline(t)||isquote(t)||ishdr(t,&z)||ishr(t) )
|
||||
if ( end_of_block(t) || isquote(t) )
|
||||
return 1;
|
||||
|
||||
/* HORRIBLE STANDARDS KLUDGE: non-toplevel paragraphs absorb adjacent
|
||||
* code blocks
|
||||
/* 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.)
|
||||
*/
|
||||
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);
|
||||
return toplevelblock ? 0 : islist(t,&z,flags,&z);
|
||||
}
|
||||
|
||||
|
||||
@@ -690,6 +748,7 @@ 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;
|
||||
|
||||
@@ -713,7 +772,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
|
||||
@@ -738,6 +797,7 @@ quoteblock(Paragraph *p, DWORD flags)
|
||||
if ( T(t->text)[qp] == ' ' )
|
||||
qp++;
|
||||
CLIP(t->text, 0, qp);
|
||||
UNCHECK(t);
|
||||
t->dle = mkd_firstnonblank(t);
|
||||
}
|
||||
|
||||
@@ -770,28 +830,6 @@ 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 *);
|
||||
|
||||
|
||||
@@ -810,8 +848,15 @@ 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;
|
||||
@@ -863,13 +908,14 @@ 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)--;
|
||||
}
|
||||
|
||||
@@ -885,7 +931,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;
|
||||
@@ -962,7 +1008,7 @@ addfootnote(Line *p, MMIOT* f)
|
||||
int c;
|
||||
Line *np = p->next;
|
||||
|
||||
Footnote *foot = &EXPAND(*f->footnotes);
|
||||
Footnote *foot = &EXPAND(f->footnotes->note);
|
||||
|
||||
CREATE(foot->tag);
|
||||
CREATE(foot->link);
|
||||
@@ -977,6 +1023,7 @@ 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;
|
||||
@@ -1075,6 +1122,7 @@ 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.
|
||||
*/
|
||||
@@ -1084,7 +1132,12 @@ compile_document(Line *ptr, MMIOT *f)
|
||||
p->down = compile(T(source), 1, f);
|
||||
T(source) = E(source) = 0;
|
||||
}
|
||||
p = Pp(&d, ptr, strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML);
|
||||
|
||||
if ( f->flags & MKD_NOSTYLE )
|
||||
blocktype = HTML;
|
||||
else
|
||||
blocktype = strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML;
|
||||
p = Pp(&d, ptr, blocktype);
|
||||
ptr = htmlblock(p, tag, &unclosed);
|
||||
if ( unclosed ) {
|
||||
p->typ = SOURCE;
|
||||
@@ -1119,6 +1172,58 @@ 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
|
||||
@@ -1149,13 +1254,17 @@ 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);
|
||||
@@ -1175,13 +1284,12 @@ 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 )
|
||||
@@ -1223,13 +1331,14 @@ 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]);
|
||||
CREATE(*doc->ctx->footnotes);
|
||||
doc->ctx->footnotes->reference = 0;
|
||||
CREATE(doc->ctx->footnotes->note);
|
||||
|
||||
mkd_initialize();
|
||||
|
||||
doc->code = compile_document(T(doc->content), doc->ctx);
|
||||
qsort(T(*doc->ctx->footnotes), S(*doc->ctx->footnotes),
|
||||
sizeof T(*doc->ctx->footnotes)[0],
|
||||
qsort(T(doc->ctx->footnotes->note), S(doc->ctx->footnotes->note),
|
||||
sizeof T(doc->ctx->footnotes->note)[0],
|
||||
(stfu)__mkd_footsort);
|
||||
memset(&doc->content, 0, sizeof doc->content);
|
||||
return 1;
|
||||
|
||||
+47
-3
@@ -23,12 +23,20 @@ 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;
|
||||
|
||||
|
||||
@@ -41,6 +49,7 @@ 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;
|
||||
@@ -73,6 +82,18 @@ 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
|
||||
*/
|
||||
@@ -81,9 +102,9 @@ typedef struct mmiot {
|
||||
Cstring in;
|
||||
Qblock Q;
|
||||
int isp;
|
||||
int reference;
|
||||
struct escaped *esc;
|
||||
char *ref_prefix;
|
||||
STRING(Footnote) *footnotes;
|
||||
struct footnote_list *footnotes;
|
||||
DWORD flags;
|
||||
#define MKD_NOLINKS 0x00000001
|
||||
#define MKD_NOIMAGE 0x00000002
|
||||
@@ -107,6 +128,7 @@ 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)
|
||||
@@ -115,6 +137,9 @@ 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
|
||||
@@ -139,6 +164,16 @@ 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 **);
|
||||
@@ -160,6 +195,9 @@ 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();
|
||||
|
||||
@@ -176,8 +214,14 @@ 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*);
|
||||
extern void ___mkd_reparse(char *, int, int, MMIOT*, char*);
|
||||
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
@@ -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.chi.il.us
|
||||
.Pq Li orc@pell.portland.or.us
|
||||
|
||||
+18
-12
@@ -45,7 +45,7 @@ basename(char *path)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (( p = strrchr(path, '/') ))
|
||||
if ( p = strrchr(path, '/') )
|
||||
return 1+p;
|
||||
return path;
|
||||
}
|
||||
@@ -65,7 +65,6 @@ fail(char *why, ...)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
@@ -82,7 +81,7 @@ char **argv;
|
||||
CREATE(footers);
|
||||
pgm = basename(argv[0]);
|
||||
|
||||
while ( argc > 2 ) {
|
||||
while ( argc > 1 ) {
|
||||
if ( strcmp(argv[1], "-css") == 0 ) {
|
||||
EXPAND(css) = argv[2];
|
||||
argc -= 2;
|
||||
@@ -98,14 +97,20 @@ char **argv;
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( argc > 1 ) {
|
||||
switch ( argc ) {
|
||||
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");
|
||||
@@ -129,10 +134,11 @@ char **argv;
|
||||
|
||||
if ( (output = fopen(dest, "w")) == 0 )
|
||||
fail("can't write to %s", dest);
|
||||
}
|
||||
else {
|
||||
input = stdin;
|
||||
output = stdout;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "usage: %s [opts] source [dest]\n", pgm);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( (mmiot = mkd_in(input, 0)) == 0 )
|
||||
@@ -153,7 +159,7 @@ char **argv;
|
||||
" <meta name=\"GENERATOR\" content=\"mkd2html %s\">\n", markdown_version);
|
||||
|
||||
fprintf(output," <meta http-equiv=\"Content-Type\"\n"
|
||||
" content=\"text/html; charset-us-ascii\">");
|
||||
" content=\"text/html; charset=utf-8\">");
|
||||
|
||||
for ( i=0; i < S(css); i++ )
|
||||
fprintf(output, " <link rel=\"stylesheet\"\n"
|
||||
|
||||
+31
-24
@@ -18,13 +18,13 @@ typedef ANCHOR(Line) LineAnchor;
|
||||
|
||||
/* create a new blank Document
|
||||
*/
|
||||
static Document*
|
||||
new_Document()
|
||||
Document*
|
||||
__mkd_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 @@ new_Document()
|
||||
/* add a line to the markdown input chain, expanding tabs and
|
||||
* noting the presence of special characters as we go.
|
||||
*/
|
||||
static void
|
||||
queue(Document* a, Cstring *line)
|
||||
void
|
||||
__mkd_enqueue(Document* a, Cstring *line)
|
||||
{
|
||||
Line *p = calloc(sizeof *p, 1);
|
||||
unsigned char c;
|
||||
@@ -75,8 +75,8 @@ queue(Document* a, Cstring *line)
|
||||
|
||||
/* trim leading blanks from a header line
|
||||
*/
|
||||
static void
|
||||
header_dle(Line *p)
|
||||
void
|
||||
__mkd_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 = new_Document();
|
||||
Document *a = __mkd_new_Document();
|
||||
int c;
|
||||
int pandoc = 0;
|
||||
|
||||
@@ -109,7 +109,7 @@ populate(getc_func getc, void* ctx, int flags)
|
||||
else
|
||||
pandoc = EOF;
|
||||
}
|
||||
queue(a, &line);
|
||||
__mkd_enqueue(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) )
|
||||
queue(a, &line);
|
||||
__mkd_enqueue(a, &line);
|
||||
|
||||
DELETE(line);
|
||||
|
||||
@@ -128,9 +128,9 @@ populate(getc_func getc, void* ctx, int flags)
|
||||
*/
|
||||
Line *headers = T(a->content);
|
||||
|
||||
a->title = headers; header_dle(a->title);
|
||||
a->author= headers->next; header_dle(a->author);
|
||||
a->date = headers->next->next; header_dle(a->date);
|
||||
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;
|
||||
}
|
||||
@@ -150,14 +150,8 @@ mkd_in(FILE *f, DWORD flags)
|
||||
|
||||
/* return a single character out of a buffer
|
||||
*/
|
||||
struct string_ctx {
|
||||
const char *data; /* the unread data */
|
||||
int size; /* and how much is there? */
|
||||
} ;
|
||||
|
||||
|
||||
static int
|
||||
strget(struct string_ctx *in)
|
||||
int
|
||||
__mkd_io_strget(struct string_stream *in)
|
||||
{
|
||||
if ( !in->size ) return EOF;
|
||||
|
||||
@@ -172,12 +166,12 @@ strget(struct string_ctx *in)
|
||||
Document *
|
||||
mkd_string(const char *buf, int len, DWORD flags)
|
||||
{
|
||||
struct string_ctx about;
|
||||
struct string_stream about;
|
||||
|
||||
about.data = buf;
|
||||
about.size = len;
|
||||
|
||||
return populate((getc_func)strget, &about, flags & INPUT_MASK);
|
||||
return populate((getc_func)__mkd_io_strget, &about, flags & INPUT_MASK);
|
||||
}
|
||||
|
||||
|
||||
@@ -221,6 +215,9 @@ 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;
|
||||
@@ -228,15 +225,25 @@ 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);
|
||||
@@ -254,7 +261,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);
|
||||
___mkd_reparse(bfr, size, 0, f, 0);
|
||||
___mkd_emblock(f);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@ 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();
|
||||
@@ -21,7 +26,7 @@ void mkd_shlib_destructor();
|
||||
/* compilation, debugging, cleanup
|
||||
*/
|
||||
int mkd_compile(MMIOT*, mkd_flag_t);
|
||||
int mkd_cleanup(MMIOT*);
|
||||
void mkd_cleanup(MMIOT*);
|
||||
|
||||
/* markup functions
|
||||
*/
|
||||
@@ -84,6 +89,7 @@ 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/ */
|
||||
@@ -99,6 +105,7 @@ 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()
|
||||
+8
-1
@@ -12,6 +12,11 @@ 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();
|
||||
@@ -21,7 +26,7 @@ void mkd_shlib_destructor();
|
||||
/* compilation, debugging, cleanup
|
||||
*/
|
||||
int mkd_compile(MMIOT*, mkd_flag_t);
|
||||
int mkd_cleanup(MMIOT*);
|
||||
void mkd_cleanup(MMIOT*);
|
||||
|
||||
/* markup functions
|
||||
*/
|
||||
@@ -84,6 +89,7 @@ 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/ */
|
||||
@@ -99,6 +105,7 @@ 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()
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/* 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);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/* 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;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#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*/
|
||||
+6
-4
@@ -51,6 +51,8 @@ ___mkd_freeParagraph(Paragraph *p)
|
||||
___mkd_freeLines(p->text);
|
||||
if (p->ident)
|
||||
free(p->ident);
|
||||
if (p->lang)
|
||||
free(p->lang);
|
||||
free(p);
|
||||
}
|
||||
|
||||
@@ -74,9 +76,9 @@ ___mkd_freefootnotes(MMIOT *f)
|
||||
int i;
|
||||
|
||||
if ( f->footnotes ) {
|
||||
for (i=0; i < S(*f->footnotes); i++)
|
||||
___mkd_freefootnote( &T(*f->footnotes)[i] );
|
||||
DELETE(*f->footnotes);
|
||||
for (i=0; i < S(f->footnotes->note); i++)
|
||||
___mkd_freefootnote( &T(f->footnotes->note)[i] );
|
||||
DELETE(f->footnotes->note);
|
||||
free(f->footnotes);
|
||||
}
|
||||
}
|
||||
@@ -96,7 +98,7 @@ ___mkd_initmmiot(MMIOT *f, void *footnotes)
|
||||
f->footnotes = footnotes;
|
||||
else {
|
||||
f->footnotes = malloc(sizeof f->footnotes[0]);
|
||||
CREATE(*f->footnotes);
|
||||
CREATE(f->footnotes->note);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-9
@@ -18,7 +18,6 @@
|
||||
#include "amalloc.h"
|
||||
#include "tags.h"
|
||||
|
||||
static int need_to_setup = 1;
|
||||
static int need_to_initrng = 1;
|
||||
|
||||
void
|
||||
@@ -29,19 +28,12 @@ mkd_initialize()
|
||||
need_to_initrng = 0;
|
||||
INITRNG(time(0));
|
||||
}
|
||||
if ( need_to_setup ) {
|
||||
need_to_setup = 0;
|
||||
mkd_prepare_tags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mkd_shlib_destructor()
|
||||
{
|
||||
if ( !need_to_setup ) {
|
||||
need_to_setup = 1;
|
||||
mkd_deallocate_tags();
|
||||
}
|
||||
mkd_deallocate_tags();
|
||||
}
|
||||
|
||||
|
||||
+36
-65
@@ -4,19 +4,36 @@
|
||||
#include "cstring.h"
|
||||
#include "tags.h"
|
||||
|
||||
STRING(struct kw) blocktags;
|
||||
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"
|
||||
|
||||
|
||||
/* define a html block tag
|
||||
/* define an additional html block tag
|
||||
*/
|
||||
void
|
||||
mkd_define_tag(char *id, int selfclose)
|
||||
{
|
||||
struct kw *p = &EXPAND(blocktags);
|
||||
struct kw *p;
|
||||
|
||||
p->id = id;
|
||||
p->size = strlen(id);
|
||||
p->selfclose = selfclose;
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,87 +54,41 @@ casort(struct kw *a, struct kw *b)
|
||||
typedef int (*stfu)(const void*,const void*);
|
||||
|
||||
|
||||
/* sort the list of html block tags for later searching
|
||||
/* sort the list of extra html block tags for later searching
|
||||
*/
|
||||
void
|
||||
mkd_sort_tags()
|
||||
{
|
||||
qsort(T(blocktags), S(blocktags), sizeof(struct kw), (stfu)casort);
|
||||
qsort(T(extratags), S(extratags), 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;
|
||||
|
||||
return bsearch(&key, T(blocktags), S(blocktags), sizeof key, (stfu)casort);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
/* destroy the extratags list (for shared libraries)
|
||||
*/
|
||||
void
|
||||
mkd_deallocate_tags()
|
||||
{
|
||||
if ( S(blocktags) > 0 ) {
|
||||
populated = 0;
|
||||
DELETE(blocktags);
|
||||
}
|
||||
if ( S(extratags) > 0 )
|
||||
DELETE(extratags);
|
||||
} /* mkd_deallocate_tags */
|
||||
|
||||
@@ -12,5 +12,10 @@ 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><</p>'
|
||||
try 'backslashes before <[space]' '\< j' '<p>< j</p>'
|
||||
|
||||
summary $0
|
||||
exit $rc
|
||||
|
||||
@@ -31,5 +31,136 @@ 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
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
. 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
|
||||
+4
-9
@@ -37,15 +37,10 @@ if [ "$DL" = "DISCOUNT" -o "$DL" = "BOTH" ]; then
|
||||
|
||||
|
||||
try -fnodefinitionlist '=tag= does nothing' "$SRC" \
|
||||
'<p>=this=</p>
|
||||
|
||||
<pre><code>is an ugly
|
||||
</code></pre>
|
||||
|
||||
<p>=test=</p>
|
||||
|
||||
<pre><code>eh?
|
||||
</code></pre>'
|
||||
'<p>=this=
|
||||
is an ugly
|
||||
=test=
|
||||
eh?</p>'
|
||||
fi
|
||||
|
||||
if [ "$DL" = "EXTRA" -o "$DL" = "BOTH" ]; then
|
||||
|
||||
@@ -31,5 +31,90 @@ 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">↩</a></p></li>
|
||||
<li id="fn:2">
|
||||
<p>Beta Footnote<a href="#fnref:2" rev="footnote">↩</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">↩</a></p></li>
|
||||
<li id="fn:2">
|
||||
<p>Test2 footnote<a href="#fnref:2" rev="footnote">↩</a></p></li>
|
||||
<li id="fn:3">
|
||||
<p>Test3 footnote<a href="#fnref:3" rev="footnote">↩</a></p></li>
|
||||
<li id="fn:4">
|
||||
<p>Test4 footnote<a href="#fnref:4" rev="footnote">↩</a></p></li>
|
||||
</ol>
|
||||
</div>'
|
||||
|
||||
try -ffootnote 'footnotes inside spans' "$TSRC" "$TOUT"
|
||||
|
||||
summary $0
|
||||
exit $rc
|
||||
|
||||
@@ -57,8 +57,13 @@ try() {
|
||||
./echo
|
||||
./echo "$1"
|
||||
fi
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
./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
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -21,15 +21,6 @@ text' \
|
||||
'<hr/>
|
||||
|
||||
|
||||
<p>text</p>'
|
||||
|
||||
try 'self-closing block tags (br)' \
|
||||
'<br>
|
||||
|
||||
text' \
|
||||
'<br>
|
||||
|
||||
|
||||
<p>text</p>'
|
||||
|
||||
try 'html comments' \
|
||||
|
||||
+44
-3
@@ -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,5 +151,46 @@ 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
|
||||
|
||||
@@ -8,10 +8,8 @@ MARKDOWN_FLAGS=
|
||||
try 'paragraph followed by code' \
|
||||
'a
|
||||
b' \
|
||||
'<p>a</p>
|
||||
|
||||
<pre><code>b
|
||||
</code></pre>'
|
||||
'<p>a
|
||||
b</p>'
|
||||
|
||||
try 'single-line paragraph' 'a' '<p>a</p>'
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ try 'list followed by header .......... ' \
|
||||
'<ul>
|
||||
<li>AAA
|
||||
|
||||
<h2>– BBB</h2></li>
|
||||
<h2>- BBB</h2></li>
|
||||
</ul>'
|
||||
|
||||
try 'ul with mixed item prefixes' \
|
||||
|
||||
@@ -6,7 +6,7 @@ rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try 'smiley faces?' '[8-9] <]:-( x ---> [4]' \
|
||||
'<p>[8-9] <]:–( x —–> [4]</p>'
|
||||
'<p>[8-9] <]:-( x —> [4]</p>'
|
||||
|
||||
try 'really long ETX headers' \
|
||||
'#####################################################hi' \
|
||||
|
||||
@@ -10,9 +10,10 @@ try '(r) -> ®' '(r)' '<p>®</p>'
|
||||
try '(tm) -> ™' '(tm)' '<p>™</p>'
|
||||
try '... -> …' '...' '<p>…</p>'
|
||||
|
||||
try '"--" -> —' '--' '<p>—</p>'
|
||||
try '"?--" -> –' '?--' '<p>?–</p>'
|
||||
try '"?---" -> —' '?---' '<p>?—</p>'
|
||||
|
||||
try '"-" -> –' 'regular -' '<p>regular –</p>'
|
||||
try '"--" -> –' 'regular --' '<p>regular –</p>'
|
||||
try 'A-B -> A-B' 'A-B' '<p>A-B</p>'
|
||||
try '"fancy" -> “fancy”' '"fancy"' '<p>“fancy”</p>'
|
||||
try "'fancy'" "'fancy'" '<p>‘fancy’</p>'
|
||||
|
||||
@@ -10,6 +10,7 @@ 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
|
||||
|
||||
@@ -30,5 +30,7 @@ try 'multiple lines unclosed' "$UNCLOSED" "$RESULT"
|
||||
|
||||
try -fnohtml 'unclosed with -fnohtml' '<style>foo' '<p><style>foo</p>'
|
||||
|
||||
try -fnostyle 'disabling style blocks' "$ASK" "$ASK"
|
||||
|
||||
summary $0
|
||||
exit $rc
|
||||
|
||||
+79
-14
@@ -12,13 +12,11 @@ try 'single-column table' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>hello</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -33,7 +31,7 @@ hello|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th>a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -75,7 +73,7 @@ hello|
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th>a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -85,7 +83,7 @@ hello|
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -99,14 +97,14 @@ hello|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="right"> a </th>
|
||||
<th align="left"> b</th>
|
||||
<th style="text-align:right;">a </th>
|
||||
<th style="text-align:left;"> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="right">hello</td>
|
||||
<td align="left">sailor</td>
|
||||
<td style="text-align:right;">hello</td>
|
||||
<td style="text-align:left;">sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
@@ -119,7 +117,7 @@ hello|sailor|boy' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th>a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -137,7 +135,7 @@ try -fnotables 'tables with -fnotables' \
|
||||
-|-
|
||||
hello|sailor' \
|
||||
'<p>a|b
|
||||
–|–
|
||||
-|-
|
||||
hello|sailor</p>'
|
||||
|
||||
try 'deceptive non-table text' \
|
||||
@@ -152,7 +150,7 @@ try 'table headers only' \
|
||||
'a|b|c
|
||||
-|-|-' \
|
||||
'<p>a|b|c
|
||||
–|–|–</p>'
|
||||
-|-|-</p>'
|
||||
|
||||
try 'escaped title line' \
|
||||
'A\|B
|
||||
@@ -177,7 +175,7 @@ try 'escaped dashes line' \
|
||||
-\|-
|
||||
C |D' \
|
||||
'<p>A |B
|
||||
–|–
|
||||
-|-
|
||||
C |D</p>'
|
||||
|
||||
try 'escaped content line' \
|
||||
@@ -204,8 +202,75 @@ try 'content line w/o dashes' \
|
||||
--|-
|
||||
CD' \
|
||||
'<p>A |B
|
||||
—|–
|
||||
–|-
|
||||
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
|
||||
|
||||
@@ -23,9 +23,11 @@ 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>'
|
||||
|
||||
@@ -56,9 +58,11 @@ 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>'
|
||||
|
||||
+20
-2
@@ -8,7 +8,10 @@
|
||||
.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
|
||||
@@ -94,7 +97,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
|
||||
.Ar o
|
||||
.Fl o
|
||||
option,
|
||||
.Nm writes the output to
|
||||
.Pa file-sans-text.html
|
||||
@@ -115,6 +118,21 @@ 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
|
||||
@@ -139,4 +157,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.chi.il.us
|
||||
.Pq Li orc@pell.portland.or.us
|
||||
|
||||
+25
-6
@@ -10,6 +10,7 @@
|
||||
* be distributed with this source code.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "pgm_options.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -37,6 +38,8 @@ 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
|
||||
@@ -54,7 +57,7 @@ basename(char *path)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (( p = strrchr(path, '/') ))
|
||||
if ( p = strrchr(path, '/') )
|
||||
return 1+p;
|
||||
return path;
|
||||
}
|
||||
@@ -466,7 +469,7 @@ spin(FILE *template, MMIOT *doc, FILE *output)
|
||||
|
||||
for (i=0; i < NR(keyword); i++)
|
||||
if ( thesame(p, keyword[i].kw) ) {
|
||||
if ( keyword[i].where & where )
|
||||
if ( everywhere || (keyword[i].where & where) )
|
||||
(*keyword[i].what)(doc,output,flags,where);
|
||||
break;
|
||||
}
|
||||
@@ -497,7 +500,6 @@ spin(FILE *template, MMIOT *doc, FILE *output)
|
||||
} /* spin */
|
||||
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
@@ -505,6 +507,7 @@ char **argv;
|
||||
char *source = "stdin";
|
||||
FILE *tmplfile;
|
||||
int opt;
|
||||
mkd_flag_t flags = MKD_TOC;
|
||||
int force = 0;
|
||||
MMIOT *doc;
|
||||
struct stat sourceinfo;
|
||||
@@ -512,16 +515,32 @@ char **argv;
|
||||
opterr=1;
|
||||
pgm = basename(argv[0]);
|
||||
|
||||
while ( (opt=getopt(argc, argv, "fd:t:p:o:V")) != EOF ) {
|
||||
while ( (opt=getopt(argc, argv, "EfC:c:d: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);
|
||||
@@ -573,7 +592,7 @@ char **argv;
|
||||
strcat(q, ".html");
|
||||
}
|
||||
}
|
||||
if ( output ) {
|
||||
if ( output && strcmp(output, "-") ) {
|
||||
if ( force )
|
||||
unlink(output);
|
||||
if ( !freopen(output, "w", stdout) )
|
||||
@@ -596,7 +615,7 @@ char **argv;
|
||||
fail("out of memory");
|
||||
#endif
|
||||
|
||||
if ( !mkd_compile(doc, MKD_TOC) )
|
||||
if ( !mkd_compile(doc, flags) )
|
||||
fail("couldn't compile input");
|
||||
|
||||
if ( tmplfile )
|
||||
|
||||
+21
-10
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* toc -- spit out a table of contents based on header blocks
|
||||
*
|
||||
* Copyright (C) 2008 Jjgod Jiang, David L Parsons.
|
||||
* Copyright (C) 2008 Jjgod Jiang, David L Parsons
|
||||
* portions Copyright (C) 2011 Stefano D'Angelo
|
||||
* The redistribution terms are provided in the COPYRIGHT file that must
|
||||
* be distributed with this source code.
|
||||
*/
|
||||
@@ -23,6 +24,7 @@ mkd_toc(Document *p, char **doc)
|
||||
int last_hnumber = 0;
|
||||
Cstring res;
|
||||
int size;
|
||||
int first = 1;
|
||||
|
||||
if ( !(doc && p && p->ctx) ) return -1;
|
||||
|
||||
@@ -38,16 +40,23 @@ mkd_toc(Document *p, char **doc)
|
||||
for ( srcp = tp->down; srcp; srcp = srcp->next ) {
|
||||
if ( srcp->typ == HDR && srcp->text ) {
|
||||
|
||||
if ( last_hnumber >= srcp->hnumber ) {
|
||||
while ( last_hnumber > srcp->hnumber ) {
|
||||
Csprintf(&res, "%*s</ul></li>\n", last_hnumber-1,"");
|
||||
--last_hnumber;
|
||||
}
|
||||
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 )
|
||||
Csprintf(&res, "</li>\n");
|
||||
else if ( (srcp->hnumber > last_hnumber) && !first )
|
||||
Csprintf(&res, "\n");
|
||||
|
||||
while ( srcp->hnumber > last_hnumber ) {
|
||||
Csprintf(&res, "%*s%s<ul>\n", last_hnumber, "",
|
||||
last_hnumber ? "<li>" : "");
|
||||
Csprintf(&res, "%*s<ul>\n", last_hnumber, "");
|
||||
if ( (srcp->hnumber - last_hnumber) > 1 )
|
||||
Csprintf(&res, "%*s<li>\n", last_hnumber+1, "");
|
||||
++last_hnumber;
|
||||
}
|
||||
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
|
||||
@@ -59,7 +68,8 @@ mkd_toc(Document *p, char **doc)
|
||||
S(srcp->text->text),
|
||||
(mkd_sta_function_t)Csputc, &res,0);
|
||||
Csprintf(&res, "</a>");
|
||||
Csprintf(&res, "</li>\n");
|
||||
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +77,8 @@ mkd_toc(Document *p, char **doc)
|
||||
|
||||
while ( last_hnumber > 0 ) {
|
||||
--last_hnumber;
|
||||
Csprintf(&res, last_hnumber ? "%*s</ul></li>\n" : "%*s</ul>\n", last_hnumber, "");
|
||||
Csprintf(&res, "</li>\n%*s</ul>\n%*s",
|
||||
last_hnumber, "", last_hnumber, "");
|
||||
}
|
||||
|
||||
if ( (size = S(res)) > 0 ) {
|
||||
|
||||
@@ -23,5 +23,8 @@ char markdown_version[] = VERSION
|
||||
#endif
|
||||
#if WITH_GITHUB_TAGS
|
||||
" GITHUB-TAGS"
|
||||
#endif
|
||||
#if WITH_FENCED_CODE
|
||||
" FENCED-CODE"
|
||||
#endif
|
||||
;
|
||||
|
||||
@@ -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] autorelease];
|
||||
encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
mkd_cleanup_wrapper(document);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user