Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated discount to v2.1.3 #14

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build/*
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
xcuserdata/
profile
*.moved-aside

Expand Down
70 changes: 43 additions & 27 deletions MarkdownLive.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 45;
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -16,6 +16,8 @@
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 */; };
AB40558C14D01D86009A583A /* update-discount.sh in Resources */ = {isa = PBXBuildFile; fileRef = AB40558B14D01D86009A583A /* update-discount.sh */; };
AB8AB90E14CF513900DBF8D5 /* blocktags in Resources */ = {isa = PBXBuildFile; fileRef = AB8AB90D14CF513900DBF8D5 /* blocktags */; };
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 */; };
Expand Down Expand Up @@ -112,6 +114,10 @@
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; };
AB40558B14D01D86009A583A /* update-discount.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "update-discount.sh"; sourceTree = "<group>"; };
AB8AB90814CF4D2F00DBF8D5 /* README.markdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.markdown; sourceTree = "<group>"; };
AB8AB90914CF4D2F00DBF8D5 /* update.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = update.sh; sourceTree = "<group>"; };
AB8AB90D14CF513900DBF8D5 /* blocktags */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = blocktags; sourceTree = "<group>"; };
ABCE3DDF13C8DFFF00DF3CD0 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
ABECD8C213C8B8CA00B77CFD /* ORCDiscount.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORCDiscount.framework; sourceTree = BUILT_PRODUCTS_DIR; };
ABECD8C313C8B8CA00B77CFD /* ORCDiscount-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ORCDiscount-Info.plist"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -176,6 +182,10 @@
22ECEEC512E7C258003B50DC /* discount-config */ = {
isa = PBXGroup;
children = (
AB40558B14D01D86009A583A /* update-discount.sh */,
AB8AB90D14CF513900DBF8D5 /* blocktags */,
AB8AB90814CF4D2F00DBF8D5 /* README.markdown */,
AB8AB90914CF4D2F00DBF8D5 /* update.sh */,
226936B912E7C8B600171322 /* mkdio.h */,
22ECEEC612E7C258003B50DC /* config.h */,
);
Expand Down Expand Up @@ -254,18 +264,18 @@
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 */,
795F6C52105D6ED800D1F90A /* generate.c */,
2269369A12E7C6AB00171322 /* html5.c */,
2269369F12E7C6BE00171322 /* tags.h */,
2269369E12E7C6BE00171322 /* tags.c */,
795F6C50105D6ECE00D1F90A /* markdown.c */,
22ECEED912E7C2E8003B50DC /* markdown.h */,
795F6C4E105D6EC400D1F90A /* mkdio.c */,
795F6C54105D6EE100D1F90A /* resource.c */,
226936C912E7CA2800171322 /* setup.c */,
2269369E12E7C6BE00171322 /* tags.c */,
2269369F12E7C6BE00171322 /* tags.h */,
795F6C61105D6F6E00D1F90A /* xml.c */,
);
path = discount;
sourceTree = "<group>";
Expand Down Expand Up @@ -353,8 +363,11 @@
/* Begin PBXProject section */
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
};
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "MarkdownLive" */;
compatibilityVersion = "Xcode 3.1";
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
Expand Down Expand Up @@ -383,6 +396,8 @@
1DDD582C0DA1D0D100B32029 /* MyDocument.xib in Resources */,
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
795F6C87105D70A300D1F90A /* MarkdownLiveApp.icns in Resources */,
AB8AB90E14CF513900DBF8D5 /* blocktags in Resources */,
AB40558C14D01D86009A583A /* update-discount.sh in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -481,26 +496,25 @@
ABECD8C413C8B8CA00B77CFD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = "ORCDiscount-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"-framework",
Foundation,
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = NO;
};
Expand All @@ -509,25 +523,24 @@
ABECD8C513C8B8CA00B77CFD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = "ORCDiscount-Info.plist";
INSTALL_PATH = "@executable_path/../Frameworks";
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = (
"-framework",
Foundation,
"-framework",
AppKit,
);
PREBINDING = NO;
PRODUCT_NAME = ORCDiscount;
RUN_CLANG_STATIC_ANALYZER = YES;
ZERO_LINK = NO;
Expand All @@ -538,10 +551,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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;
Expand All @@ -556,6 +569,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)\"/**";
GCC_MODEL_TUNING = G5;
Expand All @@ -570,10 +584,8 @@
C05733CC08A9546B00998B17 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
Expand All @@ -587,21 +599,22 @@
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "./discount-config";
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
WARNING_CFLAGS = "-Wall";
};
name = Debug;
};
C05733CD08A9546B00998B17 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = supported;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
Expand All @@ -614,10 +627,13 @@
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_PARAMETER = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
HEADER_SEARCH_PATHS = "./discount-config";
MACOSX_DEPLOYMENT_TARGET = 10.6;
SDKROOT = macosx;
SEPARATE_STRIP = YES;
STRIP_INSTALLED_PRODUCT = YES;
VALID_ARCHS = x86_64;
WARNING_CFLAGS = "-Wall";
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion MyDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary
NSURL *stdUrl = [url URLByStandardizingPath];
NSURL *docUrl = [[self fileURL] URLByStandardizingPath];
if ([[url scheme] isEqualToString:@"applewebdata"] ||
[stdUrl isFileURL] && [stdUrl isEqualTo:docUrl]) {
([stdUrl isFileURL] && [stdUrl isEqualTo:docUrl])) {
[listener use];
} else {
[[NSWorkspace sharedWorkspace] openURL:url];
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ A Cocoa markdown preview editor using [Discount][discount].

Implements the ORCDiscount framework.

To update to the latest version of discount run `./discount-config/update-discount.sh`

[discount]: https://github.com/Orc/discount
10 changes: 10 additions & 0 deletions discount-config/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ This folder holds the files generated by discount's `configure.sh` script that a

## Upgrading discount ##

To upgrade discount run `./discount-config/update-discount.sh`
This script automates the steps oulined below:

1. Upgrade the discount repo
2. Generate dynamic configuration infotmation

## Manually 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

The discount folder will contain a .git folder following the clone however this folder is not included in the enclosing repository and will not be propagated by a push or clone.

## Config files ##

When discount is changed, regenerate the config files. The included `update.sh` script should do this automatically.
Expand Down
33 changes: 33 additions & 0 deletions discount-config/blocktags
Original file line number Diff line number Diff line change
@@ -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
6 changes: 2 additions & 4 deletions discount-config/config.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*
* configuration for markdown, generated Mon 11 Jul 2011 22:16:51 BST
* by [email protected]
*/
#ifndef __AC_MARKDOWN_D
#define __AC_MARKDOWN_D 1


