1 Commits

Author SHA1 Message Date
rentzsch 28cca588a4 [DEV] Replace discount Markdown-to-html engine with mayday. 2009-09-15 16:09:54 -05:00
141 changed files with 2522 additions and 17403 deletions
-1
View File
@@ -1 +0,0 @@
*.pbxproj -crlf
-9
View File
@@ -1,9 +0,0 @@
# Xcode
/build/
/*.xcodeproj/*.mode1v3
/*.xcodeproj/*.mode2v3
/*.xcodeproj/*.pbxuser
/*.xcodeproj/xcuserdata/*
/*.xcodeproj/*.perspectivev3
/*.xcodeproj/project.xcworkspace/*
*~.nib
+3
View File
@@ -0,0 +1,3 @@
[submodule "mayday"]
path = mayday
url = git://github.com/jemmons/mayday.git
-20
View File
@@ -1,20 +0,0 @@
//
// TCLayoutManager.h
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface EditPaneLayoutManager : NSLayoutManager {
NSFont *font;
}
@property (nonatomic, retain) NSFont *font;
- (CGFloat)lineHeight;
@end
-59
View File
@@ -1,59 +0,0 @@
//
// TCLayoutManager.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "EditPaneLayoutManager.h"
#import "EditPaneTypesetter.h"
@implementation EditPaneLayoutManager
@synthesize font;
- (id)init {
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);
}
- (void)setLineFragmentRect:(NSRect)inFragmentRect forGlyphRange:(NSRange)inGlyphRange
usedRect:(NSRect)inUsedRect {
inFragmentRect.size.height = [self lineHeight];
inUsedRect.size.height = [self lineHeight];
(void)[super setLineFragmentRect:(NSRect)inFragmentRect
forGlyphRange:(NSRange)inGlyphRange
usedRect:(NSRect)inUsedRect];
}
- (void)setExtraLineFragmentRect:(NSRect)inFragmentRect usedRect:(NSRect)inUsedRect
textContainer:(NSTextContainer *)inTextContainer {
inFragmentRect.size.height = [self lineHeight];
[super setExtraLineFragmentRect:inFragmentRect usedRect:inUsedRect
textContainer:inTextContainer];
}
- (NSPoint)locationForGlyphAtIndex:(NSUInteger)inGlyphIndex {
NSPoint outPoint = [super locationForGlyphAtIndex:inGlyphIndex];
outPoint.y = [font pointSize];
return outPoint;
}
@end
-21
View File
@@ -1,21 +0,0 @@
//
// EditPaneTextView.h
// MarkdownLive
//
// Created by Akihiro Noguchi on 9/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kEditPaneTextViewChangedNotification @"EditPaneTextViewChangedNotification"
@class EditPaneLayoutManager;
@interface EditPaneTextView : NSTextView {
EditPaneLayoutManager *layoutMan;
}
- (void)updateColors;
- (void)updateFont;
@end
-113
View File
@@ -1,113 +0,0 @@
//
// EditPaneTextView.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 9/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "EditPaneTextView.h"
#import "EditPaneLayoutManager.h"
#import "PreferencesManager.h"
#import "PreferencesController.h"
@implementation EditPaneTextView
- (void)awakeFromNib {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateFont)
name:kEditPaneFontNameChangedNotification
object:nil];
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneForegroundColor]
options:0
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
options:0
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
options:0
context:@"ColorChange"];
[defaultsController addObserver:self
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
options:0
context:@"ColorChange"];
[self setUsesFontPanel:NO];
NSTextContainer *textContainer = [[NSTextContainer alloc] init];
[textContainer setContainerSize:[[self textContainer] containerSize]];
[textContainer setWidthTracksTextView:YES];
layoutMan = [[EditPaneLayoutManager alloc] init];
[self replaceTextContainer:textContainer];
[textContainer replaceLayoutManager:layoutMan];
[textContainer release];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self];
[layoutMan release];
[super dealloc];
}
- (void)keyDown:(NSEvent *)aEvent {
[super keyDown:aEvent];
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneTextViewChangedNotification
object:self];
}
- (void)setMarkedText:(id)aString
selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange {
id resultString;
if ([aString isKindOfClass:[NSAttributedString class]]) {
resultString = [[aString mutableCopy] autorelease];
selectedRange = NSMakeRange(0, [resultString length]);
NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName,
[PreferencesManager editPaneForegroundColor], NSUnderlineColorAttributeName,
nil];
[resultString setAttributes:attrs range:selectedRange];
} else {
resultString = aString;
}
[super setMarkedText:resultString
selectedRange:selectedRange replacementRange:replacementRange];
}
- (void)updateColors {
[[self enclosingScrollView] setBackgroundColor:[PreferencesManager editPaneBackgroundColor]];
[self setTextColor:[PreferencesManager editPaneForegroundColor]];
[self setInsertionPointColor:[PreferencesManager editPaneCaretColor]];
NSDictionary *selectedAttr = [NSDictionary dictionaryWithObject:[PreferencesManager editPaneSelectionColor]
forKey:NSBackgroundColorAttributeName];
[self setSelectedTextAttributes:selectedAttr];
}
- (void)updateFont {
layoutMan.font = [PreferencesManager editPaneFont];
[self setFont:layoutMan.font];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
#pragma unused(keyPath)
#pragma unused(object)
#pragma unused(change)
if ([(NSString *)context isEqualToString:@"ColorChange"]) {
[self updateColors];
}
}
@end
-16
View File
@@ -1,16 +0,0 @@
//
// TCTypeSetter.h
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface EditPaneTypesetter : NSATSTypesetter {
}
@end
-32
View File
@@ -1,32 +0,0 @@
//
// TCTypeSetter.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "EditPaneTypesetter.h"
#import "EditPaneLayoutManager.h"
@implementation EditPaneTypesetter
- (id)init {
if ((self = [super init])) {
[self setUsesFontLeading:YES];
}
return self;
}
- (CGFloat)lineSpacingAfterGlyphAtIndex:(NSUInteger)inGlyphIndex
withProposedLineFragmentRect:(NSRect)inRect {
#pragma unused(inGlyphIndex)
EditPaneLayoutManager *theManager = (EditPaneLayoutManager *)[self layoutManager];
CGFloat theDefaultLineHeight = [theManager defaultLineHeightForFont:theManager.font];
return floor(theDefaultLineHeight - inRect.size.height + 1.5);
}
@end
+1854 -912
View File
File diff suppressed because it is too large Load Diff
+600 -180
View File
@@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">11B26</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string>
<string key="IBDocument.HIToolboxVersion">566.00</string>
<string key="IBDocument.SystemVersion">10A432</string>
<string key="IBDocument.InterfaceBuilderVersion">732</string>
<string key="IBDocument.AppKitVersion">1038</string>
<string key="IBDocument.HIToolboxVersion">437.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -15,20 +15,13 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>1617</string>
<string>518</string>
<string>732</string>
<string>732</string>
</object>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<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>
<integer value="100021"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -40,7 +33,9 @@
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -53,12 +48,12 @@
<object class="NSWindowTemplate" id="275939982">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{148, 238}, {860, 600}}</string>
<string key="NSWindowRect">{{67, 760}, {769, 689}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSViewClass">View</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<string key="NSWindowContentMinSize">{94, 86}</string>
<object class="NSView" key="NSWindowView" id="568628114">
<reference key="NSNextResponder"/>
@@ -106,10 +101,8 @@
<string>public.url</string>
</object>
</object>
<string key="NSFrameSize">{439, 44}</string>
<string key="NSFrameSize">{392, 622}</string>
<reference key="NSSuperview" ref="934421653"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="106470570"/>
<object class="NSTextContainer" key="NSTextContainer" id="515139633">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -126,11 +119,11 @@
<nil key="NSDelegate"/>
</object>
<reference key="NSTextView" ref="521201844"/>
<double key="NSWidth">439</double>
<double key="NSWidth">392</double>
<int key="NSTCFlags">1</int>
</object>
<object class="NSTextViewSharedData" key="NSSharedData">
<int key="NSFlags">67120867</int>
<int key="NSFlags">12263</int>
<int key="NSTextCheckingTypes">0</int>
<nil key="NSMarkedAttributes"/>
<object class="NSColor" key="NSBackgroundColor" id="144579518">
@@ -189,46 +182,21 @@
</object>
</object>
<nil key="NSDefaultParagraphStyle"/>
<nil key="NSTextFinder"/>
<int key="NSPreferredTextFinderStyle">1</int>
</object>
<int key="NSTVFlags">6</int>
<string key="NSMaxSize">{463, 10000000}</string>
<string key="NSMinize">{223, 44}</string>
<string key="NSMaxSize">{463, 1e+07}</string>
<string key="NSMinize">{223, 133}</string>
<nil key="NSDelegate"/>
</object>
</object>
<string key="NSFrameSize">{439, 600}</string>
<string key="NSFrameSize">{392, 689}</string>
<reference key="NSSuperview" ref="60428165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="521201844"/>
<reference key="NSDocView" ref="521201844"/>
<reference key="NSBGColor" ref="144579518"/>
<object class="NSCursor" key="NSCursor">
<string key="NSHotSpot">{4, 5}</string>
<object class="NSImage" key="NSImage">
<int key="NSImageFlags">12582912</int>
<object class="NSMutableArray" key="NSReps">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="0"/>
<object class="NSBitmapImageRep">
<object class="NSData" key="NSTIFFRepresentation">
<bytes key="NS.bytes">TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym
SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA
AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA
AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA
AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
</object>
</object>
</object>
</object>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
</object>
<string key="NSHotSpot">{4, -5}</string>
<int key="NSCursorType">1</int>
</object>
<int key="NScvFlags">4</int>
</object>
@@ -237,8 +205,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<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>
@@ -249,8 +215,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<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>
@@ -258,11 +222,10 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<double key="NSPercent">0.94565218687057495</double>
</object>
</object>
<string key="NSFrameSize">{439, 600}</string>
<string key="NSFrameSize">{392, 689}</string>
<reference key="NSSuperview" ref="202269651"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="497745035"/>
<int key="NSsFlags">133648</int>
<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"/>
@@ -291,9 +254,8 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<string>public.url-name</string>
</object>
</object>
<string key="NSFrame">{{449, 0}, {411, 600}}</string>
<string key="NSFrame">{{402, 0}, {367, 689}}</string>
<reference key="NSSuperview" ref="202269651"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="FrameName"/>
<string key="GroupName"/>
@@ -319,23 +281,18 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<bool key="AllowsUndo">YES</bool>
</object>
</object>
<string key="NSFrameSize">{860, 600}</string>
<string key="NSFrameSize">{769, 689}</string>
<reference key="NSSuperview" ref="568628114"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="60428165"/>
<bool key="NSIsVertical">YES</bool>
<int key="NSDividerStyle">3</int>
</object>
</object>
<string key="NSFrameSize">{860, 600}</string>
<string key="NSFrameSize">{769, 689}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="202269651"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSScreenRect">{{0, 0}, {2560, 1578}}</string>
<string key="NSMinSize">{94, 108}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
<object class="NSCustomObject" id="796877042">
<string key="NSClassName">NSApplication</string>
@@ -360,6 +317,14 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
</object>
<int key="connectionID">18</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">100027</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">htmlPreviewWebView</string>
@@ -385,20 +350,24 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<int key="connectionID">100030</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">policyDelegate</string>
<reference key="source" ref="583055138"/>
<object class="IBBindingConnection" key="connection">
<string key="label">attributedString: markdownSource</string>
<reference key="source" ref="521201844"/>
<reference key="destination" ref="512844837"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="521201844"/>
<reference key="NSDestination" ref="512844837"/>
<string key="NSLabel">attributedString: markdownSource</string>
<string key="NSBinding">attributedString</string>
<string key="NSKeyPath">markdownSource</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSContinuouslyUpdatesValue</string>
<boolean value="YES" key="NS.object.0"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</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>
<int key="connectionID">100032</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -494,20 +463,22 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>100021.IBPluginDependency</string>
<string>100022.IBPluginDependency</string>
<string>100023.IBPluginDependency</string>
<string>100024.CustomClassName</string>
<string>100024.IBPluginDependency</string>
<string>100025.IBPluginDependency</string>
<string>100026.IBPluginDependency</string>
<string>5.IBEditorWindowLastContentRect</string>
<string>5.IBPluginDependency</string>
<string>5.IBWindowTemplateEditedContentRect</string>
<string>5.ImportedFromIB2</string>
<string>5.NSWindowTemplate.visibleAtLaunch</string>
<string>5.editorWindowContentRectSynchronizationRect</string>
<string>5.windowTemplate.hasMinSize</string>
<string>5.windowTemplate.minSize</string>
<string>6.IBPluginDependency</string>
<string>6.ImportedFromIB2</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -516,30 +487,36 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>RKSyntaxView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.WebKitIBPlugin</string>
<string>{{67, 760}, {769, 689}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{597, 57}, {769, 667}}</string>
<string>{{67, 760}, {769, 689}}</string>
<integer value="1"/>
<boolean value="NO"/>
<string>{{201, 387}, {507, 413}}</string>
<integer value="1"/>
<string>{94, 86}</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 class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</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 class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">100034</int>
<int key="maxID">100032</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -551,13 +528,6 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<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">
@@ -568,35 +538,71 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<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>
<string>NSTextView</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MyDocument.h</string>
<string key="minorKey">MyDocument.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<string key="superclassName">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="1015428475">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="203151251">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="33798900">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSControl</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="563656418">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSDocument</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -618,80 +624,493 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<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>
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">RKSyntaxView</string>
<string key="superclassName">NSTextView</string>
<string key="className">NSDocument</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/RKSyntaxView.h</string>
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDocumentScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSFormatter</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSMenu</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="177014921">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSMenu.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="1015428475"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="203151251"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="33798900"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="563656418"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDragging.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="177014921"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSTableView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="518069386">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebEditingDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebFrameLoadDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebJavaPlugIn.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPlugin.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPluginContainer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPolicyDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebResourceLoadDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebScriptObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebUIDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSScrollView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSScrollView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSScroller</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSScroller.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSplitView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSplitView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSText</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSText.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSTextView</string>
<string key="superclassName">NSText</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSTextView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSClipView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSMenuItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSRulerView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSView</string>
<string key="superclassName">NSResponder</string>
<reference key="sourceIdentifier" ref="518069386"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDrawer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
<string key="superclassName">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">WebView</string>
<string key="superclassName">NSView</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>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>goBack:</string>
<string>goForward:</string>
<string>makeTextLarger:</string>
<string>makeTextSmaller:</string>
<string>makeTextStandardSize:</string>
<string>reload:</string>
<string>reloadFromOrigin:</string>
<string>stopLoading:</string>
<string>takeStringURLFrom:</string>
<string>toggleContinuousSpellChecking:</string>
<string>toggleSmartInsertDelete:</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>
<string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/WebView.h</string>
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/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"/>
@@ -701,6 +1120,7 @@ AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../MarkdownLive.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
+2 -6
View File
@@ -10,10 +10,6 @@
<key>CFBundleTypeExtensions</key>
<array>
<string>markdown</string>
<string>md</string>
<string>text</string>
<string>txt</string>
<string></string>
</array>
<key>CFBundleTypeIconFile</key>
<string></string>
@@ -44,9 +40,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.7.1</string>
<string>1.6</string>
<key>CFBundleShortVersionString</key>
<string>1.7.1</string>
<string>1.6</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
+6 -365
View File
@@ -11,83 +11,20 @@
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */; };
795F6CCD105D741100D1F90A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 795F6CCC105D741100D1F90A /* WebKit.framework */; };
79B3D5441060376F00A8D174 /* MDMarkdownParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 79B3D5431060376F00A8D174 /* MDMarkdownParser.m */; };
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */; settings = {ATTRIBUTES = (); }; };
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
9958D88F14119A22004F7DF1 /* RKSyntaxView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9958D88E14119A22004F7DF1 /* RKSyntaxView.m */; };
9958D89214119A8D004F7DF1 /* NSColor+HexRGB.m in Sources */ = {isa = PBXBuildFile; fileRef = 9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */; };
9958D89514119B85004F7DF1 /* PageScheme.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9958D89314119B85004F7DF1 /* PageScheme.plist */; };
9958D89614119B85004F7DF1 /* PageSyntax.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9958D89414119B85004F7DF1 /* PageSyntax.plist */; };
ABE8DDF913CA38B5005852B5 /* styles.css in Resources */ = {isa = PBXBuildFile; fileRef = 226936E612E7CDC500171322 /* styles.css */; };
ABECD8C713C8B90E00B77CFD /* mkdio.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C4E105D6EC400D1F90A /* mkdio.c */; };
ABECD8C813C8B92900B77CFD /* markdown.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C50105D6ECE00D1F90A /* markdown.c */; };
ABECD8C913C8B92900B77CFD /* generate.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C52105D6ED800D1F90A /* generate.c */; };
ABECD8CA13C8B92900B77CFD /* resource.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C54105D6EE100D1F90A /* resource.c */; };
ABECD8CB13C8B92900B77CFD /* xml.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C61105D6F6E00D1F90A /* xml.c */; };
ABECD8CC13C8B92900B77CFD /* Csio.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C65105D6F8500D1F90A /* Csio.c */; };
ABECD8CD13C8B92900B77CFD /* emmatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 2269367E12E7C53000171322 /* emmatch.c */; };
ABECD8CE13C8B92900B77CFD /* html5.c in Sources */ = {isa = PBXBuildFile; fileRef = 2269369A12E7C6AB00171322 /* html5.c */; };
ABECD8CF13C8B92900B77CFD /* tags.c in Sources */ = {isa = PBXBuildFile; fileRef = 2269369E12E7C6BE00171322 /* tags.c */; };
ABECD8D013C8B92900B77CFD /* setup.c in Sources */ = {isa = PBXBuildFile; fileRef = 226936C912E7CA2800171322 /* setup.c */; };
ABECD8D113C8B94A00B77CFD /* discountWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB5105D75D300D1F90A /* discountWrapper.m */; };
ABECD8D213C8B94A00B77CFD /* markdownWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB6105D75D300D1F90A /* markdownWrapper.c */; };
ABECD8D313C8B94A00B77CFD /* mkdioWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB8105D75D300D1F90A /* mkdioWrapper.c */; };
ABECD8DE13C8B9C400B77CFD /* ORCDiscount.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */; };
ABECD8ED13C8BA1A00B77CFD /* discountWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 795F6DB4105D75D300D1F90A /* discountWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABECD8EF13C8BA2100B77CFD /* markdownWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 795F6DB7105D75D300D1F90A /* markdownWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABECD8F113C8BA2400B77CFD /* mkdioWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 795F6DB9105D75D300D1F90A /* mkdioWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABECD95C13C8D14C00B77CFD /* ORCDiscount.h in Headers */ = {isa = PBXBuildFile; fileRef = ABECD95B13C8D14C00B77CFD /* ORCDiscount.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABECD96B13C8D2D200B77CFD /* markdown.h in Headers */ = {isa = PBXBuildFile; fileRef = 22ECEED912E7C2E8003B50DC /* markdown.h */; settings = {ATTRIBUTES = (Public, ); }; };
ABECD98D13C8D6A900B77CFD /* ORCDiscount.m in Sources */ = {isa = PBXBuildFile; fileRef = ABECD98C13C8D6A900B77CFD /* ORCDiscount.m */; };
ABECD9ED13C8DC2B00B77CFD /* ORCDiscount.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */; };
ABF75D7313CDEBBB00B5E7AB /* EditPaneLayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF75D6E13CDEBBA00B5E7AB /* EditPaneLayoutManager.m */; };
ABF75D7413CDEBBB00B5E7AB /* EditPaneTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF75D6F13CDEBBA00B5E7AB /* EditPaneTextView.m */; };
ABF75D7513CDEBBB00B5E7AB /* EditPaneTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF75D7013CDEBBA00B5E7AB /* EditPaneTypesetter.m */; };
ABF75D7613CDEBBB00B5E7AB /* PreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF75D7113CDEBBA00B5E7AB /* PreferencesController.m */; };
ABF75D7713CDEBBB00B5E7AB /* PreferencesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF75D7213CDEBBA00B5E7AB /* PreferencesManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
ABECD8D713C8B98D00B77CFD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = ABECD8C113C8B8CA00B77CFD;
remoteInfo = Discount;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
ABECD8EA13C8B9E700B77CFD /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
ABECD8DE13C8B9C400B77CFD /* ORCDiscount.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* 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>"; };
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>"; };
2269367E12E7C53000171322 /* emmatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = emmatch.c; sourceTree = "<group>"; };
2269369A12E7C6AB00171322 /* html5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = html5.c; sourceTree = "<group>"; };
2269369E12E7C6BE00171322 /* tags.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tags.c; sourceTree = "<group>"; };
2269369F12E7C6BE00171322 /* tags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tags.h; sourceTree = "<group>"; };
226936B912E7C8B600171322 /* mkdio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkdio.h; sourceTree = "<group>"; };
226936C912E7CA2800171322 /* setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = setup.c; sourceTree = "<group>"; };
226936E612E7CDC500171322 /* styles.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = styles.css; sourceTree = "<group>"; };
22ECEEC612E7C258003B50DC /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
22ECEED912E7C2E8003B50DC /* markdown.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = markdown.h; sourceTree = "<group>"; };
2564AD2C0F5327BB00F57823 /* MarkdownLive_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkdownLive_Prefix.pch; sourceTree = "<group>"; };
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = "<group>"; };
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDocument.h; sourceTree = "<group>"; };
@@ -95,38 +32,12 @@
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>"; };
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>"; };
795F6C54105D6EE100D1F90A /* resource.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resource.c; sourceTree = "<group>"; };
795F6C61105D6F6E00D1F90A /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = "<group>"; };
795F6C65105D6F8500D1F90A /* Csio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Csio.c; sourceTree = "<group>"; };
795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = MarkdownLiveApp.icns; sourceTree = "<group>"; };
795F6CCC105D741100D1F90A /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
795F6DB4105D75D300D1F90A /* discountWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = discountWrapper.h; sourceTree = "<group>"; };
795F6DB5105D75D300D1F90A /* discountWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = discountWrapper.m; sourceTree = "<group>"; };
795F6DB6105D75D300D1F90A /* markdownWrapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = markdownWrapper.c; sourceTree = "<group>"; };
795F6DB7105D75D300D1F90A /* markdownWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = markdownWrapper.h; sourceTree = "<group>"; };
795F6DB8105D75D300D1F90A /* mkdioWrapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mkdioWrapper.c; sourceTree = "<group>"; };
795F6DB9105D75D300D1F90A /* mkdioWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkdioWrapper.h; sourceTree = "<group>"; };
79B3D5421060376F00A8D174 /* MDMarkdownParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MDMarkdownParser.h; path = mayday/MDMarkdownParser.h; sourceTree = "<group>"; };
79B3D5431060376F00A8D174 /* MDMarkdownParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MDMarkdownParser.m; path = mayday/MDMarkdownParser.m; sourceTree = "<group>"; };
8D15AC360486D014006FF6A4 /* MarkdownLive-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MarkdownLive-Info.plist"; sourceTree = "<group>"; };
8D15AC370486D014006FF6A4 /* MarkdownLive.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarkdownLive.app; sourceTree = BUILT_PRODUCTS_DIR; };
9958D88D14119A22004F7DF1 /* RKSyntaxView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSyntaxView.h; sourceTree = "<group>"; };
9958D88E14119A22004F7DF1 /* RKSyntaxView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSyntaxView.m; sourceTree = "<group>"; };
9958D89014119A8D004F7DF1 /* NSColor+HexRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+HexRGB.h"; sourceTree = "<group>"; };
9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+HexRGB.m"; sourceTree = "<group>"; };
9958D89314119B85004F7DF1 /* PageScheme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageScheme.plist; sourceTree = "<group>"; };
9958D89414119B85004F7DF1 /* PageSyntax.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageSyntax.plist; sourceTree = "<group>"; };
ABCE3DDF13C8DFFF00DF3CD0 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORCDiscount.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ABECD8C313C8B8CA00B77CFD /* ORCDiscount-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ORCDiscount-Info.plist"; sourceTree = "<group>"; };
ABECD95B13C8D14C00B77CFD /* ORCDiscount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ORCDiscount.h; path = ORCDiscount/ORCDiscount.h; sourceTree = "<group>"; };
ABECD98C13C8D6A900B77CFD /* ORCDiscount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ORCDiscount.m; path = ORCDiscount/ORCDiscount.m; sourceTree = "<group>"; };
ABF75D6E13CDEBBA00B5E7AB /* EditPaneLayoutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditPaneLayoutManager.m; sourceTree = "<group>"; };
ABF75D6F13CDEBBA00B5E7AB /* EditPaneTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditPaneTextView.m; sourceTree = "<group>"; };
ABF75D7013CDEBBA00B5E7AB /* EditPaneTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditPaneTypesetter.m; sourceTree = "<group>"; };
ABF75D7113CDEBBA00B5E7AB /* PreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesController.m; sourceTree = "<group>"; };
ABF75D7213CDEBBA00B5E7AB /* PreferencesManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesManager.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -134,19 +45,11 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ABECD9ED13C8DC2B00B77CFD /* ORCDiscount.framework in Frameworks */,
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
795F6CCD105D741100D1F90A /* WebKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
ABECD8C013C8B8CA00B77CFD /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -173,35 +76,18 @@
isa = PBXGroup;
children = (
8D15AC370486D014006FF6A4 /* MarkdownLive.app */,
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */,
);
name = Products;
sourceTree = "<group>";
};
22ECEEC512E7C258003B50DC /* discount-config */ = {
isa = PBXGroup;
children = (
226936B912E7C8B600171322 /* mkdio.h */,
22ECEEC612E7C258003B50DC /* config.h */,
);
path = "discount-config";
sourceTree = "<group>";
};
2A37F4AAFDCFA73011CA2CEA /* MarkdownLive */ = {
isa = PBXGroup;
children = (
9958D88B14119A18004F7DF1 /* RK */,
ABECD96113C8D1C200B77CFD /* ORCDiscount */,
2A37F4ABFDCFA73011CA2CEA /* Classes */,
795F6C4D105D6EA500D1F90A /* discount */,
22ECEEC512E7C258003B50DC /* discount-config */,
795F6DB3105D75D300D1F90A /* discount_wrappers */,
2A37F4AFFDCFA73011CA2CEA /* Other Sources */,
2A37F4B8FDCFA73011CA2CEA /* Resources */,
2A37F4C3FDCFA73011CA2CEA /* Frameworks */,
19C28FB0FE9D524F11CA2CBB /* Products */,
ABECD8C313C8B8CA00B77CFD /* ORCDiscount-Info.plist */,
ABCE3DDF13C8DFFF00DF3CD0 /* README.md */,
);
name = MarkdownLive;
sourceTree = "<group>";
@@ -209,13 +95,10 @@
2A37F4ABFDCFA73011CA2CEA /* Classes */ = {
isa = PBXGroup;
children = (
ABF75D6E13CDEBBA00B5E7AB /* EditPaneLayoutManager.m */,
ABF75D6F13CDEBBA00B5E7AB /* EditPaneTextView.m */,
ABF75D7013CDEBBA00B5E7AB /* EditPaneTypesetter.m */,
ABF75D7113CDEBBA00B5E7AB /* PreferencesController.m */,
ABF75D7213CDEBBA00B5E7AB /* PreferencesManager.m */,
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */,
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */,
79B3D5421060376F00A8D174 /* MDMarkdownParser.h */,
79B3D5431060376F00A8D174 /* MDMarkdownParser.m */,
);
name = Classes;
sourceTree = "<group>";
@@ -232,15 +115,12 @@
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
226936E612E7CDC500171322 /* styles.css */,
795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */,
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
8D15AC360486D014006FF6A4 /* MarkdownLive-Info.plist */,
089C165FFE840EACC02AAC07 /* InfoPlist.strings */,
1DDD58280DA1D0D100B32029 /* MyDocument.xib */,
1DDD582A0DA1D0D100B32029 /* MainMenu.xib */,
9958D89314119B85004F7DF1 /* PageScheme.plist */,
9958D89414119B85004F7DF1 /* PageSyntax.plist */,
);
name = Resources;
sourceTree = "<group>";
@@ -254,75 +134,8 @@
name = Frameworks;
sourceTree = "<group>";
};
795F6C4D105D6EA500D1F90A /* discount */ = {
isa = PBXGroup;
children = (
795F6C4E105D6EC400D1F90A /* mkdio.c */,
22ECEED912E7C2E8003B50DC /* markdown.h */,
795F6C50105D6ECE00D1F90A /* markdown.c */,
795F6C52105D6ED800D1F90A /* generate.c */,
795F6C54105D6EE100D1F90A /* resource.c */,
795F6C61105D6F6E00D1F90A /* xml.c */,
795F6C65105D6F8500D1F90A /* Csio.c */,
2269367E12E7C53000171322 /* emmatch.c */,
2269369A12E7C6AB00171322 /* html5.c */,
2269369F12E7C6BE00171322 /* tags.h */,
2269369E12E7C6BE00171322 /* tags.c */,
226936C912E7CA2800171322 /* setup.c */,
);
path = discount;
sourceTree = "<group>";
};
795F6DB3105D75D300D1F90A /* discount_wrappers */ = {
isa = PBXGroup;
children = (
795F6DB4105D75D300D1F90A /* discountWrapper.h */,
795F6DB5105D75D300D1F90A /* discountWrapper.m */,
795F6DB6105D75D300D1F90A /* markdownWrapper.c */,
795F6DB7105D75D300D1F90A /* markdownWrapper.h */,
795F6DB8105D75D300D1F90A /* mkdioWrapper.c */,
795F6DB9105D75D300D1F90A /* mkdioWrapper.h */,
);
path = discount_wrappers;
sourceTree = "<group>";
};
9958D88B14119A18004F7DF1 /* RK */ = {
isa = PBXGroup;
children = (
9958D89014119A8D004F7DF1 /* NSColor+HexRGB.h */,
9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */,
9958D88D14119A22004F7DF1 /* RKSyntaxView.h */,
9958D88E14119A22004F7DF1 /* RKSyntaxView.m */,
);
name = RK;
sourceTree = "<group>";
};
ABECD96113C8D1C200B77CFD /* ORCDiscount */ = {
isa = PBXGroup;
children = (
ABECD95B13C8D14C00B77CFD /* ORCDiscount.h */,
ABECD98C13C8D6A900B77CFD /* ORCDiscount.m */,
);
name = ORCDiscount;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
ABECD8BD13C8B8CA00B77CFD /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
ABECD96B13C8D2D200B77CFD /* markdown.h in Headers */,
ABECD8F113C8BA2400B77CFD /* mkdioWrapper.h in Headers */,
ABECD8EF13C8BA2100B77CFD /* markdownWrapper.h in Headers */,
ABECD8ED13C8BA1A00B77CFD /* discountWrapper.h in Headers */,
ABECD95C13C8D14C00B77CFD /* ORCDiscount.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8D15AC270486D014006FF6A4 /* MarkdownLive */ = {
isa = PBXNativeTarget;
@@ -330,13 +143,11 @@
buildPhases = (
8D15AC2B0486D014006FF6A4 /* Resources */,
8D15AC300486D014006FF6A4 /* Sources */,
ABECD8EA13C8B9E700B77CFD /* Copy Frameworks */,
8D15AC330486D014006FF6A4 /* Frameworks */,
);
buildRules = (
);
dependencies = (
ABECD8D813C8B98D00B77CFD /* PBXTargetDependency */,
);
name = MarkdownLive;
productInstallPath = "$(HOME)/Applications";
@@ -344,24 +155,6 @@
productReference = 8D15AC370486D014006FF6A4 /* MarkdownLive.app */;
productType = "com.apple.product-type.application";
};
ABECD8C113C8B8CA00B77CFD /* ORCDiscount */ = {
isa = PBXNativeTarget;
buildConfigurationList = ABECD8C613C8B8CA00B77CFD /* Build configuration list for PBXNativeTarget "ORCDiscount" */;
buildPhases = (
ABECD8BD13C8B8CA00B77CFD /* Headers */,
ABECD8BE13C8B8CA00B77CFD /* Resources */,
ABECD8BF13C8B8CA00B77CFD /* Sources */,
ABECD8C013C8B8CA00B77CFD /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = ORCDiscount;
productName = Discount;
productReference = ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -369,20 +162,12 @@
isa = PBXProject;
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MarkdownLive" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 2A37F4AAFDCFA73011CA2CEA /* MarkdownLive */;
projectDirPath = "";
projectRoot = "";
targets = (
8D15AC270486D014006FF6A4 /* MarkdownLive */,
ABECD8C113C8B8CA00B77CFD /* ORCDiscount */,
);
};
/* End PBXProject section */
@@ -397,16 +182,6 @@
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */,
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */,
9958D89514119B85004F7DF1 /* PageScheme.plist in Resources */,
9958D89614119B85004F7DF1 /* PageSyntax.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
ABECD8BE13C8B8CA00B77CFD /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ABE8DDF913CA38B5005852B5 /* styles.css in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -419,47 +194,12 @@
files = (
8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */,
8D15AC320486D014006FF6A4 /* main.m in Sources */,
ABF75D7313CDEBBB00B5E7AB /* EditPaneLayoutManager.m in Sources */,
ABF75D7413CDEBBB00B5E7AB /* EditPaneTextView.m in Sources */,
ABF75D7513CDEBBB00B5E7AB /* EditPaneTypesetter.m in Sources */,
ABF75D7613CDEBBB00B5E7AB /* PreferencesController.m in Sources */,
ABF75D7713CDEBBB00B5E7AB /* PreferencesManager.m in Sources */,
9958D88F14119A22004F7DF1 /* RKSyntaxView.m in Sources */,
9958D89214119A8D004F7DF1 /* NSColor+HexRGB.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
ABECD8BF13C8B8CA00B77CFD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ABECD8C713C8B90E00B77CFD /* mkdio.c in Sources */,
ABECD8C813C8B92900B77CFD /* markdown.c in Sources */,
ABECD8C913C8B92900B77CFD /* generate.c in Sources */,
ABECD8CA13C8B92900B77CFD /* resource.c in Sources */,
ABECD8CB13C8B92900B77CFD /* xml.c in Sources */,
ABECD8CC13C8B92900B77CFD /* Csio.c in Sources */,
ABECD8CD13C8B92900B77CFD /* emmatch.c in Sources */,
ABECD8CE13C8B92900B77CFD /* html5.c in Sources */,
ABECD8CF13C8B92900B77CFD /* tags.c in Sources */,
ABECD8D013C8B92900B77CFD /* setup.c in Sources */,
ABECD8D113C8B94A00B77CFD /* discountWrapper.m in Sources */,
ABECD8D213C8B94A00B77CFD /* markdownWrapper.c in Sources */,
ABECD8D313C8B94A00B77CFD /* mkdioWrapper.c in Sources */,
ABECD98D13C8D6A900B77CFD /* ORCDiscount.m in Sources */,
79B3D5441060376F00A8D174 /* MDMarkdownParser.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
ABECD8D813C8B98D00B77CFD /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = ABECD8C113C8B8CA00B77CFD /* ORCDiscount */;
targetProxy = ABECD8D713C8B98D00B77CFD /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -496,68 +236,11 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
ABECD8C413C8B8CA00B77CFD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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 = "";
INFOPLIST_FILE = "ORCDiscount-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_LDFLAGS = (
"-framework",
Foundation,
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = NO;
};
name = Debug;
};
ABECD8C513C8B8CA00B77CFD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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";
INSTALL_PATH = "@executable_path/../Frameworks";
OTHER_LDFLAGS = (
"-framework",
Foundation,
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = YES;
ZERO_LINK = NO;
};
name = Release;
};
C05733C808A9546B00998B17 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
@@ -566,9 +249,7 @@
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
INFOPLIST_FILE = "MarkdownLive-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = MarkdownLive;
SDKROOT = macosx;
};
name = Debug;
};
@@ -577,15 +258,12 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
INFOPLIST_FILE = "MarkdownLive-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = MarkdownLive;
SDKROOT = macosx;
};
name = Release;
};
@@ -593,21 +271,9 @@
isa = XCBuildConfiguration;
buildSettings = {
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;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
GCC_WARN_PEDANTIC = NO;
GCC_WARN_SHADOW = NO;
GCC_WARN_SIGN_COMPARE = NO;
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
@@ -619,42 +285,17 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
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;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
GCC_WARN_PEDANTIC = NO;
GCC_WARN_SHADOW = NO;
GCC_WARN_SIGN_COMPARE = NO;
GCC_WARN_STRICT_SELECTOR_MATCH = NO;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
SEPARATE_STRIP = YES;
STRIP_INSTALLED_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
ABECD8C613C8B8CA00B77CFD /* Build configuration list for PBXNativeTarget "ORCDiscount" */ = {
isa = XCConfigurationList;
buildConfigurations = (
ABECD8C413C8B8CA00B77CFD /* Debug */,
ABECD8C513C8B8CA00B77CFD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "MarkdownLive" */ = {
isa = XCConfigurationList;
buildConfigurations = (
+2 -13
View File
@@ -1,22 +1,11 @@
/*******************************************************************************
MyDocument.h - <http://github.com/rentzsch/MarkdownLive>
Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import "RKSyntaxView.h"
@class EditPaneTextView;
@class EditPaneLayoutManager;
@interface MyDocument : NSDocument {
IBOutlet RKSyntaxView *markdownSourceTextView;
IBOutlet NSTextView *markdownSourceTextView;
IBOutlet WebView *htmlPreviewWebView;
NSTextStorage *markdownSource;
NSMutableAttributedString *markdownSource;
NSTimeInterval whenToUpdatePreview;
NSTimer *htmlPreviewTimer;
+47 -188
View File
@@ -1,133 +1,66 @@
/*******************************************************************************
MyDocument.m - <http://github.com/rentzsch/MarkdownLive>
Copyright (c) 2006-2011 Jonathan 'Wolf' Rentzsch: <http://rentzsch.com>
Some rights reserved: <http://opensource.org/licenses/mit-license.php>
***************************************************************************/
#import "ORCDiscount.h"
#import "MyDocument.h"
#import "EditPaneLayoutManager.h"
#import "EditPaneTextView.h"
#import "PreferencesController.h"
#import "PreferencesManager.h"
#include "discountWrapper.h"
#import "MDMarkdownParser.h"
NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
// class extension
@interface MyDocument ()
- (void)updateContent;
- (void)htmlPreviewTimer:(NSTimer*)timer_;
@interface NSResponder (scrollToEndOfDocument)
- (IBAction)scrollToEndOfDocument:(id)sender; // For some reason this isn't declared anywhere in AppKit.
@end
@implementation MyDocument
- (NSString*)markdown2html:(NSString*)markdown_ {
if (!markdown_)
return @"";
MDMarkdownParser *parser = [[[MDMarkdownParser alloc] init] autorelease];
return [parser cleanWhitespaceOnlyLinesInString:[parser detabString:markdown_]];
}
- (id)init {
self = [super init];
if (self) {
markdownSource = [[NSTextStorage alloc] init];
self = [super init];
if (self) {
markdownSource = [[NSMutableAttributedString alloc] initWithString:@""
attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:9.0]
forKey:NSFontAttributeName]];
whenToUpdatePreview = [[NSDate distantFuture] timeIntervalSinceReferenceDate];
htmlPreviewTimer = [NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(htmlPreviewTimer:)
userInfo:nil
repeats:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textDidChange:)
name:kEditPaneTextViewChangedNotification
object:markdownSourceTextView];
// print attributes
[[self printInfo] setHorizontalPagination:NSFitPagination];
[[self printInfo] setHorizontallyCentered:NO];
[[self printInfo] setVerticallyCentered:NO];
}
return self;
}
return self;
}
- (void)dealloc {
[htmlPreviewTimer invalidate]; htmlPreviewTimer = nil;
[markdownSource release]; markdownSource = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (NSString *)windowNibName {
return @"MyDocument";
return @"MyDocument";
}
- (void)windowControllerDidLoadNib:(NSWindowController *)controller_ {
static BOOL engagedAutosave = NO;
if (!engagedAutosave) {
engagedAutosave = YES;
[[NSDocumentController sharedDocumentController] setAutosavingDelay:5.0];
}
[[markdownSourceTextView layoutManager] replaceTextStorage:markdownSource];
[self updateContent];
// If you use IB to set an NSTextView's font, the font doesn't stick,
// even if you've turned off the text view's richText setting.
//[markdownSourceTextView updateFont];
//[markdownSourceTextView updateColors];
[markdownSourceTextView loadScheme:@"PageScheme"];
[markdownSourceTextView loadSyntax:@"PageSyntax"];
[markdownSourceTextView highlight];
[super windowControllerDidLoadNib:controller_];
- (void)windowControllerDidLoadNib:(NSWindowController*)controller_ {
static BOOL engagedAutosave = NO;
if (!engagedAutosave) {
engagedAutosave = YES;
[[NSDocumentController sharedDocumentController] setAutosavingDelay:5.0];
}
[super windowControllerDidLoadNib:controller_];
}
- (BOOL)writeToURL:(NSURL*)absoluteURL_
ofType:(NSString*)typeName_
forSaveOperation:(NSSaveOperationType)saveOperation_
originalContentsURL:(NSURL*)absoluteOriginalContentsURL_
error:(NSError **)error_
{
BOOL result = NO;
- (BOOL)writeToURL:(NSURL*)absoluteURL_ ofType:(NSString*)typeName_ error:(NSError**)error_ {
BOOL result = NO;
if ([typeName_ isEqualToString:kMarkdownDocumentType]) {
[markdownSourceTextView breakUndoCoalescing];
result = [[markdownSource string] writeToURL:absoluteURL_
atomically:YES
encoding:NSUTF8StringEncoding
error:error_];
}
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
options:NSXMLNodePreserveAll|NSXMLDocumentTidyXML
error:nil] autorelease];
if (doc) {
NSArray *nodes = [doc nodesForXPath:@"//*[@id=\"markdownlive\"]" error:nil];
if ([nodes count] == 1) {
NSXMLElement *node = [nodes objectAtIndex:0];
NSXMLDocument *markdownDoc = [[[NSXMLDocument alloc] initWithXMLString:[ORCDiscount markdown2HTML:[markdownSource string]]
options:NSXMLDocumentTidyHTML
error:nil] autorelease];
NSArray *markdownNodes = [markdownDoc nodesForXPath:@"/html/body/*" error:nil];
[markdownNodes makeObjectsPerformSelector:@selector(detach)];
[node setChildren:markdownNodes];
NSString *htmlFileContent = [doc XMLStringWithOptions:NSXMLNodePrettyPrint];
if ([htmlFileContent hasPrefix:@"<?xml"]) {
NSUInteger index = [htmlFileContent rangeOfString:@"\n"].location;
htmlFileContent = [htmlFileContent substringFromIndex:index+1];
}
[htmlFileContent writeToURL:htmlFileURL
atomically:YES
encoding:NSUTF8StringEncoding
error:nil];
}
}
}
}
return result;
}
@@ -142,7 +75,9 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
if (!error) {
NSAssert(markdownSourceString, nil);
[markdownSource release];
markdownSource = [[NSTextStorage alloc] initWithString:markdownSourceString];
markdownSource = [[NSMutableAttributedString alloc] initWithString:markdownSourceString
attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:9.0]
forKey:NSFontAttributeName]];
NSAssert(markdownSource, nil);
whenToUpdatePreview = [NSDate timeIntervalSinceReferenceDate] + 0.5;
result = YES;
@@ -153,119 +88,43 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
return result;
}
- (NSView *)printableView {
NSRect frame = [[self printInfo] imageablePageBounds];
frame.size.height = 0;
NSTextView *printView = [[[NSTextView alloc] initWithFrame:frame] autorelease];
[printView setVerticallyResizable:YES];
[printView setHorizontallyResizable:NO];
// force black text color
NSMutableAttributedString *printStr = [markdownSource mutableCopy];
NSDictionary *printAttr = [NSDictionary dictionaryWithObject:[NSColor blackColor]
forKey:NSForegroundColorAttributeName];
[printStr setAttributes:printAttr
range:NSMakeRange(0, [printStr length])];
[[printView textStorage] beginEditing];
[[printView textStorage] appendAttributedString:printStr];
[printStr release];
[[printView textStorage] endEditing];
[printView sizeToFit];
return printView;
}
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings error:(NSError **)outError {
#pragma unused(printSettings)
#pragma unused(outError)
return [NSPrintOperation printOperationWithView:[self printableView]
printInfo:[self printInfo]];
}
- (void)textDidChange:(NSNotification*)notification_ {
#pragma unused(notification_)
whenToUpdatePreview = [NSDate timeIntervalSinceReferenceDate] + 0.5;
}
- (void)updateContent {
NSView *docView = [[[htmlPreviewWebView mainFrame] frameView] documentView];
NSView *parent = [docView superview];
if (parent) {
NSAssert([parent isKindOfClass:[NSClipView class]], nil);
savedOrigin = [parent bounds].origin;
// This line from Darin from http://lists.apple.com/archives/webkitsdk-dev/2003/Dec/msg00004.html :
savedAtBottom = [docView isFlipped]
? NSMaxY([docView bounds]) <= NSMaxY([docView visibleRect])
: [docView bounds].origin.y >= [docView visibleRect].origin.y;
hasSavedOrigin = YES;
}
NSURL *css = [ORCDiscount cssURL];
NSString *html = [ORCDiscount HTMLPage:[ORCDiscount markdown2HTML:[markdownSource string]] withCSSFromURL:css];
[[htmlPreviewWebView mainFrame] loadHTMLString:html baseURL:[self fileURL]];
}
- (void)htmlPreviewTimer:(NSTimer*)timer_ {
#pragma unused(timer_)
if ([NSDate timeIntervalSinceReferenceDate] >= whenToUpdatePreview) {
whenToUpdatePreview = [[NSDate distantFuture] timeIntervalSinceReferenceDate];
[self updateContent];
NSView *docView = [[[htmlPreviewWebView mainFrame] frameView] documentView];
NSView *parent = [docView superview];
if (parent) {
NSAssert([parent isKindOfClass:[NSClipView class]], nil);
savedOrigin = [parent bounds].origin;
// This line from Darin from http://lists.apple.com/archives/webkitsdk-dev/2003/Dec/msg00004.html :
savedAtBottom = [docView isFlipped]
? NSMaxY([docView bounds]) <= NSMaxY([docView visibleRect])
: [docView bounds].origin.y >= [docView visibleRect].origin.y;
hasSavedOrigin = YES;
}
[[htmlPreviewWebView mainFrame] loadHTMLString:[self markdown2html:[markdownSource string]]
baseURL:[self fileName] ? [NSURL fileURLWithPath:[self fileName]] : nil];
}
}
- (void)webView:(WebView*)sender_ didFinishLoadForFrame:(WebFrame*)frame_ {
#pragma unused(sender_)
if ([htmlPreviewWebView mainFrame] == frame_ && hasSavedOrigin) {
hasSavedOrigin = NO;
if (savedAtBottom)
[[[frame_ frameView] documentView] scrollPoint:NSMakePoint(savedOrigin.x, CGFLOAT_MAX)];
[[frame_ frameView] scrollToEndOfDocument:nil];
else
[[[frame_ frameView] documentView] scrollPoint:savedOrigin];
}
}
- (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary *)actionInformation
request:(NSURLRequest *)request
frame:(WebFrame *)frame decisionListener:(id < WebPolicyDecisionListener >)listener {
#pragma unused(webView)
#pragma unused(request)
#pragma unused(frame)
WebNavigationType actionKey = [[actionInformation objectForKey:WebActionNavigationTypeKey] intValue];
if (actionKey == WebNavigationTypeOther) {
[listener use];
} else {
NSURL *url = [actionInformation objectForKey:WebActionOriginalURLKey];
NSURL *stdUrl = [url URLByStandardizingPath];
NSURL *docUrl = [[self fileURL] URLByStandardizingPath];
if ([[url scheme] isEqualToString:@"applewebdata"] ||
[stdUrl isFileURL] && [stdUrl isEqualTo:docUrl]) {
[listener use];
} else {
[[NSWorkspace sharedWorkspace] openURL:url];
[listener ignore];
}
}
}
- (IBAction)copyGeneratedHTMLAction:(id)sender {
#pragma unused(sender)
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
[[NSPasteboard generalPasteboard] setString:[ORCDiscount markdown2HTML:[markdownSource string]] forType:NSStringPboardType];
[[NSPasteboard generalPasteboard] setString:[self markdown2html:[markdownSource string]] forType:NSStringPboardType];
}
@end
-16
View File
@@ -1,16 +0,0 @@
//
// NSColor+HexRGB.h
// TextDo
//
// Created by Vojto Rinik on 28.6.2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSColor (NSColor_HexRGB)
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString;
@end
-35
View File
@@ -1,35 +0,0 @@
//
// NSColor+HexRGB.m
// TextDo
//
// Created by Vojto Rinik on 28.6.2011.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "NSColor+HexRGB.h"
@implementation NSColor (NSColor_HexRGB)
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString {
NSColor *result = nil;
unsigned int colorCode = 0;
unsigned char redByte, greenByte, blueByte;
if (nil != inColorString)
{
NSScanner *scanner = [NSScanner scannerWithString:inColorString];
(void) [scanner scanHexInt:&colorCode]; // ignore error
}
redByte = (unsigned char) (colorCode >> 16);
greenByte = (unsigned char) (colorCode >> 8);
blueByte = (unsigned char) (colorCode); // masks off high bits
result = [NSColor
colorWithCalibratedRed: (float)redByte / 0xff
green: (float)greenByte/ 0xff
blue: (float)blueByte / 0xff
alpha:1.0];
return result;
}
@end
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
-20
View File
@@ -1,20 +0,0 @@
/*
* ORCDiscount.h
* MarkdownLive
*
* Created by Jonathan on 09/07/2011.
* Copyright 2011 mugginsoft.com.
* Some rights reserved: <http://opensource.org/licenses/mit-license.php>
*
*/
#import <Cocoa/Cocoa.h>
@interface ORCDiscount : NSObject {
}
+ (NSString *)markdown2HTML:(NSString *)markdown;
+ (NSString *)HTMLPage:(NSString *)markdownHTML withCSSHTML:(NSString *)cssHTML;
+ (NSString *)HTMLPage:(NSString *)markdownHTML withCSSFromURL:(NSURL *)cssURL;
+ (NSURL *)cssURL;
@end
-49
View File
@@ -1,49 +0,0 @@
//
// ORCDiscount.m
// MarkdownLive
//
// Created by Jonathan on 09/07/2011.
// Copyright 2011 mugginsoft.com.
// Some rights reserved: <http://opensource.org/licenses/mit-license.php>
//
#import "ORCDiscount.h"
#import "discountWrapper.h"
@implementation ORCDiscount
+ (NSString *)markdown2HTML:(NSString *)markdown_ {
if (!markdown_) {
return @"";
}
return discountToHTML(markdown_);
}
+ (NSString *)HTMLPage:(NSString *)markdownHTML withCSSHTML:(NSString *)cssHTML
{
return [NSString stringWithFormat:
@"<!DOCTYPE html>\n<html>\n<head>\n<title>%@</title>\n%@</head>\n<body>%@</body>\n</html>",
@"Markdown Preview",
cssHTML,
markdownHTML
];
}
+ (NSString *)HTMLPage:(NSString *)markdownHTML withCSSFromURL:(NSURL *)cssURL
{
NSString *cssHTML = [NSString stringWithFormat:
@"<link rel=\"stylesheet\" type=\"text/css\" href=\"%@\">\n",
[cssURL absoluteString]
];
return [self HTMLPage:markdownHTML withCSSHTML:cssHTML];
}
+ (NSURL *)cssURL
{
return [[NSBundle bundleForClass:self] URLForResource:@"styles" withExtension:@"css"];
}
@end
-35
View File
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>colors</key>
<dict>
<key>title3</key>
<string>6C71C4</string>
<key>em</key>
<string>859900</string>
<key>strong</key>
<string>48595f</string>
<key>code</key>
<string>2AA198</string>
<key>codeBackground</key>
<string>EEE8D5</string>
<key>highlight</key>
<string>EEE8D5</string>
<key>background</key>
<string>FDF6E3</string>
<key>checked</key>
<string>8e8e8e</string>
<key>default</key>
<string>586E75</string>
<key>subtitle</key>
<string>268BD2</string>
<key>title</key>
<string>DC322F</string>
<key>zone</key>
<string>f21bea</string>
</dict>
<key>font</key>
<string>Menlo</string>
</dict>
</plist>
-92
View File
@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>todo-zone</key>
<dict>
<key>color</key>
<string>zone</string>
<key>pattern</key>
<string>^●\s*.*$</string>
</dict>
<key>todo-checked</key>
<dict>
<key>color</key>
<string>checked</string>
<key>pattern</key>
<string>^✓\s*.*$</string>
</dict>
<key>todo-unchecked</key>
<dict>
<key>color</key>
<string>default</string>
<key>pattern</key>
<string>^☐\s*.*$</string>
</dict>
<key>list-item</key>
<dict>
<key>color</key>
<string>default</string>
<key>pattern</key>
<string>^\*\s+.*$</string>
</dict>
<key>markdown-header-1</key>
<dict>
<key>size</key>
<integer>14</integer>
<key>isBold</key>
<true/>
<key>color</key>
<string>title</string>
<key>pattern</key>
<string>^(# )(.*?)($| #+$)</string>
</dict>
<key>markdown-header-2</key>
<dict>
<key>color</key>
<string>subtitle</string>
<key>isBold</key>
<true/>
<key>pattern</key>
<string>^(## )(.*?)($| #+$)</string>
</dict>
<key>markdown-em</key>
<dict>
<key>color</key>
<string>em</string>
<key>patternGroup</key>
<integer>2</integer>
<key>pattern</key>
<string>(^|[^\*])(\*[^\s\*]([^\*\n]+)\*)</string>
</dict>
<key>markdown-strong</key>
<dict>
<key>isBold</key>
<true/>
<key>color</key>
<string>strong</string>
<key>pattern</key>
<string>\*{2}(.+?)\*{2}</string>
</dict>
<key>markdown-header-3</key>
<dict>
<key>color</key>
<string>title3</string>
<key>isBold</key>
<true/>
<key>pattern</key>
<string>^(### )(.*?)($| #+$)</string>
</dict>
<key>code</key>
<dict>
<key>patternGroup</key>
<integer>1</integer>
<key>backgroundColor</key>
<string>codeBackground</string>
<key>color</key>
<string>code</string>
<key>pattern</key>
<string>^ {4}(.*?)$</string>
</dict>
</dict>
</plist>
-21
View File
@@ -1,21 +0,0 @@
//
// PreferencesController.h
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kEditPaneFontNameChangedNotification @"EditPaneFontNameChangedNotification"
@interface PreferencesController : NSObject {
IBOutlet NSWindow *prefWindow;
IBOutlet NSTextField *fontPreviewField;
}
- (IBAction)resetEditPanePreferences:(id)sender;
- (IBAction)showFonts:(id)sender;
@end
-76
View File
@@ -1,76 +0,0 @@
//
// PreferencesController.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "PreferencesController.h"
#import "PreferencesManager.h"
#define FONT_DISPLAY_FORMAT @"%@ %g pt."
@interface PreferencesController (Private)
- (void)updateFontDisplay;
@end
@implementation PreferencesController
- (void)awakeFromNib {
[self updateFontDisplay];
}
- (IBAction)showFonts:(id)sender {
NSFontManager *fontMan = [NSFontManager sharedFontManager];
NSFont *currentFont = [PreferencesManager editPaneFont];
[prefWindow makeFirstResponder:prefWindow];
[fontMan setSelectedFont:currentFont isMultiple:NO];
[fontMan orderFrontFontPanel:sender];
}
- (void)updateFontDisplay {
NSString *fontName = [PreferencesManager editPaneFontName];
float fontSize = [PreferencesManager editPaneFontSize];
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
}
- (IBAction)resetEditPanePreferences:(id)sender {
#pragma unused(sender)
[PreferencesManager resetEditPanePreferences];
[self updateFontDisplay];
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
object:nil];
}
- (void)changeFont:(id)sender {
NSFont *newFont = [sender convertFont:[NSFont systemFontOfSize:0]];
NSString *fontName = [newFont fontName];
float fontSize = [newFont pointSize];
if (newFont && fontName) {
[PreferencesManager setEditPaneFontName:fontName];
[PreferencesManager setEditPaneFontSize:fontSize];
[fontPreviewField setStringValue:[NSString stringWithFormat:FONT_DISPLAY_FORMAT, fontName, fontSize]];
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
object:nil];
}
}
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel {
#pragma unused(fontPanel)
return (NSFontPanelFaceModeMask |
NSFontPanelSizeModeMask |
NSFontPanelCollectionModeMask);
}
@end
-38
View File
@@ -1,38 +0,0 @@
//
// PreferencesManager.h
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kEditPaneFontName @"EditPaneFontName"
#define kEditPaneFontSize @"EditPaneFontSize"
#define kEditPaneForegroundColor @"EditPaneForegroundColor"
#define kEditPaneBackgroundColor @"EditPaneBackgroundColor"
#define kEditPaneSelectionColor @"EditPaneSelectionColor"
#define kEditPaneCaretColor @"EditPaneCaretColor"
@interface PreferencesManager : NSObject {
}
+ (void)resetEditPanePreferences;
+ (NSString *)editPaneFontName;
+ (void)setEditPaneFontName:(NSString *)value;
+ (float)editPaneFontSize;
+ (void)setEditPaneFontSize:(float)value;
+ (NSFont *)editPaneFont;
+ (NSColor *)editPaneForegroundColor;
+ (void)setEditPaneForegroundColor:(NSColor *)value;
+ (NSColor *)editPaneBackgroundColor;
+ (void)setEditPaneBackgroundColor:(NSColor *)value;
+ (NSColor *)editPaneSelectionColor;
+ (void)setEditPaneSelectionColor:(NSColor *)value;
+ (NSColor *)editPaneCaretColor;
+ (void)setEditPaneCaretColor:(NSColor *)value;
@end
-122
View File
@@ -1,122 +0,0 @@
//
// PreferencesManager.m
// MarkdownLive
//
// Created by Akihiro Noguchi on 7/05/11.
// Copyright 2011 Aki. All rights reserved.
//
#import "PreferencesManager.h"
@interface PreferencesManager (Private)
+ (NSColor *)colorForKey:(NSString *)key;
+ (void)setColor:(NSColor *)col forKey:(NSString *)key;
+ (NSDictionary *)editPaneDefaults;
@end
@implementation PreferencesManager
+ (void)initialize {
NSMutableDictionary *defVals = [NSMutableDictionary dictionary];
[defVals addEntriesFromDictionary:[PreferencesManager editPaneDefaults]];
[[NSUserDefaults standardUserDefaults] registerDefaults:defVals];
}
+ (NSDictionary *)editPaneDefaults {
return [NSDictionary dictionaryWithObjectsAndKeys:
@"Monaco", kEditPaneFontName,
[NSNumber numberWithFloat:9.0f], kEditPaneFontSize,
[NSArchiver archivedDataWithRootObject:[NSColor blackColor]], kEditPaneForegroundColor,
[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]], kEditPaneBackgroundColor,
[NSArchiver archivedDataWithRootObject:[NSColor selectedTextBackgroundColor]], kEditPaneSelectionColor,
[NSArchiver archivedDataWithRootObject:[NSColor blackColor]], kEditPaneCaretColor,
nil];
}
+ (void)resetEditPanePreferences {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSDictionary *defs = [PreferencesManager editPaneDefaults];
for (NSString *key in defs) {
[prefs setObject:[defs objectForKey:key] forKey:key];
}
}
+ (NSString *)editPaneFontName {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
return [prefs stringForKey:kEditPaneFontName];
}
+ (void)setEditPaneFontName:(NSString *)value {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setObject:value forKey:kEditPaneFontName];
}
+ (float)editPaneFontSize {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
return [prefs floatForKey:kEditPaneFontSize];
}
+ (void)setEditPaneFontSize:(float)value {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setFloat:value forKey:kEditPaneFontSize];
}
+ (NSFont *)editPaneFont {
return [NSFont fontWithName:[PreferencesManager editPaneFontName]
size:[PreferencesManager editPaneFontSize]];
}
+ (NSColor *)colorForKey:(NSString *)key {
if (key) {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSData *data = [prefs dataForKey:key];
if (data) {
return (NSColor *)[NSUnarchiver unarchiveObjectWithData:data];
}
}
return nil;
}
+ (void)setColor:(NSColor *)col forKey:(NSString *)key {
if (col && key) {
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setValue:[NSArchiver archivedDataWithRootObject:col] forKey:key];
}
}
+ (NSColor *)editPaneForegroundColor {
return [PreferencesManager colorForKey:kEditPaneForegroundColor];
}
+ (void)setEditPaneForegroundColor:(NSColor *)value {
[PreferencesManager setColor:value forKey:kEditPaneForegroundColor];
}
+ (NSColor *)editPaneBackgroundColor {
return [PreferencesManager colorForKey:kEditPaneBackgroundColor];
}
+ (void)setEditPaneBackgroundColor:(NSColor *)value {
[PreferencesManager setColor:value forKey:kEditPaneBackgroundColor];
}
+ (NSColor *)editPaneSelectionColor {
return [PreferencesManager colorForKey:kEditPaneSelectionColor];
}
+ (void)setEditPaneSelectionColor:(NSColor *)value {
[PreferencesManager setColor:value forKey:kEditPaneSelectionColor];
}
+ (NSColor *)editPaneCaretColor {
return [PreferencesManager colorForKey:kEditPaneCaretColor];
}
+ (void)setEditPaneCaretColor:(NSColor *)value {
[PreferencesManager setColor:value forKey:kEditPaneCaretColor];
}
@end
-19
View File
@@ -1,19 +0,0 @@
## About my fork
Adds beautiful syntax highlighting to MarkdownLive.
![screenshot](https://github.com/vojto/markdownlive/raw/master/sshot.png)
[Grab Lion build](https://github.com/downloads/vojto/markdownlive/MarkdownLive.zip)
Like it? Buy [one of my apps](http://rinik.net/apps).
## MarkdownLive
A Cocoa markdown preview editor using [Discount][discount].
Implements the ORCDiscount framework.
[discount]: https://github.com/Orc/discount
-45
View File
@@ -1,45 +0,0 @@
//
// RKSyntaxView.h
//
//
// Created by Vojto Rinik on 8/24/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
@interface RKSyntaxView : NSTextView {
NSDictionary *_scheme;
NSDictionary *_syntax;
NSMutableAttributedString *_content;
}
@property (retain) NSDictionary *scheme;
@property (retain) NSDictionary *syntax;
@property (retain) NSMutableAttributedString *content;
- (void) _setup;
#pragma mark - Handling text change
- (void) _textDidChange:(NSNotification *)notif;
#pragma mark - Highlighting
- (void) highlight;
- (void) highlightRange:(NSRange)range;
#pragma mark - Scheme
- (void) loadScheme:(NSString *)schemeFilename;
- (NSColor *) _colorFor:(NSString *)key;
- (NSFont *) _font;
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold;
#pragma mark - Syntax
- (void) loadSyntax:(NSString *)syntaxFilename;
#pragma mark - Changing text attributes
- (void) _setTextColor:(NSColor *)color range:(NSRange)range;
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range;
- (void) _setFont:(NSFont *)font range:(NSRange)range;
- (void) _reflect;
@end
-169
View File
@@ -1,169 +0,0 @@
//
// RKSyntaxView.m
//
//
// Created by Vojto Rinik on 8/24/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "RKSyntaxView.h"
#import "NSColor+HexRGB.h"
@implementation RKSyntaxView
@synthesize scheme=_scheme;
@synthesize syntax=_syntax;
@synthesize content=_content;
#pragma mark - Lifecycle
- (id)init {
if ((self = [super init])) {
[self _setup];
}
return self;
}
- (void)awakeFromNib {
[self _setup];
}
- (void)_setup {
self.content = [[[NSMutableAttributedString alloc] init] autorelease];
[self setTextContainerInset:NSMakeSize(10.0, 10.0)];
[self highlight];
[self addObserver:self forKeyPath:@"string" options:0 context:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_textDidChange:) name:NSTextDidChangeNotification object:self];
}
- (void) dealloc {
self.content = nil;
[super dealloc];
}
#pragma mark - Handling text changes
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
[self highlight];
}
- (void)_textDidChange:(NSNotification *)notif {
[self highlight];
}
#pragma mark - Scheme
- (void)loadScheme:(NSString *)schemeFilename {
NSString *schemePath = [[NSBundle mainBundle] pathForResource:schemeFilename ofType:@"plist" inDirectory:nil];
self.scheme = [NSDictionary dictionaryWithContentsOfFile:schemePath];
}
- (NSColor *) _colorFor:(NSString *)key {
NSString *colorCode = [[self.scheme objectForKey:@"colors"] objectForKey:key];
if (!colorCode) return nil;
NSColor *color = [NSColor colorFromHexRGB:colorCode];
return color;
}
- (NSFont *) _font {
return [self _fontOfSize:12 bold:NO];
}
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold {
NSString *fontName = [self.scheme objectForKey:@"font"];
NSFont *font = [NSFont fontWithName:fontName size:size];
if (!font) font = [NSFont systemFontOfSize:size];
if (wantsBold) {
NSFontTraitMask traits = NSBoldFontMask;
NSFontManager *manager = [NSFontManager sharedFontManager];
font = [manager fontWithFamily:fontName traits:traits weight:5.0 size:size];
}
return font;
}
#pragma mark - Syntax
- (void)loadSyntax:(NSString *)syntaxFilename {
NSString *schemePath = [[NSBundle mainBundle] pathForResource:syntaxFilename ofType:@"plist" inDirectory:nil];
self.syntax = [NSDictionary dictionaryWithContentsOfFile:schemePath];
}
#pragma mark - Highlighting
- (void) highlight {
self.content = [[NSMutableAttributedString alloc] initWithString:[self string]];
[self.content release];
NSColor *background = [self _colorFor:@"background"];
[self setBackgroundColor:background];
[(NSScrollView *)self.superview setBackgroundColor:background];
[self setTextColor:[self _colorFor:@"default"]];
return [self highlightRange:NSMakeRange(0, [self.content length])];
}
- (void) highlightRange:(NSRange)range {
NSColor *defaultColor = [self _colorFor:@"default"];
NSInteger defaultSize = [(NSNumber *)[self.scheme objectForKey:@"size"] integerValue];
if (!defaultSize) defaultSize = 12;
NSFont *defaultFont = [self _fontOfSize:defaultSize bold:NO];
[self _setFont:defaultFont range:range];
[self _setTextColor:defaultColor range:range];
[self _setBackgroundColor:[NSColor clearColor] range:range];
NSString *string = [self.content string];
for (NSString *type in [self.syntax allKeys]) {
NSDictionary *params = [self.syntax objectForKey:type];
NSString *pattern = [params objectForKey:@"pattern"];
NSString *colorName = [params objectForKey:@"color"];
NSColor *color = [self _colorFor:colorName];
NSString *backgroundColorName = [params objectForKey:@"backgroundColor"];
NSColor *backgroundColor = [self _colorFor:backgroundColorName];
NSInteger size = [(NSNumber *)[params objectForKey:@"size"] integerValue];
BOOL isBold = [(NSNumber *)[params objectForKey:@"isBold"] boolValue];
NSFont *font = [self _fontOfSize:(size?size:defaultSize) bold:isBold];
NSInteger patternGroup = [(NSNumber *)[params objectForKey:@"patternGroup"] integerValue];
NSError *error = nil;
NSRegularExpression *expr = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive|NSRegularExpressionAnchorsMatchLines error:&error];
NSArray *matches = [expr matchesInString:string options:0 range:range];
for (NSTextCheckingResult *match in matches) {
NSRange range = patternGroup ? [match rangeAtIndex:patternGroup] : [match range];
[self _setTextColor:color range:range];
if (backgroundColor) [self _setBackgroundColor:backgroundColor range:range];
[self _setFont:font range:range];
}
}
[self _reflect];
}
#pragma mark - Changing text attributes
- (void) _setTextColor:(NSColor *)color range:(NSRange)range {
if (!color) return;
[self.content addAttribute:NSForegroundColorAttributeName value:color range:range];
}
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range {
[self.content addAttribute:NSBackgroundColorAttributeName value:color range:range];
}
- (void) _setFont:(NSFont *)font range:(NSRange)range {
[self.content addAttribute:NSFontAttributeName value:font range:range];
}
- (void) _reflect {
NSTextStorage *storage = [self textStorage];
NSAttributedString *content = self.content;
NSRange range = NSMakeRange(0, [content length]);
[content enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop){
[storage setAttributes:attributes range:range];
}];
}
@end
-19
View File
@@ -1,19 +0,0 @@
# [Discount][] instructions #
This folder holds the files generated by discount's `configure.sh` script that are used by MarkdownLive.
## Upgrading discount ##
Discount is included as a [fake submodule][]. To upgrade or test other versions of discount, delete the files in the `discount` directory and clone a new local repository into it:
rm -rf discount/
git clone git://github.com/Orc/discount.git discount
## Config files ##
When discount is changed, regenerate the config files. The included `update.sh` script should do this automatically.
If you want to update the files by hand, remove the "configuration for markdown, generated" comments at the head of `config.h` to avoid adding needless patches to the git history.
[discount]:https://github.com/Orc/discount
[fake submodule]:http://debuggable.com/posts/git-fake-submodules:4b563ee4-f3cc-4061-967e-0e48cbdd56cb
-28
View File
@@ -1,28 +0,0 @@
/*
* configuration for markdown, generated Mon 11 Jul 2011 22:16:51 BST
* by Jonathan@macbook-pro.local
*/
#ifndef __AC_MARKDOWN_D
#define __AC_MARKDOWN_D 1
#define OS_DARWIN 1
#define USE_DISCOUNT_DL 1
#define DWORD unsigned int
#define WORD unsigned short
#define BYTE unsigned char
#define HAVE_PWD_H 1
#define HAVE_GETPWUID 1
#define HAVE_SRANDOM 1
#define INITRNG(x) srandom((unsigned int)x)
#define HAVE_BZERO 1
#define HAVE_RANDOM 1
#define COINTOSS() (random()&1)
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_FCHDIR 1
#define TABSTOP 4
#define PATH_FIND "/usr/bin/find"
#define PATH_SED "/usr/bin/sed"
#endif/* __AC_MARKDOWN_D */
-108
View File
@@ -1,108 +0,0 @@
#ifndef _MKDIO_D
#define _MKDIO_D
#include <stdio.h>
typedef void MMIOT;
typedef unsigned int mkd_flag_t;
/* line builder for markdown()
*/
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 */
void mkd_basename(MMIOT*,char*);
void mkd_initialize();
void mkd_with_html5_tags();
void mkd_shlib_destructor();
/* compilation, debugging, cleanup
*/
int mkd_compile(MMIOT*, mkd_flag_t);
int mkd_cleanup(MMIOT*);
/* markup functions
*/
int mkd_dump(MMIOT*, FILE*, int, char*);
int markdown(MMIOT*, FILE*, mkd_flag_t);
int mkd_line(char *, int, char **, mkd_flag_t);
typedef int (*mkd_sta_function_t)(const int,const void*);
void mkd_string_to_anchor(char *, int, mkd_sta_function_t, void*, int);
int mkd_xhtmlpage(MMIOT*,int,FILE*);
/* header block access
*/
char* mkd_doc_title(MMIOT*);
char* mkd_doc_author(MMIOT*);
char* mkd_doc_date(MMIOT*);
/* compiled data access
*/
int mkd_document(MMIOT*, char**);
int mkd_toc(MMIOT*, char**);
int mkd_css(MMIOT*, char **);
int mkd_xml(char *, int, char **);
/* write-to-file functions
*/
int mkd_generatehtml(MMIOT*,FILE*);
int mkd_generatetoc(MMIOT*,FILE*);
int mkd_generatexml(char *, int,FILE*);
int mkd_generatecss(MMIOT*,FILE*);
#define mkd_style mkd_generatecss
int mkd_generateline(char *, int, FILE*, mkd_flag_t);
#define mkd_text mkd_generateline
/* url generator callbacks
*/
typedef char * (*mkd_callback_t)(const char*, const int, void*);
typedef void (*mkd_free_t)(char*, void*);
void mkd_e_url(void *, mkd_callback_t);
void mkd_e_flags(void *, mkd_callback_t);
void mkd_e_free(void *, mkd_free_t );
void mkd_e_data(void *, void *);
/* version#.
*/
extern char markdown_version[];
void mkd_mmiot_flags(FILE *, MMIOT *, int);
void mkd_flags_are(FILE*, mkd_flag_t, int);
void mkd_ref_prefix(MMIOT*, char*);
/* special flags for markdown() and mkd_text()
*/
#define MKD_NOLINKS 0x00000001 /* don't do link processing, block <a> tags */
#define MKD_NOIMAGE 0x00000002 /* don't do image processing, block <img> */
#define MKD_NOPANTS 0x00000004 /* don't run smartypants() */
#define MKD_NOHTML 0x00000008 /* don't allow raw html through AT ALL */
#define MKD_STRICT 0x00000010 /* disable SUPERSCRIPT, RELAXED_EMPHASIS */
#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_CDATA 0x00000080 /* generate code for xml ![CDATA[...]] */
#define MKD_NOSUPERSCRIPT 0x00000100 /* no A^B */
#define MKD_NORELAXED 0x00000200 /* emphasis happens /everywhere/ */
#define MKD_NOTABLES 0x00000400 /* disallow tables */
#define MKD_NOSTRIKETHROUGH 0x00000800 /* forbid ~~strikethrough~~ */
#define MKD_TOC 0x00001000 /* do table-of-contents processing */
#define MKD_1_COMPAT 0x00002000 /* compatibility with MarkdownTest_1.0 */
#define MKD_AUTOLINK 0x00004000 /* make http://foo.com link even without <>s */
#define MKD_SAFELINK 0x00008000 /* paranoid check for link protocol */
#define MKD_NOHEADER 0x00010000 /* don't process header blocks */
#define MKD_TABSTOP 0x00020000 /* expand tabs to 4 spaces */
#define MKD_NODIVQUOTE 0x00040000 /* forbid >%class% blocks */
#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_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
/* special flags for mkd_in() and mkd_string()
*/
#endif/*_MKDIO_D*/
-33
View File
@@ -1,33 +0,0 @@
#!/bin/bash
status_msg () {
echo -e "\033[1m$1\033[0m"
}
error_msg () {
echo -e "\033[31m$1\033[0m" >&2
tput sgr0
}
status_msg "Running configure.sh..."
cd `dirname $0`/../discount/
./configure.sh
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'
else
cp config.h ../discount-config/config.h && echo 'config.h'
error_msg "Can't locate config.h comments!"
error_msg "Check the diff before committing (and fix this script if you can)"
fi
cp mkdio.h ../discount-config/mkdio.h && echo 'mkdio.h'
status_msg "Clean files from working directory..."
git clean -f
status_msg "Done!"
-47
View File
@@ -1,47 +0,0 @@
->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:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution, and in the same place and form as other
copyright, license and disclaimer information.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment:
This product includes software developed by
David Loren Parsons <http://www.pell.portland.or.us/~orc>
in the same place and form as other third-party acknowledgments.
Alternately, this acknowledgment may appear in the software
itself, in the same form and location as other such third-party
acknowledgments.
4. Except as contained in this notice, the name of David Loren
Parsons shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Software without prior
written authorization from David Loren Parsons.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-33
View File
@@ -1,33 +0,0 @@
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)
Josh Wood -- Plan9 support.
Mike Schiraldi -- Reddit style automatic links, MANY MANY MANY
bug reports about boundary conditions and
places where I didn't get it right.
Jjgod Jiang -- Table of contents support.
Petite Abeille -- Many bug reports about places where I didn't
get it right.
Tim Channon -- inspiration for the `mkd_xhtmlpage()` function
Christian Herenz-- Many bug reports regarding my implementation of
`[]()` and `![]()`
A.S.Bradbury -- Portability bug reports for 64 bit systems.
Joyent -- Loan of a solaris box so I could get discount
working under solaris.
Ryan Tomayko -- Portability requests (and the rdiscount ruby
binding.)
yidabu -- feedback on the documentation, bug reports
against utf-8 support.
Pierre Joye -- bug reports, php discount binding.
Masayoshi Sekimura- perl discount binding.
Jeremy Hinegardner- bug reports about list handling.
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.
-61
View File
@@ -1,61 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
/* putc() into a cstring
*/
void
Csputc(int c, Cstring *iot)
{
EXPAND(*iot) = c;
}
/* printf() into a cstring
*/
int
Csprintf(Cstring *iot, char *fmt, ...)
{
va_list ptr;
int siz=100;
do {
RESERVE(*iot, siz);
va_start(ptr, fmt);
siz = vsnprintf(T(*iot)+S(*iot), ALLOCATED(*iot)-S(*iot), fmt, ptr);
va_end(ptr);
} while ( siz > (ALLOCATED(*iot)-S(*iot)) );
S(*iot) += siz;
return siz;
}
/* write() into a cstring
*/
int
Cswrite(Cstring *iot, char *bfr, int size)
{
RESERVE(*iot, size);
memcpy(T(*iot)+S(*iot), bfr, size);
S(*iot) += size;
return size;
}
/* reparse() into a cstring
*/
void
Csreparse(Cstring *iot, char *buf, int size, int flags)
{
MMIOT f;
___mkd_initmmiot(&f, 0);
___mkd_reparse(buf, size, 0, &f);
___mkd_emblock(&f);
SUFFIX(*iot, T(f.out), S(f.out));
___mkd_freemmiot(&f, 0);
}
-41
View File
@@ -1,41 +0,0 @@
HOW TO BUILD AND INSTALL DISCOUNT
1) Unpacking the distribution
The DISCOUNT sources are distributed in tarballs. After extracting from
the tarball, you should end up with all the source and build files in the
directory
discount-(version)
2) Installing the distribution
DISCOUNT uses configure.sh to set itself up for compilation. To run
configure, just do ``./configure.sh'' and it will check your system for
build dependencies and build makefiles for you. If configure.sh finishes
without complaint, you can then do a ``make'' to compile everything and a
``make install'' to install the binaries.
Configure.sh has a few options that can be set:
--src=DIR where the source lives (.)
--prefix=DIR where to install the final product (/usr/local)
--execdir=DIR where to put executables (prefix/bin)
--sbindir=DIR where to put static executables (prefix/sbin)
--confdir=DIR where to put configuration information (/etc)
--libdir=DIR where to put libraries (prefix/lib)
--libexecdir=DIR where to put private executables
--mandir=DIR where to put manpages
--enable-dl-tag Use the DL tag extension
--enable-pandoc-header Use pandoc-style header blocks
--enable-superscript A^B expands to A<sup>B</sup>
--enable-amalloc Use a debugging memory allocator (to detect leaks)
--relaxed-emphasis Don't treat _ in the middle of a word as emphasis
--with-tabstops=N Set tabstops to N characters (default is 4)
3) Installing sample programs and manpages
The standard ``make install'' rule just installs the binaries. If you
want to install the sample programs, they are installed with
``make install.samples''; to install manpages, ``make install.man''.
A shortcut to install everything is ``make install.everything''
-130
View File
@@ -1,130 +0,0 @@
CC=@CC@ -I. -L.
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@
BINDIR=@exedir@
MANDIR=@mandir@
LIBDIR=@libdir@
INCDIR=@prefix@/include
PGMS=markdown
SAMPLE_PGMS=mkd2html makepage
@THEME@SAMPLE_PGMS+= theme
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@
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.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.man:
@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;\
done
for x in mkd_in mkd_string; do \
( 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; \
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.everything: install install.man
$(DESTDIR)/$(BINDIR):
@INSTALL_DIR@ $(DESTDIR)/$(BINDIR)
$(DESTDIR)/$(INCDIR):
@INSTALL_DIR@ $(DESTDIR)/$(INCDIR)
$(DESTDIR)/$(LIBDIR):
@INSTALL_DIR@ $(DESTDIR)/$(LIBDIR)
version.o: version.c VERSION
$(CC) -DVERSION=\"`cat VERSION`\" -c version.c
# example programs
@THEME@theme: theme.o $(MKDLIB) mkdio.h
@THEME@ $(CC) -o theme theme.o -lmarkdown @LIBS@
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
$(CC) -o mkd2html mkd2html.o -lmarkdown @LIBS@
markdown: main.o pgm_options.o $(MKDLIB)
$(CC) $(CFLAGS) -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@
pgm_options.o: pgm_options.c mkdio.h config.h
$(CC) -I. -c pgm_options.c
main.o: main.c mkdio.h config.h
$(CC) -I. -c main.c
$(MKDLIB): $(OBJS)
./librarian.sh make $(MKDLIB) VERSION $(OBJS)
verify: echo tools/checkbits.sh
@./echo -n "headers ... "; tools/checkbits.sh && echo "GOOD"
test: $(PGMS) $(TESTFRAMEWORK) verify
@for x in tests/*.t; do \
@LD_LIBRARY_PATH@=`pwd` sh $$x || exit 1; \
done
cols: tools/cols.c config.h
$(CC) -o cols tools/cols.c
echo: tools/echo.c config.h
$(CC) -o echo tools/echo.c
clean:
rm -f $(PGMS) $(TESTFRAMEWORK) $(SAMPLE_PGMS) *.o
rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`
distclean spotless: clean
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@
Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
amalloc.o: amalloc.c
basename.o: basename.c config.h cstring.h amalloc.h markdown.h
css.o: css.c config.h cstring.h amalloc.h markdown.h
docheader.o: docheader.c config.h cstring.h amalloc.h markdown.h
dumptree.o: dumptree.c markdown.h cstring.h amalloc.h config.h
emmatch.o: emmatch.c config.h cstring.h amalloc.h markdown.h
generate.o: generate.c config.h cstring.h amalloc.h markdown.h
main.o: main.c config.h amalloc.h
pgm_options.o: pgm_options.c pgm_options.h config.h amalloc.h
makepage.o: makepage.c
markdown.o: markdown.c config.h cstring.h amalloc.h markdown.h
mkd2html.o: mkd2html.c config.h mkdio.h cstring.h amalloc.h
mkdio.o: mkdio.c config.h cstring.h amalloc.h markdown.h
resource.o: resource.c config.h cstring.h amalloc.h markdown.h
theme.o: theme.c config.h mkdio.h cstring.h amalloc.h
toc.o: toc.c config.h cstring.h amalloc.h markdown.h
version.o: version.c config.h
xml.o: xml.c config.h cstring.h amalloc.h markdown.h
xmlpage.o: xmlpage.c config.h cstring.h amalloc.h markdown.h
-40
View File
@@ -1,40 +0,0 @@
% Discount on Plan 9
% Josh Wood
% 2009-06-12
# *Discount* Markdown compiler on Plan 9
## Build
% CONFIG='--enable-all-features' mk config
% mk install
% markdown -V
markdown: discount X.Y.Z DL_TAG HEADER DEBUG SUPERSCRIPT RELAXED DIV
`--enable-all-features` may be replaced by zero or more of:
--enable-dl-tag Use the DL tag extension
--enable-pandoc-header Use pandoc-style header blocks
--enable-superscript A^B becomes A<sup>B</sup>
--enable-amalloc Enable memory allocation debugging
--relaxed-emphasis underscores aren't special in the middle of words
--with-tabstops=N Set tabstops to N characters (default is 4)
--enable-div Enable >%id% divisions
--enable-alpha-list Enable (a)/(b)/(c) lists
--enable-all-features Turn on all stable optional features
## Notes
The supplied mkfile merely drives Discount's own configure script and
then APE's *psh* environment to build the Discount source, then copies
the result(s) to locations appropriate for system-wide use on Plan 9.
There are a few other *mk*(1) targets:
`install.libs`: Discount includes a C library and header.
Installation is optional. Plan 9 binaries are statically linked.
`install.man`: Add manual pages for markdown(1) and (6).
`install.progs`: Extra programs. *makepage* writes complete XHTML
documents, rather than fragments. *mkd2html* is similar, but produces
HTML.
-169
View File
@@ -1,169 +0,0 @@
.TH MARKDOWN 1
.SH NAME
markdown \- convert Markdown text to HTML
.SH SYNOPSIS
.B markdown
[
.B -dTV
]
[
.BI -b " url-base
]
[
.BI -F " bitmap
]
[
.BI -f " flags
]
[
.BI -o " ofile
]
[
.BI -s " text
]
[
.BI -t " text
]
[
.I file
]
.SH DESCRIPTION
The
.I markdown
utility reads the
.IR Markdown (6)-formatted
.I file
(or standard input) and writes its
.SM HTML
fragment representation on standard output.
.PP
The options are:
.TF dfdoptions
.TP
.BI -b " url-base
Links in source begining with
.B /
will be prefixed with
.I url-base
in the output.
.TP
.B -d
Instead of printing an
.SM HTML
fragment, print a parse tree.
.TP
.BI -F " bitmap
Set translation flags.
.I Bitmap
is a bit map of the various configuration options described in
.IR markdown (2).
.TP
.BI -f " flags
Set or clear various translation
.IR flags ,
described below.
.I Flags
are in a comma-delimited list, with an optional
.B +
(set) prefix on each flag.
.TP
.BI -o " ofile
Write the generated
.SM HTML
to
.IR ofile .
.TP
.BI -s " text
Use the
.IR markdown (2)
function to format the
.I text
on standard input.
.TP
.B -T
Under
.B -f
.BR toc ,
print the table of contents as an unordered list before the usual
.SM HTML
output.
.TP
.BI -t " text
Use
.IR mkd_text
(in
.IR markdown (2))
to format
.I text
instead of processing standard input with
.IR markdown .
.TP
.B -V
Show version number and configuration. If the version includes the string
.BR DL_TAG ,
.I markdown
was configured with definition list support. If the version includes the string
.BR HEADER ,
.I markdown
was configured to support pandoc header blocks.
.PD
.SS TRANSLATION FLAGS
The translation flags understood by
.B -f
are:
.TF \ noheader
.TP
.B noimage
Don't allow image tags.
.TP
.B nolinks
Don't allow links.
.TP
.B nohtml
Don't allow any embedded HTML.
.TP
.B cdata
Generate valid XML output.
.TP
.B noheader
Do not process pandoc headers.
.TP
.B notables
Do not process the syntax extension for tables.
.TP
.B tabstops
Use Markdown-standard 4-space tabstops.
.TP
.B strict
Disable superscript and relaxed emphasis.
.TP
.B relax
Enable superscript and relaxed emphasis (the default).
.TP
.B toc
Enable table of contents support, generated from headings (in
.IR markdown (6))
in the source.
.TP
.B 1.0
Revert to Markdown 1.0 compatibility.
.PD
.PP
For example,
.B -f nolinks,quot
tells
.I markdown
not to allow
.B <a>
tags, and to expand double quotes.
.SH SOURCE
.B /sys/src/cmd/discount
.SH SEE ALSO
.IR markdown (2),
.IR markdown (6)
.PP
http://daringfireball.net/projects/markdown/,
``Markdown''.
.SH DIAGNOSTICS
.I Markdown
exits 0 on success and >0 if an error occurs.
-332
View File
@@ -1,332 +0,0 @@
.TH MARKDOWN 2
.SH NAME
mkd_in, mkd_string, markdown, mkd_compile, mkd_css, mkd_generatecss,
mkd_document, mkd_generatehtml, mkd_xhtmlpage, mkd_toc, mkd_generatetoc,
mkd_cleanup, mkd_doc_title, mkd_doc_author, mkd_doc_date, mkd_line,
mkd_generateline \- convert Markdown text to HTML
.SH SYNOPSIS
.ta \w'MMIOT* 'u
.B #include <mkdio.h>
.PP
.B
MMIOT* mkd_in(FILE *input, int flags)
.PP
.B
MMIOT* mkd_string(char *buf, int size, int flags)
.PP
.B
int markdown(MMIOT *doc, FILE *output, int flags)
.PP
.B
int mkd_compile(MMIOT *document, int flags)
.PP
.B
int mkd_css(MMIOT *document, char **doc)
.PP
.B
int mkd_generatecss(MMIOT *document, FILE *output)
.PP
.B
int mkd_document(MMIOT *document, char **doc)
.PP
.B
int mkd_generatehtml(MMIOT *document, FILE *output)
.PP
.B
int mkd_xhtmlpage(MMIOT *document, int flags, FILE *output)
.PP
.B
int mkd_toc(MMIOT *document, char **doc)
.PP
.B
int mkd_generatetoc(MMIOT *document, FILE *output)
.PP
.B
void mkd_cleanup(MMIOT*);
.PP
.B
char* mkd_doc_title(MMIOT*)
.PP
.B
char* mkd_doc_author(MMIOT*)
.PP
.B
char* mkd_doc_date(MMIOT*)
.PP
.B
int mkd_line(char *string, int size, char **doc, int flags)
.PP
.B
int mkd_generateline(char *string, int size, FILE *output, int flags)
.PD
.PP
.SH DESCRIPTION
These functions convert
.IR Markdown (6)
text into
.SM HTML
markup.
.PP
.I Mkd_in
reads the text referenced by pointer to
.B FILE
.I input
and returns a pointer to an
.B MMIOT
structure of the form expected by
.I markdown
and the other converters.
.I Mkd_string
accepts one
.I string
and returns a pointer to
.BR MMIOT .
.PP
After such preparation,
.I markdown
converts
.I doc
and writes the result to
.IR output ,
while
.I mkd_compile
transforms
.I document
in-place.
.PP
One or more of the following
.I flags
(combined with
.BR OR )
control
.IR markdown 's
processing of
.IR doc :
.TF MKD_NOIMAGE
.TP
.B MKD_NOIMAGE
Do not process
.B ![]
and remove
.B <img>
tags from the output.
.TP
.B MKD_NOLINKS
Do not process
.B []
and remove
.B <a>
tags from the output.
.TP
.B MKD_NOPANTS
Suppress Smartypants-style replacement of quotes, dashes, or ellipses.
.TP
.B MKD_STRICT
Disable superscript and relaxed emphasis processing if configured; otherwise a no-op.
.TP
.B MKD_TAGTEXT
Process as inside an
.SM HTML
tag: no
.BR <em> ,
no
.BR <bold> ,
no
.SM HTML
or
.B []
expansion.
.TP
.B MKD_NO_EXT
Don't process pseudo-protocols (in
.IR markdown (6)).
.TP
.B MKD_CDATA
Generate code for
.SM XML
.B ![CDATA[...]]
element.
.TP
.B MKD_NOHEADER
Don't process Pandoc-style headers.
.TP
.B MKD_TABSTOP
When reading documents, expand tabs to 4 spaces, overriding any compile-time configuration.
.TP
.B MKD_TOC
Label headings for use with the
.I mkd_generatetoc
and
.I mkd_toc
functions.
.TP
.B MKD_1_COMPAT
MarkdownTest_1.0 compatibility. Trim trailing spaces from first line of code blocks and disable implicit reference links (in
.IR markdown (6)).
.TP
.B MKD_AUTOLINK
Greedy
.SM URL
generation. When set, any
.SM URL
is converted to a hyperlink, even those not encased in
.BR <> .
.TP
.B MKD_SAFELINK
Don't make hyperlinks from
.B [][]
links that have unknown
.SM URL
protocol types.
.TP
.B MKD_NOTABLES
Do not process the syntax extension for tables (in
.IR markdown (6)).
.TP
.B MKD_EMBED
All of
.BR MKD_NOLINKS ,
.BR MKD_NOIMAGE ,
and
.BR MKD_TAGTEXT .
.PD
.PP
This implementation supports
Pandoc-style
headers and inline
.SM CSS
.B <style>
blocks, but
.I markdown
does not access the data provided by these extensions.
The following functions do, and allow other manipulations.
.PP
Given a pointer to
.B MMIOT
prepared by
.I mkd_in
or
.IR mkd_string ,
.I mkd_compile
compiles the
.I document
into
.BR <style> ,
Pandoc, and
.SM HTML
sections. It accepts the
.I flags
described for
.IR markdown ,
above.
.PP
Once compiled, the document particulars can be read and written:
.PP
.I Mkd_css
allocates a string and populates it with any
.B <style>
sections from the document.
.I Mkd_generatecss
writes any
.B <style>
sections to
.IR output .
.PP
.I Mkd_document
points
.I doc
to the
.B MMIOT
.IR document ,
returning
.IR document 's
size.
.PP
.I Mkd_generatehtml
writes the rest of the
.I document
to the
.IR output .
.PP
.IR Mkd_doc_title ,
.IR mkd_doc_author ,
and
.I mkd_doc_date
read the contents of any Pandoc header.
.PP
.I Mkd_xhtmlpage
writes an
.SM XHTML
page representation of the document.
It accepts the
.I flags
described for
.IR markdown ,
above.
.PP
.I Mkd_toc
.IR malloc s
a buffer into which it writes an outline, in the form of a
.B <ul>
element populated with
.BR <li> s
each containing a link to successive headings in the
.IR document .
It returns the size of that string.
.I Mkd_generatetoc
is similar,
but writes the outline to the
.I output
referenced by a pointer to
.BR FILE .
.PP
.I Mkd_cleanup
deletes a processed
.BR MMIOT .
.PP
The last two functions convert a single line of markdown source, for example a page title or a signature.
.I Mkd_line
allocates a buffer into which it writes an
.SM HTML
fragment representation of the
.IR string .
.I Mkd_generateline
writes the result to
.IR output .
.SH SOURCE
.B /sys/src/cmd/discount
.SH SEE ALSO
.IR markdown (1),
.IR markdown (6)
.SH DIAGNOSTICS
The
.I mkd_in
and
.I mkd_string
functions return a pointer to
.B MMIOT
on success, null on failure.
.IR Markdown ,
.IR mkd_compile ,
.IR mkd_style ,
and
.I mkd_generatehtml
return
.B 0
on success,
.B -1
otherwise.
.SH BUGS
Error handling is minimal at best.
.PP
The
.B MMIOT
created by
.I mkd_string
is deleted by the
.I markdown
function.
.PP
This is an
.SM APE
library.
-543
View File
@@ -1,543 +0,0 @@
.TH MARKDOWN 6
.SH NAME
Markdown \- text formatting syntax
.SH DESCRIPTION
Markdown
is a text markup syntax for machine conversion to
the more complex
.SM HTML
or
.SM XHTML
markup languages.
It is intended to be easy to read and to write, with
emphasis on readability.
A Markdown-formatted document should be publishable as-is,
in plain text, without the formatting distracting the reader.
.PP
The biggest source of inspiration for Markdown's
syntax is the format of plain text email. The markup is comprised entirely
of punctuation characters, chosen so as to look like what they mean.
Asterisks around a word look like
.IR *emphasis* .
Markdown lists look like lists. Even
blockquotes look like quoted passages of text, assuming the reader has
used email.
.PP
.SS Block Elements
.TF W
.PD
.TP
Paragraphs and Line Breaks
A paragraph is one or more consecutive lines of text, separated
by one or more blank lines. (A blank line is any line that looks like a
blank line -- a line containing nothing but spaces or tabs is considered
blank.) Normal paragraphs should not be indented with spaces or tabs.
.IP
Lines may be freely broken for readability; Markdown
does not translate source line breaks to
.B <br />
tags. To request generation of
.B <br />
in the output, end a line with two or more spaces, then a newline.
.TP
Headings
Headings can be marked in two ways, called
.I setext
and
.IR atx .
.IP
Setext-style headings are
``underlined'' using equal signs (for first-level
headings) and dashes (for second-level headings).
.IP
Atx-style headings use 1-6 hash characters at the start of the line,
corresponding to
.SM HTML
.BR <h^(1-6)^> .
Optional closing hashes may follow
the heading text.
.TP
Blockquotes
Lines beginning with
.B >
are output in blockquotes.
Blockquotes can be nested
by multiple levels of
.BR >> .
Blockquotes can contain other Markdown elements, including
headings, lists, and code blocks.
.TP
Lists
Markdown supports ordered (numbered) and unordered (bulleted) lists.
List markers typically start at the left margin, but may be indented by
up to three spaces.
List markers must be followed by one or more spaces
or a tab, then the list item text.
A newline terminates each list item.
.IP
Unordered lists use asterisks, pluses, and hyphens interchangeably as
list markers.
.IP
Ordered lists use integers followed by periods as list markers.
The order of the integers is not interpreted,
but the list should begin with
.BR 1 .
.IP
If list items are separated by blank lines, Markdown will wrap each list
item in
.B <p>
tags in the
.SM HTML
output.
.IP
List items may consist of multiple paragraphs.
Each subsequent
paragraph within a list item must be indented by either 4 spaces
or one tab.
To put a blockquote within a list item, the blockquote's
.B >
marker needs to be indented.
To put a code block within a list item, the code block needs
to be indented
.I twice
-- 8 spaces or two tabs.
.TP
Code Blocks
To produce a code block, indent every line of the
block by at least 4 spaces or 1 tab.
A code block continues until it reaches a line that is not indented.
.IP
Rather than forming normal paragraphs, the lines
of a code block are interpreted literally.
Regular Markdown syntax is not processed within code blocks.
Markdown wraps a code block in both
.B <pre>
and
.B <code>
tags.
One level of indentation -- 4
spaces or 1 tab -- is removed from each line of the code block in
the output.
.TP
Horizontal Rules
Produce a horizontal rule tag
.RB ( <hr\ /> )
by placing three or
more hyphens, asterisks, or underscores on a line by themselves.
.SS Span Elements
.TF W
.PD
.TP
Links
Markdown supports two styles of links:
.I inline
and
.IR reference .
In both styles, the link text is delimited by square brackets
.RB ( [] ).
To create an inline link, use a set of regular parentheses immediately
after the link text's closing square bracket.
Inside the parentheses,
put the link URL, along with an optional
title for the link surrounded in double quotes.
For example:
.IP
.EX
An [example](http://example.com/ "Title") inline link.
.EE
.IP
Reference-style links use a second set of square brackets, inside
which you place a label of your choosing to identify the link:
.IP
.EX
An [example][id] reference-style link.
.EE
.IP
The label is then assigned a value on its own line, anywhere in the document:
.IP
.EX
[id]: http://example.com/ "Optional Title"
.EE
.IP
Link label names may consist of letters, numbers, spaces, and
punctuation.
Labels are not case sensitive.
An empty label bracket
set after a reference-style link implies the link label is equivalent to
the link text.
A URL value can then be assigned to the link by referencing
the link text as the label name.
.TP
Emphasis
Markdown treats asterisks
.RB ( * )
and underscores
.RB ( _ )
as indicators of emphasis.
Text surrounded with single asterisks or underscores
will be wrapped with an
.SM HTML
.B <em>
tag.
Double asterisks or underscores generate an
.SM HTML
.B <strong>
tag.
.TP
Code
To indicate a span of code, wrap it with backtick quotes
.RB ( ` ).
Unlike a code block, a code span indicates code within a
normal paragraph.
To include a literal backtick character within a code span, you can use
multiple backticks as the opening and closing delimiters:
.IP
.EX
``There is a literal backtick (`) here.``
.EE
.TP
Images
Markdown image syntax is intended to resemble that
for links, allowing for two styles, once again
.I inline
and
.IR reference .
The syntax is as for each respective style of link, described above, but
prefixed with an exclamation mark character
.RB ( ! ).
Inline image syntax looks like this:
.IP
.EX
![Alt text](/path/to/img.jpg "Optional title")
.EE
.IP
That is:
An exclamation mark;
followed by a set of square brackets containing the `alt'
attribute text for the image;
followed by a set of parentheses containing the URL or path to
the image, and an optional `title' attribute enclosed in double
or single quotes.
.IP
Reference-style image syntax looks like this:
.IP
.EX
![Alt text][id]
.EE
.IP
Where
.I id
is a label used as for reference-style URL links, described above.
.SS Convenience
.TF W
.PD
.TP
Automatic Links
There is a shortcut style for creating ``automatic''
links for URLs and email addresses.
Surround the URL
or address with angle brackets.
.TP
Backslash Escapes
Use backslash escapes to generate literal
characters which would otherwise have special meaning in Markdown's
formatting syntax.
.TP
Inline HTML
For markup that is not covered by Markdown's
syntax, simply use the
.SM HTML
directly.
The only restrictions are that block-level
.SM HTML
elements --
.BR <div> ,
.BR <table> ,
.BR <pre> ,
.BR <p> ,
etc. -- must be separated from surrounding
content by blank lines, and the start and end tags of the block should
not be indented with tabs or spaces. Markdown formatting syntax is
not processed within block-level
.SM HTML
tags.
.IP
Span-level
.SM HTML
tags -- e.g.
.BR <span> ,
.BR <cite> ,
or
.B <del>
-- can be
used anywhere in a Markdown
paragraph, list item, or heading.
It is permitted to use
.SM HTML
tags instead of Markdown formatting; e.g.
.SM HTML
.B <a>
or
.B <img>
tags instead of Markdown's
link or image syntax.
Unlike block-level
.SM HTML
tags, Markdown
syntax
.I is
processed within the elements of span-level tags.
.TP
Automatic Special Character Escapes
To be displayed literally in a user agent, the characters
.B <
and
.B &
must appear as escaped entities in
.SM HTML
source, e.g.
.B &lt;
and
.BR &amp; .
Markdown
allows natural use of these characters, taking care of
the necessary escaping.
The ampersand part of a directly-used
.SM HTML
entity remains unchanged; otherwise it will be translated
into
.BR &amp; .
Inside code spans and blocks, angle brackets and
ampersands are always encoded automatically.
This makes it easy to use Markdown to write about
.SM HTML
code.
.PP
.SS Smarty Pants
The
.IR markdown (1)
utility transforms a few plain text symbols into their typographically-fancier
.SM HTML
entity equivalents.
These are extensions to the standard Markdown syntax.
.TF W
.PD
.TP
Punctuation
Input single- and double-quotes are transformed
into ``curly'' quote entities in the output (e.g.,
.B 'text'
becomes
.BR &lsquo;text&rsquo; ).
Input double-dashes
.RB ( -- )
and triple-dashes become en- and em-dashes, respectively,
while a series of three dots
.RB ( ... )
in the input becomes an ellipsis entity
.RB ( &hellip; )
in the
.SM HTML
output.
.TP
Symbols
Three other transformations replace the common plain-text shorthands
.BR (c) ,
.BR (r) ,
and
.BR (tm)
from the input with their respective
.SM HTML
entities. (As in
.B (c)
becoming
.BR &copy; ,
the Copyright symbol entity.)
.TP
Fractions
A small set of plain-text shorthands for fractions is recognized.
.B 1/4
becomes
.BR &frac14; ,
for example. These fraction notations are replaced with their
.SM HTML
entity equivalents:
.BR 1/4 ,
.BR 1/2 ,
.BR 3/4 .
.B 1/4th
and
.B 3/4ths
are replaced with their entity and the indicated ordinal suffix letters.
.PP
Like the basic Markdown syntax, none of the ``Smarty Pants'' extensions are processed
inside code blocks or spans.
.PP
.SS Discount Extensions
.IR Markdown (1)
recognizes some extensions to the Markdown format,
many of them adopted or adapted from other Markdown
interpreters or document formatting systems.
.TF W
.PD
.TP
Pandoc Headers
If
.I markdown
was configured with
.BR --enable-pandoc-header ,
the markdown source can have a 3-line Pandoc header in the format of
.IP
.EX
% Title
% Author
% Date
.EE
.IP
whose data is available to the
.IR mkd_doc_title ,
.IR mkd_doc_author ,
and
.I mkd_doc_date
(in
.IR markdown (2))
functions.
.TP
Embedded Stylesheets
Stylesheets may be defined and modified in a
.B <style>
block. A style block is parsed like any other block-level
.SM HTML;
.B <style>
starting on column 1, raw
.SM HTML
(or, in this case,
.SM CSS \)
following it, and either ending with a
.B </style>
at the end of the line or at the beginning of a subsequent line.
.IP
Style blocks apply to the entire document regardless of where they are defined.
.TP
Image Dimensions
Image specification has been extended with an argument describing image dimensions:
.BI = height x width.
For an image 400 pixels high and 300 wide, the new syntax is:
.IP
.EX
![Alt text](/path/to/image.jpg =400x300 "Title")
.EE
.TP
Pseudo-Protocols
Pseudo-protocols that may replace the common
.B http:
or
.B mailto:
have been added to the link syntax described above.
.IP
.BR abbr :
Text following is used as the
.B title
attribute of an
.B abbr
tag wrapping the link text. So
.B [LT](abbr:Link Text)
gives
.B <abbr title="Link Text">LT</abbr>.
.IP
.BR id :
The link text is marked up and written to the output, wrapped with
.B <a id=text following>
and
.BR </a> .
.IP
.BR class :
The link text is marked up and written to the output, wrapped with
.B <span class=text following>
and
.BR </span> .
.IP
.BR raw :
Text following is written to the output with no further processing.
The link text is discarded.
.TP
Alphabetic Lists
If
.I markdown
was configured with
.BR --enable-alpha-list ,
.IP
.EX
a. this
b. is
c. an alphabetic
d. list
.EE
.IP
yields an
.SM HTML
.B ol
ordered list.
.TP
Definition Lists
If configured with
.BR --enable-dl-tag ,
markup for definition lists is enabled. A definition list item is defined as
.IP
.EX
=term=
definition
.EE
.TP
Tables
Tables are specified with a pipe
.RB ( | )
and dash
.RB ( - )
marking. The markdown text
.IP
.EX
header0|header1
-------|-------
textA|textB
textC|textD
.EE
.IP
will produce an
.SM HTML
.B table
of two columns and three rows.
A header row is designated by ``underlining'' with dashes.
Declare a column's alignment by affixing a colon
.RB ( : )
to the left or right end of the dashes underlining its header.
In the output, this
yields the corresponding value for the
.B align
attribute on each
.B td
cell in the column.
A colon at both ends of a column's header dashes indicates center alignment.
.TP
Relaxed Emphasis
If configured with
.BR --relaxed-emphasis ,
the rules for emphasis are changed so that a single
.B _
will not count as an emphasis character in the middle of a word.
This is useful for documenting some code where
.B _
appears frequently, and would normally require a backslash escape.
.PD
.SH SEE ALSO
.IR markdown (1),
.IR markdown (2)
.PP
http://daringfireball.net/projects/markdown/syntax/,
``Markdown: Syntax''.
.PP
http://daringfireball.net/projects/smartypants/,
``Smarty Pants''.
.PP
http://michelf.com/projects/php-markdown/extra/#table,
``PHP Markdown Extra: Tables''.
-37
View File
@@ -1,37 +0,0 @@
BIN=/$objtype/bin
CC='cc -D_BSD_EXTENSION -D_C99_SNPRINTF_EXTENSION'
markdown:
ape/psh -c 'cd .. && make'
none:V: markdown
test: markdown
ape/psh -c 'cd ..&& make test'
install: markdown
cp ../markdown $BIN/markdown
install.progs: install
cp ../makepage $BIN/makepage
cp ../mkd2html $BIN/mkd2html
install.libs: install
cp ../mkdio.h /sys/include/ape/mkdio.h
cp ../libmarkdown.a /$objtype/lib/ape/libmarkdown.a
install.man: install
cp markdown.1 /sys/man/1/markdown
cp markdown.2 /sys/man/2/markdown
cp markdown.6 /sys/man/6/markdown
installall:V: install.libs install.man install.progs
config:
ape/psh -c 'cd .. && ./configure.sh $CONFIG'
clean:
ape/psh -c 'cd .. && make clean'
nuke:
ape/psh -c 'cd .. && make distclean'
-16
View File
@@ -1,16 +0,0 @@
DISCOUNT is a implementation of John Gruber's Markdown markup
language. It implements, as far as I can tell, all of the
language as described in
<http://daringfireball.net/projects/markdown/syntax>
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>;
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.
Most of the programs included in the DISCOUNT distribution have
manual pages describing how they work.
The file INSTALL describes how to build and install discount
-1
View File
@@ -1 +0,0 @@
2.1.0
-111
View File
@@ -1,111 +0,0 @@
/*
* debugging malloc()/realloc()/calloc()/free() that attempts
* to keep track of just what's been allocated today.
*/
#include <stdio.h>
#include <stdlib.h>
#define MAGIC 0x1f2e3d4c
struct alist { int magic, size; struct alist *next, *last; };
static struct alist list = { 0, 0, 0, 0 };
static int mallocs=0;
static int reallocs=0;
static int frees=0;
void *
acalloc(int size, int count)
{
struct alist *ret = calloc(size + sizeof(struct alist), count);
if ( ret ) {
ret->magic = MAGIC;
ret->size = size * count;
if ( list.next ) {
ret->next = list.next;
ret->last = &list;
ret->next->last = ret;
list.next = ret;
}
else {
ret->last = ret->next = &list;
list.next = list.last = ret;
}
++mallocs;
return ret+1;
}
return 0;
}
void*
amalloc(int size)
{
return acalloc(size,1);
}
void
afree(void *ptr)
{
struct alist *p2 = ((struct alist*)ptr)-1;
if ( p2->magic == MAGIC ) {
p2->last->next = p2->next;
p2->next->last = p2->last;
++frees;
free(p2);
}
else
free(ptr);
}
void *
arealloc(void *ptr, int size)
{
struct alist *p2 = ((struct alist*)ptr)-1;
struct alist save;
if ( p2->magic == MAGIC ) {
save.next = p2->next;
save.last = p2->last;
p2 = realloc(p2, sizeof(*p2) + size);
if ( p2 ) {
p2->size = size;
p2->next->last = p2;
p2->last->next = p2;
++reallocs;
return p2+1;
}
else {
save.next->last = save.last;
save.last->next = save.next;
return 0;
}
}
return realloc(ptr, size);
}
void
adump()
{
struct alist *p;
for ( p = list.next; p && (p != &list); p = p->next ) {
fprintf(stderr, "allocated: %d byte%s\n", p->size, (p->size==1) ? "" : "s");
fprintf(stderr, " [%.*s]\n", p->size, (char*)(p+1));
}
if ( getenv("AMALLOC_STATISTICS") ) {
fprintf(stderr, "%d malloc%s\n", mallocs, (mallocs==1)?"":"s");
fprintf(stderr, "%d realloc%s\n", reallocs, (reallocs==1)?"":"s");
fprintf(stderr, "%d free%s\n", frees, (frees==1)?"":"s");
}
}
-29
View File
@@ -1,29 +0,0 @@
/*
* debugging malloc()/realloc()/calloc()/free() that attempts
* to keep track of just what's been allocated today.
*/
#ifndef AMALLOC_D
#define AMALLOC_D
#include "config.h"
#ifdef USE_AMALLOC
extern void *amalloc(int);
extern void *acalloc(int,int);
extern void *arealloc(void*,int);
extern void afree(void*);
extern void adump();
#define malloc amalloc
#define calloc acalloc
#define realloc arealloc
#define free afree
#else
#define adump() (void)1
#endif
#endif/*AMALLOC_D*/
-43
View File
@@ -1,43 +0,0 @@
/*
* mkdio -- markdown front end input functions
*
* Copyright (C) 2007 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 "mkdio.h"
#include "cstring.h"
#include "amalloc.h"
static char *
e_basename(const char *string, const int size, void *context)
{
char *ret;
char *base = (char*)context;
if ( base && string && (*string == '/') && (ret=malloc(strlen(base)+size+2)) ) {
strcpy(ret, base);
strncat(ret, string, size);
return ret;
}
return 0;
}
static void
e_free(char *string, void *context)
{
if ( string ) free(string);
}
void
mkd_basename(MMIOT *document, char *base)
{
mkd_e_url(document, e_basename);
mkd_e_data(document, base);
mkd_e_free(document, e_free);
}
File diff suppressed because it is too large Load Diff
-146
View File
@@ -1,146 +0,0 @@
#! /bin/sh
# local options: ac_help is the help message that describes them
# and LOCAL_AC_OPTIONS is the script that interprets them. LOCAL_AC_OPTIONS
# is a script that's processed with eval, so you need to be very careful to
# make certain that what you quote is what you want to quote.
# load in the configuration file
#
ac_help='--enable-amalloc Enable memory allocation debugging
--with-tabstops=N Set tabstops to N characters (default is 4)
--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
--enable-all-features Turn on all stable optional features
--shared Build shared libraries (default is static)'
LOCAL_AC_OPTIONS='
set=`locals $*`;
if [ "$set" ]; then
eval $set
shift 1
else
ac_error=T;
fi'
locals() {
K=`echo $1 | $AC_UPPERCASE`
case "$K" in
--SHARED)
echo TRY_SHARED=T
;;
--ENABLE-ALL|--ENABLE-ALL-FEATURES)
echo WITH_AMALLOC=T
;;
--ENABLE-*) enable=`echo $K | sed -e 's/--ENABLE-//' | tr '-' '_'`
echo WITH_${enable}=T ;;
esac
}
TARGET=markdown
. ./configure.inc
AC_INIT $TARGET
__DL=`echo "$WITH_DL" | $AC_UPPERCASE`
case "$__DL" in
EXTRA) AC_DEFINE 'USE_EXTRA_DL' 1 ;;
DISCOUNT|1|"") AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
BOTH) AC_DEFINE 'USE_EXTRA_DL' 1
AC_DEFINE 'USE_DISCOUNT_DL' 1 ;;
*) AC_FAIL "Unknown value <$WITH_DL> for --with-dl (want 'discount', 'extra', or 'both')" ;;
esac
test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1
test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 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
AC_PROG ar || AC_FAIL "$TARGET requires ar"
AC_PROG ranlib
AC_C_VOLATILE
AC_C_CONST
AC_SCALAR_TYPES sub hdr
AC_CHECK_BASENAME
AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
if AC_CHECK_FUNCS srandom; then
AC_DEFINE 'INITRNG(x)' 'srandom((unsigned int)x)'
elif AC_CHECK_FUNCS srand; then
AC_DEFINE 'INITRNG(x)' 'srand((unsigned int)x)'
else
AC_DEFINE 'INITRNG(x)' '(void)1'
fi
if AC_CHECK_FUNCS 'bzero((char*)0,0)'; then
: # Yay
elif AC_CHECK_FUNCS 'memset((char*)0,0,0)'; then
AC_DEFINE 'bzero(p,s)' 'memset(p,s,0)'
else
AC_FAIL "$TARGET requires bzero or memset"
fi
if AC_CHECK_FUNCS random; then
AC_DEFINE 'COINTOSS()' '(random()&1)'
elif AC_CHECK_FUNCS rand; then
AC_DEFINE 'COINTOSS()' '(rand()&1)'
else
AC_DEFINE 'COINTOSS()' '1'
fi
if AC_CHECK_FUNCS strcasecmp; then
:
elif AC_CHECK_FUNCS stricmp; then
AC_DEFINE strcasecmp stricmp
else
AC_FAIL "$TARGET requires either strcasecmp() or stricmp()"
fi
if AC_CHECK_FUNCS strncasecmp; then
:
elif AC_CHECK_FUNCS strnicmp; then
AC_DEFINE strncasecmp strnicmp
else
AC_FAIL "$TARGET requires either strncasecmp() or strnicmp()"
fi
if AC_CHECK_FUNCS fchdir || AC_CHECK_FUNCS getcwd ; then
AC_SUB 'THEME' ''
else
AC_SUB 'THEME' '#'
fi
if [ -z "$WITH_TABSTOPS" ]; then
TABSTOP=4
elif [ "$WITH_TABSTOPS" -eq 1 ]; then
TABSTOP=8
else
TABSTOP=$WITH_TABSTOPS
fi
AC_DEFINE 'TABSTOP' $TABSTOP
AC_SUB 'TABSTOP' $TABSTOP
if [ "$WITH_AMALLOC" ]; then
AC_DEFINE 'USE_AMALLOC' 1
AC_SUB 'AMALLOC' 'amalloc.o'
else
AC_SUB 'AMALLOC' ''
fi
[ "$OS_FREEBSD" -o "$OS_DRAGONFLY" ] || AC_CHECK_HEADERS malloc.h
[ "$WITH_PANDOC_HEADER" ] && AC_DEFINE 'PANDOC_HEADER' '1'
AC_OUTPUT Makefile version.c mkdio.h
-85
View File
@@ -1,85 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2009 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "config.h"
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
/*
* dump out stylesheet sections.
*/
static void
stylesheets(Paragraph *p, Cstring *f)
{
Line* q;
for ( ; p ; p = p->next ) {
if ( p->typ == STYLE ) {
for ( q = p->text; q ; q = q->next ) {
Cswrite(f, T(q->text), S(q->text));
Csputc('\n', f);
}
}
if ( p->down )
stylesheets(p->down, f);
}
}
/* dump any embedded styles to a string
*/
int
mkd_css(Document *d, char **res)
{
Cstring f;
int size;
if ( res && d && d->compiled ) {
*res = 0;
CREATE(f);
RESERVE(f, 100);
stylesheets(d->code, &f);
if ( (size = S(f)) > 0 ) {
EXPAND(f) = 0;
/* HACK ALERT! HACK ALERT! HACK ALERT! */
*res = T(f);/* we know that a T(Cstring) is a character pointer */
/* so we can simply pick it up and carry it away, */
/* leaving the husk of the Ctring on the stack */
/* END HACK ALERT */
}
else
DELETE(f);
return size;
}
return EOF;
}
/* dump any embedded styles to a file
*/
int
mkd_generatecss(Document *d, FILE *f)
{
char *res;
int written = EOF, size = mkd_css(d, &res);
if ( size > 0 )
written = fwrite(res, 1, size, f);
if ( res )
free(res);
return (written == size) ? size : EOF;
}
-77
View File
@@ -1,77 +0,0 @@
/* two template types: STRING(t) which defines a pascal-style string
* of element (t) [STRING(char) is the closest to the pascal string],
* and ANCHOR(t) which defines a baseplate that a linked list can be
* built up from. [The linked list /must/ contain a ->next pointer
* for linking the list together with.]
*/
#ifndef _CSTRING_D
#define _CSTRING_D
#include <string.h>
#include <stdlib.h>
#ifndef __WITHOUT_AMALLOC
# include "amalloc.h"
#endif
/* expandable Pascal-style string.
*/
#define STRING(type) struct { type *text; int size, alloc; }
#define CREATE(x) ( (T(x) = (void*)0), (S(x) = (x).alloc = 0) )
#define EXPAND(x) (S(x)++)[(S(x) < (x).alloc) \
? (T(x)) \
: (T(x) = T(x) ? realloc(T(x), sizeof T(x)[0] * ((x).alloc += 100)) \
: malloc(sizeof T(x)[0] * ((x).alloc += 100)) )]
#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)) ) ? \
(memmove(&T(t)[i], &T(t)[i+sz], (S(t)-(i+sz)+1)*sizeof(T(t)[0])), \
S(t) -= (sz)) : -1
#define RESERVE(x, sz) T(x) = ((x).alloc > S(x) + (sz) \
? T(x) \
: T(x) \
? realloc(T(x), sizeof T(x)[0] * ((x).alloc = 100+(sz)+S(x))) \
: malloc(sizeof T(x)[0] * ((x).alloc = 100+(sz)+S(x))))
#define SUFFIX(t,p,sz) \
memcpy(((S(t) += (sz)) - (sz)) + \
(T(t) = T(t) ? realloc(T(t), sizeof T(t)[0] * ((t).alloc += sz)) \
: malloc(sizeof T(t)[0] * ((t).alloc += sz))), \
(p), sizeof(T(t)[0])*(sz))
#define PREFIX(t,p,sz) \
RESERVE( (t), (sz) ); \
if ( S(t) ) { memmove(T(t)+(sz), T(t), S(t)); } \
memcpy( T(t), (p), (sz) ); \
S(t) += (sz)
/* reference-style links (and images) are stored in an array
*/
#define T(x) (x).text
#define S(x) (x).size
#define ALLOCATED(x) (x).alloc
/* abstract anchor type that defines a list base
* with a function that attaches an element to
* the end of the list.
*
* the list base field is named .text so that the T()
* macro will work with it.
*/
#define ANCHOR(t) struct { t *text, *end; }
#define E(t) ((t).end)
#define ATTACH(t, p) ( T(t) ? ( (E(t)->next = (p)), (E(t) = (p)) ) \
: ( (T(t) = E(t) = (p)) ) )
typedef STRING(char) Cstring;
extern void Csputc(int, Cstring *);
extern int Csprintf(Cstring *, char *, ...);
extern int Cswrite(Cstring *, char *, int);
extern void Csreparse(Cstring *, char *, int, int);
#endif/*_CSTRING_D*/
-49
View File
@@ -1,49 +0,0 @@
/*
* docheader -- get values from the document header
*
* Copyright (C) 2007 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"
static char *
onlyifset(Line *l)
{
char *ret = T(l->text) + l->dle;
return ret[0] ? ret : 0;
}
char *
mkd_doc_title(Document *doc)
{
if ( doc && doc->title )
return onlyifset(doc->title);
return 0;
}
char *
mkd_doc_author(Document *doc)
{
if ( doc && doc->author )
return onlyifset(doc->author);
return 0;
}
char *
mkd_doc_date(Document *doc)
{
if ( doc && doc->date )
return onlyifset(doc->date);
return 0;
}
-152
View File
@@ -1,152 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2007 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include <stdio.h>
#include "markdown.h"
#include "cstring.h"
#include "amalloc.h"
struct frame {
int indent;
char c;
};
typedef STRING(struct frame) Stack;
static char *
Pptype(int typ)
{
switch (typ) {
case WHITESPACE: return "whitespace";
case CODE : return "code";
case QUOTE : return "quote";
case MARKUP : return "markup";
case HTML : return "html";
case DL : return "dl";
case UL : return "ul";
case OL : return "ol";
case LISTITEM : return "item";
case HDR : return "header";
case HR : return "hr";
case TABLE : return "table";
case SOURCE : return "source";
case STYLE : return "style";
default : return "mystery node!";
}
}
static void
pushpfx(int indent, char c, Stack *sp)
{
struct frame *q = &EXPAND(*sp);
q->indent = indent;
q->c = c;
}
static void
poppfx(Stack *sp)
{
S(*sp)--;
}
static void
changepfx(Stack *sp, char c)
{
char ch;
if ( !S(*sp) ) return;
ch = T(*sp)[S(*sp)-1].c;
if ( ch == '+' || ch == '|' )
T(*sp)[S(*sp)-1].c = c;
}
static void
printpfx(Stack *sp, FILE *f)
{
int i;
char c;
if ( !S(*sp) ) return;
c = T(*sp)[S(*sp)-1].c;
if ( c == '+' || c == '-' ) {
fprintf(f, "--%c", c);
T(*sp)[S(*sp)-1].c = (c == '-') ? ' ' : '|';
}
else
for ( i=0; i < S(*sp); i++ ) {
if ( i )
fprintf(f, " ");
fprintf(f, "%*s%c", T(*sp)[i].indent + 2, " ", T(*sp)[i].c);
if ( T(*sp)[i].c == '`' )
T(*sp)[i].c = ' ';
}
fprintf(f, "--");
}
static void
dumptree(Paragraph *pp, Stack *sp, FILE *f)
{
int count;
Line *p;
int d;
static char *Begin[] = { 0, "P", "center" };
while ( pp ) {
if ( !pp->next )
changepfx(sp, '`');
printpfx(sp, f);
d = fprintf(f, "[%s", Pptype(pp->typ));
if ( pp->ident )
d += fprintf(f, " %s", pp->ident);
if ( pp->align > 1 )
d += fprintf(f, ", <%s>", Begin[pp->align]);
for (count=0, p=pp->text; p; ++count, (p = p->next) )
;
if ( count )
d += fprintf(f, ", %d line%s", count, (count==1)?"":"s");
d += fprintf(f, "]");
if ( pp->down ) {
pushpfx(d, pp->down->next ? '+' : '-', sp);
dumptree(pp->down, sp, f);
poppfx(sp);
}
else fputc('\n', f);
pp = pp->next;
}
}
int
mkd_dump(Document *doc, FILE *out, int flags, char *title)
{
Stack stack;
if (mkd_compile(doc, flags) ) {
CREATE(stack);
pushpfx(fprintf(out, "%s", title), doc->code->next ? '+' : '-', &stack);
dumptree(doc->code, &stack, out);
DELETE(stack);
mkd_cleanup(doc);
return 0;
}
return -1;
}
-188
View File
@@ -1,188 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2010 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "config.h"
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
/* emmatch: the emphasis mangler that's run after a block
* of html has been generated.
*
* It should create MarkdownTest_1.0 (and _1.0.3)
* compatable emphasis for non-pathological cases
* and it should fail in a standards-compliant way
* when someone attempts to feed it junk.
*
* Emmatching is done after the input has been
* processed into a STRING (f->Q) of text and
* emphasis blocks. After ___mkd_emblock() finishes,
* it truncates f->Q and leaves the rendered paragraph
* if f->out.
*/
/* empair() -- find the NEAREST matching emphasis token (or
* subtoken of a 3+ long emphasis token.
*/
static int
empair(MMIOT *f, int first, int last, int match)
{
int i;
block *begin, *p;
begin = &T(f->Q)[first];
for (i=first+1; i <= last; i++) {
p = &T(f->Q)[i];
if ( (p->b_type != bTEXT) && (p->b_count <= 0) )
continue; /* break? */
if ( p->b_type == begin->b_type ) {
if ( p->b_count == match ) /* exact match */
return i;
if ( p->b_count > 2 ) /* fuzzy match */
return i;
}
}
return 0;
} /* empair */
/* emfill() -- if an emphasis token has leftover stars or underscores,
* convert them back into character and append them to b_text.
*/
static void
emfill(block *p)
{
int j;
if ( p->b_type == bTEXT )
return;
for (j=0; j < p->b_count; j++)
EXPAND(p->b_text) = p->b_char;
p->b_count = 0;
} /* emfill */
static void
emclose(MMIOT *f, int first, int last)
{
int j;
for (j=first+1; j<last-1; j++)
emfill(&T(f->Q)[j]);
}
static struct emtags {
char open[10];
char close[10];
int size;
} emtags[] = { { "<em>" , "</em>", 5 }, { "<strong>", "</strong>", 9 } };
static void emblock(MMIOT*,int,int);
/* emmatch() -- match emphasis for a single emphasis token.
*/
static void
emmatch(MMIOT *f, int first, int last)
{
block *start = &T(f->Q)[first];
int e, e2, match;
switch (start->b_count) {
case 2: if ( e = empair(f,first,last,match=2) )
break;
case 1: e = empair(f,first,last,match=1);
break;
case 0: return;
default:
e = empair(f,first,last,1);
e2= empair(f,first,last,2);
if ( e2 >= e ) {
e = e2;
match = 2;
}
else
match = 1;
break;
}
if ( e ) {
/* if we found emphasis to match, match it, recursively call
* emblock to match emphasis inside the new html block, add
* the emphasis markers for the block, then (tail) recursively
* call ourself to match any remaining emphasis on this token.
*/
block *end = &T(f->Q)[e];
end->b_count -= match;
start->b_count -= match;
emblock(f, first, e);
PREFIX(start->b_text, emtags[match-1].open, emtags[match-1].size-1);
SUFFIX(end->b_post, emtags[match-1].close, emtags[match-1].size);
emmatch(f, first, last);
}
} /* emmatch */
/* emblock() -- walk a blocklist, attempting to match emphasis
*/
static void
emblock(MMIOT *f, int first, int last)
{
int i;
for ( i = first; i <= last; i++ )
if ( T(f->Q)[i].b_type != bTEXT )
emmatch(f, i, last);
emclose(f, first, last);
} /* emblock */
/* ___mkd_emblock() -- emblock a string of blocks, then concatenate the
* resulting text onto f->out.
*/
void
___mkd_emblock(MMIOT *f)
{
int i;
block *p;
emblock(f, 0, S(f->Q)-1);
for (i=0; i < S(f->Q); i++) {
p = &T(f->Q)[i];
emfill(p);
if ( S(p->b_post) ) { SUFFIX(f->out, T(p->b_post), S(p->b_post));
DELETE(p->b_post); }
if ( S(p->b_text) ) { SUFFIX(f->out, T(p->b_text), S(p->b_text));
DELETE(p->b_text); }
}
S(f->Q) = 0;
} /* ___mkd_emblock */
-84
View File
@@ -1,84 +0,0 @@
#include <stdio.h>
#include "markdown.h"
struct flagnames {
DWORD flag;
char *name;
};
static struct flagnames flagnames[] = {
{ MKD_NOLINKS, "!LINKS" },
{ MKD_NOIMAGE, "!IMAGE" },
{ MKD_NOPANTS, "!PANTS" },
{ MKD_NOHTML, "!HTML" },
{ MKD_STRICT, "STRICT" },
{ MKD_TAGTEXT, "TAGTEXT" },
{ MKD_NO_EXT, "!EXT" },
{ MKD_CDATA, "CDATA" },
{ MKD_NOSUPERSCRIPT, "!SUPERSCRIPT" },
{ MKD_NORELAXED, "!RELAXED" },
{ MKD_NOTABLES, "!TABLES" },
{ MKD_NOSTRIKETHROUGH,"!STRIKETHROUGH" },
{ MKD_TOC, "TOC" },
{ MKD_1_COMPAT, "MKD_1_COMPAT" },
{ MKD_AUTOLINK, "AUTOLINK" },
{ MKD_SAFELINK, "SAFELINK" },
{ MKD_NOHEADER, "!HEADER" },
{ MKD_TABSTOP, "TABSTOP" },
{ MKD_NODIVQUOTE, "!DIVQUOTE" },
{ MKD_NOALPHALIST, "!ALPHALIST" },
{ MKD_NODLIST, "!DLIST" },
{ MKD_EXTRA_FOOTNOTE, "FOOTNOTE" },
};
#define NR(x) (sizeof x/sizeof x[0])
void
mkd_flags_are(FILE *f, DWORD flags, int htmlplease)
{
int i;
int not, set, even=1;
char *name;
if ( htmlplease )
fprintf(f, "<table class=\"mkd_flags_are\">\n");
for (i=0; i < NR(flagnames); i++) {
set = flags & flagnames[i].flag;
name = flagnames[i].name;
if ( not = (*name == '!') ) {
++name;
set = !set;
}
if ( htmlplease ) {
if ( even ) fprintf(f, " <tr>");
fprintf(f, "<td>");
}
else
fputc(' ', f);
if ( !set )
fprintf(f, htmlplease ? "<s>" : "!");
fprintf(f, "%s", name);
if ( htmlplease ) {
if ( !set )
fprintf(f, "</s>");
fprintf(f, "</td>");
if ( !even ) fprintf(f, "</tr>\n");
}
even = !even;
}
if ( htmlplease ) {
if ( even ) fprintf(f, "</tr>\n");
fprintf(f, "</table>\n");
}
}
void
mkd_mmiot_flags(FILE *f, MMIOT *m, int htmlplease)
{
if ( m )
mkd_flags_are(f, m->flags, htmlplease);
}
-1747
View File
File diff suppressed because it is too large Load Diff
-24
View File
@@ -1,24 +0,0 @@
/* block-level tags for passing html5 blocks through the blender
*/
#include "tags.h"
void
mkd_with_html5_tags()
{
static int populated = 0;
if ( populated ) return;
populated = 1;
mkd_prepare_tags();
mkd_define_tag("ASIDE", 0);
mkd_define_tag("FOOTER", 0);
mkd_define_tag("HEADER", 0);
mkd_define_tag("HGROUP", 0);
mkd_define_tag("NAV", 0);
mkd_define_tag("SECTION", 0);
mkd_define_tag("ARTICLE", 0);
mkd_sort_tags();
}
-198
View File
@@ -1,198 +0,0 @@
/*
* markdown: convert a single markdown document into html
*/
/*
* Copyright (C) 2007 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"
#include "pgm_options.h"
#if HAVE_LIBGEN_H
#include <libgen.h>
#endif
#ifndef HAVE_BASENAME
#include <string.h>
char*
basename(char *p)
{
char *ret = strrchr(p, '/');
return ret ? (1+ret) : p;
}
#endif
char *pgm = "markdown";
char *
e_flags(const char *text, const int size, void *context)
{
return (char*)context;
}
void
complain(char *fmt, ...)
{
va_list ptr;
fprintf(stderr, "%s: ", pgm);
va_start(ptr, fmt);
vfprintf(stderr, fmt, ptr);
va_end(ptr);
fputc('\n', stderr);
fflush(stderr);
}
float
main(int argc, char **argv)
{
int opt;
int rc;
mkd_flag_t flags = 0;
int debug = 0;
int toc = 0;
int version = 0;
int with_html5 = 0;
int use_mkd_line = 0;
char *extra_footnote_prefix = 0;
char *urlflags = 0;
char *text = 0;
char *ofile = 0;
char *urlbase = 0;
char *q;
MMIOT *doc;
if ( q = getenv("MARKDOWN_FLAGS") )
flags = strtol(q, 0, 0);
pgm = basename(argv[0]);
opterr = 1;
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:o:s:t:TV")) != EOF ) {
switch (opt) {
case '5': with_html5 = 1;
break;
case 'b': urlbase = optarg;
break;
case 'd': debug = 1;
break;
case 'V': version++;
break;
case 'E': urlflags = optarg;
break;
case 'F': if ( strcmp(optarg, "?") == 0 ) {
show_flags(0);
exit(0);
}
else
flags = strtol(optarg, 0, 0);
break;
case 'f': if ( strcmp(optarg, "?") == 0 ) {
show_flags(1);
exit(0);
}
else if ( !set_flag(&flags, optarg) )
complain("unknown option <%s>", optarg);
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 ) {
complain("Too many -o options");
exit(1);
}
if ( !freopen(ofile = optarg, "w", stdout) ) {
perror(ofile);
exit(1);
}
break;
default: fprintf(stderr, "usage: %s [-dTV] [-b url-base]"
" [-F bitmap] [-f {+-}flags]"
" [-o ofile] [-s text]"
" [-t text] [file]\n", pgm);
exit(1);
}
}
if ( version ) {
printf("%s: discount %s%s", pgm, markdown_version,
with_html5 ? " +html5":"");
if ( version > 1 )
mkd_flags_are(stdout, flags, 0);
putchar('\n');
exit(0);
}
argc -= optind;
argv += optind;
if ( with_html5 )
mkd_with_html5_tags();
if ( use_mkd_line )
rc = mkd_generateline( text, strlen(text), stdout, flags);
else {
if ( text ) {
if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) {
perror(text);
exit(1);
}
}
else {
if ( argc && !freopen(argv[0], "r", stdin) ) {
perror(argv[0]);
exit(1);
}
if ( (doc = mkd_in(stdin,flags)) == 0 ) {
perror(argc ? argv[0] : "stdin");
exit(1);
}
}
if ( urlbase )
mkd_basename(doc, urlbase);
if ( urlflags ) {
mkd_e_data(doc, urlflags);
mkd_e_flags(doc, e_flags);
}
if ( extra_footnote_prefix )
mkd_ref_prefix(doc, extra_footnote_prefix);
if ( debug )
rc = mkd_dump(doc, stdout, 0, argc ? basename(argv[0]) : "stdin");
else {
rc = 1;
if ( mkd_compile(doc, flags) ) {
rc = 0;
if ( toc )
mkd_generatetoc(doc, stdout);
mkd_generatehtml(doc, stdout);
mkd_cleanup(doc);
}
}
}
mkd_deallocate_tags();
adump();
exit( (rc == 0) ? 0 : errno );
}
-45
View File
@@ -1,45 +0,0 @@
.\" %A%
.\"
.Dd January 10, 2010
.Dt MAKEPAGE 1
.Os MASTODON
.Sh NAME
.Nm makepage
.Nd convert markdown input to a fully-formed xhtml page
.Sh SYNOPSIS
.Nm
.Op Fl V
.Op Fl F Pa bitmap
.Op Fl f Ar flags
.Op Pa file
.Sh DESCRIPTION
The
.Nm
utility parses a
.Xr markdown 7 Ns -formatted
.Pa textfile
.Pq or stdin if not specified,
compiles it, then prints a fully-formed xhtml page to stdout.
.Pp
The
.Fl F ,
.Fl f ,
and
.Fl V
flags are identical to the same options in
.Xr markdown 1 .
.Pp
.Nm
is part of discount.
.Sh RETURN VALUES
The
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.chi.il.us
-87
View File
@@ -1,87 +0,0 @@
/*
* makepage: Use mkd_xhtmlpage() to convert markdown input to a
* fully-formed xhtml page.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <mkdio.h>
#include "config.h"
#include "pgm_options.h"
#ifndef HAVE_BASENAME
char*
basename(char *p)
{
char *ret = strrchr(p, '/');
return ret ? (1+ret) : p;
}
#endif
char *pgm = "makepage";
float
main(argc, argv)
int argc;
char **argv;
{
MMIOT *doc;
char *q;
int version = 0;
int opt;
mkd_flag_t flags = 0;
if ( (q = getenv("MARKDOWN_FLAGS")) )
flags = strtol(q, 0, 0);
opterr = 1;
while ( (opt=getopt(argc, argv, "F:f:V")) != EOF ) {
switch (opt) {
case 'V': version++;
break;
case 'F': if ( strcmp(optarg, "?") == 0 ) {
show_flags(0);
exit(0);
}
else
flags = strtol(optarg, 0, 0);
break;
case 'f': if ( strcmp(optarg, "?") == 0 ) {
show_flags(1);
exit(0);
}
else if ( !set_flag(&flags, optarg) )
fprintf(stderr, "unknown option <%s>\n", optarg);
break;
default: fprintf(stderr, "usage: %s [-V] [-F bitmap] [-f {+-}flags]"
" [file]\n", pgm);
exit(1);
}
}
argc -= optind;
argv += optind;
if ( version ) {
printf("%s: discount %s", pgm, markdown_version);
if ( version > 1 )
mkd_flags_are(stdout, flags, 0);
putchar('\n');
exit(0);
}
if ( (argc > 1) && !freopen(argv[1], "r", stdin) ) {
perror(argv[1]);
exit(1);
}
if ( (doc = mkd_in(stdin, flags)) == 0 ) {
perror( (argc > 1) ? argv[1] : "stdin" );
exit(1);
}
exit(mkd_xhtmlpage(doc, flags, stdout));
}
-171
View File
@@ -1,171 +0,0 @@
.\" %A%
.\"
.Dd January 7, 2008
.Dt MARKDOWN 1
.Os MASTODON
.Sh NAME
.Nm markdown
.Nd text to html conversion tool
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl T
.Op Fl V
.Op Fl b Ar url-base
.Op Fl C Ar prefix
.Op Fl F Pa bitmap
.Op Fl f Ar flags
.Op Fl o Pa file
.Op Fl s Pa text
.Op Fl t Pa text
.Op Pa textfile
.Sh DESCRIPTION
The
.Nm
utility reads the
.Xr markdown 7 Ns -formatted
.Pa textfile
.Pq or stdin if not specified,
compiles it, and writes the html output
to stdout.
.Pp
The options are as follows:
.Bl -tag -width "-o file"
.It Fl b Ar url-base
Links in source beginning with / will be prefixed with
.Ar url-base
in the output.
.It Fl C
When processing markdown extra-style footnotes, use the
given prefix instead of the default of
.Ar fn .
.It Fl d
Instead of writing the html file, dump a parse
tree to stdout.
.It Fl f Ar flags
Set or clear various translation flags. The flags
are in a comma-delimited list, with an optional
.Ar +
(enable),
.Ar -
(disable), or
.Ar no
(disable) lprefix on each flag.
.Bl -tag -width "definitionlist"
.It Ar links
Allow links.
.It Ar image
Allow images.
.It Ar smarty
Enable smartypants.
.It Ar pants
Enable smartypants.
.It Ar html
Allow raw html.
.It Ar strict
Disable superscript, strikethrough & relaxed emphasis.
.It Ar ext
Enable pseudo-protocols.
.It Ar cdata
Generate code for xml
.Em ![CDATA[...]] .
.It Ar superscript
Enable superscript processing.
.It Ar emphasis
Emphasis happens
.Em everywhere .
.It Ar tables
Don't process PHP Markdown Extra tables.
.It Ar del
Enable
.Em ~~strikethrough~~ .
.It Ar strikethrough
Enable
.Em ~~strikethrough~~ .
.It Ar toc
Enable table-of-contents processing.
.It Ar 1.0
Compatibility with MarkdownTest_1.0
.It Ar autolink
Make
.Pa http://foo.com
a link even without
.Em <> .
.It Ar safelink
Paranoid check for link protocol.
.It Ar header
Process pandoc-style header blocks.
.It Ar tabstop
Expand tabs to 4 spaces.
.It Ar divquote
Allow
.Pa >%class%
blocks.
.It Ar alphalist
Allow alphabetic lists.
.It Ar definitionlist
Allow definition lists.
.It Ar footnote
Allow markdown extra-style footnotes.
.El
.Pp
As an example, the option
.Fl f Ar nolinks,smarty
tells
.Nm
to not allow \<a tags, and to do smarty
pants processing.
.It Fl F Ar bitmap
Set translation flags.
.Ar Bitmap
is a bit map of the various configuration options
described in
.Xr markdown 3
(the flag values are defined in
.Pa mkdio.h )
.It Fl V
Show the version# and compile-time configuration data.
.Pp
If the version includes the string
.Em DEBUG ,
.Nm
was configured with memory allocation debugging.
.Pp
If the version includes the string
.Em TAB ,
.Nm
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
to format
.Ar text
instead of processing stdin with the
.Xr markdown 3
function.
.It Fl T
If run with the table-of-content flag on, dump the
table of contents before the formatted text.
.It Fl s Ar text
Use the
.Xr markdown 3
function to format
.Ar text .
.El
.Sh RETURN VALUES
The
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr markdown 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.chi.il.us
-137
View File
@@ -1,137 +0,0 @@
.\"
.Dd December 20, 2007
.Dt MARKDOWN 3
.Os Mastodon
.Sh NAME
.Nm markdown
.Nd process Markdown documents
.Sh LIBRARY
Markdown
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft MMIOT
.Fn *mkd_in "FILE *input" "int flags"
.Ft MMIOT
.Fn *mkd_string "char *string" "int size" "int flags"
.Ft int
.Fn markdown "MMIOT *doc" "FILE *output" "int flags"
.Sh DESCRIPTION
These functions
convert
.Em Markdown
documents and strings into HTML.
.Fn markdown
processes an entire document, while
.Fn mkd_text
processes a single string.
.Pp
To process a file, you pass a FILE* to
.Fn mkd_in ,
and if it returns a nonzero value you pass that in to
.Fn markdown ,
which then writes the converted document to the specified
.Em FILE* .
If your input has already been written into a string (generated
input or a file opened
with
.Xr mmap 2 )
you can feed that string to
.Fn mkd_string
and pass its return value to
.Fn markdown.
.Pp
.Fn Markdown
accepts the following flag values (or-ed together if needed)
to restrict how it processes input:
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
.It Ar MKD_NOLINKS
Don't do link processing, block
.Em <a>
tags.
.It Ar MKD_NOIMAGE
Don't do image processing, block
.Em <img> .
.It Ar MKD_NOPANTS
Don't run
.Em smartypants() .
.It Ar MKD_NOHTML
Don't allow raw html through AT ALL
.It Ar MKD_STRICT
Disable
superscript and relaxed emphasis.
.It Ar MKD_TAGTEXT
Process text inside an html tag; no
.Em <em> ,
no
.Em <bold> ,
no html or
.Em []
expansion.
.It Ar MKD_NO_EXT
Don't allow pseudo-protocols.
.It Ar MKD_CDATA
Generate code for xml
.Em ![CDATA[...]] .
.It Ar MKD_NOSUPERSCRIPT
Don't generate superscripts.
Emphasis happens _everywhere_
.It Ar MKD_NOTABLES
Disallow tables.
.It Ar MKD_NOSTRIKETHROUGH
Forbid
.Em ~~strikethrough~~ .
.It Ar MKD_TOC
Do table-of-contents processing.
.It Ar MKD_1_COMPAT
Compatibility with MarkdownTest_1.0
.It Ar MKD_AUTOLINK
Make
.Em http://foo.com
into a link even without
.Em <> s.
.It Ar MKD_SAFELINK
Paranoid check for link protocol.
.It Ar MKD_NOHEADER
Don't process header blocks.
.It Ar MKD_TABSTOP
Expand tabs to 4 spaces.
.It Ar MKD_NODIVQUOTE
Forbid
.Em >%class%
blocks.
.It Ar MKD_NOALPHALIST
Forbid alphabetic lists.
.It Ar MKD_NODLIST
Forbid definition lists.
.It Ar MKD_EXTRA_FOOTNOTE
Enable markdown extra-style footnotes.
.El
.Sh RETURN VALUES
.Fn markdown
returns 0 on success, 1 on failure.
The
.Fn mkd_in
and
.Fn mkd_string
functions return a MMIOT* on success, null on failure.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr mkd-callbacks 3 ,
.Xr mkd-functions 3 ,
.Xr mkd-line 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 ,
.Xr mmap 2 .
.Pp
http://daringfireball.net/projects/markdown/syntax
.Sh BUGS
Error handling is minimal at best.
.Pp
The
.Ar MMIOT
created by
.Fn mkd_string
is deleted by the
.Nm
function.
-1020
View File
File diff suppressed because it is too large Load Diff
-1237
View File
File diff suppressed because it is too large Load Diff
-183
View File
@@ -1,183 +0,0 @@
#ifndef _MARKDOWN_D
#define _MARKDOWN_D
#include "cstring.h"
/* reference-style links (and images) are stored in an array
* of footnotes.
*/
typedef struct footnote {
Cstring tag; /* the tag for the reference link */
Cstring link; /* what this footnote points to */
Cstring title; /* what it's called (TITLE= attribute) */
int height, width; /* dimensions (for image link) */
int dealloc; /* deallocation needed? */
int refnumber;
int flags;
#define EXTRA_BOOKMARK 0x01
#define REFERENCED 0x02
} Footnote;
/* each input line is read into a Line, which contains the line,
* the offset of the first non-space character [this assumes
* that all tabs will be expanded to spaces!], and a pointer to
* the next line.
*/
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 | */
} Line;
/* a paragraph is a collection of Lines, with links to the next paragraph
* and (if it's a QUOTE, UL, or OL) to the reparsed contents of this
* paragraph.
*/
typedef struct paragraph {
struct paragraph *next; /* next paragraph */
struct paragraph *down; /* recompiled contents of this paragraph */
struct line *text; /* all the text in this paragraph */
char *ident; /* %id% tag for QUOTE */
enum { WHITESPACE=0, CODE, QUOTE, MARKUP,
HTML, STYLE, DL, UL, OL, AL, LISTITEM,
HDR, HR, TABLE, SOURCE } typ;
enum { IMPLICIT=0, PARA, CENTER} align;
int hnumber; /* <Hn> for typ == HDR */
} Paragraph;
enum { ETX, SETEXT }; /* header types */
typedef struct block {
enum { bTEXT, bSTAR, bUNDER } b_type;
int b_count;
char b_char;
Cstring b_text;
Cstring b_post;
} block;
typedef STRING(block) Qblock;
typedef char* (*mkd_callback_t)(const char*, const int, void*);
typedef void (*mkd_free_t)(char*, void*);
typedef struct callback_data {
void *e_data; /* private data for callbacks */
mkd_callback_t e_url; /* url edit callback */
mkd_callback_t e_flags; /* extra href flags callback */
mkd_free_t e_free; /* edit/flags callback memory deallocator */
} Callback_data;
/* a magic markdown io thing holds all the data structures needed to
* do the backend processing of a markdown document
*/
typedef struct mmiot {
Cstring out;
Cstring in;
Qblock Q;
int isp;
int reference;
char *ref_prefix;
STRING(Footnote) *footnotes;
DWORD flags;
#define MKD_NOLINKS 0x00000001
#define MKD_NOIMAGE 0x00000002
#define MKD_NOPANTS 0x00000004
#define MKD_NOHTML 0x00000008
#define MKD_STRICT 0x00000010
#define MKD_TAGTEXT 0x00000020
#define MKD_NO_EXT 0x00000040
#define MKD_CDATA 0x00000080
#define MKD_NOSUPERSCRIPT 0x00000100
#define MKD_NORELAXED 0x00000200
#define MKD_NOTABLES 0x00000400
#define MKD_NOSTRIKETHROUGH 0x00000800
#define MKD_TOC 0x00001000
#define MKD_1_COMPAT 0x00002000
#define MKD_AUTOLINK 0x00004000
#define MKD_SAFELINK 0x00008000
#define MKD_NOHEADER 0x00010000
#define MKD_TABSTOP 0x00020000
#define MKD_NODIVQUOTE 0x00040000
#define MKD_NOALPHALIST 0x00080000
#define MKD_NODLIST 0x00100000
#define MKD_EXTRA_FOOTNOTE 0x00200000
#define IS_LABEL 0x08000000
#define USER_FLAGS 0x0FFFFFFF
#define INPUT_MASK (MKD_NOHEADER|MKD_TABSTOP)
Callback_data *cb;
} MMIOT;
/*
* the mkdio text input functions return a document structure,
* which contains a header (retrieved from the document if
* markdown was configured * with the * --enable-pandoc-header
* and the document begins with a pandoc-style header) and the
* root of the linked list of Lines.
*/
typedef struct document {
int magic; /* "I AM VALID" magic number */
#define VALID_DOCUMENT 0x19600731
Line *title;
Line *author;
Line *date;
ANCHOR(Line) content; /* uncompiled text, not valid after compile() */
Paragraph *code; /* intermediate code generated by compile() */
int compiled; /* set after mkd_compile() */
int html; /* set after (internal) htmlify() */
int tabstop; /* for properly expanding tabs (ick) */
char *ref_prefix;
MMIOT *ctx; /* backend buffers, flags, and structures */
Callback_data cb; /* callback functions & private data */
} Document;
extern int mkd_firstnonblank(Line *);
extern int mkd_compile(Document *, DWORD);
extern int mkd_document(Document *, char **);
extern int mkd_generatehtml(Document *, FILE *);
extern int mkd_css(Document *, char **);
extern int mkd_generatecss(Document *, FILE *);
#define mkd_style mkd_generatecss
extern int mkd_xml(char *, int , char **);
extern int mkd_generatexml(char *, int, FILE *);
extern void mkd_cleanup(Document *);
extern int mkd_line(char *, int, char **, DWORD);
extern int mkd_generateline(char *, int, FILE*, DWORD);
#define mkd_text mkd_generateline
extern void mkd_basename(Document*, char *);
typedef int (*mkd_sta_function_t)(const int,const void*);
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 void mkd_initialize();
extern void mkd_shlib_destructor();
extern void mkd_ref_prefix(Document*, char*);
/* internal resource handling functions.
*/
extern void ___mkd_freeLine(Line *);
extern void ___mkd_freeLines(Line *);
extern void ___mkd_freeParagraph(Paragraph *);
extern void ___mkd_freefootnote(Footnote *);
extern void ___mkd_freefootnotes(MMIOT *);
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_emblock(MMIOT*);
extern void ___mkd_tidy(Cstring *);
#endif/*_MARKDOWN_D*/
-71
View File
@@ -1,71 +0,0 @@
.\"
.Dd January 18, 2008
.Dt MKD_CALLBACKS 3
.Os Mastodon
.Sh NAME
.Nm mkd_callbacks
.Nd functions that modify link targets
.Sh LIBRARY
Markdown
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft char*
.Fn (*mkd_callback_t) "const char*" "const int" "void*"
.Ft void
.Fn (*mkd_free_t) "char *" "void*"
.Ft void
.Fn mkd_e_url "MMIOT *document" "mkd_callback_t edit"
.Ft void
.Fn mkd_e_flags "MMIOT *document" "mkd_callback_t edit"
.Ft void
.Fn mkd_e_free "MMIOT *document" "mkd_free_t dealloc"
.Ft void
.Fn mkd_e_data "MMIOT *document" "void *data"
.Sh DESCRIPTION
.Pp
.Nm Discount
provides a small set of data access functions to let a
library user modify the targets given in a `[]' link, and to
add additional flags to the generated link.
.Pp
The data access functions are passed a character pointer to
the url being generated, the size of the url, and a data pointer
pointing to a user data area (set by the
.Fn mkd_e_data
function.) After the callback function is called (either
.Fn mkd_e_url
or
.Fn mkd_e_flags )
the data freeing function (if supplied) is called and passed the
character pointer and user data pointer.
.Sh EXAMPLE
The
.Fn mkd_basename
function (in the module basename.c) is implemented by means of
mkd callbacks; it modifies urls that start with a `/' so that
they begin with a user-supplied url base by allocating a new
string and filling it with the base + the url. Discount plugs
that url in in place of the original, then calls the basename
free function (it only does this when
.Fn mkd_e_url
or
.Fn mkd_e_flags
returns nonzero) to deallocate this memory.
.Pp
Note that only one level of callbacks are supported; if you
wish to do multiple callbacks, you need to write your own
code to handle them all.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr mkd-line 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 ,
.Xr mmap 2 .
.Pp
basename.c
.Pp
http://daringfireball.net/projects/markdown/syntax
.Sh BUGS
Error handling is minimal at best.
-205
View File
@@ -1,205 +0,0 @@
.\"
.Dd Dec 22, 2007
.Dt MKD-EXTENSIONS 7
.Os MASTODON
.Sh NAME
.Nm mkd-extensions
.Nd Extensions to the Markdown text formatting syntax
.Sh DESCRIPTION
This version of markdown has been extended in a few ways by
extending existing markup, creating new markup from scratch,
and borrowing markup from other markup languages.
.Ss Image dimensions
Markdown embedded images have been extended to allow specifying
the dimensions of the image by adding a new argument
.Em =/height/x/width/
to the link description.
.Pp
The new image syntax is
.nf
![alt text](image =/height/x/width/ "title")
.fi
.Ss pseudo-protocols
Five pseudo-protocols have been added to links
.Bl -tag -width XXXXX
.It Ar id:
The
.Ar "alt text"
is marked up and written to the output, wrapped with
.Em "<a id=id>"
and
.Em "</a>" .
.It Ar class:
The
.Ar "alt text"
is marked up and written to the output, wrapped with
.Em "<span class=class>"
and
.Em "</span>" .
.It Ar raw:
The
.Ar title
is written
.Em -- with no further processing --
to the output. The
.Ar "alt text"
is discarded.
.It Ar abbr:
The
.Ar "alt text"
is marked up and written to the output, wrapped with
.Em "<abbr title=abbr>"
and
.Em "</abbr>" .
.It Ar lang:
The
.Ar "alt text"
s marked up and written to the output, wrapped with
.Em "<span lang=lang>"
and
.Em "</span>" .
.El
.Ss Pandoc headers
The markdown source document can have a 3-line
.Xr Pandoc
header in the format of
.nf
% title
% author(s)
% date
.fi
which will be made available to the
.Fn mkd_doc_title ,
.Fn mkd_doc_author ,
and
.Fn mkd_doc_date
functions.
.Ss Definition lists
A definition list item
is defined as
.nf
=tag=
description
.fi
(that is a
.Ar = ,
followed by text, another
.Ar = ,
a newline, 4 spaces of intent, and then more text.)
.Pp
Alternatively, definition list items are defined as
.nf
tag
: description
.fi
(This is the format that
.Ar "PHP Markdown Extra"
uses.)
.Pp
.Ss embedded stylesheets
Stylesheets may be defined and modified in a
.Em <style>
block. A style block is parsed like any other
block level html;
.Em <style>
starting on column 1, raw html (or, in this case, css) following
it, and either ending with a
.Em </style>
at the end of the line or a
.Em </style>
at the beginning of a subsequent line.
.Pp
Be warned that style blocks work like footnote links -- no matter
where you define them they are valid for the entire document.
.Ss relaxed emphasis
The rules for emphasis are changed so that a single
.Ar _
will
.Em not
count as a emphasis character if it's in the middle of a word.
This is primarily for documenting code, if you don't wish to
have to backquote all code references.
.Ss alpha lists
Alphabetic lists (like regular numeric lists, but with alphabetic
items) are supported. So:
.nf
a. this
b. is
c. an alphabetic
d. list
.fi
will produce:
.nf
<ol type=a>
<li>this</li>
<li>is</li>
<li>an alphabetic</li>
<li>list</li>
</ol>
.fi
.Ss tables
.Ar "PHP Markdown Extra"
tables are supported; input of the form
.nf
header|header
------|------
text | text
.fi
will produce:
.nf
<table>
<thead>
<tr>
<th>header</th>
<th>header</th>
</tr>
</thead>
<tbody>
<tr>
<td>text</td>
<td>text</td>
</tr>
</tbody>
</table>
.fi
The dashed line can also contain
.Em :
characters for formatting; if a
.Em :
is at the start of a column, it tells
.Nm discount
to align the cell contents to the left; if it's at the end, it
aligns right, and if there's one at the start and at the
end, it centers.
.Ss strikethrough
A strikethrough syntax is supported in much the same way that
.Ar `
is used to define a section of code. If you enclose text with
two or more tildes, such as
.Em ~~erased text~~
it will be written as
.Em "<del>erased text</del>" .
Like code sections, you may use as many
.Ar ~
as you want, but there must be as many starting tildes as closing
tildes.
.Ss markdown extra-style footnotes
.Ar "PHP Markdown Extra"
footnotes are supported. If a footnote link begins with a
.Ar ^ ,
the first use of that footnote will generate a link down to the
bottom of the rendered document, which will contain a numbered footnote
with a link back to where the footnote was called.
.Sh AUTHOR
David Parsons
.%T http://www.pell.portland.or.us/~orc/
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr mkd-callbacks 3 ,
.Xr mkd-functions 3 ,
.Xr mkd-line 3 .
.Pp
.%T http://daringfireball.net/projects/markdown
.Pp
.%T http://michelf.com/projects/php-markdown
-186
View File
@@ -1,186 +0,0 @@
.\"
.Dd January 18, 2008
.Dt MKD_FUNCTIONS 3
.Os Mastodon
.Sh NAME
.Nm mkd_functions
.Nd access and process Markdown documents.
.Sh LIBRARY
Markdown
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft int
.Fn mkd_compile "MMIOT *document" "int flags"
.Ft int
.Fn mkd_css "MMIOT *document" "char **doc"
.Ft int
.Fn mkd_generatecss "MMIOT *document" "FILE *output"
.Ft int
.Fn mkd_document "MMIOT *document" "char **doc"
.Ft int
.Fn mkd_generatehtml "MMIOT *document" "FILE *output"
.Ft int
.Fn mkd_xhtmlpage "MMIOT *document" "int flags" "FILE *output"
.Ft int
.Fn mkd_toc "MMIOT *document" "char **doc"
.Ft void
.Fn mkd_generatetoc "MMIOT *document" "FILE *output"
.Ft void
.Fn mkd_cleanup "MMIOT*"
.Ft char*
.Fn mkd_doc_title "MMIOT*"
.Ft char*
.Fn mkd_doc_author "MMIOT*"
.Ft char*
.Fn mkd_doc_date "MMIOT*"
.Sh DESCRIPTION
.Pp
The
.Nm markdown
format supported in this implementation includes
Pandoc-style header and inline
.Ar \<style\>
blocks, and the standard
.Xr markdown 3
functions do not provide access to
the data provided by either of those extensions.
These functions give you access to that data, plus
they provide a finer-grained way of converting
.Em Markdown
documents into HTML.
.Pp
Given a
.Ar MMIOT*
generated by
.Fn mkd_in
or
.Fn mkd_string ,
.Fn mkd_compile
compiles the document into
.Em \<style\> ,
.Em Pandoc ,
and
.Em html
sections.
.Pp
Once compiled, the document can be examined and written
by the
.Fn mkd_css ,
.Fn mkd_document ,
.Fn mkd_generatecss ,
.Fn mkd_generatehtml ,
.Fn mkd_generatetoc ,
.Fn mkd_toc ,
.Fn mkd_xhtmlpage ,
.Fn mkd_doc_title ,
.Fn mkd_doc_author ,
and
.Fn mkd_doc_date
functions.
.Pp
.Fn mkd_css
allocates a string and populates it with any \<style\> sections
provided in the document,
.Fn mkd_generatecss
writes any \<style\> sections to the output,
.Fn mkd_document
points
.Ar text
to the text of the document and returns the
size of the document,
.Fn mkd_generatehtml
writes the rest of the document to the output,
and
.Fn mkd_doc_title ,
.Fn mkd_doc_author ,
.Fn mkd_doc_date
are used to read the contents of a Pandoc header,
if any.
.Pp
.Fn mkd_xhtmlpage
writes a xhtml page containing the document. The regular set of
flags can be passed.
.Pp
.Fn mkd_toc
writes a document outline, in the form of a collection of nested
lists with links to each header in the document, into a string
allocated with
.Fn malloc ,
and returns the size.
.Pp
.Fn mkd_generatetoc
is like
.Fn mkd_toc ,
except that it writes the document outline to the given
.Pa FILE*
argument.
.Pp
.Fn mkd_cleanup
deletes a
.Ar MMIOT*
after processing is done.
.Pp
.Fn mkd_compile
accepts the same flags that
.Fn markdown
and
.Fn mkd_string
do;
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
.It Ar MKD_NOIMAGE
Do not process `![]' and
remove
.Em \<img\>
tags from the output.
.It Ar MKD_NOLINKS
Do not process `[]' and remove
.Em \<a\>
tags from the output.
.It Ar MKD_NOPANTS
Do not do Smartypants-style mangling of quotes, dashes, or ellipses.
.It Ar MKD_TAGTEXT
Process the input as if you were inside a html tag. This means that
no html tags will be generated, and
.Fn mkd_compile
will attempt to escape anything that might terribly confuse a
web browser.
.It Ar MKD_NO_EXT
Do not process any markdown pseudo-protocols when
handing
.Ar [][]
links.
.It Ar MKD_NOHEADER
Do not attempt to parse any Pandoc-style headers.
.It Ar MKD_TOC
Label all headers for use with the
.Fn mkd_generatetoc
function.
.It Ar MKD_1_COMPAT
MarkdownTest_1.0 compatibility flag; trim trailing spaces from the
first line of code blocks and disable implicit reference links.
.It Ar MKD_NOSTRIKETHROUGH
Disable strikethrough support.
.El
.Sh RETURN VALUES
The function
.Fn mkd_compile
returns 1 in the case of success, or 0 if the document is already compiled.
The function
.Fn mkd_generatecss
returns the number of bytes written in the case of success, or EOF if an error
occurred.
The function
.Fn mkd_generatehtml
returns 0 on success, \-1 on failure.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr mkd-line 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 ,
.Xr mmap 2 .
.Pp
http://daringfireball.net/projects/markdown/syntax
.Sh BUGS
Error handling is minimal at best.
-41
View File
@@ -1,41 +0,0 @@
.\"
.Dd January 18, 2008
.Dt MKD_LINE 3
.Os Mastodon
.Sh NAME
.Nm mkd_line
.Nd do Markdown translation of small items
.Sh LIBRARY
Markdown
.Pq libmarkdown , -lmarkdown
.Sh SYNOPSIS
.Fd #include <mkdio.h>
.Ft int
.Fn mkd_line "char *string" "int size" "char **doc" "int flags"
.Ft int
.Fn mkd_generateline "char *string" "int size" "FILE *output" "int flags"
.Sh DESCRIPTION
.Pp
Occasionally one might want to do markdown translations on fragments of
data, like the title of an weblog article, a date, or a simple signature
line.
.Nm mkd_line
and
.Nm mkd_generateline
allow you to do markdown translations on small blocks of text.
.Nm mkd_line
allocates a buffer, then writes the translated text into that buffer,
and
.Nm mkd_generateline
writes the output to the specified
.Ar FILE* .
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 ,
.Xr mmap 2 .
.Pp
http://daringfireball.net/projects/markdown/syntax
.Sh BUGS
Error handling is minimal at best.
-52
View File
@@ -1,52 +0,0 @@
.\" %A%
.\"
.Dd January 10, 2010
.Dt MKD2HTML 1
.Os MASTODON
.Sh NAME
.Nm mkd2html
.Nd markdown to html converter
.Sh SYNOPSIS
.Nm
.Op Fl css Pa file
.Op Fl header Pa string
.Op Fl footer Pa string
.Op Pa file
.Sh DESCRIPTION
.Nm
utility parses a
.Xr markdown 7 Ns -formatted
.Pa textfile
.Pq or stdin if not specified,
and generates a web page. It
reads
.Ar file
or
.Ar file.text
and writes the result in
.Ar file.html
.Pq where file is the passed argument.
.Pp
.Nm
is part of discount.
.Sh OPTIONS
.Bl -tag -width "-header string"
.It Fl css Ar file
Specifies a CSS file.
.It Fl header Ar string
Specifies a line to add to the <header> tag.
.It Fl footer Ar string
Specifies a line to add before the <\/body> tag.
.El
.Sh RETURN VALUES
The
.Nm
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr markdown 1 ,
.Xr markdown 3 ,
.Xr markdown 7 ,
.Xr mkd-extensions 7 .
.Sh AUTHOR
.An David Parsons
.Pq Li orc@pell.chi.il.us
-185
View File
@@ -1,185 +0,0 @@
/*
* mkd2html: parse a markdown input file and generate a web page.
*
* usage: mkd2html [options] filename
* or mkd2html [options] < markdown > html
*
* options
* -css css-file
* -header line-to-add-to-<HEADER>
* -footer line-to-add-before-</BODY>
*
* example:
*
* mkd2html -cs /~orc/pages.css syntax
* ( read syntax OR syntax.text, write syntax.html )
*/
/*
* Copyright (C) 2007 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 <string.h>
#ifdef HAVE_BASENAME
# ifdef HAVE_LIBGEN_H
# include <libgen.h>
# else
# include <unistd.h>
# endif
#endif
#include <stdarg.h>
#include "mkdio.h"
#include "cstring.h"
#include "amalloc.h"
char *pgm = "mkd2html";
#ifndef HAVE_BASENAME
char *
basename(char *path)
{
char *p;
if (( p = strrchr(path, '/') ))
return 1+p;
return path;
}
#endif
void
fail(char *why, ...)
{
va_list ptr;
va_start(ptr,why);
fprintf(stderr, "%s: ", pgm);
vfprintf(stderr, why, ptr);
fputc('\n', stderr);
va_end(ptr);
exit(1);
}
void
main(argc, argv)
char **argv;
{
char *h;
char *source = 0, *dest = 0;
MMIOT *mmiot;
int i;
FILE *input, *output;
STRING(char*) css, headers, footers;
CREATE(css);
CREATE(headers);
CREATE(footers);
pgm = basename(argv[0]);
while ( argc > 2 ) {
if ( strcmp(argv[1], "-css") == 0 ) {
EXPAND(css) = argv[2];
argc -= 2;
argv += 2;
}
else if ( strcmp(argv[1], "-header") == 0 ) {
EXPAND(headers) = argv[2];
argc -= 2;
argv += 2;
}
else if ( strcmp(argv[1], "-footer") == 0 ) {
EXPAND(footers) = argv[2];
argc -= 2;
argv += 2;
}
}
if ( argc > 1 ) {
char *p, *dot;
source = malloc(strlen(argv[1]) + 6);
dest = malloc(strlen(argv[1]) + 6);
if ( !(source && dest) )
fail("out of memory allocating name buffers");
strcpy(source, argv[1]);
if (( p = strrchr(source, '/') ))
p = source;
else
++p;
if ( (input = fopen(source, "r")) == 0 ) {
strcat(source, ".text");
if ( (input = fopen(source, "r")) == 0 )
fail("can't open either %s or %s", argv[1], source);
}
strcpy(dest, source);
if (( dot = strrchr(dest, '.') ))
*dot = 0;
strcat(dest, ".html");
if ( (output = fopen(dest, "w")) == 0 )
fail("can't write to %s", dest);
}
else {
input = stdin;
output = stdout;
}
if ( (mmiot = mkd_in(input, 0)) == 0 )
fail("can't read %s", source ? source : "stdin");
if ( !mkd_compile(mmiot, 0) )
fail("couldn't compile input");
h = mkd_doc_title(mmiot);
/* print a header */
fprintf(output,
"<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional //EN\">\n"
"<html>\n"
"<head>\n"
" <meta name=\"GENERATOR\" content=\"mkd2html %s\">\n", markdown_version);
fprintf(output," <meta http-equiv=\"Content-Type\"\n"
" content=\"text/html; charset-us-ascii\">");
for ( i=0; i < S(css); i++ )
fprintf(output, " <link rel=\"stylesheet\"\n"
" type=\"text/css\"\n"
" href=\"%s\" />\n", T(css)[i]);
if ( h ) {
fprintf(output," <title>");
mkd_generateline(h, strlen(h), output, 0);
fprintf(output, "</title>\n");
}
for ( i=0; i < S(headers); i++ )
fprintf(output, " %s\n", T(headers)[i]);
fprintf(output, "</head>\n"
"<body>\n");
/* print the compiled body */
mkd_generatehtml(mmiot, output);
for ( i=0; i < S(footers); i++ )
fprintf(output, "%s\n", T(footers)[i]);
fprintf(output, "</body>\n"
"</html>\n");
mkd_cleanup(mmiot);
exit(0);
}
-357
View File
@@ -1,357 +0,0 @@
/*
* mkdio -- markdown front end input functions
*
* Copyright (C) 2007 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"
typedef ANCHOR(Line) LineAnchor;
/* create a new blank Document
*/
static Document*
new_Document()
{
Document *ret = calloc(sizeof(Document), 1);
if ( ret ) {
if (( ret->ctx = calloc(sizeof(MMIOT), 1) )) {
ret->magic = VALID_DOCUMENT;
return ret;
}
free(ret);
}
return 0;
}
/* 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)
{
Line *p = calloc(sizeof *p, 1);
unsigned char c;
int xp = 0;
int size = S(*line);
unsigned char *str = (unsigned char*)T(*line);
CREATE(p->text);
ATTACH(a->content, p);
while ( size-- ) {
if ( (c = *str++) == '\t' ) {
/* expand tabs into ->tabstop spaces. We use ->tabstop
* because the ENTIRE FREAKING COMPUTER WORLD uses editors
* that don't do ^T/^D, but instead use tabs for indentation,
* and, of course, set their tabs down to 4 spaces
*/
do {
EXPAND(p->text) = ' ';
} while ( ++xp % a->tabstop );
}
else if ( c >= ' ' ) {
if ( c == '|' )
p->flags |= PIPECHAR;
EXPAND(p->text) = c;
++xp;
}
}
EXPAND(p->text) = 0;
S(p->text)--;
p->dle = mkd_firstnonblank(p);
}
/* trim leading blanks from a header line
*/
static void
header_dle(Line *p)
{
CLIP(p->text, 0, 1);
p->dle = mkd_firstnonblank(p);
}
/* build a Document from any old input.
*/
typedef int (*getc_func)(void*);
Document *
populate(getc_func getc, void* ctx, int flags)
{
Cstring line;
Document *a = 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;
}
queue(a, &line);
S(line) = 0;
}
else if ( isprint(c) || isspace(c) || (c & 0x80) )
EXPAND(line) = c;
}
if ( S(line) )
queue(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; header_dle(a->title);
a->author= headers->next; header_dle(a->author);
a->date = headers->next->next; header_dle(a->date);
T(a->content) = headers->next->next->next;
}
return a;
}
/* convert a file into a linked list
*/
Document *
mkd_in(FILE *f, DWORD flags)
{
return populate((getc_func)fgetc, f, flags & INPUT_MASK);
}
/* 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)
{
if ( !in->size ) return EOF;
--(in->size);
return *(in->data)++;
}
/* convert a block of text into a linked list
*/
Document *
mkd_string(const char *buf, int len, DWORD flags)
{
struct string_ctx about;
about.data = buf;
about.size = len;
return populate((getc_func)strget, &about, flags & INPUT_MASK);
}
/* write the html to a file (xmlified if necessary)
*/
int
mkd_generatehtml(Document *p, FILE *output)
{
char *doc;
int szdoc;
if ( (szdoc = mkd_document(p, &doc)) != EOF ) {
if ( p->ctx->flags & MKD_CDATA )
mkd_generatexml(doc, szdoc, output);
else
fwrite(doc, szdoc, 1, output);
putc('\n', output);
return 0;
}
return -1;
}
/* convert some markdown text to html
*/
int
markdown(Document *document, FILE *out, int flags)
{
if ( mkd_compile(document, flags) ) {
mkd_generatehtml(document, out);
mkd_cleanup(document);
return 0;
}
return -1;
}
/* write out a Cstring, mangled into a form suitable for `<a href=` or `<a id=`
*/
void
mkd_string_to_anchor(char *s, int len, mkd_sta_function_t outchar,
void *out, int labelformat)
{
unsigned char c;
int i, size;
char *line;
size = mkd_line(s, len, &line, IS_LABEL);
if ( labelformat && (size>0) && !isalpha(line[0]) )
(*outchar)('L',out);
for ( i=0; i < size ; i++ ) {
c = line[i];
if ( labelformat ) {
if ( isalnum(c) || (c == '_') || (c == ':') || (c == '-') || (c == '.' ) )
(*outchar)(c, out);
else
(*outchar)('.', out);
}
else
(*outchar)(c,out);
}
if (line)
free(line);
}
/* ___mkd_reparse() a line
*/
static void
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_emblock(f);
}
/* ___mkd_reparse() a line, returning it in malloc()ed memory
*/
int
mkd_line(char *bfr, int size, char **res, DWORD flags)
{
MMIOT f;
int len;
mkd_parse_line(bfr, size, &f, flags);
if ( len = S(f.out) ) {
/* kludge alert; we know that T(f.out) is malloced memory,
* so we can just steal it away. This is awful -- there
* should be an opaque method that transparently moves
* the pointer out of the embedded Cstring.
*/
EXPAND(f.out) = 0;
*res = T(f.out);
T(f.out) = 0;
S(f.out) = ALLOCATED(f.out) = 0;
}
else {
*res = 0;
len = EOF;
}
___mkd_freemmiot(&f, 0);
return len;
}
/* ___mkd_reparse() a line, writing it to a FILE
*/
int
mkd_generateline(char *bfr, int size, FILE *output, DWORD flags)
{
MMIOT f;
mkd_parse_line(bfr, size, &f, flags);
if ( flags & MKD_CDATA )
mkd_generatexml(T(f.out), S(f.out), output);
else
fwrite(T(f.out), S(f.out), 1, output);
___mkd_freemmiot(&f, 0);
return 0;
}
/* set the url display callback
*/
void
mkd_e_url(Document *f, mkd_callback_t edit)
{
if ( f )
f->cb.e_url = edit;
}
/* set the url options callback
*/
void
mkd_e_flags(Document *f, mkd_callback_t edit)
{
if ( f )
f->cb.e_flags = edit;
}
/* set the url display/options deallocator
*/
void
mkd_e_free(Document *f, mkd_free_t dealloc)
{
if ( f )
f->cb.e_free = dealloc;
}
/* set the url display/options context data field
*/
void
mkd_e_data(Document *f, void *data)
{
if ( f )
f->cb.e_data = data;
}
/* set the href prefix for markdown extra style footnotes
*/
void
mkd_ref_prefix(Document *f, char *data)
{
if ( f )
f->ref_prefix = data;
}
-108
View File
@@ -1,108 +0,0 @@
#ifndef _MKDIO_D
#define _MKDIO_D
#include <stdio.h>
typedef void MMIOT;
typedef @DWORD@ mkd_flag_t;
/* line builder for markdown()
*/
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 */
void mkd_basename(MMIOT*,char*);
void mkd_initialize();
void mkd_with_html5_tags();
void mkd_shlib_destructor();
/* compilation, debugging, cleanup
*/
int mkd_compile(MMIOT*, mkd_flag_t);
int mkd_cleanup(MMIOT*);
/* markup functions
*/
int mkd_dump(MMIOT*, FILE*, int, char*);
int markdown(MMIOT*, FILE*, mkd_flag_t);
int mkd_line(char *, int, char **, mkd_flag_t);
typedef int (*mkd_sta_function_t)(const int,const void*);
void mkd_string_to_anchor(char *, int, mkd_sta_function_t, void*, int);
int mkd_xhtmlpage(MMIOT*,int,FILE*);
/* header block access
*/
char* mkd_doc_title(MMIOT*);
char* mkd_doc_author(MMIOT*);
char* mkd_doc_date(MMIOT*);
/* compiled data access
*/
int mkd_document(MMIOT*, char**);
int mkd_toc(MMIOT*, char**);
int mkd_css(MMIOT*, char **);
int mkd_xml(char *, int, char **);
/* write-to-file functions
*/
int mkd_generatehtml(MMIOT*,FILE*);
int mkd_generatetoc(MMIOT*,FILE*);
int mkd_generatexml(char *, int,FILE*);
int mkd_generatecss(MMIOT*,FILE*);
#define mkd_style mkd_generatecss
int mkd_generateline(char *, int, FILE*, mkd_flag_t);
#define mkd_text mkd_generateline
/* url generator callbacks
*/
typedef char * (*mkd_callback_t)(const char*, const int, void*);
typedef void (*mkd_free_t)(char*, void*);
void mkd_e_url(void *, mkd_callback_t);
void mkd_e_flags(void *, mkd_callback_t);
void mkd_e_free(void *, mkd_free_t );
void mkd_e_data(void *, void *);
/* version#.
*/
extern char markdown_version[];
void mkd_mmiot_flags(FILE *, MMIOT *, int);
void mkd_flags_are(FILE*, mkd_flag_t, int);
void mkd_ref_prefix(MMIOT*, char*);
/* special flags for markdown() and mkd_text()
*/
#define MKD_NOLINKS 0x00000001 /* don't do link processing, block <a> tags */
#define MKD_NOIMAGE 0x00000002 /* don't do image processing, block <img> */
#define MKD_NOPANTS 0x00000004 /* don't run smartypants() */
#define MKD_NOHTML 0x00000008 /* don't allow raw html through AT ALL */
#define MKD_STRICT 0x00000010 /* disable SUPERSCRIPT, RELAXED_EMPHASIS */
#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_CDATA 0x00000080 /* generate code for xml ![CDATA[...]] */
#define MKD_NOSUPERSCRIPT 0x00000100 /* no A^B */
#define MKD_NORELAXED 0x00000200 /* emphasis happens /everywhere/ */
#define MKD_NOTABLES 0x00000400 /* disallow tables */
#define MKD_NOSTRIKETHROUGH 0x00000800 /* forbid ~~strikethrough~~ */
#define MKD_TOC 0x00001000 /* do table-of-contents processing */
#define MKD_1_COMPAT 0x00002000 /* compatibility with MarkdownTest_1.0 */
#define MKD_AUTOLINK 0x00004000 /* make http://foo.com link even without <>s */
#define MKD_SAFELINK 0x00008000 /* paranoid check for link protocol */
#define MKD_NOHEADER 0x00010000 /* don't process header blocks */
#define MKD_TABSTOP 0x00020000 /* expand tabs to 4 spaces */
#define MKD_NODIVQUOTE 0x00040000 /* forbid >%class% blocks */
#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_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
/* special flags for mkd_in() and mkd_string()
*/
#endif/*_MKDIO_D*/
-157
View File
@@ -1,157 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2007 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "config.h"
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
/* free a (single) line
*/
void
___mkd_freeLine(Line *ptr)
{
DELETE(ptr->text);
free(ptr);
}
/* free a list of lines
*/
void
___mkd_freeLines(Line *p)
{
if (p->next)
___mkd_freeLines(p->next);
___mkd_freeLine(p);
}
/* bye bye paragraph.
*/
void
___mkd_freeParagraph(Paragraph *p)
{
if (p->next)
___mkd_freeParagraph(p->next);
if (p->down)
___mkd_freeParagraph(p->down);
if (p->text)
___mkd_freeLines(p->text);
if (p->ident)
free(p->ident);
free(p);
}
/* bye bye footnote.
*/
void
___mkd_freefootnote(Footnote *f)
{
DELETE(f->tag);
DELETE(f->link);
DELETE(f->title);
}
/* bye bye footnotes.
*/
void
___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);
free(f->footnotes);
}
}
/* initialize a new MMIOT
*/
void
___mkd_initmmiot(MMIOT *f, void *footnotes)
{
if ( f ) {
memset(f, 0, sizeof *f);
CREATE(f->in);
CREATE(f->out);
CREATE(f->Q);
if ( footnotes )
f->footnotes = footnotes;
else {
f->footnotes = malloc(sizeof f->footnotes[0]);
CREATE(*f->footnotes);
}
}
}
/* free the contents of a MMIOT, but leave the object alone.
*/
void
___mkd_freemmiot(MMIOT *f, void *footnotes)
{
if ( f ) {
DELETE(f->in);
DELETE(f->out);
DELETE(f->Q);
if ( f->footnotes != footnotes )
___mkd_freefootnotes(f);
memset(f, 0, sizeof *f);
}
}
/* free lines up to an barrier.
*/
void
___mkd_freeLineRange(Line *anchor, Line *stop)
{
Line *r = anchor->next;
if ( r != stop ) {
while ( r && (r->next != stop) )
r = r->next;
if ( r ) r->next = 0;
___mkd_freeLines(anchor->next);
}
anchor->next = 0;
}
/* clean up everything allocated in __mkd_compile()
*/
void
mkd_cleanup(Document *doc)
{
if ( doc && (doc->magic == VALID_DOCUMENT) ) {
if ( doc->ctx ) {
___mkd_freemmiot(doc->ctx, 0);
free(doc->ctx);
}
if ( doc->code) ___mkd_freeParagraph(doc->code);
if ( doc->title) ___mkd_freeLine(doc->title);
if ( doc->author) ___mkd_freeLine(doc->author);
if ( doc->date) ___mkd_freeLine(doc->date);
if ( T(doc->content) ) ___mkd_freeLines(T(doc->content));
memset(doc, 0, sizeof doc[0]);
free(doc);
}
}
-47
View File
@@ -1,47 +0,0 @@
/* markdown: a C implementation of John Gruber's Markdown markup language.
*
* Copyright (C) 2007 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 <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
#include "tags.h"
static int need_to_setup = 1;
static int need_to_initrng = 1;
void
mkd_initialize()
{
if ( need_to_initrng ) {
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();
}
}
-123
View File
@@ -1,123 +0,0 @@
/* block-level tags for passing html blocks through the blender
*/
#define __WITHOUT_AMALLOC 1
#include "cstring.h"
#include "tags.h"
STRING(struct kw) blocktags;
/* define a html block tag
*/
void
mkd_define_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*);
/* sort the list of html block tags for later searching
*/
void
mkd_sort_tags()
{
qsort(T(blocktags), S(blocktags), sizeof(struct kw), (stfu)casort);
}
/* look for a token in the html block tag list
*/
struct kw*
mkd_search_tags(char *pat, int len)
{
struct kw key;
key.id = pat;
key.size = len;
return bsearch(&key, T(blocktags), S(blocktags), sizeof key, (stfu)casort);
}
static int populated = 0;
/* load in the standard collection of html tags that markdown supports
*/
void
mkd_prepare_tags()
{
#define KW(x) mkd_define_tag(x, 0)
#define SC(x) mkd_define_tag(x, 1)
if ( populated ) return;
populated = 1;
KW("STYLE");
KW("SCRIPT");
KW("ADDRESS");
KW("BDO");
KW("BLOCKQUOTE");
KW("CENTER");
KW("DFN");
KW("DIV");
KW("OBJECT");
KW("H1");
KW("H2");
KW("H3");
KW("H4");
KW("H5");
KW("H6");
KW("LISTING");
KW("NOBR");
KW("UL");
KW("P");
KW("OL");
KW("DL");
KW("PLAINTEXT");
KW("PRE");
KW("TABLE");
KW("WBR");
KW("XMP");
SC("HR");
SC("BR");
KW("IFRAME");
KW("MAP");
mkd_sort_tags();
} /* mkd_prepare_tags */
/* destroy the blocktags list (for shared libraries)
*/
void
mkd_deallocate_tags()
{
if ( S(blocktags) > 0 ) {
populated = 0;
DELETE(blocktags);
}
} /* mkd_deallocate_tags */
-19
View File
@@ -1,19 +0,0 @@
/* block-level tags for passing html blocks through the blender
*/
#ifndef _TAGS_D
#define _TAGS_D
struct kw {
char *id;
int size;
int selfclose;
} ;
struct kw* mkd_search_tags(char *, int);
void mkd_prepare_tags();
void mkd_deallocate_tags();
void mkd_sort_tags();
void mkd_define_tag(char *, int);
#endif
-27
View File
@@ -1,27 +0,0 @@
. tests/functions.sh
title 'Reddit-style automatic links'
rc=0
try -fautolink 'single link' \
'http://www.pell.portland.or.us/~orc/Code/discount' \
'<p><a href="http://www.pell.portland.or.us/~orc/Code/discount">http://www.pell.portland.or.us/~orc/Code/discount</a></p>'
try -fautolink '[!](http://a.com "http://b.com")' \
'[!](http://a.com "http://b.com")' \
'<p><a href="http://a.com" title="http://b.com">!</a></p>'
try -fautolink 'link surrounded by text' \
'here http://it is?' \
'<p>here <a href="http://it">http://it</a> is?</p>'
try -fautolink 'naked @' '@' '<p>@</p>'
try -fautolink 'parenthesised (url)' \
'(http://here)' \
'<p>(<a href="http://here">http://here</a>)</p>'
try -fautolink 'token with trailing @' 'orc@' '<p>orc@</p>'
summary $0
exit $rc
-27
View File
@@ -1,27 +0,0 @@
. tests/functions.sh
title "automatic links"
rc=0
MARKDOWN_FLAGS=
try 'http url' '<http://here>' '<p><a href="http://here">http://here</a></p>'
try 'ftp url' '<ftp://here>' '<p><a href="ftp://here">ftp://here</a></p>'
try 'http://foo/bar' '<http://foo/bar>' '<p><a href="http://foo/bar">http://foo/bar</a></p>'
try 'http:/foo/bar' '<http:/foo/bar>' '<p><a href="http:/foo/bar">http:/foo/bar</a></p>'
try 'http:foo/bar' '<http:foo/bar>' '<p><a href="http:foo/bar">http:foo/bar</a></p>'
try '</foo/bar>' '</foo/bar>' '<p></foo/bar></p>'
match '<orc@pell.portland.or.us>' '<orc@pell.portland.or.us>' '<a href='
match '<orc@pell.com.>' '<orc@pell.com.>' '<a href='
try 'invalid <orc@>' '<orc@>' '<p>&lt;orc@></p>'
try 'invalid <@pell>' '<@pell>' '<p>&lt;@pell></p>'
try 'invalid <orc@pell>' '<orc@pell>' '<p>&lt;orc@pell></p>'
try 'invalid <orc@.pell>' '<orc@.pell>' '<p>&lt;orc@.pell></p>'
try 'invalid <orc@pell.>' '<orc@pell.>' '<p>&lt;orc@pell.></p>'
match '<mailto:orc@pell>' '<mailto:orc@pell>' '<a href='
match '<mailto:orc@pell.com>' '<mailto:orc@pell.com>' '<a href='
match '<mailto:orc@>' '<mailto:orc@>' '<a href='
match '<mailto:@pell>' '<mailto:@pell>' '<a href='
summary $0
exit $rc
-16
View File
@@ -1,16 +0,0 @@
. tests/functions.sh
title "backslash escapes"
rc=0
MARKDOWN_FLAGS=
try 'backslashes in []()' '[foo](http://\this\is\.a\test\(here\))' \
'<p><a href="http://\this\is.a\test(here)">foo</a></p>'
try -fautolink 'autolink url with trailing \' \
'http://a.com/\' \
'<p><a href="http://a.com/\">http://a.com/\</a></p>'
summary $0
exit $rc
-17
View File
@@ -1,17 +0,0 @@
. tests/functions.sh
title "callbacks"
rc=0
MARKDOWN_FLAGS=
try -bZZZ 'url modification' \
'[a](/b)' \
'<p><a href="ZZZ/b">a</a></p>'
try -EZZZ 'additional flags' \
'[a](/b)' \
'<p><a href="/b" ZZZ>a</a></p>'
summary $0
exit $rc
-13
View File
@@ -1,13 +0,0 @@
->###chrome with my markdown###<-
1. `(c)` -> `&copy;` (c)
2. `(r)` -> `&reg;` (r)
3. `(tm)` -> `&trade;` (tm)
4. `...` -> `&hellip;` ...
5. `--` -> `&emdash;` --
6. `-` -> `&ndash;` - (but not if it's between-words)
7. "fancy quoting"
8. 'fancy quoting (#2)'
9. don't do it unless it's a real quote.
10. `` (`) ``
-35
View File
@@ -1,35 +0,0 @@
. tests/functions.sh
title "code blocks"
rc=0
MARKDOWN_FLAGS=
try 'format for code block html' \
' this is
code' \
'<pre><code>this is
code
</code></pre>'
try 'mismatched backticks' '```tick``' '<p><code>`tick</code></p>'
try 'mismatched backticks(2)' '``tick```' '<p>``tick```</p>'
try 'unclosed single backtick' '`hi there' '<p>`hi there</p>'
try 'unclosed double backtick' '``hi there' '<p>``hi there</p>'
try 'triple backticks' '```hi there```' '<p><code>hi there</code></p>'
try 'quadruple backticks' '````hi there````' '<p><code>hi there</code></p>'
try 'remove space around code' '`` hi there ``' '<p><code>hi there</code></p>'
try 'code containing backticks' '`` a```b ``' '<p><code>a```b</code></p>'
try 'backslash before backtick' '`a\`' '<p><code>a\</code></p>'
try '`>`' '`>`' '<p><code>&gt;</code></p>'
try '`` ` ``' '`` ` ``' '<p><code>`</code></p>'
try '````` ``` `' '````` ``` `' '<p><code>``</code> `</p>'
try '````` ` ```' '````` ` ```' '<p><code>`` `</code></p>'
try 'backslashes in code(1)' ' printf "%s: \n", $1;' \
'<pre><code>printf "%s: \n", $1;
</code></pre>'
try 'backslashes in code(2)' '`printf "%s: \n", $1;`' \
'<p><code>printf "%s: \n", $1;</code></p>'
summary $0
exit $rc
-29
View File
@@ -1,29 +0,0 @@
. tests/functions.sh
title "markdown 1.0 compatibility"
rc=0
MARKDOWN_FLAGS=
LINKY='[this] is a test
[this]: /this'
try 'implicit reference links' "$LINKY" '<p><a href="/this">this</a> is a test</p>'
try -f1.0 'implicit reference links (-f1.0)' "$LINKY" '<p>[this] is a test</p>'
WSP=' '
WHITESPACE="
white space$WSP
and more"
try 'trailing whitespace' "$WHITESPACE" '<pre><code>white space ''
and more
</code></pre>'
try -f1.0 'trailing whitespace (-f1.0)' "$WHITESPACE" '<pre><code>white space''
and more
</code></pre>'
summary $0
exit $rc
-31
View File
@@ -1,31 +0,0 @@
. tests/functions.sh
title "crashes"
rc=0
MARKDOWN_FLAGS=
try 'zero-length input' '' ''
try 'hanging quote in list' \
' * > this should not die
no.' \
'<ul>
<li><blockquote><p>this should not die</p></blockquote></li>
</ul>
<p>no.</p>'
try 'dangling list item' ' - ' \
'<ul>
<li></li>
</ul>'
try -bHOHO 'empty []() with baseurl' '[]()' '<p><a href=""></a></p>'
try 'unclosed html block' '<table></table' '<p><table>&lt;/table</p>'
try 'unclosed style block' '<style>' '<p><style></p>'
summary $0
exit $rc
-49
View File
@@ -1,49 +0,0 @@
. tests/functions.sh
title "%div% blocks"
rc=0
MARKDOWN_FLAGS=
try 'simple >%div% block' \
'>%this%
this this' \
'<div class="this"><p>this this</p></div>'
try 'two >%div% blocks in a row' \
'>%this%
this this
>%that%
that that' \
'<div class="this"><p>this this</p></div>
<div class="that"><p>that that</p></div>'
try '>%class:div%' \
'>%class:this%
this this' \
'<div class="this"><p>this this</p></div>'
try '>%id:div%' \
'>%id:this%
this this' \
'<div id="this"><p>this this</p></div>'
try 'nested >%div%' \
'>%this%
>>%that%
>>that
>%more%
more' \
'<div class="this"><div class="that"><p>that</p></div></div>
<div class="more"><p>more</p></div>'
try '%class% with _' '>%class:this_that%' '<div class="this_that"></div>'
try '%class% with -' '>%class:this-that%' '<div class="this-that"></div>'
try 'illegal %class%' '>%class:0zip%' '<blockquote><p>%class:0zip%</p></blockquote>'
summary $0
exit $rc
-96
View File
@@ -1,96 +0,0 @@
. tests/functions.sh
title "definition lists"
eval `./markdown -V | tr ' ' '\n' | grep '^DL='`
DL=${DL:-BOTH}
rc=0
MARKDOWN_FLAGS=
SRC='
=this=
is an ugly
=test=
eh?'
RSLT='<dl>
<dt>this</dt>
<dd>is an ugly</dd>
<dt>test</dt>
<dd>eh?</dd>
</dl>'
if [ "$DL" = "DISCOUNT" -o "$DL" = "BOTH" ]; then
try -fdefinitionlist '=tag= generates definition lists' "$SRC" "$RSLT"
try 'one item with two =tags=' \
'=this=
=is=
A test, eh?' \
'<dl>
<dt>this</dt>
<dt>is</dt>
<dd>A test, eh?</dd>
</dl>'
try -fnodefinitionlist '=tag= does nothing' "$SRC" \
'<p>=this=</p>
<pre><code>is an ugly
</code></pre>
<p>=test=</p>
<pre><code>eh?
</code></pre>'
fi
if [ "$DL" = "EXTRA" -o "$DL" = "BOTH" ]; then
try 'markdown extra-style definition lists' \
'foo
: bar' \
'<dl>
<dt>foo</dt>
<dd>bar</dd>
</dl>'
try '... with two <dt>s in a row' \
'foo
bar
: baz' \
'<dl>
<dt>foo</dt>
<dt>bar</dt>
<dd>baz</dd>
</dl>'
try '... with two <dd>s in a row' \
'foo
: bar
: baz' \
'<dl>
<dt>foo</dt>
<dd>bar</dd>
<dd>baz</dd>
</dl>'
try '... with blanks between list items' \
'foo
: bar
zip
: zap' \
'<dl>
<dt>foo</dt>
<dd>bar</dd>
<dt>zip</dt>
<dd>zap</dd>
</dl>'
fi
summary $0
exit $rc
-9
View File
@@ -1,9 +0,0 @@
* [![an image](http://dustmite.org/mite.jpg =50x50)] (http://dustmite.org)
* [[an embedded link](http://wontwork.org)](http://willwork.org)
* [![dustmite][]] (http:/dustmite.org)
* ![dustmite][]
* ![dustmite][dustmite]
* [<a href="http://cheating.us">cheat me</a>](http://I.am.cheating)
[dustmite]: http://dustmite.org/mite.jpg =25x25 "here I am!"
-19
View File
@@ -1,19 +0,0 @@
. tests/functions.sh
title "emphasis"
rc=0
MARKDOWN_FLAGS=
try '*hi* -> <em>hi</em>' '*hi*' '<p><em>hi</em></p>'
try '* -> *' 'A * A' '<p>A * A</p>'
try -fstrict '***A**B*' '***A**B*' '<p><em><strong>A</strong>B</em></p>'
try -fstrict '***A*B**' '***A*B**' '<p><strong><em>A</em>B</strong></p>'
try -fstrict '**A*B***' '**A*B***' '<p><strong>A<em>B</em></strong></p>'
try -fstrict '*A**B***' '*A**B***' '<p><em>A<strong>B</strong></em></p>'
try -frelax '_A_B with -frelax' '_A_B' '<p>_A_B</p>'
try -fstrict '_A_B with -fstrict' '_A_B' '<p><em>A</em>B</p>'
summary $0
exit $rc
-35
View File
@@ -1,35 +0,0 @@
. tests/functions.sh
title "markdown extra-style footnotes"
rc=0
MARKDOWN_FLAGS=
FOOTIE='I haz a footnote[^1]
[^1]: yes?'
try -ffootnote 'footnotes (-ffootnote)' "$FOOTIE" \
'<p>I haz a footnote<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>
<div class="footnotes">
<hr/>
<ol>
<li id="fn:1">
<p>yes?<a href="#fnref:1" rev="footnote">&#8617;</a></p></li>
</ol>
</div>'
try -ffootnote -Cfoot 'footnotes (-ffootnote -Cfoot)' "$FOOTIE" \
'<p>I haz a footnote<sup id="footref:1"><a href="#foot:1" rel="footnote">1</a></sup></p>
<div class="footnotes">
<hr/>
<ol>
<li id="foot:1">
<p>yes?<a href="#footref:1" rev="footnote">&#8617;</a></p></li>
</ol>
</div>'
try -fnofootnote 'footnotes (-fnofootnote)' "$FOOTIE" \
'<p>I haz a footnote<a href="yes?">^1</a></p>'
summary $0
exit $rc
-33
View File
@@ -1,33 +0,0 @@
. tests/functions.sh
title "paragraph flow"
rc=0
MARKDOWN_FLAGS=
try 'header followed by paragraph' \
'###Hello, sailor###
And how are you today?' \
'<h3>Hello, sailor</h3>
<p>And how are you today?</p>'
try 'two lists punctuated with a HR' \
'* A
* * *
* B
* C' \
'<ul>
<li>A</li>
</ul>
<hr />
<ul>
<li>B</li>
<li>C</li>
</ul>'
summary $0
exit $rc
-16
View File
@@ -1,16 +0,0 @@
. tests/functions.sh
title "footnotes"
rc=0
MARKDOWN_FLAGS=
try 'a line with multiple []s' '[a][] [b][]:' '<p>[a][] [b][]:</p>'
try 'a valid footnote' \
'[alink][]
[alink]: link_me' \
'<p><a href="link_me">alink</a></p>'
summary $0
exit $rc
-80
View File
@@ -1,80 +0,0 @@
__tests=0
__passed=0
__failed=0
__title=
title() {
__title="$*"
if [ "$VERBOSE" ]; then
./echo "$__title"
else
./echo -n "$__title" \
'.................................................................' | ./cols 54
fi
}
summary() {
if [ -z "$VERBOSE" ]; then
if [ $__failed -eq 0 ]; then
./echo " OK"
else
./echo
./echo "$1: $__tests tests; $__failed failed/$__passed passed"
./echo
fi
fi
}
try() {
unset FLAGS
while [ "$1" ]; do
case "$1" in
-*) FLAGS="$FLAGS $1"
shift ;;
*) break ;;
esac
done
testcase=`./echo -n " $1" '........................................................' | ./cols 50`
__tests=`expr $__tests + 1`
test "$VERBOSE" && ./echo -n "$testcase"
case "$2" in
-t*) Q=`./markdown $FLAGS "$2"` ;;
*) Q=`./echo "$2" | ./markdown $FLAGS` ;;
esac
if [ "$3" = "$Q" ]; then
__passed=`expr $__passed + 1`
test $VERBOSE && ./echo " ok"
else
__failed=`expr $__failed + 1`
if [ -z "$VERBOSE" ]; then
./echo
./echo "$1"
fi
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
match() {
testcase=`./echo -n " $1" '........................................................' | ./cols 50`
test $VERBOSE && ./echo -n "$testcase"
if ./echo "$2" | ./markdown | grep "$3" >/dev/null; then
test $VERBOSE && ./echo " ok"
else
if [ -z "$VERBOSE" ]; then
./echo
./echo "$testcase"
fi
rc=1
fi
}
-26
View File
@@ -1,26 +0,0 @@
. tests/functions.sh
title "headers"
rc=0
MARKDOWN_FLAGS=
try 'single #' '#' '<p>#</p>'
try 'empty ETX' '##' '<h1>#</h1>'
try 'single-char ETX (##W)' '##W' '<h2>W</h2>'
try 'single-char ETX (##W )' '##W ' '<h2>W</h2>'
try 'single-char ETX (## W)' '## W' '<h2>W</h2>'
try 'single-char ETX (## W )' '## W ' '<h2>W</h2>'
try 'single-char ETX (##W##)' '##W##' '<h2>W</h2>'
try 'single-char ETX (##W ##)' '##W ##' '<h2>W</h2>'
try 'single-char ETX (## W##)' '## W##' '<h2>W</h2>'
try 'single-char ETX (## W ##)' '## W ##' '<h2>W</h2>'
try 'multiple-char ETX (##Hello##)' '##Hello##' '<h2>Hello</h2>'
try 'SETEXT with trailing whitespace' \
'hello
===== ' '<h1>hello</h1>'
summary $0
exit $rc
-141
View File
@@ -1,141 +0,0 @@
. tests/functions.sh
title "html blocks"
rc=0
MARKDOWN_FLAGS=
try 'self-closing block tags (hr)' \
'<hr>
text' \
'<hr>
<p>text</p>'
try 'self-closing block tags (hr/)' \
'<hr/>
text' \
'<hr/>
<p>text</p>'
try 'self-closing block tags (br)' \
'<br>
text' \
'<br>
<p>text</p>'
try 'html comments' \
'<!--
**hi**
-->' \
'<!--
**hi**
-->'
try 'no smartypants inside tags (#1)' \
'<img src="linky">' \
'<p><img src="linky"></p>'
try 'no smartypants inside tags (#2)' \
'<img src="linky" alt=":)" />' \
'<p><img src="linky" alt=":)" /></p>'
try -fnohtml 'block html with -fnohtml' '<b>hi!</b>' '<p>&lt;b>hi!&lt;/b></p>'
try -fnohtml 'malformed tag injection' '<x <script>' '<p>&lt;x &lt;script></p>'
try -fhtml 'allow html with -fhtml' '<b>hi!</b>' '<p><b>hi!</b></p>'
# check that nested raw html blocks terminate properly.
#
BLOCK1SRC='Markdown works fine *here*.
*And* here.
<div><pre>
</pre></div>
Markdown here is *not* parsed by RDiscount.
Nor in *this* paragraph, and there are no paragraph breaks.'
BLOCK1OUT='<p>Markdown works fine <em>here</em>.</p>
<p><em>And</em> here.</p>
<div><pre>
</pre></div>
<p>Markdown here is <em>not</em> parsed by RDiscount.</p>
<p>Nor in <em>this</em> paragraph, and there are no paragraph breaks.</p>'
try 'nested html blocks (1)' "$BLOCK1SRC" "$BLOCK1OUT"
try 'nested html blocks (2)' \
'<div>This is inside a html block
<div>This is, too</div>and
so is this</div>' \
'<div>This is inside a html block
<div>This is, too</div>and
so is this</div>'
try 'unfinished tags' '<foo bar' '<p>&lt;foo bar</p>'
try 'comment with trailing text' '<!-- this is -->a test' \
'<!-- this is -->
<p>a test</p>'
try 'block with trailing text' '<p>this is</p>a test' \
'<p>this is</p>
<p>a test</p>'
COMMENTS='<!-- 1. -->line 1
<!-- 2. -->line 2'
try 'two comments' "$COMMENTS" \
'<!-- 1. -->
<p>line 1</p>
<!-- 2. -->
<p>line 2</p>'
COMMENTS='<!-- 1. -->line 1
<!-- 2. -->line 2'
try 'two adjacent comments' "$COMMENTS" \
'<!-- 1. -->
<p>line 1</p>
<!-- 2. -->
<p>line 2</p>'
try 'comment, no white space' '<!--foo-->' '<!--foo-->'
try 'unclosed block' '<p>here we go!' '<p><p>here we go!</p>'
summary $0
exit $rc
-17
View File
@@ -1,17 +0,0 @@
. tests/functions.sh
title "html5 blocks (mkd_with_html5_tags)"
rc=0
MARKDOWN_FLAGS=
try -5 'html5 block elements enabled' \
'<aside>html5 does not suck</aside>' \
'<aside>html5 does not suck</aside>'
try 'html5 block elements disabled' \
'<aside>html5 sucks</aside>' \
'<p><aside>html5 sucks</aside></p>'
summary $0
exit $rc
-14
View File
@@ -1,14 +0,0 @@
1. <http://automatic>
2. [automatic] (http://automatic "automatic link")
3. [automatic](http://automatic "automatic link")
4. [automatic](http://automatic)
5. [automatic] (http://automatic)
6. [automatic] []
7. [automatic][]
8. [my][automatic]
9. [my] [automatic]
[automatic]: http://automatic "footnote"
[automatic] [
-130
View File
@@ -1,130 +0,0 @@
. tests/functions.sh
title "embedded links"
rc=0
MARKDOWN_FLAGS=
try 'url contains &' '[hehehe](u&rl)' '<p><a href="u&amp;rl">hehehe</a></p>'
try 'url contains +' '[hehehe](u+rl)' '<p><a href="u+rl">hehehe</a></p>'
try 'url contains "' '[hehehe](u"rl)' '<p><a href="u%22rl">hehehe</a></p>'
try 'url contains <' '[hehehe](u<rl)' '<p><a href="u&lt;rl">hehehe</a></p>'
try 'url contains whitespace' '[ha](r u)' '<p><a href="r%20u">ha</a></p>'
try 'label contains escaped []s' '[a\[b\]c](d)' '<p><a href="d">a[b]c</a></p>'
try '<label> w/o title' '[hello](<sailor>)' '<p><a href="sailor">hello</a></p>'
try '<label> with title' '[hello](<sailor> "boy")' '<p><a href="sailor" title="boy">hello</a></p>'
try '<label> with whitespace' '[hello]( <sailor> )' '<p><a href="sailor">hello</a></p>'
try 'url contains whitespace & title' \
'[hehehe](r u "there")' \
'<p><a href="r%20u" title="there">hehehe</a></p>'
try 'url contains escaped )' \
'[hehehe](u\))' \
'<p><a href="u)">hehehe</a></p>'
try 'image label contains <' \
'![he<he<he](url)' \
'<p><img src="url" alt="he&lt;he&lt;he" /></p>'
try 'image label contains >' \
'![he>he>he](url)' \
'<p><img src="url" alt="he&gt;he&gt;he" /></p>'
try 'sloppy context link' \
'[heh]( url "how about it?" )' \
'<p><a href="url" title="how about it?">heh</a></p>'
try 'footnote urls formed properly' \
'[hehehe]: hohoho "ha ha"
[hehehe][]' \
'<p><a href="hohoho" title="ha ha">hehehe</a></p>'
try 'linky-like []s work' \
'[foo]' \
'<p>[foo]</p>'
try 'pseudo-protocol "id:"'\
'[foo](id:bar)' \
'<p><span id="bar">foo</span></p>'
try 'pseudo-protocol "class:"' \
'[foo](class:bar)' \
'<p><span class="bar">foo</span></p>'
try 'pseudo-protocol "abbr:"'\
'[foo](abbr:bar)' \
'<p><abbr title="bar">foo</abbr></p>'
try 'nested [][]s' \
'[[z](y)](x)' \
'<p><a href="x">[z](y)</a></p>'
try 'empty [][] tags' \
'[![][1]][2]
[1]: image1
[2]: image2' \
'<p><a href="image2"><img src="image1" alt="" /></a></p>'
try 'footnote cuddled up to text' \
'foo
[bar]:bar' \
'<p>foo</p>'
try 'mid-paragraph footnote' \
'talk talk talk talk
[bar]: bar
talk talk talk talk' \
'<p>talk talk talk talk
talk talk talk talk</p>'
try 'mid-blockquote footnote' \
'>blockquote!
[footnote]: here!
>blockquote!' \
'<blockquote><p>blockquote!
blockquote!</p></blockquote>'
try 'end-blockquote footnote' \
'>blockquote!
>blockquote!
[footnote]: here!' \
'<blockquote><p>blockquote!
blockquote!</p></blockquote>'
try 'start-blockquote footnote' \
'[footnote]: here!
>blockquote!
>blockquote!' \
'<blockquote><p>blockquote!
blockquote!</p></blockquote>'
try '[text] (text) not a link' \
'[test] (me)' \
'<p>[test] (me)</p>'
try '[test] [this] w/ one space between' \
'[test] [this]
[test]: yay!
[this]: nay!' \
'<p><a href="nay!">test</a></p>'
try '[test] [this] w/ two spaces between' \
'[test] [this]
[test]: yay!
[this]: nay!' \
'<p><a href="yay!">test</a> <a href="nay!">this</a></p>'
try -f1.0 'link with <> (-f1.0)' \
'[this](<is a (test)>)' \
'<p><a href="is%20a%20(test">this</a>>)</p>'
try 'link with <>' \
'[this](<is a (test)>)' \
'<p><a href="is%20a%20(test)">this</a></p>'
summary $0
exit $rc
-21
View File
@@ -1,21 +0,0 @@
. tests/functions.sh
title "embedded images"
rc=0
MARKDOWN_FLAGS=
try 'image with size extension' \
'![picture](pic =200x200)' \
'<p><img src="pic" height="200" width="200" alt="picture" /></p>'
try 'image with height' \
'![picture](pic =x200)' \
'<p><img src="pic" height="200" alt="picture" /></p>'
try 'image with width' \
'![picture](pic =200x)' \
'<p><img src="pic" width="200" alt="picture" /></p>'
summary $0
exit $rc

Some files were not shown because too many files have changed in this diff Show More