Compare commits
82 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 518fdfe2e6 | |||
| be6c76831a | |||
| e24a91fa08 | |||
| 1dae696cb7 | |||
| 5d5dfe5da6 | |||
| 21f4bf11ae | |||
| 1931abfa5c | |||
| 460b0cae9b | |||
| 867540f2a4 | |||
| 921c71b7da | |||
| 1d96a33c96 | |||
| a1b9ee2db6 | |||
| d8413c8708 | |||
| 5346b81a51 | |||
| 3d349544bb | |||
| 42cd9cbab3 | |||
| 9ec7bf0755 | |||
| c26815c188 | |||
| 898639006e | |||
| 0e28f93ea7 | |||
| 4526658ffd | |||
| 35265cdefb | |||
| 7965019b35 | |||
| eab37e7fcf | |||
| 287bfb4cc1 | |||
| 93a75c914a | |||
| 00cb392778 | |||
| 36691b0cd6 | |||
| 2b98e93e3e | |||
| bca82faaf5 | |||
| 6877343ffb | |||
| 8b6f007a48 | |||
| 0ec416124b | |||
| 7a694e23a8 | |||
| b93e867ece | |||
| 75072250a1 | |||
| 1a13778b29 | |||
| 830451c347 | |||
| 44fb8e4801 | |||
| 030776f2ba | |||
| 82c45ea1af | |||
| 93262659a6 | |||
| 5187b09104 | |||
| 6ee11016e6 | |||
| 5c558ac91e | |||
| a39398e285 | |||
| 84810efd40 | |||
| c9fce86f78 | |||
| 8ded5daa69 | |||
| 3071cb7933 | |||
| 20b2c067b2 | |||
| 6afa337652 | |||
| c56b264b09 | |||
| 5ff86d7090 | |||
| ae03663ae9 | |||
| 47eba24b08 | |||
| a6e38f5006 | |||
| 9f226d5888 | |||
| 4fe9c024d7 | |||
| e144b9a4a4 | |||
| 70852152db | |||
| 8dabaa211e | |||
| 8f5e205db9 | |||
| 7223e4f106 | |||
| 84c389e651 | |||
| 9fe95a8570 | |||
| 54fea66afb | |||
| 4ab9b37c8a | |||
| a52a3695e5 | |||
| 660dc5e84d | |||
| c3823c58ed | |||
| 10d7a42aea | |||
| 084d4e6407 | |||
| 27d7b53cf0 | |||
| 9a110d5ba4 | |||
| e48e3565f2 | |||
| 9eaa7021e6 | |||
| eb6a08b475 | |||
| 99123324ac | |||
| 506db84cd5 | |||
| f8eba10e5e | |||
| fe219b3e7e |
@@ -0,0 +1 @@
|
||||
*.pbxproj -crlf
|
||||
@@ -0,0 +1,9 @@
|
||||
# Xcode
|
||||
/build/
|
||||
/*.xcodeproj/*.mode1v3
|
||||
/*.xcodeproj/*.mode2v3
|
||||
/*.xcodeproj/*.pbxuser
|
||||
/*.xcodeproj/xcuserdata/*
|
||||
/*.xcodeproj/*.perspectivev3
|
||||
/*.xcodeproj/project.xcworkspace/*
|
||||
*~.nib
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// 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
|
||||
+889
-1831
File diff suppressed because it is too large
Load Diff
+180
-600
@@ -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">10A432</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">732</string>
|
||||
<string key="IBDocument.AppKitVersion">1038</string>
|
||||
<string key="IBDocument.HIToolboxVersion">437.00</string>
|
||||
<string key="IBDocument.SystemVersion">11B26</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">1617</string>
|
||||
<string key="IBDocument.AppKitVersion">1138</string>
|
||||
<string key="IBDocument.HIToolboxVersion">566.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
@@ -15,13 +15,20 @@
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>732</string>
|
||||
<string>732</string>
|
||||
<string>1617</string>
|
||||
<string>518</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="100021"/>
|
||||
<string>NSView</string>
|
||||
<string>NSSplitView</string>
|
||||
<string>NSScrollView</string>
|
||||
<string>NSWindowTemplate</string>
|
||||
<string>WebView</string>
|
||||
<string>NSTextView</string>
|
||||
<string>NSScroller</string>
|
||||
<string>NSCustomObject</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -33,9 +40,7 @@
|
||||
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -48,12 +53,12 @@
|
||||
<object class="NSWindowTemplate" id="275939982">
|
||||
<int key="NSWindowStyleMask">15</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{67, 760}, {769, 689}}</string>
|
||||
<string key="NSWindowRect">{{148, 238}, {860, 600}}</string>
|
||||
<int key="NSWTFlags">1886912512</int>
|
||||
<string key="NSWindowTitle">Window</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<string key="NSViewClass">View</string>
|
||||
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<string key="NSWindowContentMinSize">{94, 86}</string>
|
||||
<object class="NSView" key="NSWindowView" id="568628114">
|
||||
<reference key="NSNextResponder"/>
|
||||
@@ -101,8 +106,10 @@
|
||||
<string>public.url</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{392, 622}</string>
|
||||
<string key="NSFrameSize">{439, 44}</string>
|
||||
<reference key="NSSuperview" ref="934421653"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="106470570"/>
|
||||
<object class="NSTextContainer" key="NSTextContainer" id="515139633">
|
||||
<object class="NSLayoutManager" key="NSLayoutManager">
|
||||
<object class="NSTextStorage" key="NSTextStorage">
|
||||
@@ -119,11 +126,11 @@
|
||||
<nil key="NSDelegate"/>
|
||||
</object>
|
||||
<reference key="NSTextView" ref="521201844"/>
|
||||
<double key="NSWidth">392</double>
|
||||
<double key="NSWidth">439</double>
|
||||
<int key="NSTCFlags">1</int>
|
||||
</object>
|
||||
<object class="NSTextViewSharedData" key="NSSharedData">
|
||||
<int key="NSFlags">12263</int>
|
||||
<int key="NSFlags">67120867</int>
|
||||
<int key="NSTextCheckingTypes">0</int>
|
||||
<nil key="NSMarkedAttributes"/>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="144579518">
|
||||
@@ -182,21 +189,46 @@
|
||||
</object>
|
||||
</object>
|
||||
<nil key="NSDefaultParagraphStyle"/>
|
||||
<nil key="NSTextFinder"/>
|
||||
<int key="NSPreferredTextFinderStyle">1</int>
|
||||
</object>
|
||||
<int key="NSTVFlags">6</int>
|
||||
<string key="NSMaxSize">{463, 1e+07}</string>
|
||||
<string key="NSMinize">{223, 133}</string>
|
||||
<string key="NSMaxSize">{463, 10000000}</string>
|
||||
<string key="NSMinize">{223, 44}</string>
|
||||
<nil key="NSDelegate"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{392, 689}</string>
|
||||
<string key="NSFrameSize">{439, 600}</string>
|
||||
<reference key="NSSuperview" ref="60428165"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="521201844"/>
|
||||
<reference key="NSDocView" ref="521201844"/>
|
||||
<reference key="NSBGColor" ref="144579518"/>
|
||||
<object class="NSCursor" key="NSCursor">
|
||||
<string key="NSHotSpot">{4, -5}</string>
|
||||
<int key="NSCursorType">1</int>
|
||||
<string key="NSHotSpot">{4, 5}</string>
|
||||
<object class="NSImage" key="NSImage">
|
||||
<int key="NSImageFlags">12582912</int>
|
||||
<object class="NSMutableArray" key="NSReps">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="0"/>
|
||||
<object class="NSBitmapImageRep">
|
||||
<object class="NSData" key="NSTIFFRepresentation">
|
||||
<bytes key="NS.bytes">TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym
|
||||
SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA
|
||||
AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA
|
||||
AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA
|
||||
AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MCAwAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="NScvFlags">4</int>
|
||||
</object>
|
||||
@@ -205,6 +237,8 @@
|
||||
<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>
|
||||
@@ -215,6 +249,8 @@
|
||||
<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>
|
||||
@@ -222,10 +258,11 @@
|
||||
<double key="NSPercent">0.94565218687057495</double>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{392, 689}</string>
|
||||
<string key="NSFrameSize">{439, 600}</string>
|
||||
<reference key="NSSuperview" ref="202269651"/>
|
||||
<reference key="NSNextKeyView" ref="934421653"/>
|
||||
<int key="NSsFlags">528</int>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="497745035"/>
|
||||
<int key="NSsFlags">133648</int>
|
||||
<reference key="NSVScroller" ref="106470570"/>
|
||||
<reference key="NSHScroller" ref="497745035"/>
|
||||
<reference key="NSContentView" ref="934421653"/>
|
||||
@@ -254,8 +291,9 @@
|
||||
<string>public.url-name</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{402, 0}, {367, 689}}</string>
|
||||
<string key="NSFrame">{{449, 0}, {411, 600}}</string>
|
||||
<reference key="NSSuperview" ref="202269651"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="FrameName"/>
|
||||
<string key="GroupName"/>
|
||||
@@ -281,18 +319,23 @@
|
||||
<bool key="AllowsUndo">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{769, 689}</string>
|
||||
<string key="NSFrameSize">{860, 600}</string>
|
||||
<reference key="NSSuperview" ref="568628114"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="60428165"/>
|
||||
<bool key="NSIsVertical">YES</bool>
|
||||
<int key="NSDividerStyle">3</int>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{769, 689}</string>
|
||||
<string key="NSFrameSize">{860, 600}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="202269651"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1578}}</string>
|
||||
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
|
||||
<string key="NSMinSize">{94, 108}</string>
|
||||
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="796877042">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
@@ -317,14 +360,6 @@
|
||||
</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>
|
||||
@@ -350,24 +385,20 @@
|
||||
<int key="connectionID">100030</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBBindingConnection" key="connection">
|
||||
<string key="label">attributedString: markdownSource</string>
|
||||
<reference key="source" ref="521201844"/>
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">policyDelegate</string>
|
||||
<reference key="source" ref="583055138"/>
|
||||
<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">100032</int>
|
||||
<int key="connectionID">100033</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">markdownSourceTextView</string>
|
||||
<reference key="source" ref="512844837"/>
|
||||
<reference key="destination" ref="521201844"/>
|
||||
</object>
|
||||
<int key="connectionID">100034</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
@@ -463,22 +494,20 @@
|
||||
<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>5.IBEditorWindowLastContentRect</string>
|
||||
<string>100026.IBPluginDependency</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>
|
||||
@@ -487,36 +516,30 @@
|
||||
<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>{{67, 760}, {769, 689}}</string>
|
||||
<integer value="1"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{597, 57}, {769, 667}}</string>
|
||||
<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"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">100032</int>
|
||||
<int key="maxID">100034</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -528,6 +551,13 @@
|
||||
<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">
|
||||
@@ -538,71 +568,35 @@
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>WebView</string>
|
||||
<string>NSTextView</string>
|
||||
<string>EditPaneTextView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>htmlPreviewWebView</string>
|
||||
<string>markdownSourceTextView</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">htmlPreviewWebView</string>
|
||||
<string key="candidateClassName">WebView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">markdownSourceTextView</string>
|
||||
<string key="candidateClassName">EditPaneTextView</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">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>
|
||||
<string key="minorKey">./Classes/MyDocument.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">
|
||||
@@ -624,493 +618,80 @@
|
||||
<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">IBFrameworkSource</string>
|
||||
<string key="minorKey">AppKit.framework/Headers/NSDocument.h</string>
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/NSDocument.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSDocument</string>
|
||||
<string key="className">RKSyntaxView</string>
|
||||
<string key="superclassName">NSTextView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<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>
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/RKSyntaxView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">WebView</string>
|
||||
<string key="superclassName">NSView</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<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>
|
||||
<string key="NS.key.0">reloadFromOrigin:</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<string key="NS.key.0">reloadFromOrigin:</string>
|
||||
<object class="IBActionInfo" key="NS.object.0">
|
||||
<string key="name">reloadFromOrigin:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebView.h</string>
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/WebView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||
<integer value="1060" key="NS.object.0"/>
|
||||
@@ -1120,7 +701,6 @@
|
||||
<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>
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>markdown</string>
|
||||
<string>md</string>
|
||||
<string>text</string>
|
||||
<string>txt</string>
|
||||
<string></string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string></string>
|
||||
@@ -40,9 +44,9 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.5.1</string>
|
||||
<string>1.7.1</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.5.1</string>
|
||||
<string>1.7.1</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSMainNibFile</key>
|
||||
|
||||
@@ -9,30 +9,85 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyDocument.xib */; };
|
||||
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
|
||||
795F6C4F105D6EC400D1F90A /* mkdio.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C4E105D6EC400D1F90A /* mkdio.c */; };
|
||||
795F6C51105D6ECE00D1F90A /* markdown.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C50105D6ECE00D1F90A /* markdown.c */; };
|
||||
795F6C53105D6ED800D1F90A /* generate.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C52105D6ED800D1F90A /* generate.c */; };
|
||||
795F6C55105D6EE100D1F90A /* resource.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C54105D6EE100D1F90A /* resource.c */; };
|
||||
795F6C62105D6F6E00D1F90A /* xml.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C61105D6F6E00D1F90A /* xml.c */; };
|
||||
795F6C66105D6F8500D1F90A /* Csio.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6C65105D6F8500D1F90A /* Csio.c */; };
|
||||
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */; };
|
||||
795F6CCD105D741100D1F90A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 795F6CCC105D741100D1F90A /* WebKit.framework */; };
|
||||
795F6DBA105D75D300D1F90A /* discountWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB5105D75D300D1F90A /* discountWrapper.m */; };
|
||||
795F6DBB105D75D300D1F90A /* markdownWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB6105D75D300D1F90A /* markdownWrapper.c */; };
|
||||
795F6DBC105D75D300D1F90A /* mkdioWrapper.c in Sources */ = {isa = PBXBuildFile; fileRef = 795F6DB8105D75D300D1F90A /* mkdioWrapper.c */; };
|
||||
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>"; };
|
||||
@@ -56,6 +111,22 @@
|
||||
795F6DB9105D75D300D1F90A /* mkdioWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkdioWrapper.h; sourceTree = "<group>"; };
|
||||
8D15AC360486D014006FF6A4 /* MarkdownLive-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "MarkdownLive-Info.plist"; sourceTree = "<group>"; };
|
||||
8D15AC370486D014006FF6A4 /* MarkdownLive.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MarkdownLive.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9958D88D14119A22004F7DF1 /* RKSyntaxView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSyntaxView.h; sourceTree = "<group>"; };
|
||||
9958D88E14119A22004F7DF1 /* RKSyntaxView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSyntaxView.m; sourceTree = "<group>"; };
|
||||
9958D89014119A8D004F7DF1 /* NSColor+HexRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+HexRGB.h"; sourceTree = "<group>"; };
|
||||
9958D89114119A8D004F7DF1 /* NSColor+HexRGB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+HexRGB.m"; sourceTree = "<group>"; };
|
||||
9958D89314119B85004F7DF1 /* PageScheme.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageScheme.plist; sourceTree = "<group>"; };
|
||||
9958D89414119B85004F7DF1 /* PageSyntax.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PageSyntax.plist; sourceTree = "<group>"; };
|
||||
ABCE3DDF13C8DFFF00DF3CD0 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
|
||||
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORCDiscount.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
ABECD8C313C8B8CA00B77CFD /* ORCDiscount-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ORCDiscount-Info.plist"; sourceTree = "<group>"; };
|
||||
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 */
|
||||
@@ -63,11 +134,19 @@
|
||||
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 */
|
||||
@@ -94,20 +173,35 @@
|
||||
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-1.5.4 */,
|
||||
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>";
|
||||
@@ -115,6 +209,11 @@
|
||||
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 */,
|
||||
);
|
||||
@@ -133,12 +232,15 @@
|
||||
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>";
|
||||
@@ -152,17 +254,23 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
795F6C4D105D6EA500D1F90A /* discount-1.5.4 */ = {
|
||||
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-1.5.4";
|
||||
path = discount;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
795F6DB3105D75D300D1F90A /* discount_wrappers */ = {
|
||||
@@ -178,8 +286,43 @@
|
||||
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;
|
||||
@@ -187,11 +330,13 @@
|
||||
buildPhases = (
|
||||
8D15AC2B0486D014006FF6A4 /* Resources */,
|
||||
8D15AC300486D014006FF6A4 /* Sources */,
|
||||
ABECD8EA13C8B9E700B77CFD /* Copy Frameworks */,
|
||||
8D15AC330486D014006FF6A4 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
ABECD8D813C8B98D00B77CFD /* PBXTargetDependency */,
|
||||
);
|
||||
name = MarkdownLive;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
@@ -199,6 +344,24 @@
|
||||
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 */
|
||||
@@ -206,12 +369,20 @@
|
||||
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 */
|
||||
@@ -226,6 +397,16 @@
|
||||
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;
|
||||
};
|
||||
@@ -238,20 +419,47 @@
|
||||
files = (
|
||||
8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */,
|
||||
8D15AC320486D014006FF6A4 /* main.m in Sources */,
|
||||
795F6C4F105D6EC400D1F90A /* mkdio.c in Sources */,
|
||||
795F6C51105D6ECE00D1F90A /* markdown.c in Sources */,
|
||||
795F6C53105D6ED800D1F90A /* generate.c in Sources */,
|
||||
795F6C55105D6EE100D1F90A /* resource.c in Sources */,
|
||||
795F6C62105D6F6E00D1F90A /* xml.c in Sources */,
|
||||
795F6C66105D6F8500D1F90A /* Csio.c in Sources */,
|
||||
795F6DBA105D75D300D1F90A /* discountWrapper.m in Sources */,
|
||||
795F6DBB105D75D300D1F90A /* markdownWrapper.c in Sources */,
|
||||
795F6DBC105D75D300D1F90A /* mkdioWrapper.c 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 */,
|
||||
);
|
||||
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;
|
||||
@@ -288,11 +496,68 @@
|
||||
/* 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;
|
||||
@@ -301,7 +566,9 @@
|
||||
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;
|
||||
};
|
||||
@@ -310,12 +577,15 @@
|
||||
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;
|
||||
};
|
||||
@@ -323,14 +593,25 @@
|
||||
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;
|
||||
SDKROOT = macosx10.6;
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/discount-1.5.4\"";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -338,18 +619,42 @@
|
||||
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;
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/discount-1.5.4\"";
|
||||
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 = (
|
||||
|
||||
+13
-2
@@ -1,11 +1,22 @@
|
||||
/*******************************************************************************
|
||||
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 NSTextView *markdownSourceTextView;
|
||||
IBOutlet RKSyntaxView *markdownSourceTextView;
|
||||
IBOutlet WebView *htmlPreviewWebView;
|
||||
|
||||
NSMutableAttributedString *markdownSource;
|
||||
NSTextStorage *markdownSource;
|
||||
|
||||
NSTimeInterval whenToUpdatePreview;
|
||||
NSTimer *htmlPreviewTimer;
|
||||
|
||||
+187
-66
@@ -1,86 +1,133 @@
|
||||
/*******************************************************************************
|
||||
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"
|
||||
|
||||
NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
|
||||
@interface NSResponder (scrollToEndOfDocument)
|
||||
- (IBAction)scrollToEndOfDocument:(id)sender; // For some reason this isn't declared anywhere in AppKit.
|
||||
// class extension
|
||||
@interface MyDocument ()
|
||||
|
||||
- (void)updateContent;
|
||||
- (void)htmlPreviewTimer:(NSTimer*)timer_;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MyDocument
|
||||
|
||||
- (NSString*)markdown2html:(NSString*)markdown_ {
|
||||
if (!markdown_)
|
||||
return @"";
|
||||
|
||||
#if 0
|
||||
NSString *result = nil;
|
||||
|
||||
char *markdownUTF8 = (char*)[markdown_ UTF8String];
|
||||
Document *document = mkd_string(markdownUTF8, strlen(markdownUTF8), 0);
|
||||
if (document) {
|
||||
if (mkd_compile(document, 0)) {
|
||||
char *htmlUTF8;
|
||||
int htmlUTF8Len = mkd_document(document, &htmlUTF8);
|
||||
if (htmlUTF8Len != EOF) {
|
||||
result = [[[NSString alloc] initWithBytes:htmlUTF8
|
||||
length:htmlUTF8Len
|
||||
encoding:NSUTF8StringEncoding] autorelease];
|
||||
}
|
||||
mkd_cleanup(document);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
#else
|
||||
return discountToHTML(markdown_);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
markdownSource = [[NSMutableAttributedString alloc] initWithString:@""
|
||||
attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:9.0]
|
||||
forKey:NSFontAttributeName]];
|
||||
self = [super init];
|
||||
if (self) {
|
||||
markdownSource = [[NSTextStorage alloc] init];
|
||||
whenToUpdatePreview = [[NSDate distantFuture] timeIntervalSinceReferenceDate];
|
||||
htmlPreviewTimer = [NSTimer scheduledTimerWithTimeInterval:0.1
|
||||
target:self
|
||||
selector:@selector(htmlPreviewTimer:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
return self;
|
||||
|
||||
[[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;
|
||||
}
|
||||
|
||||
- (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];
|
||||
}
|
||||
[super windowControllerDidLoadNib:controller_];
|
||||
- (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_];
|
||||
}
|
||||
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_ ofType:(NSString*)typeName_ error:(NSError**)error_ {
|
||||
BOOL result = NO;
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_
|
||||
ofType:(NSString*)typeName_
|
||||
forSaveOperation:(NSSaveOperationType)saveOperation_
|
||||
originalContentsURL:(NSURL*)absoluteOriginalContentsURL_
|
||||
error:(NSError **)error_
|
||||
{
|
||||
BOOL result = NO;
|
||||
if ([typeName_ isEqualToString:kMarkdownDocumentType]) {
|
||||
[markdownSourceTextView breakUndoCoalescing];
|
||||
result = [[markdownSource string] writeToURL:absoluteURL_
|
||||
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;
|
||||
}
|
||||
@@ -95,9 +142,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
if (!error) {
|
||||
NSAssert(markdownSourceString, nil);
|
||||
[markdownSource release];
|
||||
markdownSource = [[NSMutableAttributedString alloc] initWithString:markdownSourceString
|
||||
attributes:[NSDictionary dictionaryWithObject:[NSFont fontWithName:@"Monaco" size:9.0]
|
||||
forKey:NSFontAttributeName]];
|
||||
markdownSource = [[NSTextStorage alloc] initWithString:markdownSourceString];
|
||||
NSAssert(markdownSource, nil);
|
||||
whenToUpdatePreview = [NSDate timeIntervalSinceReferenceDate] + 0.5;
|
||||
result = YES;
|
||||
@@ -108,43 +153,119 @@ 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];
|
||||
|
||||
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];
|
||||
[self updateContent];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)webView:(WebView*)sender_ didFinishLoadForFrame:(WebFrame*)frame_ {
|
||||
|
||||
#pragma unused(sender_)
|
||||
|
||||
if ([htmlPreviewWebView mainFrame] == frame_ && hasSavedOrigin) {
|
||||
hasSavedOrigin = NO;
|
||||
if (savedAtBottom)
|
||||
[[frame_ frameView] scrollToEndOfDocument:nil];
|
||||
[[[frame_ frameView] documentView] scrollPoint:NSMakePoint(savedOrigin.x, CGFLOAT_MAX)];
|
||||
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:[self markdown2html:[markdownSource string]] forType:NSStringPboardType];
|
||||
[[NSPasteboard generalPasteboard] setString:[ORCDiscount markdown2HTML:[markdownSource string]] forType:NSStringPboardType];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// NSColor+HexRGB.h
|
||||
// TextDo
|
||||
//
|
||||
// Created by Vojto Rinik on 28.6.2011.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSColor (NSColor_HexRGB)
|
||||
|
||||
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// NSColor+HexRGB.m
|
||||
// TextDo
|
||||
//
|
||||
// Created by Vojto Rinik on 28.6.2011.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSColor+HexRGB.h"
|
||||
|
||||
|
||||
@implementation NSColor (NSColor_HexRGB)
|
||||
|
||||
+ (NSColor *) colorFromHexRGB:(NSString *) inColorString {
|
||||
NSColor *result = nil;
|
||||
unsigned int colorCode = 0;
|
||||
unsigned char redByte, greenByte, blueByte;
|
||||
|
||||
if (nil != inColorString)
|
||||
{
|
||||
NSScanner *scanner = [NSScanner scannerWithString:inColorString];
|
||||
(void) [scanner scanHexInt:&colorCode]; // ignore error
|
||||
}
|
||||
redByte = (unsigned char) (colorCode >> 16);
|
||||
greenByte = (unsigned char) (colorCode >> 8);
|
||||
blueByte = (unsigned char) (colorCode); // masks off high bits
|
||||
result = [NSColor
|
||||
colorWithCalibratedRed: (float)redByte / 0xff
|
||||
green: (float)greenByte/ 0xff
|
||||
blue: (float)blueByte / 0xff
|
||||
alpha:1.0];
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>colors</key>
|
||||
<dict>
|
||||
<key>title3</key>
|
||||
<string>6C71C4</string>
|
||||
<key>em</key>
|
||||
<string>859900</string>
|
||||
<key>strong</key>
|
||||
<string>48595f</string>
|
||||
<key>code</key>
|
||||
<string>2AA198</string>
|
||||
<key>codeBackground</key>
|
||||
<string>EEE8D5</string>
|
||||
<key>highlight</key>
|
||||
<string>EEE8D5</string>
|
||||
<key>background</key>
|
||||
<string>FDF6E3</string>
|
||||
<key>checked</key>
|
||||
<string>8e8e8e</string>
|
||||
<key>default</key>
|
||||
<string>586E75</string>
|
||||
<key>subtitle</key>
|
||||
<string>268BD2</string>
|
||||
<key>title</key>
|
||||
<string>DC322F</string>
|
||||
<key>zone</key>
|
||||
<string>f21bea</string>
|
||||
</dict>
|
||||
<key>font</key>
|
||||
<string>Menlo</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>todo-zone</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>zone</string>
|
||||
<key>pattern</key>
|
||||
<string>^●\s*.*$</string>
|
||||
</dict>
|
||||
<key>todo-checked</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>checked</string>
|
||||
<key>pattern</key>
|
||||
<string>^✓\s*.*$</string>
|
||||
</dict>
|
||||
<key>todo-unchecked</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>default</string>
|
||||
<key>pattern</key>
|
||||
<string>^☐\s*.*$</string>
|
||||
</dict>
|
||||
<key>list-item</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>default</string>
|
||||
<key>pattern</key>
|
||||
<string>^\*\s+.*$</string>
|
||||
</dict>
|
||||
<key>markdown-header-1</key>
|
||||
<dict>
|
||||
<key>size</key>
|
||||
<integer>14</integer>
|
||||
<key>isBold</key>
|
||||
<true/>
|
||||
<key>color</key>
|
||||
<string>title</string>
|
||||
<key>pattern</key>
|
||||
<string>^(# )(.*?)($| #+$)</string>
|
||||
</dict>
|
||||
<key>markdown-header-2</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>subtitle</string>
|
||||
<key>isBold</key>
|
||||
<true/>
|
||||
<key>pattern</key>
|
||||
<string>^(## )(.*?)($| #+$)</string>
|
||||
</dict>
|
||||
<key>markdown-em</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>em</string>
|
||||
<key>patternGroup</key>
|
||||
<integer>2</integer>
|
||||
<key>pattern</key>
|
||||
<string>(^|[^\*])(\*[^\s\*]([^\*\n]+)\*)</string>
|
||||
</dict>
|
||||
<key>markdown-strong</key>
|
||||
<dict>
|
||||
<key>isBold</key>
|
||||
<true/>
|
||||
<key>color</key>
|
||||
<string>strong</string>
|
||||
<key>pattern</key>
|
||||
<string>\*{2}(.+?)\*{2}</string>
|
||||
</dict>
|
||||
<key>markdown-header-3</key>
|
||||
<dict>
|
||||
<key>color</key>
|
||||
<string>title3</string>
|
||||
<key>isBold</key>
|
||||
<true/>
|
||||
<key>pattern</key>
|
||||
<string>^(### )(.*?)($| #+$)</string>
|
||||
</dict>
|
||||
<key>code</key>
|
||||
<dict>
|
||||
<key>patternGroup</key>
|
||||
<integer>1</integer>
|
||||
<key>backgroundColor</key>
|
||||
<string>codeBackground</string>
|
||||
<key>color</key>
|
||||
<string>code</string>
|
||||
<key>pattern</key>
|
||||
<string>^ {4}(.*?)$</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// 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
|
||||
@@ -0,0 +1,19 @@
|
||||
## About my fork
|
||||
|
||||
Adds beautiful syntax highlighting to MarkdownLive.
|
||||
|
||||

|
||||
|
||||
[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
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// RKSyntaxView.h
|
||||
//
|
||||
//
|
||||
// Created by Vojto Rinik on 8/24/11.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
@interface RKSyntaxView : NSTextView {
|
||||
NSDictionary *_scheme;
|
||||
NSDictionary *_syntax;
|
||||
|
||||
NSMutableAttributedString *_content;
|
||||
}
|
||||
|
||||
@property (retain) NSDictionary *scheme;
|
||||
@property (retain) NSDictionary *syntax;
|
||||
@property (retain) NSMutableAttributedString *content;
|
||||
|
||||
- (void) _setup;
|
||||
|
||||
#pragma mark - Handling text change
|
||||
- (void) _textDidChange:(NSNotification *)notif;
|
||||
|
||||
#pragma mark - Highlighting
|
||||
- (void) highlight;
|
||||
- (void) highlightRange:(NSRange)range;
|
||||
|
||||
#pragma mark - Scheme
|
||||
- (void) loadScheme:(NSString *)schemeFilename;
|
||||
- (NSColor *) _colorFor:(NSString *)key;
|
||||
- (NSFont *) _font;
|
||||
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold;
|
||||
|
||||
#pragma mark - Syntax
|
||||
- (void) loadSyntax:(NSString *)syntaxFilename;
|
||||
|
||||
#pragma mark - Changing text attributes
|
||||
- (void) _setTextColor:(NSColor *)color range:(NSRange)range;
|
||||
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range;
|
||||
- (void) _setFont:(NSFont *)font range:(NSRange)range;
|
||||
- (void) _reflect;
|
||||
|
||||
@end
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
//
|
||||
// RKSyntaxView.m
|
||||
//
|
||||
//
|
||||
// Created by Vojto Rinik on 8/24/11.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RKSyntaxView.h"
|
||||
#import "NSColor+HexRGB.h"
|
||||
|
||||
@implementation RKSyntaxView
|
||||
|
||||
@synthesize scheme=_scheme;
|
||||
@synthesize syntax=_syntax;
|
||||
@synthesize content=_content;
|
||||
|
||||
#pragma mark - Lifecycle
|
||||
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
[self _setup];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[self _setup];
|
||||
}
|
||||
|
||||
- (void)_setup {
|
||||
self.content = [[[NSMutableAttributedString alloc] init] autorelease];
|
||||
[self setTextContainerInset:NSMakeSize(10.0, 10.0)];
|
||||
[self highlight];
|
||||
|
||||
[self addObserver:self forKeyPath:@"string" options:0 context:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_textDidChange:) name:NSTextDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
self.content = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#pragma mark - Handling text changes
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
||||
[self highlight];
|
||||
}
|
||||
|
||||
- (void)_textDidChange:(NSNotification *)notif {
|
||||
[self highlight];
|
||||
}
|
||||
|
||||
#pragma mark - Scheme
|
||||
|
||||
- (void)loadScheme:(NSString *)schemeFilename {
|
||||
NSString *schemePath = [[NSBundle mainBundle] pathForResource:schemeFilename ofType:@"plist" inDirectory:nil];
|
||||
self.scheme = [NSDictionary dictionaryWithContentsOfFile:schemePath];
|
||||
}
|
||||
|
||||
- (NSColor *) _colorFor:(NSString *)key {
|
||||
NSString *colorCode = [[self.scheme objectForKey:@"colors"] objectForKey:key];
|
||||
if (!colorCode) return nil;
|
||||
NSColor *color = [NSColor colorFromHexRGB:colorCode];
|
||||
return color;
|
||||
}
|
||||
|
||||
- (NSFont *) _font {
|
||||
return [self _fontOfSize:12 bold:NO];
|
||||
}
|
||||
|
||||
- (NSFont *) _fontOfSize:(NSInteger)size bold:(BOOL)wantsBold {
|
||||
NSString *fontName = [self.scheme objectForKey:@"font"];
|
||||
NSFont *font = [NSFont fontWithName:fontName size:size];
|
||||
if (!font) font = [NSFont systemFontOfSize:size];
|
||||
|
||||
if (wantsBold) {
|
||||
NSFontTraitMask traits = NSBoldFontMask;
|
||||
NSFontManager *manager = [NSFontManager sharedFontManager];
|
||||
font = [manager fontWithFamily:fontName traits:traits weight:5.0 size:size];
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
#pragma mark - Syntax
|
||||
|
||||
- (void)loadSyntax:(NSString *)syntaxFilename {
|
||||
NSString *schemePath = [[NSBundle mainBundle] pathForResource:syntaxFilename ofType:@"plist" inDirectory:nil];
|
||||
self.syntax = [NSDictionary dictionaryWithContentsOfFile:schemePath];
|
||||
}
|
||||
|
||||
#pragma mark - Highlighting
|
||||
|
||||
- (void) highlight {
|
||||
self.content = [[NSMutableAttributedString alloc] initWithString:[self string]];
|
||||
[self.content release];
|
||||
|
||||
NSColor *background = [self _colorFor:@"background"];
|
||||
[self setBackgroundColor:background];
|
||||
[(NSScrollView *)self.superview setBackgroundColor:background];
|
||||
[self setTextColor:[self _colorFor:@"default"]];
|
||||
|
||||
return [self highlightRange:NSMakeRange(0, [self.content length])];
|
||||
}
|
||||
|
||||
- (void) highlightRange:(NSRange)range {
|
||||
NSColor *defaultColor = [self _colorFor:@"default"];
|
||||
NSInteger defaultSize = [(NSNumber *)[self.scheme objectForKey:@"size"] integerValue];
|
||||
if (!defaultSize) defaultSize = 12;
|
||||
NSFont *defaultFont = [self _fontOfSize:defaultSize bold:NO];
|
||||
[self _setFont:defaultFont range:range];
|
||||
[self _setTextColor:defaultColor range:range];
|
||||
[self _setBackgroundColor:[NSColor clearColor] range:range];
|
||||
|
||||
NSString *string = [self.content string];
|
||||
|
||||
for (NSString *type in [self.syntax allKeys]) {
|
||||
NSDictionary *params = [self.syntax objectForKey:type];
|
||||
NSString *pattern = [params objectForKey:@"pattern"];
|
||||
NSString *colorName = [params objectForKey:@"color"];
|
||||
NSColor *color = [self _colorFor:colorName];
|
||||
NSString *backgroundColorName = [params objectForKey:@"backgroundColor"];
|
||||
NSColor *backgroundColor = [self _colorFor:backgroundColorName];
|
||||
NSInteger size = [(NSNumber *)[params objectForKey:@"size"] integerValue];
|
||||
BOOL isBold = [(NSNumber *)[params objectForKey:@"isBold"] boolValue];
|
||||
NSFont *font = [self _fontOfSize:(size?size:defaultSize) bold:isBold];
|
||||
NSInteger patternGroup = [(NSNumber *)[params objectForKey:@"patternGroup"] integerValue];
|
||||
|
||||
NSError *error = nil;
|
||||
NSRegularExpression *expr = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive|NSRegularExpressionAnchorsMatchLines error:&error];
|
||||
NSArray *matches = [expr matchesInString:string options:0 range:range];
|
||||
for (NSTextCheckingResult *match in matches) {
|
||||
NSRange range = patternGroup ? [match rangeAtIndex:patternGroup] : [match range];
|
||||
[self _setTextColor:color range:range];
|
||||
if (backgroundColor) [self _setBackgroundColor:backgroundColor range:range];
|
||||
[self _setFont:font range:range];
|
||||
}
|
||||
}
|
||||
|
||||
[self _reflect];
|
||||
}
|
||||
|
||||
#pragma mark - Changing text attributes
|
||||
|
||||
- (void) _setTextColor:(NSColor *)color range:(NSRange)range {
|
||||
if (!color) return;
|
||||
[self.content addAttribute:NSForegroundColorAttributeName value:color range:range];
|
||||
}
|
||||
|
||||
- (void) _setBackgroundColor:(NSColor *)color range:(NSRange)range {
|
||||
[self.content addAttribute:NSBackgroundColorAttributeName value:color range:range];
|
||||
}
|
||||
|
||||
- (void) _setFont:(NSFont *)font range:(NSRange)range {
|
||||
[self.content addAttribute:NSFontAttributeName value:font range:range];
|
||||
}
|
||||
|
||||
- (void) _reflect {
|
||||
NSTextStorage *storage = [self textStorage];
|
||||
NSAttributedString *content = self.content;
|
||||
NSRange range = NSMakeRange(0, [content length]);
|
||||
[content enumerateAttributesInRange:range options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop){
|
||||
[storage setAttributes:attributes range:range];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,96 +0,0 @@
|
||||
CC=cc -I. -L.
|
||||
AR=/usr/bin/ar
|
||||
RANLIB=/usr/bin/ranlib
|
||||
|
||||
BINDIR=/usr/local/bin
|
||||
MANDIR=/usr/local/man
|
||||
LIBDIR=/usr/local/lib
|
||||
INCDIR=/usr/local/include
|
||||
|
||||
PGMS=markdown
|
||||
SAMPLE_PGMS=mkd2html makepage
|
||||
SAMPLE_PGMS+= theme
|
||||
MKDLIB=libmarkdown.a
|
||||
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
|
||||
|
||||
all: $(PGMS) $(SAMPLE_PGMS)
|
||||
|
||||
install: $(PGMS)
|
||||
/usr/bin/install -s -m 755 $(PGMS) $(DESTDIR)/$(BINDIR)
|
||||
/usr/bin/install -m 444 $(MKDLIB) $(DESTDIR)/$(LIBDIR)
|
||||
/usr/bin/install -m 444 mkdio.h $(DESTDIR)/$(INCDIR)
|
||||
|
||||
install.everything: install install.samples install.man
|
||||
|
||||
install.samples: $(SAMPLE_PGMS) install
|
||||
/usr/bin/install -s -m 755 $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
|
||||
/Users/wolf/Downloads/discount-1.5.4/config.md $(DESTDIR)/$(MANDIR)/man1
|
||||
/usr/bin/install -m 444 theme.1 $(DESTDIR)/$(MANDIR)/man1
|
||||
|
||||
install.man:
|
||||
/Users/wolf/Downloads/discount-1.5.4/config.md $(DESTDIR)/$(MANDIR)/man3
|
||||
/usr/bin/install -m 444 mkd-functions.3 markdown.3 mkd-line.3 $(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
|
||||
/Users/wolf/Downloads/discount-1.5.4/config.md $(DESTDIR)/$(MANDIR)/man7
|
||||
/usr/bin/install -m 444 markdown.7 mkd-extensions.7 $(DESTDIR)/$(MANDIR)/man7
|
||||
/Users/wolf/Downloads/discount-1.5.4/config.md $(DESTDIR)/$(MANDIR)/man1
|
||||
/usr/bin/install -m 444 markdown.1 $(DESTDIR)/$(MANDIR)/man1
|
||||
|
||||
install.everything: install install.man
|
||||
|
||||
version.o: version.c VERSION
|
||||
$(CC) -DVERSION=\"`cat VERSION`\" -c version.c
|
||||
|
||||
markdown: main.o $(MKDLIB)
|
||||
$(CC) -o markdown main.o -lmarkdown
|
||||
|
||||
# example programs
|
||||
theme: theme.o $(MKDLIB) mkdio.h
|
||||
$(CC) -o theme theme.o -lmarkdown
|
||||
|
||||
|
||||
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
|
||||
$(CC) -o mkd2html mkd2html.o -lmarkdown
|
||||
|
||||
makepage: makepage.c $(MKDLIB) mkdio.h
|
||||
$(CC) -o makepage makepage.c -lmarkdown
|
||||
|
||||
main.o: main.c mkdio.h config.h
|
||||
$(CC) -I. -c main.c
|
||||
|
||||
$(MKDLIB): $(OBJS)
|
||||
$(AR) crv $(MKDLIB) $(OBJS)
|
||||
$(RANLIB) $(MKDLIB)
|
||||
|
||||
test: $(PGMS) echo cols
|
||||
@for x in tests/*.t; do \
|
||||
sh $$x || exit 1; \
|
||||
done
|
||||
|
||||
cols: tools/cols.c
|
||||
$(CC) -o cols tools/cols.c
|
||||
echo: tools/echo.c
|
||||
$(CC) -o echo tools/echo.c
|
||||
|
||||
clean:
|
||||
rm -f $(PGMS) $(SAMPLE_PGMS) *.o $(MKDLIB)
|
||||
|
||||
distclean spotless: clean
|
||||
rm -f Makefile version.c markdown.1 config.cmd config.sub config.h config.mak config.log config.md
|
||||
|
||||
markdown.o: markdown.c config.h cstring.h markdown.h
|
||||
generate.o: generate.c config.h cstring.h markdown.h
|
||||
dumptree.o: dumptree.c cstring.h markdown.h
|
||||
mkdio.o: mkdio.c mkdio.h cstring.h config.h
|
||||
xmlpage.o: xmlpage.c mkdio.h cstring.h config.h
|
||||
toc.o: toc.c mkdio.h cstring.h config.h
|
||||
@@ -1,96 +0,0 @@
|
||||
CC=@CC@ -I. -L.
|
||||
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.a
|
||||
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 @AMALLOC@
|
||||
|
||||
all: $(PGMS) $(SAMPLE_PGMS)
|
||||
|
||||
install: $(PGMS)
|
||||
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)/$(BINDIR)
|
||||
@INSTALL_DATA@ $(MKDLIB) $(DESTDIR)/$(LIBDIR)
|
||||
@INSTALL_DATA@ mkdio.h $(DESTDIR)/$(INCDIR)
|
||||
|
||||
install.everything: install install.samples install.man
|
||||
|
||||
install.samples: $(SAMPLE_PGMS) install
|
||||
@INSTALL_PROGRAM@ $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
|
||||
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
|
||||
@INSTALL_DATA@ theme.1 $(DESTDIR)/$(MANDIR)/man1
|
||||
|
||||
install.man:
|
||||
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man3
|
||||
@INSTALL_DATA@ mkd-functions.3 markdown.3 mkd-line.3 $(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
|
||||
|
||||
version.o: version.c VERSION
|
||||
$(CC) -DVERSION=\"`cat VERSION`\" -c version.c
|
||||
|
||||
markdown: main.o $(MKDLIB)
|
||||
$(CC) -o markdown main.o -lmarkdown @LIBS@
|
||||
|
||||
# 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@
|
||||
|
||||
makepage: makepage.c $(MKDLIB) mkdio.h
|
||||
$(CC) -o makepage makepage.c -lmarkdown @LIBS@
|
||||
|
||||
main.o: main.c mkdio.h config.h
|
||||
$(CC) -I. -c main.c
|
||||
|
||||
$(MKDLIB): $(OBJS)
|
||||
$(AR) crv $(MKDLIB) $(OBJS)
|
||||
$(RANLIB) $(MKDLIB)
|
||||
|
||||
test: $(PGMS) echo cols
|
||||
@for x in tests/*.t; do \
|
||||
sh $$x || exit 1; \
|
||||
done
|
||||
|
||||
cols: tools/cols.c
|
||||
$(CC) -o cols tools/cols.c
|
||||
echo: tools/echo.c
|
||||
$(CC) -o echo tools/echo.c
|
||||
|
||||
clean:
|
||||
rm -f $(PGMS) $(SAMPLE_PGMS) *.o $(MKDLIB)
|
||||
|
||||
distclean spotless: clean
|
||||
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@
|
||||
|
||||
markdown.o: markdown.c config.h cstring.h markdown.h
|
||||
generate.o: generate.c config.h cstring.h markdown.h
|
||||
dumptree.o: dumptree.c cstring.h markdown.h
|
||||
mkdio.o: mkdio.c mkdio.h cstring.h config.h
|
||||
xmlpage.o: xmlpage.c mkdio.h cstring.h config.h
|
||||
toc.o: toc.c mkdio.h cstring.h config.h
|
||||
@@ -1 +0,0 @@
|
||||
1.5.4
|
||||
@@ -1,2 +0,0 @@
|
||||
#! /bin/sh
|
||||
configure.sh
|
||||
@@ -1,35 +0,0 @@
|
||||
[echo ...Configuring for [markdown]
|
||||
Looking for cpp
|
||||
CPP=[/usr/bin/cpp], CPPFLAGS=[]
|
||||
looking for install
|
||||
(/usr/bin/install)
|
||||
checking out the C compiler
|
||||
checking for "volatile" keyword
|
||||
checking for "const" keyword
|
||||
defining WORD & DWORD scalar types
|
||||
/tmp/pd717.c: In function ‘main’:
|
||||
/tmp/pd717.c:13: warning: incompatible implicit declaration of built-in function ‘exit’
|
||||
/tmp/ngc717.c: In function ‘main’:
|
||||
/tmp/ngc717.c:5: warning: initialization makes pointer from integer without a cast
|
||||
/tmp/ngc717.c:6: warning: initialization makes pointer from integer without a cast
|
||||
./configure.inc: line 1058: 857 Segmentation fault /tmp/ngc$$
|
||||
looking for header pwd.h
|
||||
looking for the getpwuid function
|
||||
looking for the srandom function
|
||||
looking for the random function
|
||||
looking for the strcasecmp function
|
||||
looking for the strncasecmp function
|
||||
looking for the fchdir function
|
||||
looking for header malloc.h
|
||||
test failed: command was cc -c -o /tmp/doto717.o /tmp/ngc717.c
|
||||
output:
|
||||
/tmp/ngc717.c:2:20: error: malloc.h: No such file or directory
|
||||
offending sources:
|
||||
/tmp/ngc717.c:
|
||||
/* AC_CHECK_HEADERS */
|
||||
#include <malloc.h>
|
||||
main() { }
|
||||
sed is /usr/bin/sed
|
||||
generating Makefile
|
||||
generating version.c
|
||||
generating markdown.1
|
||||
@@ -1 +0,0 @@
|
||||
HAVE_SED = 1
|
||||
@@ -1,5 +0,0 @@
|
||||
#! /bin/sh
|
||||
# script generated Sun Sep 13 13:13:07 CDT 2009 by configure.sh
|
||||
|
||||
test -d "$1" || mkdir -p "$1"
|
||||
exit 0
|
||||
Vendored
-27
@@ -1,27 +0,0 @@
|
||||
s;@CPP@;/usr/bin/cpp;g
|
||||
s;@CPPFLAGS@;;g
|
||||
s;@INSTALL@;/usr/bin/install;g
|
||||
s;@INSTALL_PROGRAM@;/usr/bin/install -s -m 755;g
|
||||
s;@INSTALL_DATA@;/usr/bin/install -m 444;g
|
||||
s;@INSTALL_DIR@;/Users/wolf/Downloads/discount-1.5.4/config.md;g
|
||||
s;@CC@;cc;g
|
||||
s;@AR@;/usr/bin/ar;g
|
||||
s;@RANLIB@;/usr/bin/ranlib;g
|
||||
s;@THEME@;;g
|
||||
s;@TABSTOP@;4;g
|
||||
s;@AMALLOC@;;g
|
||||
s;@STRICT@;.\";g
|
||||
s;@LIBS@;;g
|
||||
s;@CONFIGURE_FILES@;config.cmd config.sub config.h config.mak config.log config.md;g
|
||||
s;@GENERATED_FILES@;Makefile version.c markdown.1;g
|
||||
s;@CFLAGS@;-g;g
|
||||
s;@LDFLAGS@;-g;g
|
||||
s;@srcdir@;/Users/wolf/Downloads/discount-1.5.4;g
|
||||
s;@prefix@;/usr/local;g
|
||||
s;@exedir@;/usr/local/bin;g
|
||||
s;@sbindir@;/usr/local/sbin;g
|
||||
s;@libdir@;/usr/local/lib;g
|
||||
s;@libexec@;/usr/local/lib;g
|
||||
s;@confdir@;/etc;g
|
||||
s;@mandir@;/usr/local/man;g
|
||||
s;@SED@;/usr/bin/sed;g
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* makepage: Use mkd_xhtmlpage() to convert markdown input to a
|
||||
* fully-formed xhtml page.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <mkdio.h>
|
||||
|
||||
float
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
MMIOT *doc;
|
||||
|
||||
if ( (argc > 1) && !freopen(argv[1], "r", stdin) ) {
|
||||
perror(argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( (doc = mkd_in(stdin, 0)) == 0 ) {
|
||||
perror( (argc > 1) ? argv[1] : "stdin" );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(mkd_xhtmlpage(doc, 0, stdout));
|
||||
}
|
||||
@@ -1,128 +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 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 begining with / will be prefixed with
|
||||
.Ar url-base
|
||||
in the output.
|
||||
.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 +
|
||||
(set) prefix on each flag.
|
||||
.Bl -tag -width "NOHEADER"
|
||||
.It Ar noimage
|
||||
Don't allow image tags.
|
||||
.It Ar nolinks
|
||||
Don't allow links.
|
||||
.It Ar nohtml
|
||||
Don't allow
|
||||
.B any
|
||||
embedded html.
|
||||
.It Ar cdata
|
||||
Generate valid XML output.
|
||||
.It Ar noheader
|
||||
Do not process pandoc headers.
|
||||
.It Ar notables
|
||||
Do not process Markdown Extra-style tables.
|
||||
.It Ar tabstops
|
||||
Use markdown-standard 4-space tabstops.
|
||||
@STRICT@.It Ar strict
|
||||
@STRICT@Disable superscript and relaxed emphasis.
|
||||
@STRICT@.It Ar relax
|
||||
@STRICT@Enable superscript and relaxed emphasis (this is the default.)
|
||||
.It Ar toc
|
||||
Enable table-of-contents support
|
||||
.It Ar 1.0
|
||||
Revert to Markdown 1.0 compatability.
|
||||
.El
|
||||
.Pp
|
||||
As an example, the option
|
||||
.Fl f Ar nolinks,quot
|
||||
tells
|
||||
.Nm
|
||||
to not allow \<a tags, and to expand
|
||||
double-quotes.
|
||||
.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 configuration data.
|
||||
.Pp
|
||||
If the version includes the string
|
||||
.Em DL_TAG ,
|
||||
.Nm
|
||||
was configured with definition list support.
|
||||
.Pp
|
||||
If the version includes the string
|
||||
.Em HEADER ,
|
||||
.Nm
|
||||
was configured to support pandoc header blocks.
|
||||
.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
|
||||
@@ -1,79 +0,0 @@
|
||||
#ifndef _MKDIO_D
|
||||
#define _MKDIO_D
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef void MMIOT;
|
||||
|
||||
/* line builder for markdown()
|
||||
*/
|
||||
MMIOT *mkd_in(FILE*,int); /* assemble input from a file */
|
||||
MMIOT *mkd_string(char*,int,int); /* assemble input from a buffer */
|
||||
|
||||
void mkd_basename(MMIOT*,char*);
|
||||
|
||||
/* compilation, debugging, cleanup
|
||||
*/
|
||||
int mkd_compile(MMIOT*, int);
|
||||
int mkd_cleanup(MMIOT*);
|
||||
|
||||
/* markup functions
|
||||
*/
|
||||
int mkd_dump(MMIOT*, FILE*, int, char*);
|
||||
int markdown(MMIOT*, FILE*, int);
|
||||
int mkd_line(char *, int, char **, int);
|
||||
void mkd_string_to_anchor(char *, int, int (*)(int,void*), void*);
|
||||
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*, int);
|
||||
#define mkd_text mkd_generateline
|
||||
|
||||
/* version#.
|
||||
*/
|
||||
extern char markdown_version[];
|
||||
|
||||
/* special flags for markdown() and mkd_text()
|
||||
*/
|
||||
#define MKD_NOLINKS 0x0001 /* don't do link processing, block <a> tags */
|
||||
#define MKD_NOIMAGE 0x0002 /* don't do image processing, block <img> */
|
||||
#define MKD_NOPANTS 0x0004 /* don't run smartypants() */
|
||||
#define MKD_NOHTML 0x0008 /* don't allow raw html through AT ALL */
|
||||
#define MKD_STRICT 0x0010 /* disable SUPERSCRIPT, RELAXED_EMPHASIS */
|
||||
#define MKD_TAGTEXT 0x0020 /* process text inside an html tag; no
|
||||
* <em>, no <bold>, no html or [] expansion */
|
||||
#define MKD_NO_EXT 0x0040 /* don't allow pseudo-protocols */
|
||||
#define MKD_CDATA 0x0080 /* generate code for xml ![CDATA[...]] */
|
||||
#define MKD_NOTABLES 0x0400 /* disallow tables */
|
||||
#define MKD_TOC 0x1000 /* do table-of-contents processing */
|
||||
#define MKD_1_COMPAT 0x2000 /* compatability with MarkdownTest_1.0 */
|
||||
#define MKD_AUTOLINK 0x4000 /* make http://foo.com link even without <>s */
|
||||
#define MKD_SAFELINK 0x8000 /* paranoid check for link protocol */
|
||||
#define MKD_EMBED MKD_NOLINKS|MKD_NOIMAGE|MKD_TAGTEXT
|
||||
|
||||
/* special flags for mkd_in() and mkd_string()
|
||||
*/
|
||||
#define MKD_NOHEADER 0x0100 /* don't process header blocks */
|
||||
#define MKD_TABSTOP 0x0200 /* expand tabs to 4 spaces */
|
||||
|
||||
|
||||
#endif/*_MKDIO_D*/
|
||||
@@ -1,35 +0,0 @@
|
||||
./echo "backslash escapes"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got: $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
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>'
|
||||
|
||||
|
||||
exit $rc
|
||||
@@ -1,39 +0,0 @@
|
||||
./echo "code blocks"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try 'format for code block html' \
|
||||
' this is
|
||||
code' \
|
||||
'<pre><code>this is
|
||||
code
|
||||
</code></pre>'
|
||||
|
||||
try 'unclosed single backtick' '`hi there' '<p>`hi there</p>'
|
||||
try 'unclosed double backtick' '``hi there' '<p>``hi there</p>'
|
||||
try 'remove space around code' '`` hi there ``' '<p><code>hi there</code></p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,48 +0,0 @@
|
||||
./echo "crashes"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
./echo -n ' zero-length input ................ '
|
||||
|
||||
if ./markdown < /dev/null >/dev/null; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
./echo -n ' hanging quote in list ............ '
|
||||
|
||||
./markdown >/dev/null 2>/dev/null << EOF
|
||||
* > this should not die
|
||||
|
||||
no.
|
||||
EOF
|
||||
|
||||
if [ "$?" -eq 0 ]; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
./echo -n ' dangling list item ............... '
|
||||
|
||||
if ./echo ' - ' | ./markdown >/dev/null 2>/dev/null; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
./echo -n ' empty []() with baseurl .......... '
|
||||
|
||||
if ./markdown -bHOHO -s '[]()' >/dev/null 2>/dev/null; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,69 +0,0 @@
|
||||
./echo "definition lists"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
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 ./markdown -V | grep DL_TAG >/dev/null; then
|
||||
|
||||
try '=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>'
|
||||
|
||||
|
||||
else
|
||||
try '=tag= does nothing' "$SRC" \
|
||||
'<p>=this=</p>
|
||||
|
||||
<pre><code>is an ugly
|
||||
</code></pre>
|
||||
|
||||
<p>=test=</p>
|
||||
|
||||
<pre><code>eh?
|
||||
</code></pre>'
|
||||
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,40 +0,0 @@
|
||||
./echo "emphasis"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
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>'
|
||||
|
||||
if ./markdown -V | grep RELAXED >/dev/null; then
|
||||
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>'
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,52 +0,0 @@
|
||||
./echo "paragraph flow"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
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>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,34 +0,0 @@
|
||||
./echo "footnotes"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
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>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,31 +0,0 @@
|
||||
./echo "embedded images"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try 'image with size extension' \
|
||||
'' \
|
||||
'<p><img src="pic" height="200" width="200" alt="picture" /></p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,33 +0,0 @@
|
||||
./echo "misc"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try 'single paragraph' 'AAA' '<p>AAA</p>'
|
||||
try '< -> <' '<' '<p><</p>'
|
||||
try '`>` -> <code>></code>' '`>`' '<p><code>></code></p>'
|
||||
try '`` ` `` -> <code>`</code>' '`` ` ``' '<p><code>`</code></p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,74 +0,0 @@
|
||||
./echo "pandoc headers"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
HEADER='% title
|
||||
% author(s)
|
||||
% date'
|
||||
|
||||
|
||||
if ./markdown -V | grep HEADER > /dev/null; then
|
||||
|
||||
try 'valid header' "$HEADER" ''
|
||||
try -F0x0100 'valid header with -F0x0100' "$HEADER" '<p>% title
|
||||
% author(s)
|
||||
% date</p>'
|
||||
|
||||
try 'invalid header' \
|
||||
'% title
|
||||
% author(s)
|
||||
a pony!' \
|
||||
'<p>% title
|
||||
% author(s)
|
||||
a pony!</p>'
|
||||
|
||||
try 'offset header' \
|
||||
'
|
||||
% title
|
||||
% author(s)
|
||||
% date' \
|
||||
'<p>% title
|
||||
% author(s)
|
||||
% date</p>'
|
||||
|
||||
try 'indented header' \
|
||||
' % title
|
||||
% author(s)
|
||||
% date' \
|
||||
'<p> % title
|
||||
% author(s)
|
||||
% date</p>'
|
||||
|
||||
else
|
||||
|
||||
try 'ignore headers' "$HEADER" '<p>% title
|
||||
% author(s)
|
||||
% date</p>'
|
||||
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,38 +0,0 @@
|
||||
./echo "paragraph blocking"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try 'paragraph followed by code' \
|
||||
'a
|
||||
b' \
|
||||
'<p>a</p>
|
||||
|
||||
<pre><code>b
|
||||
</code></pre>'
|
||||
|
||||
try 'single-line paragraph' 'a' '<p>a</p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,31 +0,0 @@
|
||||
./echo "paranoia"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try -fsafelink 'bogus url (-fsafelink)' '[test](bad:protocol)' '<p>[test](bad:protocol)</p>'
|
||||
try -fnosafelink 'bogus url (-fnosafelink)' '[test](bad:protocol)' '<p><a href="bad:protocol">test</a></p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,64 +0,0 @@
|
||||
./echo "markup peculiarities"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try 'list followed by header .......... ' \
|
||||
"
|
||||
- AAA
|
||||
- BBB
|
||||
-" \
|
||||
'<ul>
|
||||
<li>AAA
|
||||
|
||||
<h2>– BBB</h2></li>
|
||||
</ul>'
|
||||
|
||||
try 'ul with mixed item prefixes' \
|
||||
'
|
||||
- A
|
||||
1. B' \
|
||||
'<ul>
|
||||
<li>A</li>
|
||||
<li>B</li>
|
||||
</ul>'
|
||||
|
||||
try 'ol with mixed item prefixes' \
|
||||
'
|
||||
1. A
|
||||
- B
|
||||
' \
|
||||
'<ol>
|
||||
<li>A</li>
|
||||
<li>B</li>
|
||||
</ol>'
|
||||
|
||||
try 'forcing a <br/>' 'this ' '<p>this<br/>
|
||||
</p>'
|
||||
|
||||
try 'trimming single spaces' 'this ' '<p>this</p>'
|
||||
try -fnohtml 'markdown <br/> with -fnohtml' 'foo ' '<p>foo<br/>
|
||||
</p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,34 +0,0 @@
|
||||
./echo "footnotes inside reparse sections"
|
||||
|
||||
rc=0
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
try 'footnote inside [] section' \
|
||||
'[![foo][]](bar)
|
||||
|
||||
[foo]: bar2' \
|
||||
'<p><a href="bar"><img src="bar2" alt="foo" /></a></p>'
|
||||
|
||||
exit $rc
|
||||
@@ -1,34 +0,0 @@
|
||||
./echo "The snakepit of Markdown.pl compatability"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
try '[](single quote) text (quote)' \
|
||||
"[foo](http://Poe's law) will make this fail ('no, it won't!') here."\
|
||||
'<p><a href="http://Poe" title="s law) will make this fail ('"'no, it won't!"'">foo</a> here.</p>'
|
||||
|
||||
try '[](unclosed <url)' '[foo](<http://no trailing gt)' \
|
||||
'<p><a href="http://no%20trailing%20gt">foo</a></p>'
|
||||
exit $rc
|
||||
@@ -1,32 +0,0 @@
|
||||
./echo "styles"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
./echo -n ' <style> blocks -- one line ....... '
|
||||
|
||||
count=`./echo '<style> ul {display:none;} </style>' | ./markdown|wc -c`
|
||||
|
||||
if [ $count -eq 1 ]; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
./echo -n ' <style> blocks -- multiline ...... '
|
||||
|
||||
ASK='<style>
|
||||
ul {display:none;}
|
||||
</style>'
|
||||
|
||||
count=`./echo "$ASK" | ./markdown | wc -c`
|
||||
|
||||
if [ $count -eq 1 ]; then
|
||||
./echo "ok"
|
||||
else
|
||||
./echo "FAILED"
|
||||
rc=1
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,66 +0,0 @@
|
||||
rc=0
|
||||
unset MARKDOWN_FLAGS
|
||||
unset MKD_TABSTOP
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
eval `./markdown -V | tr ' ' '\n' | grep TAB`
|
||||
|
||||
if [ "${TAB:-4}" -eq 8 ]; then
|
||||
./echo "dealing with tabstop derangement"
|
||||
|
||||
LIST='
|
||||
* A
|
||||
* B
|
||||
* C'
|
||||
|
||||
try 'markdown with TAB=8' \
|
||||
"$LIST" \
|
||||
'<ul>
|
||||
<li>A
|
||||
|
||||
<ul>
|
||||
<li>B
|
||||
|
||||
<ul>
|
||||
<li>C</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>'
|
||||
|
||||
try -F0x0200 'markdown with TAB=4' \
|
||||
"$LIST" \
|
||||
'<ul>
|
||||
<li>A
|
||||
|
||||
<ul>
|
||||
<li>B</li>
|
||||
<li>C</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>'
|
||||
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
@@ -1,41 +0,0 @@
|
||||
./echo "table-of-contents support"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=
|
||||
|
||||
try() {
|
||||
unset FLAGS
|
||||
|
||||
case "$1" in
|
||||
-*) FLAGS=$1
|
||||
shift ;;
|
||||
esac
|
||||
|
||||
./echo -n " $1" '..................................' | ./cols 36
|
||||
|
||||
Q=`./echo "$2" | ./markdown $FLAGS`
|
||||
|
||||
if [ "$3" = "$Q" ]; then
|
||||
./echo " ok"
|
||||
else
|
||||
./echo " FAILED"
|
||||
./echo "wanted: $3"
|
||||
./echo "got : $Q"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
try '-T -ftoc' 'table of contents' \
|
||||
'#H1
|
||||
hi' \
|
||||
'
|
||||
<ul>
|
||||
<li><a href="#H1">H1</a> </li>
|
||||
</ul>
|
||||
<h1 id="H1">H1</h1>
|
||||
|
||||
<p>hi</p>'
|
||||
|
||||
|
||||
exit $rc
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
char markdown_version[] = VERSION
|
||||
#if DL_TAG_EXTENSION
|
||||
" DL_TAG"
|
||||
#endif
|
||||
#if PANDOC_HEADER
|
||||
" HEADER"
|
||||
#endif
|
||||
#if 4 != 4
|
||||
" TAB=4"
|
||||
#endif
|
||||
#if USE_AMALLOC
|
||||
" DEBUG"
|
||||
#endif
|
||||
#if SUPERSCRIPT
|
||||
" SUPERSCRIPT"
|
||||
#endif
|
||||
#if RELAXED_EMPHASIS
|
||||
" RELAXED"
|
||||
#endif
|
||||
#if DIV_QUOTE
|
||||
" DIV"
|
||||
#endif
|
||||
#if ALPHA_LIST
|
||||
" AL"
|
||||
#endif
|
||||
;
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "config.h"
|
||||
|
||||
char markdown_version[] = VERSION
|
||||
#if DL_TAG_EXTENSION
|
||||
" DL_TAG"
|
||||
#endif
|
||||
#if PANDOC_HEADER
|
||||
" HEADER"
|
||||
#endif
|
||||
#if @TABSTOP@ != 4
|
||||
" TAB=@TABSTOP@"
|
||||
#endif
|
||||
#if USE_AMALLOC
|
||||
" DEBUG"
|
||||
#endif
|
||||
#if SUPERSCRIPT
|
||||
" SUPERSCRIPT"
|
||||
#endif
|
||||
#if RELAXED_EMPHASIS
|
||||
" RELAXED"
|
||||
#endif
|
||||
#if DIV_QUOTE
|
||||
" DIV"
|
||||
#endif
|
||||
#if ALPHA_LIST
|
||||
" AL"
|
||||
#endif
|
||||
;
|
||||
@@ -0,0 +1,19 @@
|
||||
# [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
|
||||
@@ -1,25 +1,28 @@
|
||||
/*
|
||||
* configuration for markdown, generated Sun Sep 13 13:13:06 CDT 2009
|
||||
* by wolf@wolf-mbp.local
|
||||
* configuration for markdown, generated Mon 11 Jul 2011 22:16:51 BST
|
||||
* by Jonathan@macbook-pro.local
|
||||
*/
|
||||
#ifndef __AC_MARKDOWN_D
|
||||
#define __AC_MARKDOWN_D 1
|
||||
|
||||
|
||||
#define OS_DARWIN 1
|
||||
#define DWORD unsigned int
|
||||
#define WORD unsigned short
|
||||
#define BYTE unsigned char
|
||||
#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 */
|
||||
@@ -0,0 +1,108 @@
|
||||
#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*/
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/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!"
|
||||
@@ -0,0 +1,130 @@
|
||||
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
|
||||
@@ -9,10 +9,10 @@ mkd_generateline \- convert Markdown text to HTML
|
||||
.B #include <mkdio.h>
|
||||
.PP
|
||||
.B
|
||||
MMIOT* mkd_in(FILE *input)
|
||||
MMIOT* mkd_in(FILE *input, int flags)
|
||||
.PP
|
||||
.B
|
||||
MMIOT* mkd_string(char *string, int size)
|
||||
MMIOT* mkd_string(char *buf, int size, int flags)
|
||||
.PP
|
||||
.B
|
||||
int markdown(MMIOT *doc, FILE *output, int flags)
|
||||
@@ -39,7 +39,7 @@ int mkd_xhtmlpage(MMIOT *document, int flags, FILE *output)
|
||||
int mkd_toc(MMIOT *document, char **doc)
|
||||
.PP
|
||||
.B
|
||||
void mkd_generatetoc(MMIOT *document, FILE *output)
|
||||
int mkd_generatetoc(MMIOT *document, FILE *output)
|
||||
.PP
|
||||
.B
|
||||
void mkd_cleanup(MMIOT*);
|
||||
@@ -1,5 +1,5 @@
|
||||
BIN=/$objtype/bin
|
||||
CC='cc -D_BSD_EXTENSION'
|
||||
CC='cc -D_BSD_EXTENSION -D_C99_SNPRINTF_EXTENSION'
|
||||
|
||||
markdown:
|
||||
ape/psh -c 'cd .. && make'
|
||||
@@ -0,0 +1 @@
|
||||
2.1.0
|
||||
@@ -100,7 +100,7 @@ adump()
|
||||
|
||||
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, p+1);
|
||||
fprintf(stderr, " [%.*s]\n", p->size, (char*)(p+1));
|
||||
}
|
||||
|
||||
if ( getenv("AMALLOC_STATISTICS") ) {
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
@@ -55,6 +55,13 @@ __ac_dirname() {
|
||||
}
|
||||
fi
|
||||
|
||||
__remove() {
|
||||
if [ \( -x "$1" \) -a "$__MACOS_DSYM" ]; then
|
||||
rm -rf "$1".dSYM
|
||||
fi
|
||||
rm -f "$@"
|
||||
}
|
||||
|
||||
ac_progname=$0
|
||||
ac_configure_command=
|
||||
Q=\'
|
||||
@@ -133,17 +140,17 @@ AC_CONTINUE () {
|
||||
__MAKEDOTO() {
|
||||
AC_PROG_CC
|
||||
|
||||
if $AC_CC -c -o /tmp/doto$$.o "$@" $AC_LIBS 2>/tmp/doto$$.err; then
|
||||
rm -f /tmp/doto$$.o /tmp/doto$$.err
|
||||
if $AC_CC -c -o ngc$$.o "$@" $AC_LIBS 2>ngc$$.err; then
|
||||
__remove ngc$$.o ngc$$.err
|
||||
TLOG " (found)"
|
||||
return 0
|
||||
fi
|
||||
rm -f /tmp/doto$$.o
|
||||
__remove ngc$$.o
|
||||
TLOG " (not found)"
|
||||
echo "test failed: command was $AC_CC -c -o /tmp/doto$$.o" "$@" $AC_LIBS
|
||||
echo "test failed: command was $AC_CC -c -o ngc$$.o" "$@" $AC_LIBS
|
||||
echo "output:"
|
||||
cat /tmp/doto$$.err
|
||||
rm -f /tmp/doto$$.err
|
||||
cat ngc$$.err
|
||||
__remove ngc$$.err
|
||||
echo "offending sources:"
|
||||
for x in "$@"; do
|
||||
echo "$x:"
|
||||
@@ -158,21 +165,21 @@ __MAKEDOTO() {
|
||||
#
|
||||
AC_CHECK_HEADERS () {
|
||||
|
||||
echo "/* AC_CHECK_HEADERS */" > /tmp/ngc$$.c
|
||||
echo "/* AC_CHECK_HEADERS */" > ngc$$.c
|
||||
for hdr in $*; do
|
||||
echo "#include <$hdr>" >> /tmp/ngc$$.c
|
||||
echo "#include <$hdr>" >> ngc$$.c
|
||||
done
|
||||
echo "main() { }" >> /tmp/ngc$$.c
|
||||
echo "main() { }" >> ngc$$.c
|
||||
|
||||
LOGN "looking for header $hdr"
|
||||
|
||||
if __MAKEDOTO /tmp/ngc$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
AC_DEFINE 'HAVE_'`echo $hdr | $AC_UPPERCASE | tr './' '_'` 1
|
||||
rc=0
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -183,37 +190,43 @@ AC_CHECK_HEADERS () {
|
||||
AC_CHECK_FUNCS () {
|
||||
AC_PROG_CC
|
||||
|
||||
F=$1
|
||||
shift
|
||||
rm -f /tmp/ngc$$.c
|
||||
B=`echo "$1" | sed -e 's/(.*)//'`
|
||||
|
||||
case "$B" in
|
||||
"$1") F="$1()" ;;
|
||||
*) F="$1" ;;
|
||||
esac
|
||||
|
||||
while [ "$1" ]; do
|
||||
echo "#include <$1>" >> /tmp/ngc$$.c
|
||||
shift
|
||||
done
|
||||
__remove ngc$$.c
|
||||
|
||||
cat >> /tmp/ngc$$.c << EOF
|
||||
while [ "$1" ]; do
|
||||
echo "#include <$1>" >> ngc$$.c
|
||||
shift
|
||||
done
|
||||
|
||||
cat >> ngc$$.c << EOF
|
||||
main()
|
||||
{
|
||||
|
||||
$F();
|
||||
$F;
|
||||
}
|
||||
EOF
|
||||
|
||||
LOGN "looking for the $F function"
|
||||
LOGN "looking for the $B function"
|
||||
|
||||
if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
|
||||
AC_DEFINE `echo ${2:-HAVE_$F} | $AC_UPPERCASE` 1
|
||||
if $AC_CC -o ngc$$ ngc$$.c $LIBS; then
|
||||
AC_DEFINE `echo ${2:-HAVE_$B} | $AC_UPPERCASE` 1
|
||||
TLOG " (found)"
|
||||
rc=0
|
||||
else
|
||||
echo "offending command was:"
|
||||
cat /tmp/ngc$$.c
|
||||
echo "$AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS"
|
||||
cat ngc$$.c
|
||||
echo "$AC_CC -o ngc$$ ngc$$.c $LIBS"
|
||||
TLOG " (not found)"
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c /tmp/ngc$$
|
||||
__remove ngc$$ ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -227,13 +240,13 @@ AC_CHECK_STRUCT () {
|
||||
struct=$1
|
||||
shift
|
||||
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
|
||||
for include in $*; do
|
||||
echo "#include <$include>" >> /tmp/ngc$$.c
|
||||
echo "#include <$include>" >> ngc$$.c
|
||||
done
|
||||
|
||||
cat >> /tmp/ngc$$.c << EOF
|
||||
cat >> ngc$$.c << EOF
|
||||
main()
|
||||
{
|
||||
struct $struct foo;
|
||||
@@ -242,13 +255,13 @@ EOF
|
||||
|
||||
LOGN "looking for struct $struct"
|
||||
|
||||
if __MAKEDOTO /tmp/ngc$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
AC_DEFINE HAVE_STRUCT_`echo ${struct} | $AC_UPPERCASE`
|
||||
rc=0
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -262,13 +275,13 @@ AC_CHECK_TYPE () {
|
||||
type=$1
|
||||
shift
|
||||
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
|
||||
for include in $*; do
|
||||
echo "#include <$include>" >> /tmp/ngc$$.c
|
||||
echo "#include <$include>" >> ngc$$.c
|
||||
done
|
||||
|
||||
cat >> /tmp/ngc$$.c << EOF
|
||||
cat >> ngc$$.c << EOF
|
||||
main()
|
||||
{
|
||||
$type foo;
|
||||
@@ -277,13 +290,13 @@ EOF
|
||||
|
||||
LOGN "looking for $type type"
|
||||
|
||||
if __MAKEDOTO /tmp/ngc$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
AC_DEFINE HAVE_TYPE_`echo ${type} | $AC_UPPERCASE`
|
||||
rc=0
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -299,13 +312,13 @@ AC_CHECK_FIELD () {
|
||||
field=$2
|
||||
shift 2
|
||||
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
|
||||
for include in $*;do
|
||||
echo "#include <$include>" >> /tmp/ngc$$.c
|
||||
echo "#include <$include>" >> ngc$$.c
|
||||
done
|
||||
|
||||
cat >> /tmp/ngc$$.c << EOF
|
||||
cat >> ngc$$.c << EOF
|
||||
main()
|
||||
{
|
||||
struct $struct foo;
|
||||
@@ -316,13 +329,13 @@ EOF
|
||||
|
||||
LOGN "checking that struct $struct has a $field field"
|
||||
|
||||
if __MAKEDOTO /tmp/ngc$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
AC_DEFINE HAVE_`echo ${struct}_$field | $AC_UPPERCASE`
|
||||
rc=0
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -333,7 +346,7 @@ EOF
|
||||
AC_PROG_CC () {
|
||||
test "$AC_CC" && return 0
|
||||
|
||||
cat > /tmp/ngc$$.c << \EOF
|
||||
cat > ngc$$.c << \EOF
|
||||
#include <stdio.h>
|
||||
main()
|
||||
{
|
||||
@@ -364,10 +377,13 @@ EOF
|
||||
fi
|
||||
echo "checking out the C compiler"
|
||||
|
||||
$AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c
|
||||
unset __MACOS_DSYM
|
||||
$AC_CC -o ngc$$ ngc$$.c
|
||||
status=$?
|
||||
test -d ngc$$.dSYM && __MACOS_DSYM=1
|
||||
|
||||
TLOGN " ($AC_CC)"
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
if $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; then
|
||||
TLOG " oh ick, it looks like gcc"
|
||||
@@ -382,7 +398,7 @@ EOF
|
||||
|
||||
if [ "$CFLAGS" ]; then
|
||||
test "$CFLAGS" && echo "validating CFLAGS=${CFLAGS}"
|
||||
if $AC_CC $CFLAGS -o /tmp/ngc$$.o /tmp/ngc$$.c ; then
|
||||
if $AC_CC $CFLAGS -o ngc$$.o ngc$$.c ; then
|
||||
AC_CFLAGS=${CFLAGS:-"-g"}
|
||||
test "$CFLAGS" && echo "CFLAGS=\"${CFLAGS}\" are okay"
|
||||
elif [ "$CFLAGS" ]; then
|
||||
@@ -393,7 +409,7 @@ EOF
|
||||
fi
|
||||
if [ "$LDFLAGS" ]; then
|
||||
test "$LDFLAGS" && echo "validating LDFLAGS=${LDFLAGS}"
|
||||
if $AC_CC $LDFLAGS -o /tmp/ngc$$ /tmp/ngc$$.o; then
|
||||
if $AC_CC $LDFLAGS -o ngc$$ ngc$$.o; then
|
||||
AC_LDFLAGS=${LDFLAGS:-"-g"}
|
||||
test "$LDFLAGS" && TLOG "LDFLAGS=\"${LDFLAGS}\" are okay"
|
||||
elif [ "$LDFLAGS" ]; then
|
||||
@@ -408,7 +424,7 @@ EOF
|
||||
|
||||
AC_SUB 'CC' "$AC_CC"
|
||||
|
||||
rm -f /tmp/ngc$$ /tmp/ngc$$.c /tmp/ngc$$.o
|
||||
__remove ngc$$ ngc$$.c ngc$$.o
|
||||
|
||||
return $status
|
||||
}
|
||||
@@ -671,16 +687,20 @@ AC_PROG_YACC () {
|
||||
#
|
||||
AC_PROG () {
|
||||
PN=`basename $1 | $AC_UPPERCASE | tr -dc $AC_UPPER_PAT`
|
||||
TLOGN "looking for $1"
|
||||
DEST=`acLookFor $1`
|
||||
if [ "$DEST" ]; then
|
||||
AC_SUB $PN $DEST
|
||||
TLOG " ($DEST)"
|
||||
return 0
|
||||
|
||||
if set | grep -v PROG_$PN >/dev/null; then
|
||||
TLOGN "looking for $1"
|
||||
DEST=`acLookFor $1`
|
||||
if [ "$DEST" ]; then
|
||||
eval PROG_$PN="$DEST"
|
||||
AC_SUB $PN $DEST
|
||||
TLOG " ($DEST)"
|
||||
return 0
|
||||
fi
|
||||
AC_SUB $PN true
|
||||
TLOG " (not found)"
|
||||
return 1
|
||||
fi
|
||||
AC_SUN $PN true
|
||||
TLOG " (not found)"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -701,6 +721,7 @@ AC_PROG_LN_S () {
|
||||
if [ "`$AC_FIND_PROG /tmp/b$$ -type l -print`" ]; then
|
||||
TLOG " ($DEST)"
|
||||
echo "$DEST exists, and ln -s works"
|
||||
PROG_LN_S="$DEST -s"
|
||||
AC_SUB 'LN_S' "$DEST -s"
|
||||
rm -f /tmp/b$$
|
||||
else
|
||||
@@ -785,18 +806,18 @@ AC_TYPE_PID_T () {
|
||||
# AC_C_CONST checks to see if the compiler supports the const keyword
|
||||
#
|
||||
AC_C_CONST () {
|
||||
cat > /tmp/pd$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
const char me=1;
|
||||
EOF
|
||||
LOGN "checking for \"const\" keyword"
|
||||
|
||||
if __MAKEDOTO /tmp/pd$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
rc=0
|
||||
else
|
||||
AC_DEFINE 'const' '/**/'
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/pd$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -805,18 +826,18 @@ EOF
|
||||
# AC_C_VOLATILE checks to see if the compiler supports the volatile keyword
|
||||
#
|
||||
AC_C_VOLATILE () {
|
||||
cat > /tmp/pd$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
f() { volatile char me=1; }
|
||||
EOF
|
||||
LOGN "checking for \"volatile\" keyword"
|
||||
|
||||
if __MAKEDOTO /tmp/pd$$.c; then
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
rc=0
|
||||
else
|
||||
AC_DEFINE 'volatile' '/**/'
|
||||
rc=1
|
||||
fi
|
||||
rm -f /tmp/pd$$.c
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -825,43 +846,72 @@ EOF
|
||||
# AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints.
|
||||
#
|
||||
AC_SCALAR_TYPES () {
|
||||
cat > /tmp/pd$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
#include <stdio.h>
|
||||
main()
|
||||
#include <string.h>
|
||||
|
||||
int pound_define = 1;
|
||||
|
||||
void
|
||||
say(char *w, char *v)
|
||||
{
|
||||
printf(pound_define ? "#define %s %s\n"
|
||||
: "s:@%s@:%s:g\n", w, v);
|
||||
}
|
||||
|
||||
void
|
||||
main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
unsigned long v_long;
|
||||
unsigned int v_int;
|
||||
unsigned short v_short;
|
||||
|
||||
if ( argc > 1 && strcmp(argv[1], "sub") == 0 )
|
||||
pound_define = 0;
|
||||
|
||||
if (sizeof v_long == 4)
|
||||
puts("#define DWORD unsigned long");
|
||||
say("DWORD", "unsigned long");
|
||||
else if (sizeof v_int == 4)
|
||||
puts("#define DWORD unsigned int");
|
||||
say("DWORD", "unsigned int");
|
||||
else
|
||||
exit(1);
|
||||
|
||||
if (sizeof v_int == 2)
|
||||
puts("#define WORD unsigned int");
|
||||
say("WORD", "unsigned int");
|
||||
else if (sizeof v_short == 2)
|
||||
puts("#define WORD unsigned short");
|
||||
say("WORD", "unsigned short");
|
||||
else
|
||||
exit(2);
|
||||
puts("#define BYTE unsigned char");
|
||||
say("BYTE", "unsigned char");
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
rc=1
|
||||
LOGN "defining WORD & DWORD scalar types"
|
||||
if $AC_CC /tmp/pd$$.c -o /tmp/pd$$; then
|
||||
if /tmp/pd$$ >> $__cwd/config.h; then
|
||||
rc=0
|
||||
if $AC_CC ngc$$.c -o ngc$$; then
|
||||
while [ "$1" ]; do
|
||||
case "$1" in
|
||||
sub)if ./ngc$$ sub >> $__cwd/config.sub; then
|
||||
rc=0
|
||||
fi;;
|
||||
*) if ./ngc$$ >> $__cwd/config.h; then
|
||||
rc=0
|
||||
fi ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
if [ "$rc" != 0 ]; then
|
||||
if ./ngc$$ >> $__cwd/config.h; then
|
||||
rc=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
__remove ngc$$ ngc$$.c
|
||||
case "$rc" in
|
||||
0) TLOG "" ;;
|
||||
*) TLOG " ** FAILED **" ;;
|
||||
*) AC_FAIL " ** FAILED **" ;;
|
||||
esac
|
||||
rm -f /tmp/pd$$ /tmp/pd$$.c
|
||||
}
|
||||
|
||||
|
||||
@@ -884,6 +934,46 @@ AC_OUTPUT () {
|
||||
AC_SUB 'confdir' "$AC_CONFDIR"
|
||||
AC_SUB 'mandir' "$AC_MANDIR"
|
||||
|
||||
if echo "$__config_files" | grep -v librarian.sh >/dev/null; then
|
||||
# write a librarian that works with static libraries
|
||||
if AC_PROG_LN_S ; then
|
||||
__dolink=$PROG_LN_S
|
||||
elif AC_PROG ln; then
|
||||
__dolink=$PROG_LN
|
||||
elif AC_PROG cp; then
|
||||
__dolink=$PROG_CP
|
||||
else
|
||||
__dolink=:
|
||||
fi
|
||||
AC_PROG ar
|
||||
AC_PROG ranlib
|
||||
AC_SUB LD_LIBRARY_PATH HERE
|
||||
AC
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build static libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
ACTION=\$1; shift
|
||||
LIBRARY=\$1; shift
|
||||
VERSION=\$1; shift
|
||||
|
||||
case "\$ACTION" in
|
||||
make) ${PROG_AR} crv \$LIBRARY.a "\$@"
|
||||
${PROG_RANLIB} \$LIBRARY.a
|
||||
rm -f \$LIBRARY
|
||||
${__dolink} \$LIBRARY.a \$LIBRARY
|
||||
;;
|
||||
files) echo "\${LIBRARY}.a"
|
||||
;;
|
||||
install)$PROG_INSTALL -m 644 \${LIBRARY}.a \$1
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
fi
|
||||
chmod +x librarian.sh
|
||||
|
||||
if [ -r config.sub ]; then
|
||||
test "$AC_SED_PROG" || AC_PROG_SED
|
||||
test "$AC_SED_PROG" || return 1
|
||||
@@ -925,7 +1015,7 @@ AC_CHECK_FLOCK() {
|
||||
|
||||
AC_CHECK_HEADERS sys/types.h sys/file.h fcntl.h
|
||||
|
||||
cat << EOF > $$.c
|
||||
cat << EOF > ngc$$.c
|
||||
#include <stdio.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/types.h>
|
||||
@@ -946,7 +1036,7 @@ EOF
|
||||
|
||||
LOGN "checking flock() sanity"
|
||||
HAS_FLOCK=0
|
||||
if $AC_CC -o flock $$.c ; then
|
||||
if $AC_CC -o ngc$$ ngc$$.c ; then
|
||||
if ./flock ; then
|
||||
LOG " (good)"
|
||||
HAS_FLOCK=1
|
||||
@@ -958,7 +1048,7 @@ EOF
|
||||
LOG " (not found)"
|
||||
fi
|
||||
|
||||
rm -f flock $$.c
|
||||
__remove ngc$$ ngc$$.c
|
||||
|
||||
case "$HAS_FLOCK" in
|
||||
0) return 1 ;;
|
||||
@@ -978,7 +1068,7 @@ AC_CHECK_RESOLVER () {
|
||||
|
||||
__ACR_rc=0
|
||||
|
||||
cat > /tmp/ngc$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
@@ -993,22 +1083,22 @@ main()
|
||||
}
|
||||
EOF
|
||||
|
||||
if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c; then
|
||||
if $AC_CC -o ngc$$ ngc$$.c; then
|
||||
TLOG " (found)"
|
||||
elif $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c -lresolv; then
|
||||
elif $AC_CC -o ngc$$ ngc$$.c -lresolv; then
|
||||
TLOG " (found, needs -lresolv)"
|
||||
AC_LIBS="$AC_LIBS -lresolv"
|
||||
elif $AC_CC -DBIND_8_COMPAT -o /tmp/ngc$$ /tmp/ngc$$.c; then
|
||||
elif $AC_CC -DBIND_8_COMPAT -o ngc$$ ngc$$.c; then
|
||||
TLOG " (found, needs BIND_8_COMPAT)"
|
||||
AC_DEFINE BIND_8_COMPAT 1
|
||||
elif $AC_CC -DBIND_8_COMPAT -o /tmp/ngc$$ /tmp/ngc$$.c -lresolv; then
|
||||
elif $AC_CC -DBIND_8_COMPAT -o ngc$$ ngc$$.c -lresolv; then
|
||||
TLOG " (found, needs BIND_8_COMPAT & -lresolv)"
|
||||
AC_DEFINE BIND_8_COMPAT 1
|
||||
else
|
||||
TLOG " (not found)"
|
||||
__ACR_rc=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c
|
||||
__remove ngc$$ ngc$$.c
|
||||
return $__ACR_rc
|
||||
}
|
||||
|
||||
@@ -1021,7 +1111,7 @@ AC_CHECK_ALLOCA () {
|
||||
AC_PROG_CC
|
||||
AC_CHECK_HEADERS stdlib.h
|
||||
|
||||
cat - > /tmp/ngc$$.c << EOF
|
||||
cat - > ngc$$.c << EOF
|
||||
#if T
|
||||
# include <alloca.h>
|
||||
#else
|
||||
@@ -1034,18 +1124,18 @@ main()
|
||||
EOF
|
||||
|
||||
LOGN "looking for the alloca function"
|
||||
if $AC_CC -DT /tmp/ngc$$.c -o /tmp/ngc$$; then
|
||||
if $AC_CC -DT ngc$$.c -o ngc$$; then
|
||||
AC_DEFINE 'HAVE_ALLOCA_H' 1
|
||||
status=0
|
||||
TLOG " (found in alloca.h)"
|
||||
elif $AC_CC /tmp/ngc$$.c -o /tmp/ngc$$; then
|
||||
elif $AC_CC ngc$$.c -o ngc$$; then
|
||||
TLOG " (found)"
|
||||
status=0
|
||||
else
|
||||
TLOG " (not found)"
|
||||
status=1
|
||||
fi
|
||||
rm -f /tmp/ngc$$.c /tmp/ngc
|
||||
__remove ngc$$ ngc$$.c
|
||||
return $status
|
||||
|
||||
}
|
||||
@@ -1058,7 +1148,7 @@ EOF
|
||||
AC_CHECK_BASENAME() {
|
||||
TLOGN "looking for a reentrant basename "
|
||||
|
||||
cat > /tmp/ngc$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
#include <string.h>
|
||||
|
||||
main()
|
||||
@@ -1071,8 +1161,8 @@ main()
|
||||
}
|
||||
EOF
|
||||
|
||||
if $AC_CC -o /tmp/ngc$$ /tmp/ngc$$.c $LIBS; then
|
||||
if /tmp/ngc$$; then
|
||||
if $AC_CC -o ngc$$ ngc$$.c $LIBS; then
|
||||
if ngc$$; then
|
||||
TLOG "(found)"
|
||||
AC_DEFINE 'HAVE_BASENAME' 1
|
||||
AC_CHECK_HEADERS libgen.h
|
||||
@@ -1082,7 +1172,136 @@ EOF
|
||||
else
|
||||
TLOG "(not found)"
|
||||
fi
|
||||
rm -f /tmp/ngc$$ /tmp/ngc$$.c
|
||||
__remove ngc$$ ngc$$.c
|
||||
}
|
||||
|
||||
#
|
||||
# AC_COMPILER_PIC checks for the compiler option to produce position independent
|
||||
# code. At the moment we assume gcc semantics.
|
||||
#
|
||||
AC_COMPILER_PIC () {
|
||||
AC_PROG_CC
|
||||
|
||||
LOGN "checking for C compiler option to produce PIC "
|
||||
echo "int some_variable = 0;" > ngc$$.c
|
||||
|
||||
if $AC_CC -c -fPIC -o ngc$$ ngc$$.c $LIBS; then
|
||||
AC_CFLAGS="$AC_CFLAGS -fPIC"
|
||||
LOG "(-fPIC)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(none)"
|
||||
__rc=1
|
||||
fi
|
||||
__remove ngc$$ ngc$$.c
|
||||
return $__rc
|
||||
}
|
||||
|
||||
#
|
||||
# AC_CC_SHLIBS checks if the C compiler can produce shared libraries
|
||||
# and if it can writes a librarian that handles those libraries for us.
|
||||
#
|
||||
AC_CC_SHLIBS () {
|
||||
AC_PROG_CC || AC_FAIL "Need a C compiler to build shared libraries"
|
||||
AC_PROG_LN_S || AC_FAIL "Need to be able to make symbolic links for shared libraries"
|
||||
AC_PROG_INSTALL || AC_FAIL "Need an install program to install shared libraries"
|
||||
LOGN "checking whether the C compiler can build shared libraries "
|
||||
|
||||
echo "int some_variable = 0;" > ngc$$.c
|
||||
|
||||
if $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
|
||||
AC_SUB LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
# -Wl option probably works, but be paranoid anyway
|
||||
_VFLAGS="$AC_PICFLAG -shared -Wl,-soname,ngc$$.so.1"
|
||||
if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then
|
||||
USE_SONAME=T
|
||||
fi
|
||||
LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build ELF shared libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
ACTION=\$1; shift
|
||||
LIBRARY=\$1; shift
|
||||
|
||||
eval \`awk -F. '{ printf "MAJOR=%d\n", \$1;
|
||||
printf "VERSION=%d.%d.%d\n", \$1, \$2, \$3; }' \$1\`
|
||||
shift
|
||||
|
||||
LIBNAME=\$LIBRARY.so
|
||||
FULLNAME=\$LIBNAME.\$VERSION
|
||||
|
||||
case "\$ACTION" in
|
||||
make) FLAGS="$AC_CFLAGS -shared"
|
||||
unset VFLAGS
|
||||
test "$USE_SONAME" && VFLAGS="-Wl,-soname,\$LIBNAME.\$MAJOR"
|
||||
|
||||
rm -f \$LIBRARY \$LIBNAME \$LIBNAME.\$MAJOR
|
||||
if $AC_CC \$FLAGS \$VFLAGS -o \$FULLNAME "\$@"; then
|
||||
$PROG_LN_S \$FULLNAME \$LIBRARY
|
||||
$PROG_LN_S \$FULLNAME \$LIBNAME
|
||||
$PROG_LN_S \$FULLNAME \$LIBNAME.\$MAJOR
|
||||
fi
|
||||
;;
|
||||
files) echo "\$FULLNAME" "\$LIBNAME" "\$LIBNAME.\$MAJOR"
|
||||
;;
|
||||
install)$PROG_INSTALL -c \$FULLNAME "\$1"
|
||||
$PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME.\$MAJOR
|
||||
$PROG_LN_S -f \$FULLNAME \$1/\$LIBNAME
|
||||
test "$LDCONFIG" && $LDCONFIG "\$1"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x librarian.sh
|
||||
LOG "(yes; -shared)"
|
||||
__rc=0
|
||||
elif $AC_CC $AC_PICFLAG -dynamiclib -o ngc$$.so ngc$$.c; then
|
||||
# macosx
|
||||
AC_SUB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
ACTION=\$1; shift
|
||||
LIBRARY=\$1; shift
|
||||
|
||||
eval \`awk -F. '{ printf "MAJOR=%d\n", \$1;
|
||||
printf "VERSION=%d.%d.%d\n", \$1, \$2, \$3; }' \$1\`
|
||||
shift
|
||||
|
||||
LIBNAME=\$LIBRARY.dylib
|
||||
FULLNAME=\$LIBNAME
|
||||
|
||||
case "\$ACTION" in
|
||||
make) FLAGS="$AC_CFLAGS -dynamiclib"
|
||||
VFLAGS="-current_version \$VERSION -compatibility_version \$MAJOR"
|
||||
|
||||
rm -f \$LIBRARY
|
||||
if $AC_CC \$FLAGS \$VFLAGS -o \$FULLNAME "\$@"; then
|
||||
$PROG_LN_S \$FULLNAME \$LIBRARY
|
||||
fi
|
||||
;;
|
||||
files) echo "\$FULLNAME"
|
||||
;;
|
||||
install)$PROG_INSTALL -c \$FULLNAME "\$1"
|
||||
;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x librarian.sh
|
||||
LOG "(yes; macos dylib)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(no)"
|
||||
__rc=1
|
||||
fi
|
||||
|
||||
__remove ngc$$.so ngc$$.c
|
||||
|
||||
return $__rc
|
||||
}
|
||||
|
||||
|
||||
@@ -1174,22 +1393,22 @@ EOD
|
||||
# compiler options
|
||||
#
|
||||
acCheckCPP () {
|
||||
cat > /tmp/ngc$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
#define FOO BAR
|
||||
|
||||
FOO
|
||||
EOF
|
||||
|
||||
if $1 $2 /tmp/ngc$$.c > /tmp/ngc$$.o; then
|
||||
if grep -v '#define' /tmp/ngc$$.o | grep -s BAR >/dev/null; then
|
||||
if $1 $2 ngc$$.c > ngc$$.o; then
|
||||
if grep -v '#define' ngc$$.o | grep -s BAR >/dev/null; then
|
||||
echo "CPP=[$1], CPPFLAGS=[$2]"
|
||||
AC_SUB 'CPP' "$1"
|
||||
AC_SUB 'CPPFLAGS' "$2"
|
||||
rm /tmp/ngc$$.c /tmp/ngc$$.o
|
||||
rm ngc$$.c ngc$$.o
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
rm /tmp/ngc$$.c /tmp/ngc$$.o
|
||||
rm ngc$$.c ngc$$.o
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -7,15 +7,13 @@
|
||||
|
||||
# load in the configuration file
|
||||
#
|
||||
ac_help='--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
|
||||
ac_help='--enable-amalloc Enable memory allocation debugging
|
||||
--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'
|
||||
--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 $*`;
|
||||
@@ -29,17 +27,11 @@ fi'
|
||||
locals() {
|
||||
K=`echo $1 | $AC_UPPERCASE`
|
||||
case "$K" in
|
||||
--RELAXED-EMPHAS*)
|
||||
echo RELAXED_EMPHASIS=T
|
||||
;;
|
||||
--SHARED)
|
||||
echo TRY_SHARED=T
|
||||
;;
|
||||
--ENABLE-ALL|--ENABLE-ALL-FEATURES)
|
||||
echo WITH_DL_TAG=T
|
||||
echo RELAXED_EMPHASIS=T
|
||||
echo WITH_PANDOC_HEADER=T
|
||||
echo WITH_SUPERSCRIPT=T
|
||||
echo WITH_AMALLOC=T
|
||||
echo WITH_DIV=T
|
||||
#echo WITH_ALPHA_LIST=T
|
||||
;;
|
||||
--ENABLE-*) enable=`echo $K | sed -e 's/--ENABLE-//' | tr '-' '_'`
|
||||
echo WITH_${enable}=T ;;
|
||||
@@ -51,8 +43,23 @@ TARGET=markdown
|
||||
|
||||
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 )' ;;
|
||||
@@ -63,7 +70,7 @@ AC_PROG ranlib
|
||||
|
||||
AC_C_VOLATILE
|
||||
AC_C_CONST
|
||||
AC_SCALAR_TYPES
|
||||
AC_SCALAR_TYPES sub hdr
|
||||
AC_CHECK_BASENAME
|
||||
|
||||
AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
|
||||
@@ -76,6 +83,14 @@ 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
|
||||
@@ -116,11 +131,6 @@ fi
|
||||
AC_DEFINE 'TABSTOP' $TABSTOP
|
||||
AC_SUB 'TABSTOP' $TABSTOP
|
||||
|
||||
test -z "$WITH_SUPERSCRIPT" || AC_DEFINE 'SUPERSCRIPT' 1
|
||||
test -z "$RELAXED_EMPHASIS" || AC_DEFINE 'RELAXED_EMPHASIS' 1
|
||||
test -z "$WITH_DIV" || AC_DEFINE 'DIV_QUOTE' 1
|
||||
test -z "$WITH_ALPHA_LIST" || AC_DEFINE 'ALPHA_LIST' 1
|
||||
|
||||
|
||||
if [ "$WITH_AMALLOC" ]; then
|
||||
AC_DEFINE 'USE_AMALLOC' 1
|
||||
@@ -129,16 +139,8 @@ else
|
||||
AC_SUB 'AMALLOC' ''
|
||||
fi
|
||||
|
||||
if [ "$RELAXED_EMPHASIS" -o "$WITH_SUPERSCRIPT" ]; then
|
||||
AC_SUB 'STRICT' ''
|
||||
else
|
||||
AC_SUB 'STRICT' '.\"'
|
||||
fi
|
||||
|
||||
|
||||
[ "$OS_FREEBSD" -o "$OS_DRAGONFLY" ] || AC_CHECK_HEADERS malloc.h
|
||||
|
||||
[ "$WITH_DL_TAG" ] && AC_DEFINE 'DL_TAG_EXTENSION' '1'
|
||||
[ "$WITH_PANDOC_HEADER" ] && AC_DEFINE 'PANDOC_HEADER' '1'
|
||||
|
||||
AC_OUTPUT Makefile version.c markdown.1
|
||||
AC_OUTPUT Makefile version.c mkdio.h
|
||||
@@ -28,9 +28,10 @@ stylesheets(Paragraph *p, Cstring *f)
|
||||
|
||||
for ( ; p ; p = p->next ) {
|
||||
if ( p->typ == STYLE ) {
|
||||
for ( q = p->text; q ; q = q->next )
|
||||
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);
|
||||
@@ -44,17 +45,25 @@ int
|
||||
mkd_css(Document *d, char **res)
|
||||
{
|
||||
Cstring f;
|
||||
int size;
|
||||
|
||||
if ( res && *res && d && d->compiled ) {
|
||||
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 */
|
||||
*res = T(f);/* we know that a T(Cstring) is a character pointer */
|
||||
/* so we can simply pick it up and carry it away, */
|
||||
return S(f); /* leaving the husk of the Ctring on the stack */
|
||||
/* leaving the husk of the Ctring on the stack */
|
||||
/* END HACK ALERT */
|
||||
}
|
||||
else
|
||||
DELETE(f);
|
||||
return size;
|
||||
}
|
||||
return EOF;
|
||||
}
|
||||
@@ -69,7 +78,7 @@ mkd_generatecss(Document *d, FILE *f)
|
||||
int written = EOF, size = mkd_css(d, &res);
|
||||
|
||||
if ( size > 0 )
|
||||
written = fwrite(res, size, 1, f);
|
||||
written = fwrite(res, 1, size, f);
|
||||
if ( res )
|
||||
free(res);
|
||||
return (written == size) ? size : EOF;
|
||||
@@ -10,13 +10,15 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "amalloc.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*)(S(x) = (x).alloc = 0)
|
||||
#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)) \
|
||||
@@ -14,13 +14,19 @@
|
||||
#include "markdown.h"
|
||||
#include "amalloc.h"
|
||||
|
||||
#define afterdle(t) (T((t)->text) + (t)->dle)
|
||||
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->headers )
|
||||
return afterdle(doc->headers);
|
||||
if ( doc && doc->title )
|
||||
return onlyifset(doc->title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -28,8 +34,8 @@ mkd_doc_title(Document *doc)
|
||||
char *
|
||||
mkd_doc_author(Document *doc)
|
||||
{
|
||||
if ( doc && doc->headers && doc->headers->next )
|
||||
return afterdle(doc->headers->next);
|
||||
if ( doc && doc->author )
|
||||
return onlyifset(doc->author);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,7 +43,7 @@ mkd_doc_author(Document *doc)
|
||||
char *
|
||||
mkd_doc_date(Document *doc)
|
||||
{
|
||||
if ( doc && doc->headers && doc->headers->next && doc->headers->next->next )
|
||||
return afterdle(doc->headers->next->next);
|
||||
if ( doc && doc->date )
|
||||
return onlyifset(doc->date);
|
||||
return 0;
|
||||
}
|
||||
Executable → Regular
+2
-1
@@ -33,6 +33,7 @@ Pptype(int typ)
|
||||
case HR : return "hr";
|
||||
case TABLE : return "table";
|
||||
case SOURCE : return "source";
|
||||
case STYLE : return "style";
|
||||
default : return "mystery node!";
|
||||
}
|
||||
}
|
||||
@@ -110,7 +111,7 @@ dumptree(Paragraph *pp, Stack *sp, FILE *f)
|
||||
d = fprintf(f, "[%s", Pptype(pp->typ));
|
||||
if ( pp->ident )
|
||||
d += fprintf(f, " %s", pp->ident);
|
||||
if ( pp->align )
|
||||
if ( pp->align > 1 )
|
||||
d += fprintf(f, ", <%s>", Begin[pp->align]);
|
||||
|
||||
for (count=0, p=pp->text; p; ++count, (p = p->next) )
|
||||
@@ -0,0 +1,188 @@
|
||||
/* 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 */
|
||||
@@ -0,0 +1,84 @@
|
||||
#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);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
/* 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();
|
||||
}
|
||||
@@ -13,9 +13,11 @@
|
||||
#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>
|
||||
@@ -36,65 +38,24 @@ basename(char *p)
|
||||
|
||||
char *pgm = "markdown";
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
int off;
|
||||
int flag;
|
||||
} opts[] = {
|
||||
{ "tabstop", 0, MKD_TABSTOP },
|
||||
{ "image", 1, MKD_NOIMAGE },
|
||||
{ "links", 1, MKD_NOLINKS },
|
||||
{ "relax", 1, MKD_STRICT },
|
||||
{ "strict", 0, MKD_STRICT },
|
||||
{ "tables", 1, MKD_NOTABLES },
|
||||
{ "header", 1, MKD_NOHEADER },
|
||||
{ "html", 1, MKD_NOHTML },
|
||||
{ "ext", 1, MKD_NO_EXT },
|
||||
{ "cdata", 0, MKD_CDATA },
|
||||
{ "pants", 1, MKD_NOPANTS },
|
||||
{ "smarty", 1, MKD_NOPANTS },
|
||||
{ "toc", 0, MKD_TOC },
|
||||
{ "autolink",0, MKD_AUTOLINK },
|
||||
{ "safelink",0, MKD_SAFELINK },
|
||||
{ "1.0", 0, MKD_1_COMPAT },
|
||||
} ;
|
||||
char *
|
||||
e_flags(const char *text, const int size, void *context)
|
||||
{
|
||||
return (char*)context;
|
||||
}
|
||||
|
||||
#define NR(x) (sizeof x / sizeof x[0])
|
||||
|
||||
|
||||
void
|
||||
set(int *flags, char *optionstring)
|
||||
complain(char *fmt, ...)
|
||||
{
|
||||
int i;
|
||||
int enable;
|
||||
char *arg;
|
||||
va_list ptr;
|
||||
|
||||
for ( arg = strtok(optionstring, ","); arg; arg = strtok(NULL, ",") ) {
|
||||
if ( *arg == '+' || *arg == '-' )
|
||||
enable = (*arg++ == '+') ? 1 : 0;
|
||||
else if ( strncasecmp(arg, "no", 2) == 0 ) {
|
||||
arg += 2;
|
||||
enable = 0;
|
||||
}
|
||||
else
|
||||
enable = 1;
|
||||
|
||||
for ( i=0; i < NR(opts); i++ )
|
||||
if ( strcasecmp(arg, opts[i].name) == 0 )
|
||||
break;
|
||||
|
||||
if ( i < NR(opts) ) {
|
||||
if ( opts[i].off )
|
||||
enable = !enable;
|
||||
|
||||
if ( enable )
|
||||
*flags |= opts[i].flag;
|
||||
else
|
||||
*flags &= ~opts[i].flag;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "%s: unknown option <%s>\n", pgm, arg);
|
||||
}
|
||||
fprintf(stderr, "%s: ", pgm);
|
||||
va_start(ptr, fmt);
|
||||
vfprintf(stderr, fmt, ptr);
|
||||
va_end(ptr);
|
||||
fputc('\n', stderr);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,10 +64,14 @@ main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int rc;
|
||||
int flags = 0;
|
||||
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;
|
||||
@@ -119,17 +84,31 @@ main(int argc, char **argv)
|
||||
pgm = basename(argv[0]);
|
||||
opterr = 1;
|
||||
|
||||
while ( (opt=getopt(argc, argv, "b:df:F:o:s:t:TV")) != EOF ) {
|
||||
while ( (opt=getopt(argc, argv, "5b:C:df:E:F:o:s:t:TV")) != EOF ) {
|
||||
switch (opt) {
|
||||
case '5': with_html5 = 1;
|
||||
break;
|
||||
case 'b': urlbase = optarg;
|
||||
break;
|
||||
case 'd': debug = 1;
|
||||
break;
|
||||
case 'V': printf("%s: discount %s\n", pgm, markdown_version);
|
||||
exit(0);
|
||||
case 'F': flags = strtol(optarg, 0, 0);
|
||||
case 'V': version++;
|
||||
break;
|
||||
case 'f': set(&flags, optarg);
|
||||
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;
|
||||
@@ -138,8 +117,10 @@ main(int argc, char **argv)
|
||||
break;
|
||||
case 's': text = optarg;
|
||||
break;
|
||||
case 'C': extra_footnote_prefix = optarg;
|
||||
break;
|
||||
case 'o': if ( ofile ) {
|
||||
fprintf(stderr, "Too many -o options\n");
|
||||
complain("Too many -o options");
|
||||
exit(1);
|
||||
}
|
||||
if ( !freopen(ofile = optarg, "w", stdout) ) {
|
||||
@@ -154,9 +135,22 @@ main(int argc, char **argv)
|
||||
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 {
|
||||
@@ -178,6 +172,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
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");
|
||||
@@ -192,6 +192,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
mkd_deallocate_tags();
|
||||
adump();
|
||||
exit( (rc == 0) ? 0 : errno );
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
.\" %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
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
.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
|
||||
@@ -31,9 +32,13 @@ to stdout.
|
||||
The options are as follows:
|
||||
.Bl -tag -width "-o file"
|
||||
.It Fl b Ar url-base
|
||||
Links in source begining with / will be prefixed with
|
||||
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.
|
||||
@@ -41,40 +46,75 @@ tree to stdout.
|
||||
Set or clear various translation flags. The flags
|
||||
are in a comma-delimited list, with an optional
|
||||
.Ar +
|
||||
(set) prefix on each flag.
|
||||
.Bl -tag -width "NOHEADER"
|
||||
.It Ar noimage
|
||||
Don't allow image tags.
|
||||
.It Ar nolinks
|
||||
Don't allow links.
|
||||
.It Ar nohtml
|
||||
Don't allow
|
||||
.B any
|
||||
embedded html.
|
||||
(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 valid XML output.
|
||||
.It Ar noheader
|
||||
Do not process pandoc headers.
|
||||
.It Ar notables
|
||||
Do not process Markdown Extra-style tables.
|
||||
.It Ar tabstops
|
||||
Use markdown-standard 4-space tabstops.
|
||||
.".It Ar strict
|
||||
."Disable superscript and relaxed emphasis.
|
||||
.".It Ar relax
|
||||
."Enable superscript and relaxed emphasis (this is the default.)
|
||||
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 support
|
||||
Enable table-of-contents processing.
|
||||
.It Ar 1.0
|
||||
Revert to Markdown 1.0 compatability.
|
||||
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,quot
|
||||
.Fl f Ar nolinks,smarty
|
||||
tells
|
||||
.Nm
|
||||
to not allow \<a tags, and to expand
|
||||
double-quotes.
|
||||
to not allow \<a tags, and to do smarty
|
||||
pants processing.
|
||||
.It Fl F Ar bitmap
|
||||
Set translation flags.
|
||||
.Ar Bitmap
|
||||
@@ -84,17 +124,20 @@ described in
|
||||
(the flag values are defined in
|
||||
.Pa mkdio.h )
|
||||
.It Fl V
|
||||
Show the version# and configuration data.
|
||||
Show the version# and compile-time configuration data.
|
||||
.Pp
|
||||
If the version includes the string
|
||||
.Em DL_TAG ,
|
||||
.Em DEBUG ,
|
||||
.Nm
|
||||
was configured with definition list support.
|
||||
was configured with memory allocation debugging.
|
||||
.Pp
|
||||
If the version includes the string
|
||||
.Em HEADER ,
|
||||
.Em TAB ,
|
||||
.Nm
|
||||
was configured to support pandoc header blocks.
|
||||
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 .
|
||||
@@ -11,9 +11,9 @@ Markdown
|
||||
.Sh SYNOPSIS
|
||||
.Fd #include <mkdio.h>
|
||||
.Ft MMIOT
|
||||
.Fn *mkd_in "FILE *input"
|
||||
.Fn *mkd_in "FILE *input" "int flags"
|
||||
.Ft MMIOT
|
||||
.Fn *mkd_string "char *string" "int size"
|
||||
.Fn *mkd_string "char *string" "int size" "int flags"
|
||||
.Ft int
|
||||
.Fn markdown "MMIOT *doc" "FILE *output" "int flags"
|
||||
.Sh DESCRIPTION
|
||||
@@ -44,54 +44,68 @@ and pass its return value to
|
||||
.Fn Markdown
|
||||
accepts the following flag values (or-ed together if needed)
|
||||
to restrict how it processes input:
|
||||
.Bl -tag -width MKD_SAFELINK -compact
|
||||
.It Ar MKD_NOIMAGE
|
||||
Do not process `![]' and
|
||||
remove
|
||||
.Em \<img\>
|
||||
tags from the output.
|
||||
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
|
||||
.It Ar MKD_NOLINKS
|
||||
Do not process `[]' and remove
|
||||
.Em \<a\>
|
||||
tags from the output.
|
||||
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
|
||||
Do not do Smartypants-style mangling of quotes, dashes, or ellipses.
|
||||
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 processing (if they are configured;
|
||||
otherwise it's a no-op.)
|
||||
.\" .It Ar MKD_QUOT
|
||||
.\" Expand
|
||||
.\" .Ar \&"
|
||||
.\" to \&".
|
||||
.It Ar MKD_NOHEADER
|
||||
Do not attempt to parse any Pandoc-style headers.
|
||||
.It Ar MKD_TABSTOP
|
||||
When reading documents, expand tabs to
|
||||
.Em 4
|
||||
spaces instead of whatever
|
||||
.Nm
|
||||
was originally configured for.
|
||||
.It Ar MKD_TOC
|
||||
Label all headers for use with the
|
||||
.Fn mkd_generatetoc
|
||||
and
|
||||
.Fn mkd_toc
|
||||
functions.
|
||||
.It Ar MKD_1_COMPAT
|
||||
MarkdownTest_1.0 compatability flag; trim trailing spaces from the
|
||||
first line of code blocks and disable implicit reference links.
|
||||
.It Ar MKD_AUTOLINK
|
||||
Greedily urlify links -- if
|
||||
.Em MKD_AUTOLINK
|
||||
is set, urls will be converted into hyperlinks even if they
|
||||
aren't encased in
|
||||
.Em <> .
|
||||
.It Ar MKD_SAFELINK
|
||||
Don't make hyperlinks from
|
||||
.Em [][]
|
||||
links that have unknown url types.
|
||||
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
|
||||
Don't process tables.
|
||||
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
|
||||
@@ -103,6 +117,7 @@ and
|
||||
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 ,
|
||||
@@ -120,4 +135,3 @@ created by
|
||||
is deleted by the
|
||||
.Nm
|
||||
function.
|
||||
|
||||
@@ -1001,6 +1001,7 @@ John Gruber
|
||||
.Sh SEE ALSO
|
||||
.Xr markdown 1 ,
|
||||
.Xr markdown 3 ,
|
||||
.Xr mkd-callbacks 3 ,
|
||||
.Xr mkd-functions 3 ,
|
||||
.Xr mkd-extensions 7 .
|
||||
.Pp
|
||||
@@ -4,6 +4,8 @@
|
||||
* 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>
|
||||
@@ -11,51 +13,15 @@
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "cstring.h"
|
||||
#include "markdown.h"
|
||||
#include "amalloc.h"
|
||||
|
||||
/* block-level tags for passing html blocks through the blender
|
||||
*/
|
||||
struct kw {
|
||||
char *id;
|
||||
int size;
|
||||
int selfclose;
|
||||
} ;
|
||||
|
||||
#define KW(x) { x, sizeof(x)-1, 0 }
|
||||
#define SC(x) { x, sizeof(x)-1, 1 }
|
||||
|
||||
static struct kw blocktags[] = { KW("!--"), KW("STYLE"), KW("SCRIPT"),
|
||||
KW("ADDRESS"), KW("BDO"), KW("BLOCKQUOTE"),
|
||||
KW("CENTER"), KW("DFN"), KW("DIV"), 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") };
|
||||
#define SZTAGS (sizeof blocktags / sizeof blocktags[0])
|
||||
#define MAXTAG 11 /* sizeof "BLOCKQUOTE" */
|
||||
#include "tags.h"
|
||||
|
||||
typedef int (*stfu)(const void*,const void*);
|
||||
|
||||
typedef ANCHOR(Paragraph) ParagraphRoot;
|
||||
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
/* case insensitive string sort for Footnote tags.
|
||||
*/
|
||||
int
|
||||
@@ -135,19 +101,28 @@ ___mkd_tidy(Cstring *t)
|
||||
}
|
||||
|
||||
|
||||
static struct kw comment = { "!--", 3, 0 };
|
||||
|
||||
static struct kw *
|
||||
isopentag(Line *p)
|
||||
{
|
||||
int i=0, len;
|
||||
struct kw key, *ret;
|
||||
char *line;
|
||||
|
||||
if ( !p ) return 0;
|
||||
|
||||
line = T(p->text);
|
||||
len = S(p->text);
|
||||
|
||||
if ( len < 3 || T(p->text)[0] != '<' )
|
||||
if ( len < 3 || line[0] != '<' )
|
||||
return 0;
|
||||
|
||||
if ( line[1] == '!' && line[2] == '-' && line[3] == '-' )
|
||||
/* comments need special case handling, because
|
||||
* the !-- doesn't need to end in a whitespace
|
||||
*/
|
||||
return &comment;
|
||||
|
||||
/* find how long the tag is so we can check to see if
|
||||
* it's a block-level tag
|
||||
*/
|
||||
@@ -156,13 +131,8 @@ isopentag(Line *p)
|
||||
&& !isspace(T(p->text)[i]); ++i )
|
||||
;
|
||||
|
||||
key.id = T(p->text)+1;
|
||||
key.size = i-1;
|
||||
|
||||
if ( ret = bsearch(&key, blocktags, SZTAGS, sizeof key, (stfu)casort))
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
return mkd_search_tags(T(p->text)+1, i-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,6 +141,8 @@ typedef struct _flo {
|
||||
int i;
|
||||
} FLO;
|
||||
|
||||
#define floindex(x) (x.i)
|
||||
|
||||
|
||||
static int
|
||||
flogetc(FLO *f)
|
||||
@@ -186,15 +158,56 @@ flogetc(FLO *f)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
splitline(Line *t, int cutpoint)
|
||||
{
|
||||
if ( t && (cutpoint < S(t->text)) ) {
|
||||
Line *tmp = calloc(1, sizeof *tmp);
|
||||
|
||||
tmp->next = t->next;
|
||||
t->next = tmp;
|
||||
|
||||
tmp->dle = t->dle;
|
||||
SUFFIX(tmp->text, T(t->text)+cutpoint, S(t->text)-cutpoint);
|
||||
S(t->text) = cutpoint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Line *
|
||||
htmlblock(Paragraph *p, struct kw *tag)
|
||||
commentblock(Paragraph *p, int *unclosed)
|
||||
{
|
||||
Line *t, *ret;
|
||||
char *end;
|
||||
|
||||
for ( t = p->text; t ; t = t->next) {
|
||||
if ( end = strstr(T(t->text), "-->") ) {
|
||||
splitline(t, 3 + (end - T(t->text)) );
|
||||
ret = t->next;
|
||||
t->next = 0;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
*unclosed = 1;
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static Line *
|
||||
htmlblock(Paragraph *p, struct kw *tag, int *unclosed)
|
||||
{
|
||||
Line *ret;
|
||||
FLO f = { p->text, 0 };
|
||||
int c;
|
||||
int i, closing, depth=0;
|
||||
|
||||
if ( tag->selfclose || (tag->size >= MAXTAG) ) {
|
||||
*unclosed = 0;
|
||||
|
||||
if ( tag == &comment )
|
||||
return commentblock(p, unclosed);
|
||||
|
||||
if ( tag->selfclose ) {
|
||||
ret = f.t->next;
|
||||
f.t->next = 0;
|
||||
return ret;
|
||||
@@ -230,6 +243,11 @@ htmlblock(Paragraph *p, struct kw *tag)
|
||||
/* consume trailing gunk in close tag */
|
||||
c = flogetc(&f);
|
||||
}
|
||||
if ( c == EOF )
|
||||
break;
|
||||
if ( !f.t )
|
||||
return 0;
|
||||
splitline(f.t, floindex(f));
|
||||
ret = f.t->next;
|
||||
f.t->next = 0;
|
||||
return ret;
|
||||
@@ -238,27 +256,11 @@ htmlblock(Paragraph *p, struct kw *tag)
|
||||
}
|
||||
}
|
||||
}
|
||||
*unclosed = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static Line *
|
||||
comment(Paragraph *p)
|
||||
{
|
||||
Line *t, *ret;
|
||||
|
||||
for ( t = p->text; t ; t = t->next) {
|
||||
if ( strstr(T(t->text), "-->") ) {
|
||||
ret = t->next;
|
||||
t->next = 0;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* tables look like
|
||||
* header|header{|header}
|
||||
* ------|------{|......}
|
||||
@@ -268,18 +270,35 @@ static int
|
||||
istable(Line *t)
|
||||
{
|
||||
char *p;
|
||||
Line *dashes = t->next;
|
||||
Line *dashes, *body;
|
||||
int l;
|
||||
int dashed = 0;
|
||||
|
||||
/* two lines, first must contain | */
|
||||
if ( !(dashes && memchr(T(t->text), '|', S(t->text))) )
|
||||
/* three lines, first must contain |,
|
||||
second must be ---|---,
|
||||
third must contain |
|
||||
*/
|
||||
if ( !(t->flags & PIPECHAR) )
|
||||
return 0;
|
||||
|
||||
dashes = t->next;
|
||||
if ( !(dashes && (dashes->flags & PIPECHAR)) )
|
||||
return 0;
|
||||
|
||||
/* second line must be only whitespace, |, -, or - */
|
||||
for ( p = T(dashes->text)+S(dashes->text)-1; p >= T(dashes->text); --p)
|
||||
if ( ! ((*p == '|') || (*p == ':') || (*p == '-') || isspace(*p)) )
|
||||
body = dashes->next;
|
||||
if ( !(body && (body->flags & PIPECHAR)) )
|
||||
return 0;
|
||||
|
||||
/* second line must contain - or | and nothing
|
||||
* else except for whitespace or :
|
||||
*/
|
||||
for ( p = T(dashes->text), l = S(dashes->text); l > 0; ++p, --l)
|
||||
if ( *p == '-' )
|
||||
dashed = 1;
|
||||
else if ( ! ((*p == '|') || (*p == ':') || isspace(*p)) )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return dashed;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,8 +315,8 @@ isfootnote(Line *t)
|
||||
for ( ++i; i < S(t->text) ; ++i ) {
|
||||
if ( T(t->text)[i] == '[' )
|
||||
return 0;
|
||||
else if ( T(t->text)[i] == ']' && T(t->text)[i+1] == ':' )
|
||||
return 1;
|
||||
else if ( T(t->text)[i] == ']' )
|
||||
return ( T(t->text)[i+1] == ':' ) ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -306,7 +325,14 @@ isfootnote(Line *t)
|
||||
static int
|
||||
isquote(Line *t)
|
||||
{
|
||||
return ( T(t->text)[0] == '>' );
|
||||
int j;
|
||||
|
||||
for ( j=0; j < 4; j++ )
|
||||
if ( T(t->text)[j] == '>' )
|
||||
return 1;
|
||||
else if ( !isspace(T(t->text)[j]) )
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -346,6 +372,34 @@ ishr(Line *t)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
issetext(Line *t, int *htyp)
|
||||
{
|
||||
int i;
|
||||
/* then check for setext-style HEADER
|
||||
* ======
|
||||
*/
|
||||
|
||||
if ( t->next ) {
|
||||
char *q = T(t->next->text);
|
||||
int last = S(t->next->text);
|
||||
|
||||
if ( (*q == '=') || (*q == '-') ) {
|
||||
/* ignore trailing whitespace */
|
||||
while ( (last > 1) && isspace(q[last-1]) )
|
||||
--last;
|
||||
|
||||
for (i=1; i < last; i++)
|
||||
if ( q[0] != q[i] )
|
||||
return 0;
|
||||
*htyp = SETEXT;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ishdr(Line *t, int *htyp)
|
||||
{
|
||||
@@ -367,75 +421,116 @@ ishdr(Line *t, int *htyp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* then check for setext-style HEADER
|
||||
* ======
|
||||
*/
|
||||
|
||||
if ( t->next ) {
|
||||
char *q = T(t->next->text);
|
||||
|
||||
if ( (*q == '=') || (*q == '-') ) {
|
||||
for (i=1; i < S(t->next->text); i++)
|
||||
if ( q[0] != q[i] )
|
||||
return 0;
|
||||
*htyp = SETEXT;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return issetext(t, htyp);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
isdefinition(Line *t)
|
||||
static Line*
|
||||
is_discount_dt(Line *t, int *clip)
|
||||
{
|
||||
#if DL_TAG_EXTENSION
|
||||
return t && t->next
|
||||
&& (S(t->text) > 2)
|
||||
&& (t->dle == 0)
|
||||
&& (T(t->text)[0] == '=')
|
||||
&& (T(t->text)[S(t->text)-1] == '=')
|
||||
&& ( (t->next->dle >= 4) || isdefinition(t->next) );
|
||||
#else
|
||||
return 0;
|
||||
#if USE_DISCOUNT_DL
|
||||
if ( t && t->next
|
||||
&& (S(t->text) > 2)
|
||||
&& (t->dle == 0)
|
||||
&& (T(t->text)[0] == '=')
|
||||
&& (T(t->text)[S(t->text)-1] == '=') ) {
|
||||
if ( t->next->dle >= 4 ) {
|
||||
*clip = 4;
|
||||
return t;
|
||||
}
|
||||
else
|
||||
return is_discount_dt(t->next, clip);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
islist(Line *t, int *trim)
|
||||
is_extra_dd(Line *t)
|
||||
{
|
||||
return (t->dle < 4) && (T(t->text)[t->dle] == ':')
|
||||
&& isspace(T(t->text)[t->dle+1]);
|
||||
}
|
||||
|
||||
|
||||
static Line*
|
||||
is_extra_dt(Line *t, int *clip)
|
||||
{
|
||||
#if USE_EXTRA_DL
|
||||
int i;
|
||||
|
||||
if ( t && t->next && T(t->text)[0] != '='
|
||||
&& T(t->text)[S(t->text)-1] != '=') {
|
||||
Line *x;
|
||||
|
||||
if ( iscode(t) || blankline(t) || ishdr(t,&i) || ishr(t) )
|
||||
return 0;
|
||||
|
||||
if ( (x = skipempty(t->next)) && is_extra_dd(x) ) {
|
||||
*clip = x->dle+2;
|
||||
return t;
|
||||
}
|
||||
|
||||
if ( x=is_extra_dt(t->next, clip) )
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static Line*
|
||||
isdefinition(Line *t, int *clip, int *kind)
|
||||
{
|
||||
Line *ret;
|
||||
|
||||
*kind = 1;
|
||||
if ( ret = is_discount_dt(t,clip) )
|
||||
return ret;
|
||||
|
||||
*kind=2;
|
||||
return is_extra_dt(t,clip);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
islist(Line *t, int *clip, DWORD flags, int *list_type)
|
||||
{
|
||||
int i, j;
|
||||
char *q;
|
||||
|
||||
if ( iscode(t) || blankline(t) || ishdr(t,&i) || ishr(t) )
|
||||
if ( /*iscode(t) ||*/ blankline(t) || ishdr(t,&i) || ishr(t) )
|
||||
return 0;
|
||||
|
||||
if ( isdefinition(t) ) {
|
||||
*trim = 4;
|
||||
if ( !(flags & (MKD_NODLIST|MKD_STRICT)) && isdefinition(t,clip,list_type) )
|
||||
return DL;
|
||||
}
|
||||
|
||||
if ( strchr("*-+", T(t->text)[t->dle]) && isspace(T(t->text)[t->dle+1]) ) {
|
||||
i = nextnonblank(t, t->dle+1);
|
||||
*trim = (i > 4) ? 4 : i;
|
||||
return UL;
|
||||
*clip = (i > 4) ? 4 : i;
|
||||
*list_type = UL;
|
||||
return AL;
|
||||
}
|
||||
|
||||
if ( (j = nextblank(t,t->dle)) > t->dle ) {
|
||||
if ( T(t->text)[j-1] == '.' ) {
|
||||
#if ALPHA_LIST
|
||||
if ( (j == t->dle + 2) && isalpha(T(t->text)[t->dle]) ) {
|
||||
j = nextnonblank(t,j);
|
||||
*trim = j;
|
||||
return AL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !(flags & (MKD_NOALPHALIST|MKD_STRICT))
|
||||
&& (j == t->dle + 2)
|
||||
&& isalpha(T(t->text)[t->dle]) ) {
|
||||
j = nextnonblank(t,j);
|
||||
*clip = (j > 4) ? 4 : j;
|
||||
*list_type = AL;
|
||||
return AL;
|
||||
}
|
||||
|
||||
strtoul(T(t->text)+t->dle, &q, 10);
|
||||
if ( (q > T(t->text)+t->dle) && (q == T(t->text) + (j-1)) ) {
|
||||
j = nextnonblank(t,j);
|
||||
*trim = j;
|
||||
return OL;
|
||||
*clip = (j > 4) ? 4 : j;
|
||||
*list_type = OL;
|
||||
return AL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,7 +561,8 @@ headerblock(Paragraph *pp, int htyp)
|
||||
* the leading and trailing `#`'s
|
||||
*/
|
||||
|
||||
for (i=0; (T(p->text)[i] == T(p->text)[0]) && (i < S(p->text)-1); i++)
|
||||
for (i=0; (T(p->text)[i] == T(p->text)[0]) && (i < S(p->text)-1)
|
||||
&& (i < 6); i++)
|
||||
;
|
||||
|
||||
pp->hnumber = i;
|
||||
@@ -530,27 +626,33 @@ centered(Line *first, Line *last)
|
||||
|
||||
|
||||
static int
|
||||
endoftextblock(Line *t, int toplevelblock)
|
||||
endoftextblock(Line *t, int toplevelblock, DWORD flags)
|
||||
{
|
||||
int z;
|
||||
|
||||
if ( blankline(t)||isquote(t)||iscode(t)||ishdr(t,&z)||ishr(t) )
|
||||
if ( blankline(t)||isquote(t)||ishdr(t,&z)||ishr(t) )
|
||||
return 1;
|
||||
|
||||
/* HORRIBLE STANDARDS KLUDGE: non-toplevel paragraphs absorb adjacent
|
||||
* code blocks
|
||||
*/
|
||||
if ( toplevelblock && iscode(t) )
|
||||
return 1;
|
||||
|
||||
/* HORRIBLE STANDARDS KLUDGE: Toplevel paragraphs eat absorb adjacent
|
||||
* list items, but sublevel blocks behave properly.
|
||||
*/
|
||||
return toplevelblock ? 0 : islist(t,&z);
|
||||
return toplevelblock ? 0 : islist(t,&z,flags, &z);
|
||||
}
|
||||
|
||||
|
||||
static Line *
|
||||
textblock(Paragraph *p, int toplevel)
|
||||
textblock(Paragraph *p, int toplevel, DWORD flags)
|
||||
{
|
||||
Line *t, *next;
|
||||
|
||||
for ( t = p->text; t ; t = next ) {
|
||||
if ( ((next = t->next) == 0) || endoftextblock(next, toplevel) ) {
|
||||
if ( ((next = t->next) == 0) || endoftextblock(next, toplevel, flags) ) {
|
||||
p->align = centered(p->text, t);
|
||||
t->next = 0;
|
||||
return next;
|
||||
@@ -577,27 +679,32 @@ szmarkerclass(char *p)
|
||||
* check if the first line of a quoted block is the special div-not-quote
|
||||
* marker %[kind:]name%
|
||||
*/
|
||||
#define iscsschar(c) (isalpha(c) || (c == '-') || (c == '_') )
|
||||
|
||||
static int
|
||||
isdivmarker(Line *p, int start)
|
||||
isdivmarker(Line *p, int start, DWORD flags)
|
||||
{
|
||||
#if DIV_QUOTE
|
||||
char *s = T(p->text);
|
||||
int len = S(p->text);
|
||||
int i;
|
||||
char *s;
|
||||
int last, i;
|
||||
|
||||
if ( !(len && s[start] == '%' && s[len-1] == '%') ) return 0;
|
||||
if ( flags & (MKD_NODIVQUOTE|MKD_STRICT) )
|
||||
return 0;
|
||||
|
||||
i = szmarkerclass(s+start+1)+start;
|
||||
len -= start+1;
|
||||
last= S(p->text) - (1 + start);
|
||||
s = T(p->text) + start;
|
||||
|
||||
while ( ++i < len )
|
||||
if ( !isalnum(s[i]) )
|
||||
if ( (last <= 0) || (*s != '%') || (s[last] != '%') )
|
||||
return 0;
|
||||
|
||||
i = szmarkerclass(s+1);
|
||||
|
||||
if ( !iscsschar(s[i+1]) )
|
||||
return 0;
|
||||
while ( ++i < last )
|
||||
if ( !(isdigit(s[i]) || iscsschar(s[i])) )
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -613,27 +720,36 @@ isdivmarker(Line *p, int start)
|
||||
* way the markdown sample web form at Daring Fireball works.
|
||||
*/
|
||||
static Line *
|
||||
quoteblock(Paragraph *p)
|
||||
quoteblock(Paragraph *p, DWORD flags)
|
||||
{
|
||||
Line *t, *q;
|
||||
int qp;
|
||||
|
||||
for ( t = p->text; t ; t = q ) {
|
||||
if ( isquote(t) ) {
|
||||
qp = (T(t->text)[1] == ' ') ? 2 : 1;
|
||||
/* clip leading spaces */
|
||||
for (qp = 0; T(t->text)[qp] != '>'; qp ++)
|
||||
/* assert: the first nonblank character on this line
|
||||
* will be a >
|
||||
*/;
|
||||
/* clip '>' */
|
||||
qp++;
|
||||
/* clip next space, if any */
|
||||
if ( T(t->text)[qp] == ' ' )
|
||||
qp++;
|
||||
CLIP(t->text, 0, qp);
|
||||
t->dle = mkd_firstnonblank(t);
|
||||
}
|
||||
|
||||
q = skipempty(t->next);
|
||||
|
||||
if ( (q == 0) || ((q != t->next) && (!isquote(q) || isdivmarker(q,1))) ) {
|
||||
if ( (q == 0) || ((q != t->next) && (!isquote(q) || isdivmarker(q,1,flags))) ) {
|
||||
___mkd_freeLineRange(t, q);
|
||||
t = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( isdivmarker(p->text,0) ) {
|
||||
if ( isdivmarker(p->text,0,flags) ) {
|
||||
char *prefix = "class";
|
||||
int i;
|
||||
|
||||
@@ -664,7 +780,7 @@ tableblock(Paragraph *p)
|
||||
Line *t, *q;
|
||||
|
||||
for ( t = p->text; t && (q = t->next); t = t->next ) {
|
||||
if ( !memchr(T(q->text), '|', S(q->text)) ) {
|
||||
if ( !(t->flags & PIPECHAR) ) {
|
||||
t->next = 0;
|
||||
return q;
|
||||
}
|
||||
@@ -676,6 +792,8 @@ tableblock(Paragraph *p)
|
||||
static Paragraph *Pp(ParagraphRoot *, Line *, int);
|
||||
static Paragraph *compile(Line *, int, MMIOT *);
|
||||
|
||||
typedef int (*linefn)(Line *);
|
||||
|
||||
|
||||
/*
|
||||
* pull in a list block. A list block starts with a list marker and
|
||||
@@ -684,7 +802,7 @@ static Paragraph *compile(Line *, int, MMIOT *);
|
||||
* marker, but multiple paragraphs need to start with a 4-space indent.
|
||||
*/
|
||||
static Line *
|
||||
listitem(Paragraph *p, int indent)
|
||||
listitem(Paragraph *p, int indent, DWORD flags, linefn check)
|
||||
{
|
||||
Line *t, *q;
|
||||
int clip = indent;
|
||||
@@ -700,8 +818,9 @@ listitem(Paragraph *p, int indent)
|
||||
}
|
||||
|
||||
/* after a blank line, the next block needs to start with a line
|
||||
* that's indented 4 spaces, but after that the line doesn't
|
||||
* need any indentation
|
||||
* that's indented 4(? -- reference implementation allows a 1
|
||||
* character indent, but that has unfortunate side effects here)
|
||||
* spaces, but after that the line doesn't need any indentation
|
||||
*/
|
||||
if ( q != t->next ) {
|
||||
if (q->dle < indent) {
|
||||
@@ -709,10 +828,14 @@ listitem(Paragraph *p, int indent)
|
||||
t->next = 0;
|
||||
return q;
|
||||
}
|
||||
indent = 4;
|
||||
/* indent at least 2, and at most as
|
||||
* as far as the initial line was indented. */
|
||||
indent = clip ? clip : 2;
|
||||
}
|
||||
|
||||
if ( (q->dle < indent) && (ishr(q) || islist(q,&z)) && !ishdr(q,&z) ) {
|
||||
if ( (q->dle < indent) && (ishr(q) || islist(q,&z,flags,&z)
|
||||
|| (check && (*check)(q)))
|
||||
&& !issetext(q,&z) ) {
|
||||
q = t->next;
|
||||
t->next = 0;
|
||||
return q;
|
||||
@@ -725,39 +848,81 @@ listitem(Paragraph *p, int indent)
|
||||
|
||||
|
||||
static Line *
|
||||
listblock(Paragraph *top, int trim, MMIOT *f)
|
||||
definition_block(Paragraph *top, int clip, MMIOT *f, int kind)
|
||||
{
|
||||
ParagraphRoot d = { 0, 0 };
|
||||
Paragraph *p;
|
||||
Line *q = top->text, *text, *label;
|
||||
int isdl = (top->typ == DL),
|
||||
para = 0,
|
||||
ltype;
|
||||
Line *q = top->text, *text = 0, *labels;
|
||||
int z, para;
|
||||
|
||||
while (( labels = q )) {
|
||||
|
||||
if ( (q = isdefinition(labels, &z, &kind)) == 0 )
|
||||
break;
|
||||
|
||||
if ( (text = skipempty(q->next)) == 0 )
|
||||
break;
|
||||
|
||||
if (( para = (text != q->next) ))
|
||||
___mkd_freeLineRange(q, text);
|
||||
|
||||
q->next = 0;
|
||||
if ( kind == 1 /* discount dl */ )
|
||||
for ( q = labels; q; q = q->next ) {
|
||||
CLIP(q->text, 0, 1);
|
||||
S(q->text)--;
|
||||
}
|
||||
|
||||
dd_block:
|
||||
p = Pp(&d, text, LISTITEM);
|
||||
|
||||
text = listitem(p, clip, f->flags, (kind==2) ? is_extra_dd : 0);
|
||||
p->down = compile(p->text, 0, f);
|
||||
p->text = labels; labels = 0;
|
||||
|
||||
if ( para && p->down ) p->down->align = PARA;
|
||||
|
||||
if ( (q = skipempty(text)) == 0 )
|
||||
break;
|
||||
|
||||
if (( para = (q != text) )) {
|
||||
Line anchor;
|
||||
|
||||
anchor.next = text;
|
||||
___mkd_freeLineRange(&anchor,q);
|
||||
text = q;
|
||||
|
||||
}
|
||||
|
||||
if ( kind == 2 && is_extra_dd(q) )
|
||||
goto dd_block;
|
||||
}
|
||||
top->text = 0;
|
||||
top->down = T(d);
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
static Line *
|
||||
enumerated_block(Paragraph *top, int clip, MMIOT *f, int list_class)
|
||||
{
|
||||
ParagraphRoot d = { 0, 0 };
|
||||
Paragraph *p;
|
||||
Line *q = top->text, *text;
|
||||
int para = 0, z;
|
||||
|
||||
while (( text = q )) {
|
||||
if ( top->typ == DL ) {
|
||||
Line *lp;
|
||||
|
||||
for ( lp = label = text; lp ; lp = lp->next ) {
|
||||
text = lp->next;
|
||||
CLIP(lp->text, 0, 1);
|
||||
S(lp->text)--;
|
||||
if ( !isdefinition(lp->next) )
|
||||
lp->next = 0;
|
||||
}
|
||||
}
|
||||
else label = 0;
|
||||
|
||||
|
||||
p = Pp(&d, text, LISTITEM);
|
||||
text = listitem(p, trim);
|
||||
text = listitem(p, clip, f->flags, 0);
|
||||
|
||||
p->down = compile(p->text, 0, f);
|
||||
p->text = label;
|
||||
p->text = 0;
|
||||
|
||||
if ( para && (top->typ != DL) && p->down ) p->down->align = PARA;
|
||||
if ( para && p->down ) p->down->align = PARA;
|
||||
|
||||
if ( !(q = skipempty(text)) || ((ltype = islist(q, &trim)) == 0)
|
||||
|| (isdl != (ltype == DL)) )
|
||||
if ( (q = skipempty(text)) == 0
|
||||
|| islist(q, &clip, f->flags, &z) != list_class )
|
||||
break;
|
||||
|
||||
if ( para = (q != text) ) {
|
||||
@@ -765,9 +930,9 @@ listblock(Paragraph *top, int trim, MMIOT *f)
|
||||
|
||||
anchor.next = text;
|
||||
___mkd_freeLineRange(&anchor, q);
|
||||
}
|
||||
|
||||
if ( para && (top->typ != DL) && p->down ) p->down->align = PARA;
|
||||
if ( p->down ) p->down->align = PARA;
|
||||
}
|
||||
}
|
||||
top->text = 0;
|
||||
top->down = T(d);
|
||||
@@ -802,7 +967,7 @@ addfootnote(Line *p, MMIOT* f)
|
||||
CREATE(foot->tag);
|
||||
CREATE(foot->link);
|
||||
CREATE(foot->title);
|
||||
foot->height = foot->width = 0;
|
||||
foot->flags = foot->height = foot->width = 0;
|
||||
|
||||
for (j=i=p->dle+1; T(p->text)[j] != ']'; j++)
|
||||
EXPAND(foot->tag) = T(p->text)[j];
|
||||
@@ -811,6 +976,12 @@ addfootnote(Line *p, MMIOT* f)
|
||||
S(foot->tag)--;
|
||||
j = nextnonblank(p, j+2);
|
||||
|
||||
if ( (f->flags & MKD_EXTRA_FOOTNOTE) && (T(foot->tag)[0] == '^') ) {
|
||||
while ( j < S(p->text) )
|
||||
EXPAND(foot->title) = T(p->text)[j++];
|
||||
goto skip_to_end;
|
||||
}
|
||||
|
||||
while ( (j < S(p->text)) && !isspace(T(p->text)[j]) )
|
||||
EXPAND(foot->link) = T(p->text)[j++];
|
||||
EXPAND(foot->link) = 0;
|
||||
@@ -850,6 +1021,7 @@ addfootnote(Line *p, MMIOT* f)
|
||||
--S(foot->title);
|
||||
}
|
||||
|
||||
skip_to_end:
|
||||
___mkd_freeLine(p);
|
||||
return np;
|
||||
}
|
||||
@@ -899,10 +1071,10 @@ compile_document(Line *ptr, MMIOT *f)
|
||||
ANCHOR(Line) source = { 0, 0 };
|
||||
Paragraph *p = 0;
|
||||
struct kw *tag;
|
||||
int eaten;
|
||||
int eaten, unclosed;
|
||||
|
||||
while ( ptr ) {
|
||||
if ( !(f->flags & DENY_HTML) && (tag = isopentag(ptr)) ) {
|
||||
if ( !(f->flags & MKD_NOHTML) && (tag = isopentag(ptr)) ) {
|
||||
/* If we encounter a html/style block, compile and save all
|
||||
* of the cached source BEFORE processing the html/style.
|
||||
*/
|
||||
@@ -913,10 +1085,12 @@ compile_document(Line *ptr, MMIOT *f)
|
||||
T(source) = E(source) = 0;
|
||||
}
|
||||
p = Pp(&d, ptr, strcmp(tag->id, "STYLE") == 0 ? STYLE : HTML);
|
||||
if ( strcmp(tag->id, "!--") == 0 )
|
||||
ptr = comment(p);
|
||||
else
|
||||
ptr = htmlblock(p, tag);
|
||||
ptr = htmlblock(p, tag, &unclosed);
|
||||
if ( unclosed ) {
|
||||
p->typ = SOURCE;
|
||||
p->down = compile(p->text, 1, f);
|
||||
p->text = 0;
|
||||
}
|
||||
}
|
||||
else if ( isfootnote(ptr) ) {
|
||||
/* footnotes, like cats, sleep anywhere; pull them
|
||||
@@ -958,7 +1132,7 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
Line *r;
|
||||
int para = toplevel;
|
||||
int blocks = 0;
|
||||
int hdr_type, list_type, indent;
|
||||
int hdr_type, list_type, list_class, indent;
|
||||
|
||||
ptr = consume(ptr, ¶);
|
||||
|
||||
@@ -981,13 +1155,19 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
ptr = ptr->next;
|
||||
___mkd_freeLine(r);
|
||||
}
|
||||
else if (( list_type = islist(ptr, &indent) )) {
|
||||
p = Pp(&d, ptr, list_type);
|
||||
ptr = listblock(p, indent, f);
|
||||
else if (( list_class = islist(ptr, &indent, f->flags, &list_type) )) {
|
||||
if ( list_class == DL ) {
|
||||
p = Pp(&d, ptr, DL);
|
||||
ptr = definition_block(p, indent, f, list_type);
|
||||
}
|
||||
else {
|
||||
p = Pp(&d, ptr, list_type);
|
||||
ptr = enumerated_block(p, indent, f, list_class);
|
||||
}
|
||||
}
|
||||
else if ( isquote(ptr) ) {
|
||||
p = Pp(&d, ptr, QUOTE);
|
||||
ptr = quoteblock(p);
|
||||
ptr = quoteblock(p, f->flags);
|
||||
p->down = compile(p->text, 1, f);
|
||||
p->text = 0;
|
||||
}
|
||||
@@ -995,13 +1175,13 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
p = Pp(&d, ptr, HDR);
|
||||
ptr = headerblock(p, hdr_type);
|
||||
}
|
||||
else if ( istable(ptr) && !(f->flags & (STRICT|NOTABLES)) ) {
|
||||
else if ( istable(ptr) && !(f->flags & (MKD_STRICT|MKD_NOTABLES)) ) {
|
||||
p = Pp(&d, ptr, TABLE);
|
||||
ptr = tableblock(p);
|
||||
}
|
||||
else {
|
||||
p = Pp(&d, ptr, MARKUP);
|
||||
ptr = textblock(p, toplevel);
|
||||
ptr = textblock(p, toplevel, f->flags);
|
||||
}
|
||||
|
||||
if ( (para||toplevel) && !p->align )
|
||||
@@ -1019,19 +1199,6 @@ compile(Line *ptr, int toplevel, MMIOT *f)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
initialize()
|
||||
{
|
||||
static int first = 1;
|
||||
|
||||
if ( first-- > 0 ) {
|
||||
first = 0;
|
||||
INITRNG(time(0));
|
||||
qsort(blocktags, SZTAGS, sizeof blocktags[0], (stfu)casort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* the guts of the markdown() function, ripped out so I can do
|
||||
* debugging.
|
||||
@@ -1041,7 +1208,7 @@ initialize()
|
||||
* prepare and compile `text`, returning a Paragraph tree.
|
||||
*/
|
||||
int
|
||||
mkd_compile(Document *doc, int flags)
|
||||
mkd_compile(Document *doc, DWORD flags)
|
||||
{
|
||||
if ( !doc )
|
||||
return 0;
|
||||
@@ -1051,13 +1218,14 @@ mkd_compile(Document *doc, int flags)
|
||||
|
||||
doc->compiled = 1;
|
||||
memset(doc->ctx, 0, sizeof(MMIOT) );
|
||||
doc->ctx->flags = flags & USER_FLAGS;
|
||||
doc->ctx->base = doc->base;
|
||||
doc->ctx->ref_prefix= doc->ref_prefix;
|
||||
doc->ctx->cb = &(doc->cb);
|
||||
doc->ctx->flags = flags & USER_FLAGS;
|
||||
CREATE(doc->ctx->in);
|
||||
doc->ctx->footnotes = malloc(sizeof doc->ctx->footnotes[0]);
|
||||
CREATE(*doc->ctx->footnotes);
|
||||
|
||||
initialize();
|
||||
mkd_initialize();
|
||||
|
||||
doc->code = compile_document(T(doc->content), doc->ctx);
|
||||
qsort(T(*doc->ctx->footnotes), S(*doc->ctx->footnotes),
|
||||
@@ -12,6 +12,10 @@ typedef struct footnote {
|
||||
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,
|
||||
@@ -22,7 +26,9 @@ typedef struct footnote {
|
||||
typedef struct line {
|
||||
Cstring text;
|
||||
struct line *next;
|
||||
int dle;
|
||||
int dle; /* leading indent on the line */
|
||||
int flags; /* special attributes for this line */
|
||||
#define PIPECHAR 0x01 /* line contains a | */
|
||||
} Line;
|
||||
|
||||
|
||||
@@ -56,6 +62,17 @@ typedef struct 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
|
||||
*/
|
||||
@@ -64,24 +81,37 @@ typedef struct mmiot {
|
||||
Cstring in;
|
||||
Qblock Q;
|
||||
int isp;
|
||||
int reference;
|
||||
char *ref_prefix;
|
||||
STRING(Footnote) *footnotes;
|
||||
int flags;
|
||||
#define DENY_A 0x0001
|
||||
#define DENY_IMG 0x0002
|
||||
#define DENY_SMARTY 0x0004
|
||||
#define DENY_HTML 0x0008
|
||||
#define STRICT 0x0010
|
||||
#define INSIDE_TAG 0x0020
|
||||
#define NO_PSEUDO_PROTO 0x0040
|
||||
#define CDATA_OUTPUT 0x0080
|
||||
#define NOTABLES 0x0400
|
||||
#define TOC 0x1000
|
||||
#define MKD_1_COMPAT 0x2000
|
||||
#define AUTOLINK 0x4000
|
||||
#define SAFELINK 0x8000
|
||||
#define USER_FLAGS 0xFCFF
|
||||
#define EMBEDDED DENY_A|DENY_IMG|NO_PSEUDO_PROTO|CDATA_OUTPUT
|
||||
char *base;
|
||||
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;
|
||||
|
||||
|
||||
@@ -93,19 +123,24 @@ typedef struct mmiot {
|
||||
* root of the linked list of Lines.
|
||||
*/
|
||||
typedef struct document {
|
||||
Line *headers; /* title -> author(s) -> date */
|
||||
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 */
|
||||
char *base; /* url basename for url fragments */
|
||||
Callback_data cb; /* callback functions & private data */
|
||||
} Document;
|
||||
|
||||
|
||||
extern int mkd_firstnonblank(Line *);
|
||||
extern int mkd_compile(Document *, int);
|
||||
extern int mkd_compile(Document *, DWORD);
|
||||
extern int mkd_document(Document *, char **);
|
||||
extern int mkd_generatehtml(Document *, FILE *);
|
||||
extern int mkd_css(Document *, char **);
|
||||
@@ -114,19 +149,21 @@ extern int mkd_generatecss(Document *, FILE *);
|
||||
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 **, int);
|
||||
extern int mkd_generateline(char *, int, FILE*, int);
|
||||
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 *);
|
||||
extern void mkd_string_to_anchor(char*,int, void(*)(int,void*), void*);
|
||||
|
||||
extern Document *mkd_in(FILE *, int);
|
||||
extern Document *mkd_string(char*,int, int);
|
||||
typedef int (*mkd_sta_function_t)(const int,const void*);
|
||||
extern void mkd_string_to_anchor(char*,int, mkd_sta_function_t, void*, int);
|
||||
|
||||
#define NO_HEADER 0x0100
|
||||
#define STD_TABSTOP 0x0200
|
||||
#define INPUT_MASK (NO_HEADER|STD_TABSTOP)
|
||||
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.
|
||||
*/
|
||||
@@ -0,0 +1,71 @@
|
||||
.\"
|
||||
.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.
|
||||
@@ -20,7 +20,7 @@ The new image syntax is
|
||||

|
||||
.fi
|
||||
.Ss pseudo-protocols
|
||||
Three pseudo-protocols have been added to links
|
||||
Five pseudo-protocols have been added to links
|
||||
.Bl -tag -width XXXXX
|
||||
.It Ar id:
|
||||
The
|
||||
@@ -48,14 +48,19 @@ is discarded.
|
||||
The
|
||||
.Ar "alt text"
|
||||
is marked up and written to the output, wrapped with
|
||||
.Em "<abbr title="abbr">
|
||||
.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
|
||||
If markdown was configured with
|
||||
.Ar --enable-pandoc-header ,
|
||||
the markdown source document can have a 3-line
|
||||
The markdown source document can have a 3-line
|
||||
.Xr Pandoc
|
||||
header in the format of
|
||||
.nf
|
||||
@@ -70,9 +75,7 @@ and
|
||||
.Fn mkd_doc_date
|
||||
functions.
|
||||
.Ss Definition lists
|
||||
If markdown was configured with
|
||||
.Ar --enable-dl-tag ,
|
||||
markup for definition lists is enabled. A definition list item
|
||||
A definition list item
|
||||
is defined as
|
||||
.nf
|
||||
=tag=
|
||||
@@ -84,6 +87,15 @@ 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>
|
||||
@@ -100,9 +112,7 @@ at the beginning of a subsequent line.
|
||||
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
|
||||
If markdown was configured with
|
||||
.Ar --relaxed-emphasis ,
|
||||
the rules for emphasis are changed so that a single
|
||||
The rules for emphasis are changed so that a single
|
||||
.Ar _
|
||||
will
|
||||
.Em not
|
||||
@@ -110,9 +120,7 @@ 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
|
||||
If markdown was configured with
|
||||
.Ar --enable-alpha-list ,
|
||||
alphabetic lists (like regular numeric lists, but with alphabetic
|
||||
Alphabetic lists (like regular numeric lists, but with alphabetic
|
||||
items) are supported. So:
|
||||
.nf
|
||||
a. this
|
||||
@@ -130,7 +138,7 @@ will produce:
|
||||
</ol>
|
||||
.fi
|
||||
.Ss tables
|
||||
.Ar PHP Markdown Extra -style
|
||||
.Ar "PHP Markdown Extra"
|
||||
tables are supported; input of the form
|
||||
.nf
|
||||
header|header
|
||||
@@ -163,15 +171,34 @@ is at the start of a column, it tells
|
||||
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 ,
|
||||
.Xr mkd-extensions 7 .
|
||||
.Xr mkd-line 3 .
|
||||
.Pp
|
||||
.%T http://daringfireball.net/projects/markdown
|
||||
.Pp
|
||||
@@ -127,7 +127,7 @@ accepts the same flags that
|
||||
and
|
||||
.Fn mkd_string
|
||||
do;
|
||||
.Bl -tag -width MKD_NOIMAGE -compact
|
||||
.Bl -tag -width MKD_NOSTRIKETHROUGH -compact
|
||||
.It Ar MKD_NOIMAGE
|
||||
Do not process `![]' and
|
||||
remove
|
||||
@@ -157,16 +157,22 @@ Label all headers for use with the
|
||||
.Fn mkd_generatetoc
|
||||
function.
|
||||
.It Ar MKD_1_COMPAT
|
||||
MarkdownTest_1.0 compatability flag; trim trailing spaces from the
|
||||
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 functions
|
||||
.Fn mkd_compile ,
|
||||
.Fn mkd_style ,
|
||||
and
|
||||
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
|
||||
return 0 on success, -1 on failure.
|
||||
returns 0 on success, \-1 on failure.
|
||||
.Sh SEE ALSO
|
||||
.Xr markdown 1 ,
|
||||
.Xr markdown 3 ,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user