Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f22cac676 | |||
| fc8039010f | |||
| bdcd2d8a69 | |||
| cd55f40353 | |||
| 4df49785d2 | |||
| bed96f76ad | |||
| 6e0cba6f77 | |||
| 0b83cde16b | |||
| d947bc4973 | |||
| 3c094cabae | |||
| 7dada0fe9a | |||
| 417e4b9a10 | |||
| 4ff297358f | |||
| df917df6a3 | |||
| 63f5a1ff82 | |||
| 260e1b0a46 | |||
| 783fa83c5d | |||
| 3310439a20 | |||
| cb0e3d2394 | |||
| d05d2da9b9 | |||
| 35f20bc78c | |||
| 6185cfba6d | |||
| 2173098c41 | |||
| 46977d9c7a | |||
| 463734dfab | |||
| f8f6d8976b | |||
| 15287c0e85 | |||
| 28d8f5e73a | |||
| bf5850c112 | |||
| 1931abfa5c | |||
| 460b0cae9b | |||
| 867540f2a4 | |||
| 921c71b7da | |||
| 1d96a33c96 | |||
| a1b9ee2db6 | |||
| d8413c8708 | |||
| 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
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
# Xcode
|
||||
build/*
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
*.xcworkspace
|
||||
!default.xcworkspace
|
||||
xcuserdata
|
||||
profile
|
||||
*.moved-aside
|
||||
|
||||
## Ignore incredibly annoying .DS_Store files
|
||||
.DS_Store
|
||||
@@ -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, strong) NSFont *font;
|
||||
|
||||
- (CGFloat)lineHeight;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// 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];
|
||||
[self setUsesFontLeading:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (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,22 @@
|
||||
//
|
||||
// EditPaneTextView.h
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Akihiro Noguchi on 9/05/11.
|
||||
// Copyright 2011 Aki. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString * const kEditPaneTextViewChangedNotification;
|
||||
|
||||
@class EditPaneLayoutManager;
|
||||
|
||||
@interface EditPaneTextView : NSTextView {
|
||||
__weak EditPaneLayoutManager *layoutMan;
|
||||
}
|
||||
|
||||
- (void)updateColors;
|
||||
- (void)updateFont;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// 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"
|
||||
|
||||
NSString * const kEditPaneTextViewChangedNotification = @"EditPaneTextViewChangedNotification";
|
||||
NSString * const kEditPaneColorChangedNotification = @"EditPaneColorChangedNotification";
|
||||
|
||||
@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:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
|
||||
options:0
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
|
||||
options:0
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController addObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
|
||||
options:0
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
|
||||
[self setUsesFontPanel:NO];
|
||||
|
||||
NSTextContainer *textContainer = [[NSTextContainer alloc] init];
|
||||
[textContainer setContainerSize:[[self textContainer] containerSize]];
|
||||
[textContainer setWidthTracksTextView:YES];
|
||||
[self replaceTextContainer:textContainer];
|
||||
|
||||
EditPaneLayoutManager *lManager = [[EditPaneLayoutManager alloc] init];
|
||||
[textContainer replaceLayoutManager:lManager];
|
||||
layoutMan = lManager;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||
|
||||
[defaultsController removeObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneForegroundColor]
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController removeObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneBackgroundColor]
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController removeObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneSelectionColor]
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
[defaultsController removeObserver:self
|
||||
forKeyPath:[NSString stringWithFormat:@"values.%@", kEditPaneCaretColor]
|
||||
context:(__bridge void *)kEditPaneColorChangedNotification];
|
||||
}
|
||||
|
||||
- (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];
|
||||
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 ([(__bridge NSString *)context isEqualToString:kEditPaneColorChangedNotification]) {
|
||||
[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
|
||||
+1106
-1957
File diff suppressed because it is too large
Load Diff
+279
-1126
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// MLAppDelegate.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by David Beck on 9/23/11.
|
||||
// Copyright 2011 David Beck. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MLAppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
@property (nonatomic, strong) IBOutlet NSMenuItem *viewMenu;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// MLAppDelegate.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by David Beck on 9/23/11.
|
||||
// Copyright 2011 David Beck. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
#import "MLAppDelegate.h"
|
||||
|
||||
@implementation MLAppDelegate
|
||||
|
||||
@synthesize viewMenu = _viewMenu;
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
if ([NSWindow instancesRespondToSelector:@selector(toggleFullScreen:)]) {
|
||||
[[NSApp mainMenu] insertItem:self.viewMenu atIndex:3];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -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>
|
||||
|
||||
@@ -3,36 +3,96 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
11EF12E0142D24BB0086C77F /* MLAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 11EF12DF142D24BB0086C77F /* MLAppDelegate.m */; };
|
||||
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* MyDocument.xib */; };
|
||||
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
|
||||
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 */; };
|
||||
3D6A8BBC15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */; };
|
||||
3D6A8BE115F0F33C002C8B62 /* Ordered List Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */; };
|
||||
3D6A8BE215F0F33C002C8B62 /* Quote Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */; };
|
||||
3D6A8BE315F0F33C002C8B62 /* Unordered List Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */; };
|
||||
3D8BA23315F160FD000555C7 /* Image Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D8BA23115F160FD000555C7 /* Image Template.pdf */; };
|
||||
3D8BA23415F160FD000555C7 /* Link Template.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3D8BA23215F160FD000555C7 /* Link Template.pdf */; };
|
||||
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */; };
|
||||
795F6CCD105D741100D1F90A /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 795F6CCC105D741100D1F90A /* WebKit.framework */; };
|
||||
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 */; };
|
||||
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>"; };
|
||||
11EF12DE142D24BB0086C77F /* MLAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLAppDelegate.h; sourceTree = "<group>"; };
|
||||
11EF12DF142D24BB0086C77F /* MLAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLAppDelegate.m; sourceTree = "<group>"; };
|
||||
13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||
1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MyDocument.xib; sourceTree = "<group>"; };
|
||||
1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
@@ -40,6 +100,18 @@
|
||||
2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = "<group>"; };
|
||||
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
3D6A8BBA15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextView+EditPlainTextWithUndo.h"; sourceTree = "<group>"; };
|
||||
3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTextView+EditPlainTextWithUndo.m"; sourceTree = "<group>"; };
|
||||
3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Ordered List Template.pdf"; sourceTree = "<group>"; };
|
||||
3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Quote Template.pdf"; sourceTree = "<group>"; };
|
||||
3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Unordered List Template.pdf"; sourceTree = "<group>"; };
|
||||
3D8BA23115F160FD000555C7 /* Image Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Image Template.pdf"; sourceTree = "<group>"; };
|
||||
3D8BA23215F160FD000555C7 /* Link Template.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "Link Template.pdf"; sourceTree = "<group>"; };
|
||||
3DD161871431FCED0003F6C7 /* PreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesController.h; sourceTree = "<group>"; };
|
||||
3DD161881431FCF40003F6C7 /* EditPaneTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneTypesetter.h; sourceTree = "<group>"; };
|
||||
3DD161891431FCFC0003F6C7 /* EditPaneTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneTextView.h; sourceTree = "<group>"; };
|
||||
3DD1618A1431FD030003F6C7 /* EditPaneLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditPaneLayoutManager.h; sourceTree = "<group>"; };
|
||||
3DD1618B1431FD0B0003F6C7 /* PreferencesManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencesManager.h; sourceTree = "<group>"; };
|
||||
795F6C4E105D6EC400D1F90A /* mkdio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mkdio.c; sourceTree = "<group>"; };
|
||||
795F6C50105D6ECE00D1F90A /* markdown.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = markdown.c; sourceTree = "<group>"; };
|
||||
795F6C52105D6ED800D1F90A /* generate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = generate.c; sourceTree = "<group>"; };
|
||||
@@ -56,6 +128,16 @@
|
||||
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; };
|
||||
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 +145,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,6 +184,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D15AC370486D014006FF6A4 /* MarkdownLive.app */,
|
||||
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -101,13 +192,17 @@
|
||||
2A37F4AAFDCFA73011CA2CEA /* MarkdownLive */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ABECD96113C8D1C200B77CFD /* ORCDiscount */,
|
||||
2A37F4ABFDCFA73011CA2CEA /* Classes */,
|
||||
795F6C4D105D6EA500D1F90A /* discount-1.5.4 */,
|
||||
3D6A8BBD15F0D919002C8B62 /* Categories */,
|
||||
795F6C4D105D6EA500D1F90A /* discount */,
|
||||
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 +210,18 @@
|
||||
2A37F4ABFDCFA73011CA2CEA /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
11EF12DE142D24BB0086C77F /* MLAppDelegate.h */,
|
||||
11EF12DF142D24BB0086C77F /* MLAppDelegate.m */,
|
||||
3DD1618A1431FD030003F6C7 /* EditPaneLayoutManager.h */,
|
||||
ABF75D6E13CDEBBA00B5E7AB /* EditPaneLayoutManager.m */,
|
||||
3DD161891431FCFC0003F6C7 /* EditPaneTextView.h */,
|
||||
ABF75D6F13CDEBBA00B5E7AB /* EditPaneTextView.m */,
|
||||
3DD161881431FCF40003F6C7 /* EditPaneTypesetter.h */,
|
||||
ABF75D7013CDEBBA00B5E7AB /* EditPaneTypesetter.m */,
|
||||
3DD161871431FCED0003F6C7 /* PreferencesController.h */,
|
||||
ABF75D7113CDEBBA00B5E7AB /* PreferencesController.m */,
|
||||
3DD1618B1431FD0B0003F6C7 /* PreferencesManager.h */,
|
||||
ABF75D7213CDEBBA00B5E7AB /* PreferencesManager.m */,
|
||||
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */,
|
||||
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */,
|
||||
);
|
||||
@@ -133,6 +240,8 @@
|
||||
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D6A8BD915F0F33C002C8B62 /* Images */,
|
||||
226936E612E7CDC500171322 /* styles.css */,
|
||||
795F6C86105D70A300D1F90A /* MarkdownLiveApp.icns */,
|
||||
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
|
||||
8D15AC360486D014006FF6A4 /* MarkdownLive-Info.plist */,
|
||||
@@ -152,17 +261,46 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
795F6C4D105D6EA500D1F90A /* discount-1.5.4 */ = {
|
||||
3D6A8BBD15F0D919002C8B62 /* Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D6A8BBA15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.h */,
|
||||
3D6A8BBB15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.m */,
|
||||
);
|
||||
name = Categories;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D6A8BD915F0F33C002C8B62 /* Images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D8BA23115F160FD000555C7 /* Image Template.pdf */,
|
||||
3D8BA23215F160FD000555C7 /* Link Template.pdf */,
|
||||
3D6A8BDC15F0F33C002C8B62 /* Ordered List Template.pdf */,
|
||||
3D6A8BDD15F0F33C002C8B62 /* Quote Template.pdf */,
|
||||
3D6A8BDE15F0F33C002C8B62 /* Unordered List Template.pdf */,
|
||||
);
|
||||
path = Images;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
795F6C4D105D6EA500D1F90A /* discount */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
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 */,
|
||||
226936B912E7C8B600171322 /* mkdio.h */,
|
||||
22ECEEC612E7C258003B50DC /* config.h */,
|
||||
);
|
||||
path = "discount-1.5.4";
|
||||
path = discount;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
795F6DB3105D75D300D1F90A /* discount_wrappers */ = {
|
||||
@@ -178,8 +316,32 @@
|
||||
path = discount_wrappers;
|
||||
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 +349,13 @@
|
||||
buildPhases = (
|
||||
8D15AC2B0486D014006FF6A4 /* Resources */,
|
||||
8D15AC300486D014006FF6A4 /* Sources */,
|
||||
ABECD8EA13C8B9E700B77CFD /* Copy Frameworks */,
|
||||
8D15AC330486D014006FF6A4 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
ABECD8D813C8B98D00B77CFD /* PBXTargetDependency */,
|
||||
);
|
||||
name = MarkdownLive;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
@@ -199,19 +363,48 @@
|
||||
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 */
|
||||
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0600;
|
||||
};
|
||||
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MarkdownLive" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 2A37F4AAFDCFA73011CA2CEA /* MarkdownLive */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8D15AC270486D014006FF6A4 /* MarkdownLive */,
|
||||
ABECD8C113C8B8CA00B77CFD /* ORCDiscount */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -226,6 +419,19 @@
|
||||
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */,
|
||||
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
|
||||
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */,
|
||||
3D6A8BE115F0F33C002C8B62 /* Ordered List Template.pdf in Resources */,
|
||||
3D6A8BE215F0F33C002C8B62 /* Quote Template.pdf in Resources */,
|
||||
3D6A8BE315F0F33C002C8B62 /* Unordered List Template.pdf in Resources */,
|
||||
3D8BA23315F160FD000555C7 /* Image Template.pdf in Resources */,
|
||||
3D8BA23415F160FD000555C7 /* Link Template.pdf in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
ABECD8BE13C8B8CA00B77CFD /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
ABE8DDF913CA38B5005852B5 /* styles.css in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -238,20 +444,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 */,
|
||||
11EF12E0142D24BB0086C77F /* MLAppDelegate.m in Sources */,
|
||||
3D6A8BBC15F0D914002C8B62 /* NSTextView+EditPlainTextWithUndo.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,14 +521,72 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
ABECD8C413C8B8CA00B77CFD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_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,
|
||||
);
|
||||
PRODUCT_NAME = ORCDiscount;
|
||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
ABECD8C513C8B8CA00B77CFD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
GCC_PREFIX_HEADER = "";
|
||||
INFOPLIST_FILE = "ORCDiscount-Info.plist";
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Foundation,
|
||||
"-framework",
|
||||
AppKit,
|
||||
);
|
||||
PRODUCT_NAME = ORCDiscount;
|
||||
RUN_CLANG_STATIC_ANALYZER = YES;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C05733C808A9546B00998B17 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
|
||||
@@ -309,8 +600,11 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = MarkdownLive_Prefix.pch;
|
||||
INFOPLIST_FILE = "MarkdownLive-Info.plist";
|
||||
@@ -323,14 +617,24 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
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;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
USER_HEADER_SEARCH_PATHS = "\"$(SRCROOT)/discount-1.5.4\"";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -338,18 +642,41 @@
|
||||
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_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\"";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
SDKROOT = macosx;
|
||||
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 = (
|
||||
|
||||
+25
-2
@@ -1,11 +1,21 @@
|
||||
/*******************************************************************************
|
||||
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>
|
||||
|
||||
@class EditPaneTextView;
|
||||
@class EditPaneLayoutManager;
|
||||
|
||||
@interface MyDocument : NSDocument {
|
||||
IBOutlet NSTextView *markdownSourceTextView;
|
||||
IBOutlet EditPaneTextView *markdownSourceTextView;
|
||||
IBOutlet WebView *htmlPreviewWebView;
|
||||
|
||||
NSMutableAttributedString *markdownSource;
|
||||
NSTextStorage *markdownSource;
|
||||
|
||||
NSTimeInterval whenToUpdatePreview;
|
||||
NSTimer *htmlPreviewTimer;
|
||||
@@ -17,4 +27,17 @@
|
||||
|
||||
- (IBAction)copyGeneratedHTMLAction:(id)sender;
|
||||
|
||||
- (IBAction)boldItalic:(id)sender;
|
||||
- (IBAction)bold:(id)sender;
|
||||
- (IBAction)italic:(id)sender;
|
||||
- (IBAction)header1:(id)sender;
|
||||
- (IBAction)header2:(id)sender;
|
||||
- (IBAction)header3:(id)sender;
|
||||
- (IBAction)blockQuote:(id)sender;
|
||||
- (IBAction)codeSection:(id)sender;
|
||||
- (IBAction)unorderedList:(id)sender;
|
||||
- (IBAction)numberedList:(id)sender;
|
||||
- (IBAction)link:(id)sender;
|
||||
- (IBAction)image:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
+437
-70
@@ -1,86 +1,148 @@
|
||||
/*******************************************************************************
|
||||
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 "EditPaneTextView.h"
|
||||
#import "NSTextView+EditPlainTextWithUndo.h"
|
||||
#include "discountWrapper.h"
|
||||
|
||||
NSString * const kNumberedListTemplate = @"%lu. ";
|
||||
|
||||
NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
|
||||
@interface NSResponder (scrollToEndOfDocument)
|
||||
- (IBAction)scrollToEndOfDocument:(id)sender; // For some reason this isn't declared anywhere in AppKit.
|
||||
|
||||
@interface MyDocument ()
|
||||
|
||||
- (void)_surroundSelectionWithString:(NSString *)string;
|
||||
- (void)_surroundSelectionWithPrefixString:(NSString *)prefixString
|
||||
suffixString:(NSString *)suffixString
|
||||
selectionOffset:(NSInteger)selectionOffset;
|
||||
- (void)_addStringBeforeSelectedLines:(NSString *)string
|
||||
skippingEmptyLines:(BOOL)skipEmptyLines;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
// class extension
|
||||
@interface MyDocument ()
|
||||
|
||||
- (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;
|
||||
[super dealloc];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification {
|
||||
[htmlPreviewTimer invalidate];
|
||||
}
|
||||
|
||||
- (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];
|
||||
|
||||
if ([controller_.window respondsToSelector:@selector(toggleFullScreen:)]) {
|
||||
controller_.window.collectionBehavior &= !NSWindowCollectionBehaviorFullScreenAuxiliary;
|
||||
controller_.window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
|
||||
}
|
||||
|
||||
[super windowControllerDidLoadNib:controller_];
|
||||
}
|
||||
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_ ofType:(NSString*)typeName_ error:(NSError**)error_ {
|
||||
BOOL result = NO;
|
||||
- (BOOL)writeToURL:(NSURL*)absoluteURL_
|
||||
ofType:(NSString*)typeName_
|
||||
forSaveOperation:(NSSaveOperationType)saveOperation_
|
||||
originalContentsURL:(NSURL*)absoluteOriginalContentsURL_
|
||||
error:(NSError **)error_
|
||||
{
|
||||
BOOL result = NO;
|
||||
if ([typeName_ isEqualToString:kMarkdownDocumentType]) {
|
||||
[markdownSourceTextView breakUndoCoalescing];
|
||||
result = [[markdownSource string] writeToURL:absoluteURL_
|
||||
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];
|
||||
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];
|
||||
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;
|
||||
}
|
||||
@@ -94,10 +156,7 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
error:&error];
|
||||
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 +167,351 @@ NSString *kMarkdownDocumentType = @"MarkdownDocumentType";
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSView *)printableView {
|
||||
NSRect frame = [[self printInfo] imageablePageBounds];
|
||||
frame.size.height = 0;
|
||||
NSTextView *printView = [[NSTextView alloc] initWithFrame:frame];
|
||||
[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];
|
||||
[[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]], @"");
|
||||
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)updateContentOnUndo {
|
||||
NSUndoManager *undoManager = [self undoManager];
|
||||
|
||||
[undoManager registerUndoWithTarget:self
|
||||
selector:@selector(updateContentOnUndo)
|
||||
object:nil];
|
||||
|
||||
if ([undoManager isUndoing]) {
|
||||
[self updateContent];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateContentIncludingOnRedo {
|
||||
NSUndoManager *undoManager = [self undoManager];
|
||||
|
||||
[undoManager registerUndoWithTarget:self
|
||||
selector:@selector(updateContentIncludingOnRedo)
|
||||
object:nil];
|
||||
|
||||
if ([undoManager isUndoing] == NO) {
|
||||
[self updateContent];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)htmlPreviewTimer:(NSTimer*)timer_ {
|
||||
|
||||
#pragma unused(timer_)
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
- (void)_surroundSelectionWithString:(NSString *)string {
|
||||
[self _surroundSelectionWithPrefixString:string
|
||||
suffixString:string
|
||||
selectionOffset:0];
|
||||
}
|
||||
|
||||
- (void)_surroundSelectionWithPrefixString:(NSString *)prefixString
|
||||
suffixString:(NSString *)suffixString
|
||||
selectionOffset:(NSInteger)selectionOffset {
|
||||
[self updateContentOnUndo];
|
||||
|
||||
NSMutableArray *newSelection = [[NSMutableArray alloc] init];
|
||||
|
||||
NSUInteger prefixStringLength = prefixString.length;
|
||||
NSUInteger suffixStringLength = suffixString.length;
|
||||
NSUInteger insertedStringLength = prefixStringLength + suffixStringLength;
|
||||
|
||||
NSUInteger insertedCharacters = 0;
|
||||
NSArray *selectedRanges = [markdownSourceTextView selectedRanges];
|
||||
BOOL multipleSelections = (selectedRanges.count != 1);
|
||||
|
||||
for (NSValue *rangeInfo in selectedRanges) {
|
||||
NSRange range = [rangeInfo rangeValue];
|
||||
range.location += insertedCharacters;
|
||||
|
||||
[markdownSourceTextView insertText:suffixString atIndex:NSMaxRange(range)];
|
||||
[markdownSourceTextView insertText:prefixString atIndex:range.location];
|
||||
|
||||
insertedCharacters += insertedStringLength;
|
||||
|
||||
if (multipleSelections || selectionOffset == 0) {
|
||||
range.location += prefixStringLength;
|
||||
} else {
|
||||
// We use the selectionOffset only if there is a single selection.
|
||||
if (selectionOffset < 0) {
|
||||
// Negative offsets are relative to the end of the resulting range.
|
||||
range.location += range.length + insertedStringLength + selectionOffset;
|
||||
} else {
|
||||
// Positive offsets are relative to the start of the resulting range.
|
||||
range.location += selectionOffset;
|
||||
}
|
||||
range.length = 0;
|
||||
}
|
||||
[newSelection addObject:[NSValue valueWithRange:range]];
|
||||
}
|
||||
|
||||
[markdownSourceTextView setSelectedRangesWithUndo:newSelection];
|
||||
|
||||
[self updateContentIncludingOnRedo];
|
||||
}
|
||||
|
||||
- (void)_addStringBeforeSelectedLines:(NSString *)string
|
||||
skippingEmptyLines:(BOOL)skipEmptyLines {
|
||||
[self updateContentOnUndo];
|
||||
|
||||
NSMutableString *mutableString = markdownSourceTextView.textStorage.mutableString;
|
||||
NSMutableArray *newSelection = [[NSMutableArray alloc] init];
|
||||
NSUInteger stringLength = string.length;
|
||||
|
||||
NSUInteger insertedCharacters = 0;
|
||||
|
||||
for (NSValue *rangeInfo in [markdownSourceTextView selectedRanges]) {
|
||||
NSRange range = [rangeInfo rangeValue];
|
||||
range.location += insertedCharacters;
|
||||
|
||||
NSUInteger rangeEnd = NSMaxRange(range);
|
||||
NSUInteger currentIndex = range.location;
|
||||
|
||||
NSUInteger insertionCounter = 0;
|
||||
|
||||
while (currentIndex < (rangeEnd + insertedCharacters)
|
||||
&& currentIndex < mutableString.length) {
|
||||
NSUInteger startIndex, lineEndIndex, contentsEndIndex;
|
||||
|
||||
[mutableString getLineStart:&startIndex
|
||||
end:&lineEndIndex
|
||||
contentsEnd:&contentsEndIndex
|
||||
forRange:NSMakeRange(currentIndex, 0)];
|
||||
|
||||
BOOL lineHasContent = (startIndex < contentsEndIndex);
|
||||
|
||||
if ((skipEmptyLines == NO) || lineHasContent) {
|
||||
// Prefix line with string.
|
||||
if (string == kNumberedListTemplate) {
|
||||
NSString *currentString = [NSString stringWithFormat:string, (unsigned long)(insertionCounter + 1)];
|
||||
[markdownSourceTextView insertText:currentString atIndex:startIndex];
|
||||
|
||||
stringLength = currentString.length;
|
||||
}
|
||||
else {
|
||||
[markdownSourceTextView insertText:string atIndex:startIndex];
|
||||
}
|
||||
|
||||
insertedCharacters += stringLength;
|
||||
|
||||
currentIndex = stringLength + lineEndIndex;
|
||||
|
||||
insertionCounter++;
|
||||
}
|
||||
else {
|
||||
// startIndex == contentsEndIndex => the line is empty. Do nothing and go to next line.
|
||||
currentIndex = lineEndIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (insertionCounter == 1) {
|
||||
// If this was within a single line, we keep the previously selected characters selected.
|
||||
range.location += stringLength;
|
||||
range.length += insertedCharacters - stringLength;
|
||||
}
|
||||
else {
|
||||
// If this selection went across multiple lines, we extend the selection to all the lines that were touched.
|
||||
range.length += insertedCharacters;
|
||||
}
|
||||
|
||||
[newSelection addObject:[NSValue valueWithRange:range]];
|
||||
}
|
||||
|
||||
[markdownSourceTextView setSelectedRangesWithUndo:newSelection];
|
||||
|
||||
[self updateContentIncludingOnRedo];
|
||||
}
|
||||
|
||||
- (IBAction)boldItalic:(NSSegmentedControl *)sender {
|
||||
//NSLog(@"sender: %ld", sender.selectedSegment);
|
||||
|
||||
switch (sender.selectedSegment) {
|
||||
case 0: { //bold
|
||||
[self bold:sender];
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: { //italic
|
||||
[self italic:sender];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_undoBold:(NSString *)string
|
||||
{
|
||||
NSLog(@"string: %@", string);
|
||||
}
|
||||
|
||||
- (IBAction)bold:(id)sender
|
||||
{
|
||||
[self _surroundSelectionWithString:@"**"];
|
||||
}
|
||||
|
||||
- (IBAction)italic:(id)sender
|
||||
{
|
||||
[self _surroundSelectionWithString:@"*"];
|
||||
}
|
||||
|
||||
- (IBAction)header1:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@"# "
|
||||
skippingEmptyLines:YES];
|
||||
}
|
||||
|
||||
- (IBAction)header2:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@"## "
|
||||
skippingEmptyLines:YES];
|
||||
}
|
||||
|
||||
- (IBAction)header3:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@"### "
|
||||
skippingEmptyLines:YES];
|
||||
}
|
||||
|
||||
- (IBAction)blockQuote:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@"> "
|
||||
skippingEmptyLines:NO];
|
||||
}
|
||||
|
||||
- (IBAction)codeSection:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@" "
|
||||
skippingEmptyLines:NO];
|
||||
}
|
||||
|
||||
- (IBAction)unorderedList:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:@"* "
|
||||
skippingEmptyLines:YES];
|
||||
}
|
||||
|
||||
- (IBAction)numberedList:(id)sender
|
||||
{
|
||||
[self _addStringBeforeSelectedLines:kNumberedListTemplate
|
||||
skippingEmptyLines:YES];
|
||||
}
|
||||
|
||||
- (IBAction)link:(id)sender
|
||||
{
|
||||
[self _surroundSelectionWithPrefixString:@"[" suffixString:@"]()"
|
||||
selectionOffset:-1];
|
||||
}
|
||||
|
||||
- (IBAction)image:(id)sender
|
||||
{
|
||||
[self _surroundSelectionWithPrefixString:@"![" suffixString:@"]()"
|
||||
selectionOffset:-1];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// NSTextView+EditPlainTextWithUndo.h
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
// Based on DrewThaler’s post at http://www.cocoadev.com/index.pl?UndoSupportForNSTextStorage
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSTextView (EditPlainTextWithUndo)
|
||||
|
||||
- (void)setSelectedRangeWithUndo:(NSRange)range;
|
||||
- (void)setSelectedRangesWithUndo:(NSArray *)ranges;
|
||||
|
||||
- (BOOL)setText:(NSString *)string;
|
||||
- (BOOL)replaceCharactersInRange:(NSRange)range withText:(NSString *)string;
|
||||
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index;
|
||||
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index checkIndex:(BOOL)checkIndex;
|
||||
- (BOOL)insertText:(NSString *)string;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// NSTextView+EditPlainTextWithUndo.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Jan Weiß on 31.08.12. Some rights reserved: <http://opensource.org/licenses/mit-license.php>
|
||||
//
|
||||
|
||||
// Based on DrewThaler’s post at http://www.cocoadev.com/index.pl?UndoSupportForNSTextStorage
|
||||
|
||||
#import "NSTextView+EditPlainTextWithUndo.h"
|
||||
|
||||
|
||||
@implementation NSTextView (EditPlainTextWithUndo)
|
||||
|
||||
- (void)setSelectedRangeWithUndo:(NSRange)range;
|
||||
{
|
||||
[self setSelectedRange:range];
|
||||
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:range];
|
||||
}
|
||||
|
||||
- (void)setSelectedRangesWithUndo:(NSArray *)ranges;
|
||||
{
|
||||
[self setSelectedRanges:ranges];
|
||||
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangesWithUndo:ranges];
|
||||
}
|
||||
|
||||
- (BOOL)setText:(NSString *)string;
|
||||
{
|
||||
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:self.selectedRange];
|
||||
|
||||
NSTextStorage *textStorage = [self textStorage];
|
||||
|
||||
if ([self shouldChangeTextInRange:NSMakeRange(0, [textStorage length])
|
||||
replacementString:string]) {
|
||||
|
||||
[textStorage.mutableString setString:string];
|
||||
|
||||
[self didChangeText];
|
||||
|
||||
[self setSelectedRangeWithUndo:NSMakeRange(0, 0)];
|
||||
|
||||
return YES;
|
||||
}
|
||||
else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)replaceCharactersInRange:(NSRange)range withText:(NSString *)string;
|
||||
{
|
||||
NSString *selectedText = [[self string] substringWithRange:range];
|
||||
NSString *stringForDelegate = string;
|
||||
|
||||
// If only attributes are changing, pass nil.
|
||||
if ([string isEqualToString:selectedText]) {
|
||||
stringForDelegate = nil;
|
||||
}
|
||||
|
||||
[[self.undoManager prepareWithInvocationTarget:self] setSelectedRangeWithUndo:self.selectedRange];
|
||||
|
||||
// Call delegate methods to force undo recording
|
||||
if ([self shouldChangeTextInRange:range
|
||||
replacementString:stringForDelegate]) {
|
||||
|
||||
[self.textStorage.mutableString replaceCharactersInRange:range
|
||||
withString:string];
|
||||
|
||||
[self didChangeText];
|
||||
|
||||
[self setSelectedRangeWithUndo:NSMakeRange(range.location + [string length], 0)];
|
||||
|
||||
return YES;
|
||||
}
|
||||
else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)insertText:(NSString *)string atIndex:(NSUInteger)index;
|
||||
{
|
||||
NSRange range = NSMakeRange(index, 0);
|
||||
return [self replaceCharactersInRange:range withText:string];
|
||||
}
|
||||
|
||||
- (BOOL)insertText:(NSString *)attributedString atIndex:(NSUInteger)index checkIndex:(BOOL)checkIndex;
|
||||
{
|
||||
NSUInteger textLength = [self.textStorage length];
|
||||
|
||||
if (checkIndex && (index == NSNotFound || !(index <= textLength))) {
|
||||
index = textLength; // AFTER the last character in textStorage
|
||||
}
|
||||
|
||||
return [self insertText:attributedString atIndex:index];
|
||||
}
|
||||
|
||||
- (BOOL)insertText:(NSString *)attributedString;
|
||||
{
|
||||
NSRange range = [self selectedRange];
|
||||
return [self replaceCharactersInRange:range withText:attributedString];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -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,21 @@
|
||||
//
|
||||
// PreferencesController.h
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Akihiro Noguchi on 7/05/11.
|
||||
// Copyright 2011 Aki. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString * const kEditPaneFontNameChangedNotification;
|
||||
|
||||
@interface PreferencesController : NSObject {
|
||||
IBOutlet NSWindow *prefWindow;
|
||||
IBOutlet NSTextField *fontPreviewField;
|
||||
}
|
||||
|
||||
- (IBAction)resetEditPanePreferences:(id)sender;
|
||||
- (IBAction)showFonts:(id)sender;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// PreferencesController.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Akihiro Noguchi on 7/05/11.
|
||||
// Copyright 2011 Aki. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PreferencesController.h"
|
||||
#import "PreferencesManager.h"
|
||||
|
||||
NSString * const kEditPaneFontNameChangedNotification = @"EditPaneFontNameChangedNotification";
|
||||
|
||||
NSString * const kFontDisplayFormat = @"%@ %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:kFontDisplayFormat, 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:kFontDisplayFormat, fontName, fontSize]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kEditPaneFontNameChangedNotification
|
||||
object:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel {
|
||||
|
||||
#pragma unused(fontPanel)
|
||||
|
||||
return (NSFontPanelFaceModeMask |
|
||||
NSFontPanelSizeModeMask |
|
||||
NSFontPanelCollectionModeMask);
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// PreferencesManager.h
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Akihiro Noguchi on 7/05/11.
|
||||
// Copyright 2011 Aki. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString * const kEditPaneFontName;
|
||||
extern NSString * const kEditPaneFontSize;
|
||||
extern NSString * const kEditPaneForegroundColor;
|
||||
extern NSString * const kEditPaneBackgroundColor;
|
||||
extern NSString * const kEditPaneSelectionColor;
|
||||
extern NSString * const kEditPaneCaretColor;
|
||||
|
||||
@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,129 @@
|
||||
//
|
||||
// PreferencesManager.m
|
||||
// MarkdownLive
|
||||
//
|
||||
// Created by Akihiro Noguchi on 7/05/11.
|
||||
// Copyright 2011 Aki. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PreferencesManager.h"
|
||||
|
||||
NSString * const kEditPaneFontName = @"EditPaneFontName";
|
||||
NSString * const kEditPaneFontSize = @"EditPaneFontSize";
|
||||
NSString * const kEditPaneForegroundColor = @"EditPaneForegroundColor";
|
||||
NSString * const kEditPaneBackgroundColor = @"EditPaneBackgroundColor";
|
||||
NSString * const kEditPaneSelectionColor = @"EditPaneSelectionColor";
|
||||
NSString * const kEditPaneCaretColor = @"EditPaneCaretColor";
|
||||
|
||||
@interface PreferencesManager (Private)
|
||||
|
||||
+ (NSColor *)colorForKey:(NSString *)key;
|
||||
+ (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,8 @@
|
||||
## MarkdownLive
|
||||
|
||||
A Cocoa markdown preview editor using [Discount][discount].
|
||||
|
||||
Implements the ORCDiscount framework.
|
||||
|
||||
|
||||
[discount]: https://github.com/Orc/discount
|
||||
@@ -1,47 +0,0 @@
|
||||
->Copyright (C) 2007 David Loren Parsons.
|
||||
All rights reserved.<-
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicence, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution, and in the same place and form as other
|
||||
copyright, license and disclaimer information.
|
||||
|
||||
3. The end-user documentation included with the redistribution, if
|
||||
any, must include the following acknowledgment:
|
||||
|
||||
This product includes software developed by
|
||||
David Loren Parsons <http://www.pell.portland.or.us/~orc>
|
||||
|
||||
in the same place and form as other third-party acknowledgments.
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, in the same form and location as other such third-party
|
||||
acknowledgments.
|
||||
|
||||
4. Except as contained in this notice, the name of David Loren
|
||||
Parsons shall not be used in advertising or otherwise to promote
|
||||
the sale, use or other dealings in this Software without prior
|
||||
written authorization from David Loren Parsons.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -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.
|
||||
.".It Ar strict
|
||||
."Disable superscript and relaxed emphasis.
|
||||
.".It Ar relax
|
||||
."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,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,50 +0,0 @@
|
||||
./echo "smarty pants"
|
||||
|
||||
rc=0
|
||||
MARKDOWN_FLAGS=0x0; export 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 '(c) -> ©' '(c)' '<p>©</p>'
|
||||
try '(r) -> ®' '(r)' '<p>®</p>'
|
||||
try '(tm) -> ™' '(tm)' '<p>™</p>'
|
||||
try '... -> …' '...' '<p>…</p>'
|
||||
|
||||
try '"--" -> —' '--' '<p>—</p>'
|
||||
|
||||
try '"-" -> –' 'regular -' '<p>regular –</p>'
|
||||
try 'A-B -> A-B' 'A-B' '<p>A-B</p>'
|
||||
try '"fancy" -> “fancy”' '"fancy"' '<p>“fancy”</p>'
|
||||
try "'fancy'" "'fancy'" '<p>‘fancy’</p>'
|
||||
try "don<b>'t -> don<b>’t" "don<b>'t" '<p>don<b>’t</p>'
|
||||
try "don't -> don’t" "don't" '<p>don’t</p>'
|
||||
try "it's -> it’s" "it's" '<p>it’s</p>'
|
||||
|
||||
if ./markdown -V | grep SUPERSCRIPT >/dev/null; then
|
||||
try -frelax 'A^B -> A<sup>B</sup> (-frelax)' 'A^B' '<p>A<sup>B</sup></p>'
|
||||
try -fstrict 'A^B != A<sup>B</sup> (-fstrict)' 'A^B' '<p>A^B</p>'
|
||||
try -frelax 'A^B in link title' '[link](here "A^B")' '<p><a href="here" title="A^B">link</a></p>'
|
||||
fi
|
||||
|
||||
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,164 +0,0 @@
|
||||
./echo "tables"
|
||||
|
||||
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-column table' \
|
||||
'|hello
|
||||
|-----
|
||||
|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>hello</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
|
||||
try 'two-column table' \
|
||||
'
|
||||
a | b
|
||||
-----|------
|
||||
hello|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>hello</td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
try 'three-column table' \
|
||||
'a|b|c
|
||||
-|-|-
|
||||
hello||sailor'\
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>a</th>
|
||||
<th>b</th>
|
||||
<th>c</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>hello</td>
|
||||
<td></td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
try 'two-column table with empty cells' \
|
||||
'
|
||||
a | b
|
||||
-----|------
|
||||
hello|
|
||||
|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>hello</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
try 'two-column table with alignment' \
|
||||
'
|
||||
a | b
|
||||
----:|:-----
|
||||
hello|sailor' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="right"> a </th>
|
||||
<th align="left"> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="right">hello</td>
|
||||
<td align="left">sailor</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
try 'table with extra data column' \
|
||||
'
|
||||
a | b
|
||||
-----|------
|
||||
hello|sailor|boy' \
|
||||
'<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th> a </th>
|
||||
<th> b</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>hello</td>
|
||||
<td>sailor|boy</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>'
|
||||
|
||||
|
||||
try -fnotables 'tables with -fnotables' \
|
||||
'a|b
|
||||
-|-
|
||||
hello|sailor' \
|
||||
'<p>a|b
|
||||
–|–
|
||||
hello|sailor</p>'
|
||||
|
||||
|
||||
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,90 +0,0 @@
|
||||
/*
|
||||
* toc -- spit out a table of contents based on header blocks
|
||||
*
|
||||
* Copyright (C) 2008 Jjgod Jiang, David L Parsons.
|
||||
* The redistribution terms are provided in the COPYRIGHT file that must
|
||||
* be distributed with this source code.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cstring.h"
|
||||
#include "markdown.h"
|
||||
#include "amalloc.h"
|
||||
|
||||
/* write an header index
|
||||
*/
|
||||
int
|
||||
mkd_toc(Document *p, char **doc)
|
||||
{
|
||||
Paragraph *tp, *srcp;
|
||||
int last_hnumber = 0;
|
||||
Cstring res;
|
||||
|
||||
CREATE(res);
|
||||
RESERVE(res, 100);
|
||||
|
||||
*doc = 0;
|
||||
|
||||
if ( !(p && p->ctx) ) return -1;
|
||||
if ( ! (p->ctx->flags & TOC) ) return 0;
|
||||
|
||||
for ( tp = p->code; tp ; tp = tp->next ) {
|
||||
if ( tp->typ == SOURCE ) {
|
||||
for ( srcp = tp->down; srcp; srcp = srcp->next ) {
|
||||
if ( srcp->typ == HDR && srcp->text ) {
|
||||
|
||||
if ( last_hnumber == srcp->hnumber )
|
||||
Csprintf(&res, "%*s</li>\n", srcp->hnumber, "");
|
||||
else while ( last_hnumber > srcp->hnumber ) {
|
||||
Csprintf(&res, "%*s</li>\n%*s</ul>\n",
|
||||
last_hnumber, "",
|
||||
last_hnumber-1,"");
|
||||
--last_hnumber;
|
||||
}
|
||||
|
||||
while ( srcp->hnumber > last_hnumber ) {
|
||||
Csprintf(&res, "\n%*s<ul>\n", srcp->hnumber, "");
|
||||
++last_hnumber;
|
||||
}
|
||||
Csprintf(&res, "%*s<li><a href=\"#", srcp->hnumber, "");
|
||||
mkd_string_to_anchor(T(srcp->text->text), S(srcp->text->text), Csputc, &res);
|
||||
Csprintf(&res, "\">");
|
||||
Csreparse(&res, T(srcp->text->text), S(srcp->text->text), 0);
|
||||
Csprintf(&res, "</a>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ( last_hnumber > 0 ) {
|
||||
Csprintf(&res, "%*s</li>\n%*s</ul>\n",
|
||||
last_hnumber, "", last_hnumber, "");
|
||||
--last_hnumber;
|
||||
}
|
||||
/* HACK ALERT! HACK ALERT! HACK ALERT! */
|
||||
*doc = T(res); /* we know that a T(Cstring) is a character pointer */
|
||||
/* so we can simply pick it up and carry it away, */
|
||||
return S(res); /* leaving the husk of the Ctring on the stack */
|
||||
/* END HACK ALERT */
|
||||
}
|
||||
|
||||
|
||||
/* write an header index
|
||||
*/
|
||||
int
|
||||
mkd_generatetoc(Document *p, FILE *out)
|
||||
{
|
||||
char *buf = 0;
|
||||
int sz = mkd_toc(p, &buf);
|
||||
int ret = EOF;
|
||||
|
||||
if ( sz > 0 )
|
||||
ret = fwrite(buf, sz, 1, out);
|
||||
|
||||
if ( buf ) free(buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -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
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
make blocktags
|
||||
|
||||
status_msg "Copying important files..."
|
||||
|
||||
if head -n 1 config.h | grep -q "^/\*$"; then
|
||||
# remove generated comments in config.h
|
||||
sed -i '1,/^ *\*\/ *$/ { d; }' <config.h
|
||||
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 -df -e blocktags -e 'config.h' -e 'mkdio.h'
|
||||
|
||||
status_msg "Done!"
|
||||
@@ -0,0 +1,30 @@
|
||||
->Copyright (C) 2007 David Loren Parsons.
|
||||
All rights reserved.<-
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of works must retain the original copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the original copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither my name (David L Parsons) nor the names of contributors to
|
||||
this code may be used to endorse or promote products derived
|
||||
from this work without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Discount is primarily my work, but it has only reached the point
|
||||
where it is via contributions, critiques, and bug reports from a
|
||||
host of other people, some of which are listed before. If your
|
||||
name isn't on this list, please remind me
|
||||
-david parsons (orc@pell.chi.il.us)
|
||||
-david parsons (orc@pell.portland.or.us)
|
||||
|
||||
|
||||
Josh Wood -- Plan9 support.
|
||||
@@ -29,5 +29,7 @@ Andrew White -- bug reports about the format of generated urls.
|
||||
Steve Huff -- bug reports about Makefile portability (for Fink)
|
||||
Ignacio Burgue?o-- bug reports about `>%class%`
|
||||
Henrik Nyh -- bug reports about embedded html handling.
|
||||
John J. Foerch -- bug reports about incorrect `–` and `—`
|
||||
translations.
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ Csreparse(Cstring *iot, char *buf, int size, int flags)
|
||||
{
|
||||
MMIOT f;
|
||||
___mkd_initmmiot(&f, 0);
|
||||
___mkd_reparse(buf, size, 0, &f);
|
||||
___mkd_reparse(buf, size, 0, &f, 0);
|
||||
___mkd_emblock(&f);
|
||||
SUFFIX(*iot, T(f.out), S(f.out));
|
||||
___mkd_freemmiot(&f, 0);
|
||||
@@ -0,0 +1,141 @@
|
||||
CC=@CC@ -I.
|
||||
LFLAGS=-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 \
|
||||
github_flavoured.o setup.o tags.o html5.o flags.o @AMALLOC@
|
||||
TESTFRAMEWORK=echo cols
|
||||
|
||||
MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3
|
||||
|
||||
all: $(PGMS) $(SAMPLE_PGMS) $(TESTFRAMEWORK)
|
||||
|
||||
install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR)
|
||||
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)$(BINDIR)
|
||||
./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR)
|
||||
@INSTALL_DATA@ mkdio.h $(DESTDIR)$(INCDIR)
|
||||
|
||||
install.everything: install install.samples install.man
|
||||
|
||||
install.samples: $(SAMPLE_PGMS) install $(DESTDIR)$(BINDIR)
|
||||
@INSTALL_DIR@ $(DESTDIR)$(MANDIR)/man1
|
||||
for x in $(SAMPLE_PGMS); do \
|
||||
@INSTALL_PROGRAM@ $$x $(DESTDIR)$(BINDIR)/$(SAMPLE_PFX)$$x; \
|
||||
@INSTALL_DATA@ $$x.1 $(DESTDIR)$(MANDIR)/man1/$(SAMPLE_PFX)$$x.1; \
|
||||
done
|
||||
|
||||
install.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) $(CFLAGS) -DVERSION=\"`cat VERSION`\" -c version.c
|
||||
|
||||
VERSION:
|
||||
@true
|
||||
|
||||
tags.o: tags.c blocktags
|
||||
|
||||
blocktags: mktags
|
||||
./mktags > blocktags
|
||||
|
||||
# example programs
|
||||
@THEME@theme: theme.o $(MKDLIB) mkdio.h
|
||||
@THEME@ $(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
|
||||
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o mkd2html mkd2html.o -lmarkdown @LIBS@
|
||||
|
||||
markdown: main.o pgm_options.o $(MKDLIB)
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
makepage: makepage.c pgm_options.o $(MKDLIB) mkdio.h
|
||||
$(CC) $(CFLAGS) $(LFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
|
||||
|
||||
pgm_options.o: pgm_options.c mkdio.h config.h
|
||||
$(CC) $(CFLAGS) -I. -c pgm_options.c
|
||||
|
||||
main.o: main.c mkdio.h config.h
|
||||
$(CC) $(CFLAGS) -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@ ./mktags ./blocktags ./librarian.sh
|
||||
|
||||
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'
|
||||
@@ -5,7 +5,7 @@ language as described in
|
||||
and passes the Markdown test suite at
|
||||
<http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>
|
||||
|
||||
DISCOUNT is free software written by David Parsons <orc@pell.chi.il.us>;
|
||||
DISCOUNT is free software written by David Parsons <orc@pell.portland.or.us>;
|
||||
it is released under a BSD-style license that allows you to do
|
||||
as you wish with it as long as you don't attempt to claim it as
|
||||
your own work.
|
||||
@@ -0,0 +1 @@
|
||||
2.1.8
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
static struct kw blocktags[] = {
|
||||
{ "P", 1, 0 },
|
||||
{ "DL", 2, 0 },
|
||||
{ "H1", 2, 0 },
|
||||
{ "H2", 2, 0 },
|
||||
{ "H3", 2, 0 },
|
||||
{ "H4", 2, 0 },
|
||||
{ "H5", 2, 0 },
|
||||
{ "H6", 2, 0 },
|
||||
{ "HR", 2, 1 },
|
||||
{ "OL", 2, 0 },
|
||||
{ "UL", 2, 0 },
|
||||
{ "BDO", 3, 0 },
|
||||
{ "DFN", 3, 0 },
|
||||
{ "DIV", 3, 0 },
|
||||
{ "MAP", 3, 0 },
|
||||
{ "PRE", 3, 0 },
|
||||
{ "WBR", 3, 0 },
|
||||
{ "XMP", 3, 0 },
|
||||
{ "NOBR", 4, 0 },
|
||||
{ "STYLE", 5, 0 },
|
||||
{ "TABLE", 5, 0 },
|
||||
{ "CENTER", 6, 0 },
|
||||
{ "IFRAME", 6, 0 },
|
||||
{ "OBJECT", 6, 0 },
|
||||
{ "SCRIPT", 6, 0 },
|
||||
{ "ADDRESS", 7, 0 },
|
||||
{ "LISTING", 7, 0 },
|
||||
{ "PLAINTEXT", 9, 0 },
|
||||
{ "BLOCKQUOTE", 10, 0 },
|
||||
};
|
||||
|
||||
#define NR_blocktags 29
|
||||
@@ -1,25 +1,30 @@
|
||||
/*
|
||||
* configuration for markdown, generated Sun Sep 13 13:13:06 CDT 2009
|
||||
* by wolf@wolf-mbp.local
|
||||
* configuration for markdown, generated Wed Apr 8 00:13:17 CDT 2015
|
||||
* by vino@achilleus.local
|
||||
*/
|
||||
#ifndef __AC_MARKDOWN_D
|
||||
#define __AC_MARKDOWN_D 1
|
||||
|
||||
|
||||
#define OS_DARWIN 1
|
||||
#define DWORD unsigned int
|
||||
#define WORD unsigned short
|
||||
#define BYTE unsigned char
|
||||
#define USE_DISCOUNT_DL 1
|
||||
#define while(x) while( (x) != 0 )
|
||||
#define if(x) if( (x) != 0 )
|
||||
#define DWORD unsigned int
|
||||
#define WORD unsigned short
|
||||
#define BYTE unsigned char
|
||||
#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 */
|
||||
@@ -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,47 @@ 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()"; need_proto=1 ;;
|
||||
*) F="$1" ; unset need_proto ;;
|
||||
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
|
||||
|
||||
if [ "$need_proto" ]; then
|
||||
echo "void $F;" >> ngc$$.c
|
||||
fi
|
||||
|
||||
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 +244,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 +259,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 +279,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 +294,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 +316,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 +333,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 +350,7 @@ EOF
|
||||
AC_PROG_CC () {
|
||||
test "$AC_CC" && return 0
|
||||
|
||||
cat > /tmp/ngc$$.c << \EOF
|
||||
cat > ngc$$.c << \EOF
|
||||
#include <stdio.h>
|
||||
main()
|
||||
{
|
||||
@@ -364,13 +381,21 @@ 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
|
||||
if $AC_CC -x c /dev/null -dM -E 2>&1 | grep '__clang__' >/dev/null; then
|
||||
TLOG " yuck, you're using clang"
|
||||
IS_CLANG=T
|
||||
IS_BROKEN_CC=T
|
||||
elif $AC_CC -v 2>&1 | grep 'gcc version' >/dev/null; then
|
||||
TLOG " oh ick, it looks like gcc"
|
||||
IS_GCC=T
|
||||
IS_BROKEN_CC=T
|
||||
else
|
||||
TLOG " ok"
|
||||
@@ -382,7 +407,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 +418,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
|
||||
@@ -406,9 +431,7 @@ EOF
|
||||
AC_FAIL " does not compile code properly"
|
||||
fi
|
||||
|
||||
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 +694,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 +728,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 +813,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 +833,33 @@ EOF
|
||||
# AC_C_VOLATILE checks to see if the compiler supports the volatile keyword
|
||||
#
|
||||
AC_C_VOLATILE () {
|
||||
cat > /tmp/pd$$.c << EOF
|
||||
f() { volatile char me=1; }
|
||||
EOF
|
||||
echo 'f() { volatile char me=1; }' > ngc$$.c
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# AC_C_INLINE checks to see if compiler supports the inline keyword
|
||||
#
|
||||
AC_C_INLINE() {
|
||||
echo 'inline int foo() { return 1; }' > ngc$$.c
|
||||
LOGN 'Checking for "inline" keyword'
|
||||
if __MAKEDOTO ngc$$.c; then
|
||||
rc=0
|
||||
else
|
||||
AC_DEFINE inline '/**/'
|
||||
rc=1
|
||||
fi
|
||||
__remove ngc$$.c
|
||||
return $rc
|
||||
}
|
||||
|
||||
@@ -825,43 +868,82 @@ 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
|
||||
|
||||
rc=1
|
||||
LOGN "defining WORD & DWORD scalar types"
|
||||
|
||||
if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
|
||||
# windows machine; BYTE, WORD, DWORD already
|
||||
# defined
|
||||
echo "#include <WinDef.h>" >> $__cwd/config.h
|
||||
TLOG " (defined in WinDef.h)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cat > ngc$$.c << EOF
|
||||
#include <stdio.h>
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
||||
@@ -873,6 +955,7 @@ AC_OUTPUT () {
|
||||
AC_SUB 'LIBS' "$AC_LIBS"
|
||||
AC_SUB 'CONFIGURE_FILES' "$__config_files"
|
||||
AC_SUB 'GENERATED_FILES' "$*"
|
||||
AC_SUB 'CC' "$AC_CC"
|
||||
AC_SUB 'CFLAGS' "$AC_CFLAGS"
|
||||
AC_SUB 'LDFLAGS' "$AC_LDFLAGS"
|
||||
AC_SUB 'srcdir' "$AC_SRCDIR"
|
||||
@@ -884,6 +967,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 +1048,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 +1069,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 +1081,7 @@ EOF
|
||||
LOG " (not found)"
|
||||
fi
|
||||
|
||||
rm -f flock $$.c
|
||||
__remove ngc$$ ngc$$.c
|
||||
|
||||
case "$HAS_FLOCK" in
|
||||
0) return 1 ;;
|
||||
@@ -978,7 +1101,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 +1116,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 +1144,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 +1157,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,9 +1181,11 @@ EOF
|
||||
AC_CHECK_BASENAME() {
|
||||
TLOGN "looking for a reentrant basename "
|
||||
|
||||
cat > /tmp/ngc$$.c << EOF
|
||||
cat > ngc$$.c << EOF
|
||||
#include <string.h>
|
||||
|
||||
extern char *basename(char*);
|
||||
|
||||
main()
|
||||
{
|
||||
char *a = basename("/a/test");
|
||||
@@ -1071,8 +1196,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 +1207,157 @@ 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
|
||||
}
|
||||
|
||||
|
||||
# generate a macosX librarian
|
||||
#
|
||||
__AC_MACOS_LIBRARIAN() {
|
||||
AC_SUB LD_LIBRARY_PATH DYLD_LIBRARY_PATH
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build MacOS shared libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
# Generate an ELF librarian (for Linux, freebsd)
|
||||
#
|
||||
__AC_ELF_LIBRARIAN() {
|
||||
AC_SUB LD_LIBRARY_PATH LD_LIBRARY_PATH
|
||||
# -Wl option probably works, but be paranoid anyway
|
||||
_VFLAGS="$AC_PICFLAG -shared -Wl,-soname,ngc$$.so.1"
|
||||
if $AC_CC $_VFLAGS -o ngc$$.so ngc$$.c; then
|
||||
USE_SONAME=T
|
||||
fi
|
||||
LDCONFIG=`AC_PATH=/sbin:/usr/sbin:/usr/local/sbin acLookFor ldconfig`
|
||||
__config_files="$__config_files librarian.sh"
|
||||
cat > librarian.sh << EOF
|
||||
#! /bin/sh
|
||||
#
|
||||
# Build ELF shared libraries, hiding (some) ickiness from the makefile
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# AC_CC_SHLIBS checks if the C compiler can produce shared libraries
|
||||
# and if it can writes a librarian that handles those libraries for us.
|
||||
#
|
||||
AC_CC_SHLIBS () {
|
||||
AC_PROG_CC || AC_FAIL "Need a C compiler to build shared libraries"
|
||||
AC_PROG_LN_S || AC_FAIL "Need to be able to make symbolic links for shared libraries"
|
||||
AC_PROG_INSTALL || AC_FAIL "Need an install program to install shared libraries"
|
||||
LOGN "checking whether the C compiler can build shared libraries "
|
||||
|
||||
echo "int some_variable = 0;" > ngc$$.c
|
||||
|
||||
if uname -a | grep Darwin >/dev/null; then
|
||||
# Claims to be macos?
|
||||
if $AC_CC $AC_PICFLAG -dynamiclib -o ngc$$.so ngc$$.c; then
|
||||
__AC_MACOS_LIBRARIAN
|
||||
|
||||
LOG "(yes; macos dylib)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(no)"
|
||||
__rc=1
|
||||
fi
|
||||
elif $AC_CC $AC_PICFLAG -shared -o ngc$$.so ngc$$.c; then
|
||||
__AC_ELF_LIBRARIAN
|
||||
LOG "(yes; -shared)"
|
||||
__rc=0
|
||||
else
|
||||
LOG "(no)"
|
||||
__rc=1
|
||||
fi
|
||||
|
||||
__remove ngc$$.so ngc$$.c
|
||||
|
||||
return $__rc
|
||||
}
|
||||
|
||||
|
||||
@@ -1174,22 +1449,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,15 @@
|
||||
|
||||
# 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
|
||||
--with-fenced-code Allow fenced code blocks
|
||||
--with-urlencoded-anchor Use url-encoded chars to multibyte chars in toc links
|
||||
--enable-all-features Turn on all stable optional features
|
||||
--shared Build shared libraries (default is static)'
|
||||
|
||||
LOCAL_AC_OPTIONS='
|
||||
set=`locals $*`;
|
||||
@@ -29,20 +29,17 @@ 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 ;;
|
||||
--DEBIAN-GLITCH)
|
||||
echo DEBIAN_GLITCH=T
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -51,19 +48,49 @@ 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_FENCED_CODE" && AC_DEFINE "WITH_FENCED_CODE" 1
|
||||
test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1
|
||||
test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 1
|
||||
test "$WITH_URLENCODED_ANCHOR" && AC_DEFINE 'WITH_URLENCODED_ANCHOR' 1
|
||||
test "$DEBIAN_GLITCH" && AC_DEFINE 'DEBIAN_GLITCH' 1
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
case "$AC_CC $AC_CFLAGS" in
|
||||
*-Wall*) AC_DEFINE 'while(x)' 'while( (x) != 0 )'
|
||||
AC_DEFINE 'if(x)' 'if( (x) != 0 )' ;;
|
||||
esac
|
||||
test "$TRY_SHARED" && AC_COMPILER_PIC && AC_CC_SHLIBS
|
||||
|
||||
if [ "IS_BROKEN_CC" ]; then
|
||||
case "$AC_CC $AC_CFLAGS" in
|
||||
*-pedantic*) ;;
|
||||
*) # hack around deficiencies in gcc and clang
|
||||
#
|
||||
AC_DEFINE 'while(x)' 'while( (x) != 0 )'
|
||||
AC_DEFINE 'if(x)' 'if( (x) != 0 )'
|
||||
|
||||
if [ "$IS_CLANG" ]; then
|
||||
AC_CC="$AC_CC -Wno-implicit-int"
|
||||
elif [ "$IS_GCC" ]; then
|
||||
AC_CC="$AC_CC -Wno-return-type -Wno-implicit-int"
|
||||
fi ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_PROG ar || AC_FAIL "$TARGET requires ar"
|
||||
AC_PROG ranlib
|
||||
|
||||
AC_C_VOLATILE
|
||||
AC_C_CONST
|
||||
AC_SCALAR_TYPES
|
||||
AC_C_INLINE
|
||||
AC_SCALAR_TYPES sub hdr
|
||||
AC_CHECK_BASENAME
|
||||
|
||||
AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
|
||||
@@ -76,6 +103,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 +151,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 +159,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)) \
|
||||
@@ -25,9 +27,9 @@
|
||||
#define DELETE(x) ALLOCATED(x) ? (free(T(x)), S(x) = (x).alloc = 0) \
|
||||
: ( S(x) = 0 )
|
||||
#define CLIP(t,i,sz) \
|
||||
( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
|
||||
S(t) -= ( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
|
||||
(memmove(&T(t)[i], &T(t)[i+sz], (S(t)-(i+sz)+1)*sizeof(T(t)[0])), \
|
||||
S(t) -= (sz)) : -1
|
||||
(sz)) : 0
|
||||
|
||||
#define RESERVE(x, sz) T(x) = ((x).alloc > S(x) + (sz) \
|
||||
? T(x) \
|
||||
@@ -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)
|
||||
* compatible 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,85 @@
|
||||
#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" },
|
||||
{ MKD_NOSTYLE, "!STYLE" },
|
||||
};
|
||||
#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,100 @@
|
||||
|
||||
/*
|
||||
* github_flavoured -- implement the obnoxious "returns are hard newlines"
|
||||
* feature in github flavoured markdown.
|
||||
*
|
||||
* Copyright (C) 2012 David L Parsons.
|
||||
* The redistribution terms are provided in the COPYRIGHT file that must
|
||||
* be distributed with this source code.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cstring.h"
|
||||
#include "markdown.h"
|
||||
#include "amalloc.h"
|
||||
|
||||
/* build a Document from any old input.
|
||||
*/
|
||||
typedef int (*getc_func)(void*);
|
||||
|
||||
Document *
|
||||
gfm_populate(getc_func getc, void* ctx, int flags)
|
||||
{
|
||||
Cstring line;
|
||||
Document *a = __mkd_new_Document();
|
||||
int c;
|
||||
int pandoc = 0;
|
||||
|
||||
if ( !a ) return 0;
|
||||
|
||||
a->tabstop = (flags & MKD_TABSTOP) ? 4 : TABSTOP;
|
||||
|
||||
CREATE(line);
|
||||
|
||||
while ( (c = (*getc)(ctx)) != EOF ) {
|
||||
if ( c == '\n' ) {
|
||||
if ( pandoc != EOF && pandoc < 3 ) {
|
||||
if ( S(line) && (T(line)[0] == '%') )
|
||||
pandoc++;
|
||||
else
|
||||
pandoc = EOF;
|
||||
}
|
||||
|
||||
if (pandoc == EOF) {
|
||||
EXPAND(line) = ' ';
|
||||
EXPAND(line) = ' ';
|
||||
}
|
||||
__mkd_enqueue(a, &line);
|
||||
S(line) = 0;
|
||||
}
|
||||
else if ( isprint(c) || isspace(c) || (c & 0x80) )
|
||||
EXPAND(line) = c;
|
||||
}
|
||||
|
||||
if ( S(line) )
|
||||
__mkd_enqueue(a, &line);
|
||||
|
||||
DELETE(line);
|
||||
|
||||
if ( (pandoc == 3) && !(flags & (MKD_NOHEADER|MKD_STRICT)) ) {
|
||||
/* the first three lines started with %, so we have a header.
|
||||
* clip the first three lines out of content and hang them
|
||||
* off header.
|
||||
*/
|
||||
Line *headers = T(a->content);
|
||||
|
||||
a->title = headers; __mkd_header_dle(a->title);
|
||||
a->author= headers->next; __mkd_header_dle(a->author);
|
||||
a->date = headers->next->next; __mkd_header_dle(a->date);
|
||||
|
||||
T(a->content) = headers->next->next->next;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
/* convert a block of text into a linked list
|
||||
*/
|
||||
Document *
|
||||
gfm_string(const char *buf, int len, DWORD flags)
|
||||
{
|
||||
struct string_stream about;
|
||||
|
||||
about.data = buf;
|
||||
about.size = len;
|
||||
|
||||
return gfm_populate((getc_func)__mkd_io_strget, &about, flags & INPUT_MASK);
|
||||
}
|
||||
|
||||
|
||||
/* convert a file into a linked list
|
||||
*/
|
||||
Document *
|
||||
gfm_in(FILE *f, DWORD flags)
|
||||
{
|
||||
return gfm_populate((getc_func)fgetc, f, flags & INPUT_MASK);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* 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_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,12 @@
|
||||
#include <mkdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "amalloc.h"
|
||||
#include "pgm_options.h"
|
||||
#include "tags.h"
|
||||
|
||||
#if HAVE_LIBGEN_H
|
||||
#include <libgen.h>
|
||||
@@ -36,77 +39,43 @@ 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 },
|
||||
} ;
|
||||
|
||||
#define NR(x) (sizeof x / sizeof x[0])
|
||||
|
||||
|
||||
void
|
||||
set(int *flags, char *optionstring)
|
||||
char *
|
||||
e_flags(const char *text, const int size, void *context)
|
||||
{
|
||||
int i;
|
||||
int enable;
|
||||
char *arg;
|
||||
|
||||
for ( arg = strtok(optionstring, ","); arg; arg = strtok(NULL, ",") ) {
|
||||
if ( *arg == '+' || *arg == '-' )
|
||||
enable = (*arg++ == '+') ? 1 : 0;
|
||||
else if ( strncasecmp(arg, "no", 2) == 0 ) {
|
||||
arg += 2;
|
||||
enable = 0;
|
||||
}
|
||||
else
|
||||
enable = 1;
|
||||
|
||||
for ( i=0; i < NR(opts); i++ )
|
||||
if ( strcasecmp(arg, opts[i].name) == 0 )
|
||||
break;
|
||||
|
||||
if ( i < NR(opts) ) {
|
||||
if ( opts[i].off )
|
||||
enable = !enable;
|
||||
|
||||
if ( enable )
|
||||
*flags |= opts[i].flag;
|
||||
else
|
||||
*flags &= ~opts[i].flag;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "%s: unknown option <%s>\n", pgm, arg);
|
||||
}
|
||||
return (char*)context;
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
void
|
||||
complain(char *fmt, ...)
|
||||
{
|
||||
va_list ptr;
|
||||
|
||||
fprintf(stderr, "%s: ", pgm);
|
||||
va_start(ptr, fmt);
|
||||
vfprintf(stderr, fmt, ptr);
|
||||
va_end(ptr);
|
||||
fputc('\n', stderr);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
int rc;
|
||||
int flags = 0;
|
||||
mkd_flag_t flags = 0;
|
||||
int debug = 0;
|
||||
int toc = 0;
|
||||
int content = 1;
|
||||
int version = 0;
|
||||
int with_html5 = 0;
|
||||
int styles = 0;
|
||||
int use_mkd_line = 0;
|
||||
int github_flavoured = 0;
|
||||
char *extra_footnote_prefix = 0;
|
||||
char *urlflags = 0;
|
||||
char *text = 0;
|
||||
char *ofile = 0;
|
||||
char *urlbase = 0;
|
||||
@@ -119,27 +88,49 @@ 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:Gno:s:St: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 'G': github_flavoured = 1;
|
||||
break;
|
||||
case 'n': content = 0;
|
||||
break;
|
||||
case 's': text = optarg;
|
||||
break;
|
||||
case 'S': styles = 1;
|
||||
break;
|
||||
case 't': text = optarg;
|
||||
use_mkd_line = 1;
|
||||
break;
|
||||
case 'T': toc = 1;
|
||||
break;
|
||||
case 's': text = optarg;
|
||||
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,14 +145,30 @@ 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 {
|
||||
if ( text ) {
|
||||
if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) {
|
||||
doc = github_flavoured ? gfm_string(text, strlen(text), flags)
|
||||
: mkd_string(text, strlen(text), flags) ;
|
||||
|
||||
if ( !doc ) {
|
||||
perror(text);
|
||||
exit(1);
|
||||
}
|
||||
@@ -171,13 +178,21 @@ main(int argc, char **argv)
|
||||
perror(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if ( (doc = mkd_in(stdin,flags)) == 0 ) {
|
||||
|
||||
doc = github_flavoured ? gfm_in(stdin,flags) : mkd_in(stdin,flags);
|
||||
if ( !doc ) {
|
||||
perror(argc ? argv[0] : "stdin");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
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");
|
||||
@@ -185,13 +200,17 @@ main(int argc, char **argv)
|
||||
rc = 1;
|
||||
if ( mkd_compile(doc, flags) ) {
|
||||
rc = 0;
|
||||
if ( styles )
|
||||
mkd_generatecss(doc, stdout);
|
||||
if ( toc )
|
||||
mkd_generatetoc(doc, stdout);
|
||||
mkd_generatehtml(doc, stdout);
|
||||
if ( content )
|
||||
mkd_generatehtml(doc, stdout);
|
||||
mkd_cleanup(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
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.portland.or.us
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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";
|
||||
|
||||
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));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user