#define OS_DARWIN 1
#define USE_DISCOUNT_DL 1
#define while(x) while( (x) != 0 )
#define if(x) if( (x) != 0 )
#define DWORD unsigned int
#define WORD unsigned short
#define BYTE unsigned char
Expand Down
1 change: 1 addition & 0 deletions discount-config/mkdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void mkd_ref_prefix(MMIOT*, char*);
#define MKD_TAGTEXT 0x00000020 /* process text inside an html tag; no
* <em>, no <bold>, no html or [] expansion */
#define MKD_NO_EXT 0x00000040 /* don't allow pseudo-protocols */
#define MKD_NOEXT MKD_NO_EXT /* ^^^ (aliased for user convenience) */
#define MKD_CDATA 0x00000080 /* generate code for xml ![CDATA[...]] */
#define MKD_NOSUPERSCRIPT 0x00000100 /* no A^B */
#define MKD_NORELAXED 0x00000200 /* emphasis happens /everywhere/ */
Expand Down
17 changes: 17 additions & 0 deletions discount-config/update-discount.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/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 "Removing discount folder..."
rm -rf ../discount/

status_msg "Cloning discount ..."
git clone git://github.com/Orc/discount.git ../discount

./update.sh
7 changes: 6 additions & 1 deletion discount-config/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ status_msg "Running configure.sh..."
cd `dirname $0`/../discount/
./configure.sh

# make the blocktags
make blocktags

status_msg "Copying important files..."

if head -n 1 config.h | grep -q "^/\*$"; then
Expand All @@ -25,9 +28,11 @@ else
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'
cp blocktags ../discount-config/blocktags && echo 'blocktags'

status_msg "Clean files from working directory..."

git clean -f
# clean the working directory of generated files and folders
git clean -f -d

status_msg "Done!"
2 changes: 2 additions & 0 deletions discount/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -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 `&ndash;` and `&mdash;`
translations.


2 changes: 1 addition & 1 deletion discount/Csio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading