├── platform
├── ios
│ ├── ImageMasters
│ │ ├── Icon.sketch
│ │ │ ├── fonts
│ │ │ ├── version
│ │ │ ├── Data
│ │ │ └── QuickLook
│ │ │ │ ├── Preview.png
│ │ │ │ └── Thumbnail.png
│ │ └── UITabBarIcons.sketch
│ │ │ ├── version
│ │ │ ├── fonts
│ │ │ ├── Data
│ │ │ └── QuickLook
│ │ │ ├── Preview.png
│ │ │ └── Thumbnail.png
│ ├── Bypass
│ │ ├── BypassTests
│ │ │ ├── en.lproj
│ │ │ │ └── InfoPlist.strings
│ │ │ ├── BypassTests-Info.plist
│ │ │ ├── BPParserTests.m
│ │ │ ├── BPDocumentTests.mm
│ │ │ └── BPElementTests.mm
│ │ ├── Bypass
│ │ │ ├── Bypass-Prefix.pch
│ │ │ ├── BPParser.h
│ │ │ ├── Bypass.h
│ │ │ ├── BPElementPrivate.h
│ │ │ ├── BPDocumentPrivate.h
│ │ │ ├── BPImageGetter.h
│ │ │ ├── BPDocument.h
│ │ │ ├── BPParser.mm
│ │ │ ├── BPMarkdownPageView.h
│ │ │ ├── BPAttributedStringConverter.h
│ │ │ ├── BPDisplaySettings.h
│ │ │ ├── BPMarkdownView.h
│ │ │ ├── BPDocument.mm
│ │ │ ├── BPElement.h
│ │ │ ├── BPDisplaySettings.m
│ │ │ ├── BPMarkdownPageView.m
│ │ │ └── BPElement.mm
│ │ └── Bypass.xcodeproj
│ │ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ ├── images
│ │ ├── target.png
│ │ ├── buildPhases.png
│ │ ├── buildSettings.png
│ │ ├── dragXcodeproj.png
│ │ ├── linkLibraries.png
│ │ └── targetDependency.png
│ ├── BypassSample
│ │ ├── BypassSample
│ │ │ ├── en.lproj
│ │ │ │ ├── InfoPlist.strings
│ │ │ │ └── MainStoryboard.storyboard
│ │ │ ├── iPhone.png
│ │ │ ├── Default.png
│ │ │ ├── markdown.png
│ │ │ ├── Default@2x.png
│ │ │ ├── UITextView.png
│ │ │ ├── UITextView@2x.png
│ │ │ ├── iPhone Retina.png
│ │ │ ├── BPMarkdownView.png
│ │ │ ├── Default-568h@2x.png
│ │ │ ├── BPMarkdownView@2x.png
│ │ │ ├── BPAbstractViewController.h
│ │ │ ├── BPImageGetterSample.h
│ │ │ ├── BPMarkdownViewController.h
│ │ │ ├── BypassSample-Prefix.pch
│ │ │ ├── BPImageGetterSample.m
│ │ │ ├── main.m
│ │ │ ├── sample.markdown
│ │ │ ├── BPMarkdownViewController.m
│ │ │ ├── BPAbstractViewController.m
│ │ │ ├── BPTextViewController.h
│ │ │ ├── BPAppDelegate.h
│ │ │ ├── BypassSample-Info.plist
│ │ │ ├── BPAppDelegate.m
│ │ │ └── BPTextViewController.mm
│ │ ├── BypassSampleTests
│ │ │ ├── en.lproj
│ │ │ │ └── InfoPlist.strings
│ │ │ ├── BypassSampleTests.h
│ │ │ ├── BypassSampleTests.m
│ │ │ └── BypassSampleTests-Info.plist
│ │ ├── iPhone.png
│ │ ├── iPhone Retina.png
│ │ └── BypassSample.xcodeproj
│ │ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ └── README.md
└── android
│ ├── .gitignore
│ ├── library
│ ├── jni
│ │ ├── Application.mk
│ │ ├── Android.mk
│ │ ├── in_uncod_android_bypass_Bypass.h
│ │ └── bypass.cpp
│ ├── res
│ │ └── values
│ │ │ └── strings.xml
│ ├── src
│ │ └── in
│ │ │ └── uncod
│ │ │ └── android
│ │ │ └── bypass
│ │ │ ├── Document.java
│ │ │ ├── style
│ │ │ └── HorizontalLineSpan.java
│ │ │ ├── ReverseSpannableStringBuilder.java
│ │ │ └── Element.java
│ ├── AndroidManifest.xml
│ ├── project.properties
│ └── pom.xml
│ ├── functional-test
│ ├── res
│ │ ├── values
│ │ │ └── strings.xml
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── layout
│ │ │ ├── main.xml~
│ │ │ └── main.xml
│ │ └── raw
│ │ │ └── readme.txt
│ ├── project.properties
│ ├── AndroidManifest.xml
│ ├── src
│ │ └── in
│ │ │ └── uncod
│ │ │ └── android
│ │ │ └── bypass
│ │ │ └── test
│ │ │ └── BenchmarkActivity.java
│ └── pom.xml
│ ├── functional-test-tests
│ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-ldpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ └── values
│ │ │ └── strings.xml
│ ├── project.properties
│ ├── AndroidManifest.xml
│ ├── pom.xml
│ └── src
│ │ └── in
│ │ └── uncod
│ │ └── andrpod
│ │ └── bypass
│ │ └── bypass_test
│ │ └── test
│ │ └── BasicTests.java
│ ├── README.md
│ └── pom.xml
├── dep
├── Makefile
└── libsoldout
│ ├── LICENSE
│ ├── expanded_markdown.sh
│ ├── CHANGES
│ ├── GNUmakefile
│ ├── renderers.h
│ ├── BSDmakefile
│ ├── benchmark.c
│ ├── markdown.h
│ ├── array.h
│ ├── buffer.h
│ ├── mkd2html.c
│ ├── mkd2man.c
│ ├── buffer.c
│ └── array.c
├── src
├── Makefile
├── document.h
├── document.cpp
├── element.h
├── parser.h
└── element.cpp
├── Makefile
├── .gitignore
├── test
├── Makefile
├── document_tests.cpp
└── element_tests.cpp
├── README.md
├── logo.svg
└── LICENSE.txt
/platform/ios/ImageMasters/Icon.sketch/fonts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/Icon.sketch/version:
--------------------------------------------------------------------------------
1 | 9
--------------------------------------------------------------------------------
/platform/android/.gitignore:
--------------------------------------------------------------------------------
1 | obj/
2 | gen/
3 | bin/
4 |
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/UITabBarIcons.sketch/version:
--------------------------------------------------------------------------------
1 | 9
--------------------------------------------------------------------------------
/platform/ios/Bypass/BypassTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/platform/ios/images/target.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/target.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSampleTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/iPhone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/iPhone.png
--------------------------------------------------------------------------------
/platform/ios/images/buildPhases.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/buildPhases.png
--------------------------------------------------------------------------------
/platform/ios/images/buildSettings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/buildSettings.png
--------------------------------------------------------------------------------
/platform/ios/images/dragXcodeproj.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/dragXcodeproj.png
--------------------------------------------------------------------------------
/platform/ios/images/linkLibraries.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/linkLibraries.png
--------------------------------------------------------------------------------
/platform/ios/images/targetDependency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/images/targetDependency.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/iPhone Retina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/iPhone Retina.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/Icon.sketch/Data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/Icon.sketch/Data
--------------------------------------------------------------------------------
/platform/android/library/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64
2 | APP_STL := gnustl_static
3 |
--------------------------------------------------------------------------------
/platform/android/functional-test/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bypass-Test
4 |
5 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/iPhone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/iPhone.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/UITabBarIcons.sketch/fonts:
--------------------------------------------------------------------------------
1 | Helvetica
2 | SnellRoundhand
3 | Helvetica
4 | SnellRoundhand
5 | Helvetica
6 | SnellRoundhand
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/Default.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/markdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/markdown.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/UITabBarIcons.sketch/Data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/UITabBarIcons.sketch/Data
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/Default@2x.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/UITextView.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/UITextView.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/UITextView@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/UITextView@2x.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/iPhone Retina.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/iPhone Retina.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPMarkdownView.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/BPMarkdownView.png
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/Default-568h@2x.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/Icon.sketch/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/Icon.sketch/QuickLook/Preview.png
--------------------------------------------------------------------------------
/platform/android/library/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Bypass
4 |
5 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPMarkdownView@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/BypassSample/BypassSample/BPMarkdownView@2x.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/Icon.sketch/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/Icon.sketch/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/platform/android/functional-test/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/UITabBarIcons.sketch/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/UITabBarIcons.sketch/QuickLook/Preview.png
--------------------------------------------------------------------------------
/platform/ios/ImageMasters/UITabBarIcons.sketch/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/ios/ImageMasters/UITabBarIcons.sketch/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test-tests/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test-tests/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test-tests/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Uncodin/bypass/HEAD/platform/android/functional-test-tests/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Bypass-Test-FrameworkTest
5 |
6 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/Bypass-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Bypass' target in the 'Bypass' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/dep/Makefile:
--------------------------------------------------------------------------------
1 | LIBSOLDOUT_DIR = libsoldout
2 |
3 | .PHONY: all libsoldout clean
4 |
5 | all: libsoldout
6 |
7 | libsoldout:
8 | $(MAKE) -C $(LIBSOLDOUT_DIR)
9 |
10 | clean:
11 | $(MAKE) -C $(LIBSOLDOUT_DIR) clean
12 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Makefile:
--------------------------------------------------------------------------------
1 | SRC = $(wildcard *.cpp)
2 | OBJ = $(SRC:.cpp=.o)
3 | CPPFLAGS = -Wall
4 | CXXFLAGS = -I../dep/libsoldout -g -O3 -fPIC
5 |
6 | .PHONY: all clean
7 |
8 | all: $(OBJ)
9 |
10 | %.o: %.cpp
11 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
12 |
13 | clean:
14 | rm -f *.o
15 | rm -f *.a
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSampleTests/BypassSampleTests.h:
--------------------------------------------------------------------------------
1 | //
2 | // BypassSampleTests.h
3 | // BypassSampleTests
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BypassSampleTests : SenTestCase
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SRC_DIR = src
2 | TEST_DIR = test
3 | DEP_DIR = dep
4 |
5 | .PHONY: all dep lib check clean
6 |
7 | all: check
8 |
9 | dep:
10 | $(MAKE) -C $(DEP_DIR)
11 |
12 | lib: dep
13 | $(MAKE) -C $(SRC_DIR)
14 |
15 | check: lib
16 | $(MAKE) -C $(TEST_DIR)
17 |
18 | clean:
19 | $(MAKE) -C $(TEST_DIR) clean
20 | $(MAKE) -C $(SRC_DIR) clean
21 | $(MAKE) -C $(DEP_DIR) clean
22 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPAbstractViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPAbstractViewController.h
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/13/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface BPAbstractViewController : UIViewController
12 |
13 | - (NSString *)sampleMarkdown;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPImageGetterSample.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPImageGetterSample.h
3 | // BypassSample
4 | //
5 | // Created by Victor Oliveira on 17/07/17.
6 | // Copyright © 2017 Uncodin. All rights reserved.
7 | //
8 |
9 | #import "BPImageGetter.h"
10 |
11 | @interface BPImageGetterSample : NSObject
12 |
13 | - (UIImage *) getUIImageWithSource:(NSString *)source;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/platform/android/library/src/in/uncod/android/bypass/Document.java:
--------------------------------------------------------------------------------
1 | package in.uncod.android.bypass;
2 |
3 | public class Document {
4 |
5 | Element[] elements;
6 |
7 | public Document(Element[] elements) {
8 | this.elements = elements;
9 | }
10 |
11 | public int getElementCount() {
12 | return elements.length;
13 | }
14 |
15 | public Element getElement(int pos) {
16 | return elements[pos];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.a
3 | *.pbxuser
4 | *.mode1v3
5 | .DS_Store
6 | xcuserdata
7 | *.svn
8 | pulse.xml
9 | ivy.xml
10 | build.properties
11 | Version.txt
12 | build.xml
13 | .fseventsd
14 | .TemporaryItems
15 | *.o
16 | *.so
17 | *.so.1
18 | *.dSYM
19 | dep/libsoldout*/*.d
20 | dep/libsoldout-1.3/depends
21 | dep/libsoldout-1.3/mkd2html
22 | dep/libsoldout-1.3/mkd2latex
23 | dep/libsoldout-1.3/mkd2man
24 | test/*.tst
25 | *.class
26 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPMarkdownViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPMarkdownViewController.h
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/13/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "BPAbstractViewController.h"
12 |
13 | @interface BPMarkdownViewController : BPAbstractViewController
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BypassSample-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'BypassSample' target in the 'BypassSample' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_5_0
8 | #warning "This project uses features only available in iOS SDK 5.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPImageGetterSample.m:
--------------------------------------------------------------------------------
1 | //
2 | // BPImageGetterSample.m
3 | // BypassSample
4 | //
5 | // Created by Victor Oliveira on 17/07/17.
6 | // Copyright © 2017 Uncodin. All rights reserved.
7 | //
8 |
9 | #import "BPImageGetterSample.h"
10 |
11 | @implementation BPImageGetterSample
12 |
13 | - (UIImage *) getUIImageWithSource:(NSString *)source {
14 |
15 | return [UIImage imageNamed:source];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "BPAppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([BPAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/platform/android/functional-test/res/layout/main.xml~:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/platform/android/library/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/platform/android/functional-test/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/platform/android/library/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | BYPASS_SRC := ../../../../src/
3 |
4 | include $(CLEAR_VARS)
5 |
6 | LOCAL_MODULE := bypass
7 | LOCAL_SRC_FILES := \
8 | bypass.cpp \
9 | $(BYPASS_SRC)parser.cpp \
10 | $(BYPASS_SRC)document.cpp \
11 | $(BYPASS_SRC)element.cpp \
12 | ../../../../dep/libsoldout/markdown.c \
13 | ../../../../dep/libsoldout/buffer.c \
14 | ../../../../dep/libsoldout/array.c
15 |
16 | LOCAL_C_INCLUDES:= ../../../dep/libsoldout ../../../src /opt/local/include /usr/local/include $(BYPASS_INCLUDE_PATH)
17 |
18 | include $(BUILD_SHARED_LIBRARY)
19 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/sample.markdown:
--------------------------------------------------------------------------------
1 | #Header sizes
2 | ##Smaller header
3 | ###Even smaller header
4 |
5 | Paragraphs are obviously supported along with all the fancy text styling you could want.
6 | There is *italic*, **bold** and ***bold italic***.
7 | Even links are supported, visit the
8 | github page for Bypass [here](https://github.com/Uncodin/bypass).
9 |
10 | * Nested List
11 | * One
12 | * Two
13 | * Three
14 | * One
15 | * One
16 | * Two
17 | * Three
18 |
19 | ## Code Block Support
20 |
21 | const char* str;
22 | str = env->GetStringUTFChars(markdown, NULL);
23 |
24 | ## Image Support
25 |
26 | 
27 |
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-16
15 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSampleTests/BypassSampleTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // BypassSampleTests.m
3 | // BypassSampleTests
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import "BypassSampleTests.h"
10 |
11 | @implementation BypassSampleTests
12 |
13 | - (void)setUp
14 | {
15 | [super setUp];
16 |
17 | // Set-up code here.
18 | }
19 |
20 | - (void)tearDown
21 | {
22 | // Tear-down code here.
23 |
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample
28 | {
29 | STFail(@"Unit tests are not implemented yet in BypassSampleTests");
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/platform/android/library/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | android.library=true
14 | # Project target.
15 | target=android-8
16 |
--------------------------------------------------------------------------------
/platform/android/library/jni/in_uncod_android_bypass_Bypass.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class in_uncod_android_bypass_Bypass */
4 |
5 | #ifndef _Included_in_uncod_android_bypass_Bypass
6 | #define _Included_in_uncod_android_bypass_Bypass
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: in_uncod_android_bypass_Bypass
12 | * Method: processMarkdown
13 | * Signature: (Ljava/lang/String;)Lin/uncod/android/bypass/Document;
14 | */
15 | JNIEXPORT jobject JNICALL Java_in_uncod_android_bypass_Bypass_processMarkdown
16 | (JNIEnv *, jobject, jstring);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 | #endif
22 |
--------------------------------------------------------------------------------
/platform/android/functional-test/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library.reference.1=../library
16 |
--------------------------------------------------------------------------------
/test/Makefile:
--------------------------------------------------------------------------------
1 | DEPOBJ = $(wildcard ../dep/libsoldout/*.o)
2 | SUTOBJ = $(wildcard ../src/*.o)
3 | SRC = $(wildcard *.cpp)
4 | OBJ = $(SRC:.cpp=.o)
5 | TESTS = $(SRC:.cpp=.tst)
6 | CPPFLAGS = -Wall
7 | CXXFLAGS = -I../src -I../dep/libsoldout -g -O3 -Wno-unknown-pragmas
8 |
9 | .PHONY: all clean check test
10 | .SECONDARY:
11 |
12 | all: check
13 |
14 | %.o: %.cpp
15 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
16 |
17 | %.tst: %.o
18 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(addsuffix .tst,$(basename $<)) $(DEPOBJ) $(SUTOBJ) $^
19 |
20 | test: $(TESTS)
21 |
22 | check: test
23 | for test in *.tst; do echo "• $${test}" && "./$${test}"; done
24 |
25 | clean:
26 | rm -f *.o
27 | rm -f *.tst
28 | rm -rf *.dSYM
29 |
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
12 |
13 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPMarkdownViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BPMarkdownViewController.m
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/13/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import "BPMarkdownViewController.h"
10 |
11 | @interface BPMarkdownViewController ()
12 | @property (strong, nonatomic) IBOutlet BPMarkdownView *markdownView;
13 | @end
14 |
15 | @implementation BPMarkdownViewController
16 |
17 | - (void)viewWillAppear:(BOOL)animated
18 | {
19 | NSString *sampleMarkdown = [self sampleMarkdown];
20 | [[self markdownView] setMarkdown:sampleMarkdown];
21 | }
22 |
23 | - (void)viewDidAppear:(BOOL)animated
24 | {
25 | [[self markdownView] flashScrollIndicators];
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/dep/libsoldout/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009, Natacha Porté
2 |
3 | Permission to use, copy, modify, and distribute this software for any
4 | purpose with or without fee is hereby granted, provided that the above
5 | copyright notice and this permission notice appear in all copies.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/BypassTests/BypassTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.uncodin.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSampleTests/BypassSampleTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.uncodin.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPAbstractViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // BPAbstractViewController.m
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/13/13.
6 | // Copyright (c) 2013 Uncodin. All rights reserved.
7 | //
8 |
9 | #import "BPAbstractViewController.h"
10 |
11 | @interface BPAbstractViewController ()
12 |
13 | @end
14 |
15 | @implementation BPAbstractViewController
16 |
17 | - (NSString *)sampleMarkdown
18 | {
19 | NSString *samplePath = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"markdown"];
20 |
21 | NSError *error = nil;
22 | NSString *sample = [NSString stringWithContentsOfFile:samplePath encoding:NSUTF8StringEncoding error:&error];
23 |
24 | if (error != nil) {
25 | NSLog(@"Error: %@", error);
26 | return nil;
27 | }
28 |
29 | return sample;
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/platform/android/functional-test/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPParser.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPParser.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #import "BPDocument.h"
23 |
24 | @interface BPParser : NSObject
25 |
26 | - (BPDocument *)parse:(NSString *)markdown;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/Bypass.h:
--------------------------------------------------------------------------------
1 | //
2 | // Bypass.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import "BPAttributedStringConverter.h"
22 | #import "BPElement.h"
23 | #import "BPDocument.h"
24 | #import "BPMarkdownView.h"
25 | #import "BPParser.h"
26 | #import "BPDisplaySettings.h"
27 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPElementPrivate.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPElementPrivate.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 3/1/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import "BPElement.h"
22 | #import "element.h"
23 |
24 | @interface BPElement (Private)
25 |
26 | - (id)init;
27 | - (id)initWithElement:(Bypass::Element)element;
28 |
29 | @end
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPTextViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPTextViewController.h
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/1/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #import "BPAbstractViewController.h"
23 |
24 | @interface BPTextViewController : BPAbstractViewController
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BPAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPAppDelegate.h
3 | // BypassSample
4 | //
5 | // Created by Damian Carrillo on 3/1/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 |
23 | @interface BPAppDelegate : UIResponder
24 |
25 | @property (strong, nonatomic) UIWindow *window;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPDocumentPrivate.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPDocumentPrivate.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 3/1/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import "BPDocument.h"
22 | #import "BPElementPrivate.h"
23 | #import "document.h"
24 |
25 | @interface BPDocument (Private)
26 |
27 | - (id)init;
28 | - (id)initWithDocument:(Bypass::Document)document;
29 |
30 | @end
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPImageGetter.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPImageGetter.h
3 | // Bypass
4 | //
5 | // Created by Victor Oliveira on 17/07/17.
6 | // Copyright © 2017 Uncodin. All rights reserved.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #ifndef BPImageGetter_h
23 | #define BPImageGetter_h
24 |
25 | @protocol BPImageGetter
26 |
27 | @required
28 | - (UIImage *) getUIImageWithSource:(NSString *)source;
29 |
30 | @end
31 |
32 | #endif /* BPImageGetter_h */
33 |
--------------------------------------------------------------------------------
/src/document.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2013 Uncodin, Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #ifndef BYPASS_DOCUMENT_H
18 | #define BYPASS_DOCUMENT_H
19 |
20 | #include
21 | #include "element.h"
22 |
23 | namespace Bypass
24 | {
25 | class Document
26 | {
27 | public:
28 | Document();
29 | ~Document();
30 | void append(const Element& elements);
31 | Element operator[](size_t i);
32 | size_t size();
33 | private:
34 | std::vector elements;
35 | };
36 | }
37 |
38 | #endif // BYPASS_DOCUMENT_H
39 |
--------------------------------------------------------------------------------
/src/document.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2013 Uncodin, Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #include "document.h"
18 |
19 | namespace Bypass {
20 |
21 | Document::Document()
22 | : elements()
23 | {
24 |
25 | }
26 |
27 | Document::~Document() {
28 |
29 | }
30 |
31 | void Document::append(const Element& element) {
32 | elements.push_back(Element(element));
33 | }
34 |
35 | size_t Document::size() {
36 | return elements.size();
37 | }
38 |
39 | Element Document::operator[](size_t i) {
40 | return elements[i];
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPDocument.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPDocument.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #import "BPElement.h"
23 |
24 | @interface BPDocument : NSObject
25 | @property (strong, nonatomic, readonly) NSArray *elements;
26 |
27 | #if __has_feature(objc_subscripting)
28 |
29 | /*!
30 | \brief Convenience accessor for retrieving elements
31 | */
32 | - (id)objectAtIndexedSubscript:(NSUInteger)idx;
33 |
34 | #endif
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/dep/libsoldout/expanded_markdown.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Copyright (c) 2009, Natacha Porté
4 | #
5 | # Permission to use, copy, modify, and distribute this software for any
6 | # purpose with or without fee is hereby granted, provided that the above
7 | # copyright notice and this permission notice appear in all copies.
8 | #
9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 |
17 | # This script is used for markdown validation:
18 | # The original Markdown.pl expand tabs into spaces, which is something
19 | # I don't want to do, and it cannot be easily fixed in the renderer,
20 | # so has to be preprocessed. expand(1) is used for that preprocessing,
21 | # feeding tab-free data into my markdown.
22 |
23 | expand -t 4 "$@" | $(dirname $0)/lace --markdown --xhtml
24 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPParser.mm:
--------------------------------------------------------------------------------
1 | //
2 | // BPParser.m
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import "BPParser.h"
22 | #import "BPDocumentPrivate.h"
23 | #import "parser.h"
24 |
25 | @implementation BPParser
26 |
27 | - (BPDocument *)parse:(NSString *)markdown
28 | {
29 | using namespace Bypass;
30 |
31 | const char *mstr = [markdown cStringUsingEncoding:NSUTF8StringEncoding];
32 |
33 | Bypass::Parser parser = Bypass::Parser();
34 | Document doc = parser.parse(mstr);
35 | BPDocument *document = [[BPDocument alloc] initWithDocument:doc];
36 |
37 | return document;
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/platform/android/functional-test/res/raw/readme.txt:
--------------------------------------------------------------------------------
1 | #Bypass
2 |
3 | #Header sizes
4 | ##Smaller header
5 | ##Even smaller header
6 |
7 | Paragraphs are obviously supported along with all the fancy text styling you could want.
8 | There is *italic*, **bold** and ***bold italic***. Even links are supported, visit the
9 | github page for Bypass [here](https://github.com/Uncodin/bypass).
10 |
11 | * Nested List
12 | * One
13 | * Two
14 | * Three
15 | * One
16 | * One
17 | * Two
18 | * Three
19 |
20 | ## Code Block Support
21 |
22 | const char* str;
23 | str = env->GetStringUTFChars(markdown, NULL);
24 |
25 | Bypass::Parser parser;
26 | Bypass::Document document = parser.parse(str);
27 |
28 | env->ReleaseStringUTFChars(markdown, str);
29 |
30 |
31 | #Quote Support
32 | > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ullamcorper tempus neque vulputate congue.
33 | > Quisque ipsum tellus, pharetra vitae dictum sit amet, placerat vitae felis. Etiam ornare eleifend libero,
34 | > et dignissim nibh rhoncus eu. Morbi mattis nisi in velit tristique eu mollis odio molestie.
35 | > Phasellus pretium dapibus mattis. Nullam mollis nisl id enim vestibulum quis lacinia turpis pellentesque.
36 | > Integer id mi quam. Fusce sagittis cursus eros, nec convallis ligula consectetur quis. Suspendisse potenti.
37 |
38 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPMarkdownPageView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPMarkdownPageView.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 3/13/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #import
23 |
24 | @class BPDocument;
25 |
26 | @protocol BPMarkdownPageViewLinkDelegate;
27 |
28 | @interface BPMarkdownPageView : UIView
29 | @property (weak, nonatomic) id linkDelegate;
30 |
31 | - (id)initWithFrame:(CGRect)frame textFrame:(CTFrameRef)textFrame;
32 |
33 | @end
34 |
35 | @protocol BPMarkdownPageViewLinkDelegate
36 | @required
37 |
38 | - (void)markdownPageView:(BPMarkdownPageView *)markdownPageView
39 | didHaveLinkTapped:(NSString *)link;
40 |
41 | @end
--------------------------------------------------------------------------------
/dep/libsoldout/CHANGES:
--------------------------------------------------------------------------------
1 | This is the changelog for libsoldout project.
2 | Please note that this is a user-centered condensed changelog; for an
3 | exhaustive list of changes, please consult the repository, I don't see the
4 | point of duplicating this information here, while on the other hand I have
5 | often missed a simple change list containing only what affect users of
6 | release versions.
7 |
8 |
9 | ## Changes from v1.2 to 1.3 ##
10 |
11 | * New example renderer that outputs LaTeX.
12 |
13 |
14 | ## Changes from v1.1 to v1.2 ##
15 |
16 | * Name change to libsoldout
17 |
18 | * Bug fixes:
19 | + various issues with matching emphasis delimiter have been fixed
20 | + better compatibility with non-gcc compilers
21 | + GNU make now uses correct compiler options to generate PIC code
22 |
23 |
24 | ## Changes from v1.0 to v1.1 ##
25 |
26 | * New features:
27 | + new callbacks for document prolog and epilog,
28 | + support of PHP-Markdown-like tables, through 3 new callbacks.
29 |
30 | * Several bug fixes, most notably:
31 | + span-level entities are now correctly recognized in headers,
32 | + empty ATX-styles header (i.e. lines containing only '#' charcters)
33 | no longer crash the library
34 | + empty documents are now correctly handled
35 | + blackslash escapes work in inline URIs, thereby allowing to include
36 | ')' characters in such URIs.
37 |
--------------------------------------------------------------------------------
/platform/android/library/src/in/uncod/android/bypass/style/HorizontalLineSpan.java:
--------------------------------------------------------------------------------
1 | package in.uncod.android.bypass.style;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Paint;
5 | import android.text.style.ReplacementSpan;
6 |
7 | /**
8 | * Draws a line across the screen.
9 | */
10 | public class HorizontalLineSpan extends ReplacementSpan {
11 |
12 | private Paint mPaint;
13 | private int mLineHeight;
14 | private int mTopBottomPadding;
15 |
16 | public HorizontalLineSpan(int color, int lineHeight, int topBottomPadding) {
17 | mPaint = new Paint();
18 | mPaint.setColor(color);
19 | mLineHeight = lineHeight;
20 | mTopBottomPadding = topBottomPadding;
21 | }
22 |
23 | @Override
24 | public int getSize(
25 | Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
26 | if (fm != null) {
27 | fm.ascent = -mLineHeight - mTopBottomPadding;
28 | fm.descent = 0;
29 |
30 | fm.top = fm.ascent;
31 | fm.bottom = 0;
32 | }
33 |
34 | // Take up *all* the horizontal space
35 | return Integer.MAX_VALUE;
36 | }
37 |
38 | @Override
39 | public void draw(
40 | Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
41 | int middle = (top + bottom) / 2;
42 | int halfLineHeight = mLineHeight / 2;
43 | canvas.drawRect(x, middle - halfLineHeight, Integer.MAX_VALUE, middle + halfLineHeight, mPaint);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPAttributedStringConverter.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPAttributedStringRenderer.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 3/1/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 | #import "BPDocument.h"
23 | #import "BPImageGetter.h"
24 |
25 | @class BPDisplaySettings;
26 |
27 | OBJC_EXPORT NSString *const BPLinkStyleAttributeName;
28 |
29 | /*!
30 | \brief Renders a Bypass Document to an `NSAttributedString`.
31 | */
32 | @interface BPAttributedStringConverter : NSObject
33 |
34 | @property(nonatomic, strong) BPDisplaySettings *displaySettings;
35 |
36 | - (NSAttributedString *)convertDocument:(BPDocument *)document;
37 |
38 | - (NSAttributedString *)convertDocument:(BPDocument *)document WithImageGetter: (id)imageGetter;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/platform/android/library/src/in/uncod/android/bypass/ReverseSpannableStringBuilder.java:
--------------------------------------------------------------------------------
1 | package in.uncod.android.bypass;
2 |
3 | import android.text.SpannableStringBuilder;
4 |
5 | /**
6 | * Exactly the same as SpannableStringBuilder, but it returns its spans in reverse.
7 | *
8 | * What effect does this have? Well, if you're building up a Spannable recursively (as we
9 | * are doing in Bypass) then returning the spans in reverse order has the correct effect
10 | * in some corner cases regarding leading spans.
11 | *
12 | * Example:
13 | * Suppose we have a BLOCK_QUOTE with a LIST inside of it. Both of them have leading spans, but the LIST
14 | * span is set first. As a result, the QuoteSpan for the BLOCK_QUOTE is actually indented by the LIST's span!
15 | * If the order is reversed, then the LIST's margin span is properly indented (and the BlockQuote remains on
16 | * the side).
17 | */
18 | public class ReverseSpannableStringBuilder extends SpannableStringBuilder {
19 |
20 | @Override
21 | public T[] getSpans(int queryStart, int queryEnd, Class kind) {
22 | T[] ret = super.getSpans(queryStart, queryEnd, kind);
23 | reverse(ret);
24 | return ret;
25 | }
26 |
27 | private static void reverse(Object[] arr) {
28 | if (arr == null) {
29 | return;
30 | }
31 |
32 | int i = 0;
33 | int j = arr.length - 1;
34 | Object tmp;
35 | while (j > i) {
36 | tmp = arr[j];
37 | arr[j] = arr[i];
38 | arr[i] = tmp;
39 | j--;
40 | i++;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/BypassTests/BPParserTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "BPParser.h"
3 |
4 | @interface BPParserTests : SenTestCase
5 | @end
6 |
7 | @implementation BPParserTests
8 | {
9 | BPParser *parser;
10 | }
11 |
12 | - (void)setUp
13 | {
14 | parser = [[BPParser alloc] init];
15 | }
16 |
17 | - (void)testSimpleCase
18 | {
19 | NSString *example =
20 |
21 | @"This is a normal paragraph:\n"
22 | "\n"
23 | " This is a code block.";
24 |
25 | BPDocument *document = [parser parse:example];
26 |
27 | STAssertNotNil(document, @"Expected a non-nil document");
28 | STAssertEquals([[document elements] count], 2U, @"Expected 2 elements in document");
29 |
30 | STAssertEquals([[document elements][0] elementType], BPParagraph, @"Expected first element to be a paragraph");
31 | STAssertEquals([[[document elements][0] childElements][0] elementType], BPText, @"Expected first element to have an inner text element");
32 | STAssertEqualObjects([[[document elements][0] childElements][0] text], @"This is a normal paragraph:", @"Expected first inner text element to match");
33 |
34 | STAssertEquals([[document elements][1] elementType], BPBlockCode, @"Expected second element to be a code block");
35 | STAssertEquals([[[document elements][1] childElements][0] elementType], BPText, @"Expected second element to have an inner text element");
36 | STAssertEqualObjects([[[document elements][1] childElements][0] text], @"This is a code block.", @"Expected second inner text element to match");
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/platform/ios/BypassSample/BypassSample/BypassSample-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Bypass
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundlePrimaryIcon
14 |
15 | CFBundleIconFiles
16 |
17 | iPhone Retina.png
18 | iPhone.png
19 |
20 |
21 |
22 | CFBundleIdentifier
23 | com.uncodin.${PRODUCT_NAME:rfc1034identifier}
24 | CFBundleInfoDictionaryVersion
25 | 6.0
26 | CFBundleName
27 | ${PRODUCT_NAME}
28 | CFBundlePackageType
29 | APPL
30 | CFBundleShortVersionString
31 | 1.0
32 | CFBundleSignature
33 | ????
34 | CFBundleVersion
35 | 1.0
36 | LSRequiresIPhoneOS
37 |
38 | UIMainStoryboardFile
39 | MainStoryboard
40 | UIRequiredDeviceCapabilities
41 |
42 | armv7
43 |
44 | UISupportedInterfaceOrientations
45 |
46 | UIInterfaceOrientationPortrait
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/platform/android/functional-test/src/in/uncod/android/bypass/test/BenchmarkActivity.java:
--------------------------------------------------------------------------------
1 | package in.uncod.android.bypass.test;
2 |
3 | import java.io.InputStream;
4 |
5 | import in.uncod.android.bypass.Bypass;
6 | import in.uncod.andrpod.bypass.bypass_test.R;
7 | import android.app.Activity;
8 | import android.content.res.Resources;
9 | import android.os.Bundle;
10 | import android.text.method.LinkMovementMethod;
11 | import android.util.TimingLogger;
12 | import android.widget.TextView;
13 |
14 | public class BenchmarkActivity extends Activity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 |
20 | setContentView(R.layout.main);
21 |
22 | TextView text = (TextView) findViewById(R.id.demoText);
23 |
24 | TimingLogger timings = new TimingLogger("Bypass", "onCreate");
25 |
26 | String readme = loadFile();
27 |
28 | timings.addSplit("read raw");
29 |
30 | Bypass bypass = new Bypass();
31 |
32 | timings.addSplit("instantiated Bypass");
33 |
34 | CharSequence string = bypass.markdownToSpannable(readme);
35 |
36 | timings.addSplit("convert to spannable");
37 | timings.dumpToLog();
38 |
39 | text.setText(string);
40 | //Allows link clicking
41 | text.setMovementMethod(LinkMovementMethod.getInstance());
42 | }
43 |
44 | private String loadFile() {
45 | try {
46 | Resources res = getResources();
47 | InputStream in_s = res.openRawResource(R.raw.readme);
48 |
49 | byte[] b = new byte[in_s.available()];
50 | in_s.read(b);
51 | return new String(b);
52 | } catch (Exception e) {
53 | // e.printStackTrace();
54 | }
55 | return "";
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/BypassTests/BPDocumentTests.mm:
--------------------------------------------------------------------------------
1 | #import
2 | #import "BPDocumentPrivate.h"
3 |
4 | @interface BPDocumentTests : SenTestCase
5 | @end
6 |
7 | @implementation BPDocumentTests
8 | {
9 | BPDocument *document;
10 | }
11 |
12 | - (void)setUp
13 | {
14 | using namespace Bypass;
15 |
16 | Document d;
17 |
18 | Element e0;
19 | e0.setType(PARAGRAPH);
20 | e0.setText("text");
21 | e0.addAttribute("a", "A");
22 | e0.addAttribute("b", "B");
23 | d.append(e0);
24 |
25 | Element e1;
26 | e1.setType(PARAGRAPH);
27 | e1.setText("text");
28 | e1.addAttribute("a", "A");
29 | e1.addAttribute("b", "B");
30 | d.append(e1);
31 |
32 | document = [[BPDocument alloc] initWithDocument:d];
33 | }
34 |
35 | - (void)testInitialization
36 | {
37 | STAssertNotNil(document, @"Expected non-nil document");
38 | }
39 |
40 | - (void)testElementsAccessor_forPointerEquality
41 | {
42 | NSArray *elements = [document elements];
43 | STAssertEquals([document elements], elements, @"Expected same elements");
44 | }
45 |
46 | - (void)testChildElements
47 | {
48 | STAssertEquals([[document elements] count], 2U, @"Expected 2 elements");
49 | STAssertEquals([[document elements][0] elementType], BPParagraph, @"Expected first element type to be BPParagraph");
50 | STAssertEquals([[document elements][1] elementType], BPParagraph, @"Expected second element type to be BPParagraph");
51 | }
52 |
53 | #if __has_feature(objc_subscripting)
54 |
55 | - (void)testNumericSubscripting
56 | {
57 | STAssertEquals(document[0], [[document elements] objectAtIndex:0], @"Expected document subscripting to return an element");
58 | }
59 |
60 | #endif
61 |
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Bypass
2 | ======
3 |
4 | Skip the HTML, Bypass takes markdown and renders it directly on Android and iOS.
5 |
6 | ## License
7 |
8 | [Apache License v2.0](http://www.tldrlegal.com/l/APACHE2)
9 |
10 | ## Requirements
11 |
12 | - Boost must be [installed on your system](http://www.boost.org/doc/libs/1_53_0/more/getting_started/index.html)
13 |
14 | ## Android
15 |
16 | If you just want to include Bypass in your Maven project, add the following
17 | dependency block to your `pom.xml`:
18 |
19 |
20 | in.uncod.android.bypass
21 | bypass
22 | apklib
23 | 1.1
24 |
25 |
26 | [Building And Using](platform/android/README.md)
27 |
28 | ### Contributors
29 |
30 | * [Colin Edwards](https://github.com/DDRBoxman)
31 | * [Cameron Currie](https://github.com/cwc)
32 | * [Albert Wang](https://github.com/albert-wang)
33 | * [Jimi Smith](https://github.com/JimiSmith)
34 | * [Dan Lew](https://github.com/dlew)
35 |
36 | ## iOS
37 |
38 | [Building And Using](platform/ios/README.md)
39 |
40 | ### Contributors
41 |
42 | * [Damian Carrillo](https://github.com/damiancarrillo)
43 | * [Cameron Currie](https://github.com/cwc)
44 | * [Albert Wang](https://github.com/albert-wang)
45 | * [Matthias Tretter](https://github.com/myell0w)
46 | * [Audun Holm Ellertsen](https://github.com/audun)
47 | * [Vinh Nguyen](https://github.com/vinhnx)
48 | * [Victor L. Oliveira](https://github.com/victorlaerte)
49 |
50 | ## 3rd Party Libraries
51 |
52 | - [**Boost**](http://www.boost.org/) - [license](http://www.boost.org/LICENSE_1_0.txt)
53 | - [**libsoldout**](http://fossil.instinctive.eu/libsoldout/home) - [license](http://fossil.instinctive.eu/libsoldout/artifact/c8d2f5b1e9e1df422ca06d1bc846d9e3055a925b)
54 |
--------------------------------------------------------------------------------
/platform/android/functional-test/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | in.uncod.android.bypass
5 | functional-test
6 | apk
7 | Functional Test
8 |
9 |
10 | in.uncod.android.bypass
11 | parent
12 | 1.2-SNAPSHOT
13 | ../pom.xml
14 |
15 |
16 |
17 |
18 | com.google.android
19 | android
20 | provided
21 |
22 |
23 | in.uncod.android.bypass
24 | bypass
25 | apklib
26 | 1.2-SNAPSHOT
27 |
28 |
29 |
30 |
31 | src
32 |
33 |
34 | org.apache.maven.plugins
35 | maven-compiler-plugin
36 |
37 | 1.6
38 | 1.6
39 |
40 |
41 |
42 | com.jayway.maven.plugins.android.generation2
43 | android-maven-plugin
44 |
45 |
46 | ${env.ANDROID_HOME}
47 | 16
48 |
49 |
50 | true
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPDisplaySettings.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Audun Holm Ellertsen on 4/30/13.
3 | // Copyright (c) 2013 Uncodin. All rights reserved.
4 | //
5 | // To change the template use AppCode | Preferences | File Templates.
6 | //
7 |
8 |
9 | #import
10 | #import
11 |
12 | @interface BPDisplaySettings : NSObject
13 |
14 | @property(nonatomic) UIColor *defaultColor;
15 | @property(nonatomic) UIColor *quoteColor;
16 | @property(nonatomic) UIColor *codeColor;
17 | @property(nonatomic) UIColor *linkColor;
18 |
19 | @property(nonatomic) UIFont *defaultFont;
20 | @property(nonatomic) UIFont *boldFont;
21 | @property(nonatomic) UIFont *italicFont;
22 | @property(nonatomic) UIFont *boldItalicFont;
23 | @property(nonatomic) UIFont *monospaceFont;
24 | @property(nonatomic) UIFont *quoteFont;
25 | @property(nonatomic) UIFont *h1Font;
26 | @property(nonatomic) UIFont *h2Font;
27 | @property(nonatomic) UIFont *h3Font;
28 | @property(nonatomic) UIFont *h4Font;
29 | @property(nonatomic) UIFont *h5Font;
30 | @property(nonatomic) UIFont *h6Font;
31 |
32 | @property(nonatomic) CGFloat bulletIndentation;
33 | @property(nonatomic) CGFloat codeIndentation;
34 | @property(nonatomic) CGFloat quoteIndentation;
35 | @property(nonatomic) CGFloat lineSpacingSmall;
36 |
37 | @property(nonatomic) CGFloat paragraphSpacing;
38 | @property(nonatomic) CGFloat paragraphSpacingHeading;
39 | @property(nonatomic) CGFloat paragraphSpacingH2;
40 |
41 | @property(nonatomic) CGFloat paragraphSpacingCode;
42 |
43 | @property(nonatomic) CGFloat paragraphLineSpacing;
44 | @property(nonatomic) CGFloat paragraphLineSpacingHeading;
45 |
46 | @property(nonatomic) CGFloat firstParagraphFirstLineHeadIndent;
47 |
48 | @property(nonatomic) CGFloat paragraphFirstLineHeadIndent;
49 | @property(nonatomic) CGFloat paragraphHeadIndent;
50 |
51 | @property(nonatomic) CGFloat headerFirstLineHeadIndent;
52 | @property(nonatomic) CGFloat headerHeadIndent;
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/platform/android/functional-test-tests/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 4.0.0
5 | in.uncod.android.bypass
6 | functional-test-tests
7 | apk
8 | Functional Test Tests
9 |
10 |
11 | in.uncod.android.bypass
12 | parent
13 | 1.2-SNAPSHOT
14 | ../pom.xml
15 |
16 |
17 |
18 |
19 | com.google.android
20 | android
21 | provided
22 |
23 |
24 | com.google.android
25 | android-test
26 | provided
27 |
28 |
29 | in.uncod.android.bypass
30 | functional-test
31 | 1.2-SNAPSHOT
32 | apk
33 |
34 |
35 |
36 | src
37 |
38 |
39 | org.apache.maven.plugins
40 | maven-compiler-plugin
41 |
42 | 1.6
43 | 1.6
44 |
45 |
46 |
47 | com.jayway.maven.plugins.android.generation2
48 | android-maven-plugin
49 |
50 |
51 | ${env.ANDROID_HOME}
52 | 16
53 |
54 |
55 | true
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/dep/libsoldout/GNUmakefile:
--------------------------------------------------------------------------------
1 | # Makefile
2 |
3 | # Copyright (c) 2009, Natacha Porté
4 | #
5 | # Permission to use, copy, modify, and distribute this software for any
6 | # purpose with or without fee is hereby granted, provided that the above
7 | # copyright notice and this permission notice appear in all copies.
8 | #
9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 |
17 | DEPDIR=depends
18 | CFLAGS=-c -g -O3 -Wall -Werror -fPIC
19 | LDFLAGS=-g -O3 -Wall -Werror
20 | CC=gcc
21 |
22 | all: libsoldout.so
23 |
24 | .PHONY: all clean
25 |
26 |
27 | # libraries
28 |
29 | libsoldout.so: libsoldout.so.1
30 | ln -s $^ $@
31 |
32 | libsoldout.so.1: markdown.o array.o buffer.o renderers.o
33 | $(CC) $(LDFLAGS) -shared -Wl $^ -o $@
34 |
35 |
36 | # executables
37 |
38 | mkd2html: mkd2html.o libsoldout.so
39 | $(CC) $(LDFLAGS) $^ -o $@
40 |
41 | mkd2latex: mkd2latex.o libsoldout.so
42 | $(CC) $(LDFLAGS) $^ -o $@
43 |
44 | mkd2man: mkd2man.o libsoldout.so
45 | $(CC) $(LDFLAGS) $^ -o $@
46 |
47 |
48 | # housekeeping
49 |
50 | benchmark: benchmark.o libsoldout.so
51 | $(CC) $(LDFLAGS) $^ -o $@
52 |
53 | clean:
54 | rm -f *.o
55 | rm -f libsoldout.so libsoldout.so.*
56 | rm -f mkd2html mkd2latex mkd2man benchmark
57 | rm -rf $(DEPDIR)
58 |
59 |
60 | # dependencies
61 |
62 | include $(wildcard $(DEPDIR)/*.d)
63 |
64 |
65 | # generic object compilations
66 |
67 | %.o: %.c
68 | @mkdir -p $(DEPDIR)
69 | @$(CC) -MM $< > $(DEPDIR)/$*.d
70 | $(CC) $(CFLAGS) -o $@ $<
71 |
72 | %.o: %.m
73 | @mkdir -p $(DEPDIR)
74 | @$(CC) -MM $< > depends/$*.d
75 | $(CC) $(CFLAGS) -o $@ $<
76 |
--------------------------------------------------------------------------------
/dep/libsoldout/renderers.h:
--------------------------------------------------------------------------------
1 | /* renderers.h - example markdown renderers */
2 |
3 | /*
4 | * Copyright (c) 2009, Natacha Porté
5 | *
6 | * Permission to use, copy, modify, and distribute this software for any
7 | * purpose with or without fee is hereby granted, provided that the above
8 | * copyright notice and this permission notice appear in all copies.
9 | *
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 | */
18 |
19 | #ifndef MARKDOWN_RENDERERS_H
20 | #define MARKDOWN_RENDERERS_H
21 |
22 | #include "markdown.h"
23 |
24 |
25 | /*****************************
26 | * EXPORTED HELPER FUNCTIONS *
27 | *****************************/
28 |
29 | /* lus_attr_escape • copy the buffer entity-escaping '<', '>', '&' and '"' */
30 | void
31 | lus_attr_escape(struct buf *ob, char *src, size_t size);
32 |
33 | /* lus_body_escape • copy the buffer entity-escaping '<', '>' and '&' */
34 | void
35 | lus_body_escape(struct buf *ob, char *src, size_t size);
36 |
37 |
38 |
39 | /***********************
40 | * RENDERER STRUCTURES *
41 | ***********************/
42 |
43 | /* original markdown renderers */
44 | extern const struct mkd_renderer mkd_html; /* HTML 4 renderer */
45 | extern const struct mkd_renderer mkd_xhtml; /* XHTML 1.0 renderer */
46 |
47 | /* renderers with some discount extensions */
48 | extern const struct mkd_renderer discount_html;
49 | extern const struct mkd_renderer discount_xhtml;
50 |
51 | /* renderers with Natasha's own extensions */
52 | extern const struct mkd_renderer nat_html;
53 | extern const struct mkd_renderer nat_xhtml;
54 |
55 | #endif /* ndef MARKDOWN_RENDERERS_H */
56 |
--------------------------------------------------------------------------------
/platform/android/library/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | in.uncod.android.bypass
6 | bypass
7 | apklib
8 | Bypass
9 |
10 |
11 | in.uncod.android.bypass
12 | parent
13 | 1.2-SNAPSHOT
14 | ../pom.xml
15 |
16 |
17 |
18 |
19 | com.google.android
20 | android
21 | provided
22 |
23 |
24 |
25 |
26 | src
27 |
28 |
29 |
30 | com.jayway.maven.plugins.android.generation2
31 | android-maven-plugin
32 |
33 |
35 |
36 |
37 | ndk-build
38 |
39 |
40 | all
41 | true
42 |
44 | true
45 |
48 | true
49 |
50 |
51 |
52 | true
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/platform/android/README.md:
--------------------------------------------------------------------------------
1 | ### Usage
2 |
3 | TextView text = (TextView) findViewById(R.id.demoText);
4 | Bypass bypass = new Bypass();
5 | String markdownString = "#Markdown!";
6 | CharSequence string = bypass.markdownToSpannable(markdownString);
7 | text.setText(string);
8 | text.setMovementMethod(LinkMovementMethod.getInstance());
9 |
10 | ### Maven Dependency
11 | If you just want to include Bypass in your Maven project, add the following
12 | dependency block to your `pom.xml`:
13 |
14 |
15 | in.uncod.android.bypass
16 | bypass
17 | apklib
18 | 1.1
19 |
20 |
21 | ### Manual Build
22 | Make sure `$ANDROID_NDK_HOME` is correctly set to the root directory of your
23 | NDK installation. Also, if Boost lives in a non-standard directory (or you're
24 | on Windows) you'll need to set `$BYPASS_INCLUDE_PATH` to its parent directory.
25 |
26 | #### Maven
27 | cd ./platform/android
28 | mvn install
29 |
30 | #### Library Project
31 | cd ./platform/android/library
32 | ndk-build
33 |
34 | Then simply point to the library from your project.
35 |
36 | ## Speed
37 |
38 | ### Android
39 | The following benchmarks were obtained by clocking the parsing of Sundown's readme file.
40 |
41 | ##### Bypass
42 | 03-01 15:13:12.662: D/Bypass(8998): onCreate: begin
43 | 03-01 15:13:12.662: D/Bypass(8998): onCreate: 1 ms, read raw
44 | 03-01 15:13:12.662: D/Bypass(8998): onCreate: 2 ms, instantiated Bypass
45 | 03-01 15:13:12.662: D/Bypass(8998): onCreate: 37 ms, convert to spannable
46 | 03-01 15:13:12.662: D/Bypass(8998): onCreate: end, 40 ms
47 |
48 | ##### [cwac-anddown](https://github.com/commonsguy/cwac-anddown)
49 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: begin
50 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: 2 ms, read raw
51 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: 2 ms, instantiated AndDown
52 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: 2 ms, convert to HTML
53 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: 167 ms, convert to Spanned
54 | 03-01 15:14:44.662: D/AndDown(9047): onCreate: end, 173 ms
55 |
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPMarkdownView.h:
--------------------------------------------------------------------------------
1 | //
2 | // BPMarkdownView.h
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 3/20/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import
22 |
23 | @protocol BPMarkdownViewLinkDelegate;
24 | @class BPDisplaySettings;
25 |
26 | @interface BPMarkdownView : UIScrollView
27 |
28 | /*!
29 | * The markdown that this view will show.
30 | */
31 | @property (strong, nonatomic) NSString *markdown;
32 |
33 | @property (strong, nonatomic) BPDisplaySettings *displaySettings;
34 |
35 | /*!
36 | * Whether or not to render the markdown asynchronously. If you are concerned with loading long
37 | * bodies of text, this may be of use to you. You can schedule the view to immediately load,
38 | * render markdown to Core Text frames in the background, and then show the results when it
39 | * has finished.
40 | *
41 | * The default is to load synchronously.
42 | */
43 | @property (assign, nonatomic, getter = isAsynchronous) BOOL asynchronous;
44 |
45 | /*!
46 | * The duration at which an asynchronous load operation will fade the text in at. This property
47 | * only has an effect when this view loads asynchronously.
48 | */
49 | @property (assign, nonatomic) NSTimeInterval asynchronousRevealDuration;
50 |
51 | /*!
52 | * The delegate that should handle link taps. By default this view will use the system to open
53 | * links based on whatever handler is most appropriate.
54 | */
55 | @property (weak, nonatomic) id linkDelegate;
56 |
57 | - (id)initWithFrame:(CGRect)frame markdown:(NSString *)markdown;
58 |
59 | @end
60 |
61 | @protocol BPMarkdownViewLinkDelegate
62 |
63 | - (void)markdownView:(BPMarkdownView *)markdownView didHaveLinkTapped:(NSString *)link;
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/test/document_tests.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2013 Uncodin, Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #define BOOST_TEST_MODULE DocumentTests
18 |
19 | #include
20 | #include
21 | #include
22 | #include "document.h"
23 |
24 | using namespace Bypass;
25 |
26 | struct F {
27 | F()
28 | : document()
29 | {
30 |
31 | }
32 |
33 | ~F() {
34 |
35 | }
36 |
37 | Document document;
38 | };
39 |
40 | BOOST_FIXTURE_TEST_CASE(document_initial_size, F) {
41 | BOOST_REQUIRE(document.size() == 0);
42 | }
43 |
44 | BOOST_FIXTURE_TEST_CASE(document_append_single, F) {
45 | Element element;
46 |
47 | document.append(element);
48 | BOOST_REQUIRE(document.size() == 1);
49 | }
50 |
51 | BOOST_FIXTURE_TEST_CASE(document_append_multiple, F) {
52 | int i, count = 3;
53 |
54 | for (i = 0; i < count; i++) {
55 | Element element;
56 | char str[10];
57 | sprintf(str, "%d", i);
58 | element.setText(std::string(str));
59 | document.append(element);
60 | }
61 |
62 | BOOST_REQUIRE(document.size() == 3);
63 | }
64 |
65 | BOOST_FIXTURE_TEST_CASE(document_access_single, F) {
66 | std::string expected = "expected";
67 |
68 | Element element;
69 | element.setText(expected);
70 |
71 | document.append(element);
72 |
73 | BOOST_REQUIRE(document[0].getText() == expected);
74 | }
75 |
76 | BOOST_FIXTURE_TEST_CASE(document_access_multiple, F) {
77 | int i, count = 3;
78 |
79 | for (i = 0; i < count; i++) {
80 | Element element;
81 |
82 | char str[10];
83 | sprintf(str, "%d", i);
84 |
85 | const std::string value = std::string(str);
86 |
87 | element.setText(value);
88 | document.append(element);
89 | }
90 |
91 | BOOST_REQUIRE(document[0].getText() == "0");
92 | BOOST_REQUIRE(document[1].getText() == "1");
93 | BOOST_REQUIRE(document[2].getText() == "2");
94 | }
--------------------------------------------------------------------------------
/platform/ios/Bypass/Bypass/BPDocument.mm:
--------------------------------------------------------------------------------
1 | //
2 | // BPDocument.m
3 | // Bypass
4 | //
5 | // Created by Damian Carrillo on 2/28/13.
6 | // Copyright 2013 Uncodin, Inc.
7 | //
8 | // Licensed under the Apache License, Version 2.0 (the "License");
9 | // you may not use this file except in compliance with the License.
10 | // You may obtain a copy of the License at
11 | //
12 | // http://www.apache.org/licenses/LICENSE-2.0
13 | //
14 | // Unless required by applicable law or agreed to in writing, software
15 | // distributed under the License is distributed on an "AS IS" BASIS,
16 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | // See the License for the specific language governing permissions and
18 | // limitations under the License.
19 | //
20 |
21 | #import "BPDocumentPrivate.h"
22 |
23 | @implementation BPDocument
24 | {
25 | Bypass::Document _document;
26 | NSArray *_elements;
27 | }
28 |
29 | - (id)init
30 | {
31 | Bypass::Document document;
32 | return [self initWithDocument:document];
33 | }
34 |
35 | - (id)initWithDocument:(Bypass::Document)document
36 | {
37 | self = [super init];
38 |
39 | if (self != nil) {
40 | _document = document;
41 | }
42 |
43 | return self;
44 | }
45 |
46 | - (NSArray *)elements
47 | {
48 | using namespace Bypass;
49 |
50 | if (_elements == nil) {
51 | size_t i, count = _document.size();
52 |
53 | NSMutableArray *elements = [NSMutableArray arrayWithCapacity:count];
54 |
55 | for (i = 0; i < count; ++i) {
56 | Element e = _document[i];
57 |
58 | BPElement *ee = [[BPElement alloc] initWithElement:e];
59 | elements[i] = ee;
60 | }
61 |
62 | _elements = [NSArray arrayWithArray:elements];
63 | }
64 |
65 | return _elements;
66 | }
67 |
68 | #if __has_feature(objc_subscripting)
69 |
70 | - (id)objectAtIndexedSubscript:(NSUInteger)idx
71 | {
72 | return [[self elements] objectAtIndexedSubscript:idx];
73 | }
74 |
75 | #endif
76 |
77 | - (NSString *)debugDescription
78 | {
79 | NSMutableString *desc = [NSMutableString stringWithString:NSStringFromClass([self class])];
80 | [desc appendString:@"{ childElements:"];
81 |
82 | for (BPElement *element in [self elements]) {
83 | [desc appendFormat:@"%@\n", [element debugDescription]];
84 | }
85 |
86 | [desc appendString:@"}"];
87 | return desc;
88 | }
89 |
90 |
91 | @end
92 |
--------------------------------------------------------------------------------
/dep/libsoldout/BSDmakefile:
--------------------------------------------------------------------------------
1 | # Makefile
2 |
3 | # Copyright (c) 2009, Natacha Porté
4 | #
5 | # Permission to use, copy, modify, and distribute this software for any
6 | # purpose with or without fee is hereby granted, provided that the above
7 | # copyright notice and this permission notice appear in all copies.
8 | #
9 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 |
17 | DEPDIR=depends
18 | ALLDEPS=$(DEPDIR)/all
19 | CFLAGS=-c -g -O3 -Wall -Werror -fPIC
20 | LDFLAGS=-g -O3 -Wall -Werror
21 | CC=gcc
22 |
23 | all: libsoldout.so mkd2html mkd2latex mkd2man
24 |
25 | .PHONY: all clean
26 |
27 |
28 | # libraries
29 |
30 | libsoldout.so: libsoldout.so.1
31 | ln -s $(.ALLSRC) $(.TARGET)
32 |
33 | libsoldout.so.1: markdown.o array.o buffer.o renderers.o
34 | $(CC) $(LDFLAGS) -shared -Wl,-soname=$(.TARGET) \
35 | $(.ALLSRC) -o $(.TARGET)
36 |
37 |
38 | # executables
39 |
40 | mkd2html: mkd2html.o libsoldout.so
41 | $(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
42 |
43 | mkd2latex: mkd2latex.o libsoldout.so
44 | $(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
45 |
46 | mkd2man: mkd2man.o libsoldout.so
47 | $(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
48 |
49 |
50 | # Housekeeping
51 |
52 | benchmark: benchmark.o libsoldout.so
53 | $(CC) $(LDFLAGS) $(.ALLSRC) -o $(.TARGET)
54 |
55 | clean:
56 | rm -f *.o
57 | rm -f libsoldout.so libsoldout.so.*
58 | rm -f mkd2html mkd2latex mkd2man benchmark
59 | rm -rf $(DEPDIR)
60 |
61 |
62 | # dependencies
63 |
64 | .sinclude "$(ALLDEPS)"
65 |
66 |
67 | # generic object compilations
68 |
69 | .c.o:
70 | @mkdir -p $(DEPDIR)
71 | @touch $(ALLDEPS)
72 | @$(CC) -MM $(.IMPSRC) > $(DEPDIR)/$(.PREFIX).d
73 | @grep -q "$(.PREFIX).d" $(ALLDEPS) \
74 | || echo ".include \"$(.PREFIX).d\"" >> $(ALLDEPS)
75 | $(CC) $(CFLAGS) -o $(.TARGET) $(.IMPSRC)
76 |
77 | .m.o:
78 | @mkdir -p $(DEPDIR)
79 | @touch $(ALLDEPS)
80 | @$(CC) -MM $(.IMPSRC) > depends/$(.PREFIX).d
81 | @grep -q "$(.PREFIX).d" $(ALLDEPS) \
82 | || echo ".include \"$(.PREFIX).d\"" >> $(ALLDEPS)
83 | $(CC) $(CFLAGS) -o $(.TARGET) $(.IMPSRC)
84 |
--------------------------------------------------------------------------------
/platform/android/library/src/in/uncod/android/bypass/Element.java:
--------------------------------------------------------------------------------
1 | package in.uncod.android.bypass;
2 |
3 | import java.util.Map;
4 | import java.util.HashMap;
5 |
6 | public class Element {
7 |
8 | public static final int F_LIST_ORDERED = 1;
9 |
10 | public enum Type {
11 |
12 | // Block Element Types
13 |
14 | BLOCK_CODE(0x000),
15 | BLOCK_QUOTE(0x001),
16 | BLOCK_HTML(0x002),
17 | HEADER(0x003),
18 | HRULE(0x004),
19 | LIST(0x005),
20 | LIST_ITEM(0x006),
21 | PARAGRAPH(0x007),
22 | TABLE(0x008),
23 | TABLE_CELL(0x009),
24 | TABLE_ROW(0x00A),
25 |
26 | // Span Element Types
27 |
28 | AUTOLINK(0x10B),
29 | CODE_SPAN(0x10C),
30 | DOUBLE_EMPHASIS(0x10D),
31 | EMPHASIS(0x10E),
32 | IMAGE(0x10F),
33 | LINEBREAK(0x110),
34 | LINK(0x111),
35 | RAW_HTML_TAG(0x112),
36 | TRIPLE_EMPHASIS(0x113),
37 | TEXT(0x114),
38 | STRIKETHROUGH(0x115);
39 |
40 | private final int value;
41 |
42 | private Type(int value) {
43 | this.value = value;
44 | }
45 |
46 | private static final Type[] TypeValues = Type.values();
47 | public static Type fromInteger(int x) {
48 | for (Type type : TypeValues) {
49 | if (type.value == x) {
50 | return type;
51 | }
52 | }
53 | return null;
54 | }
55 | }
56 |
57 | String text;
58 | Map attributes = new HashMap();
59 | Element[] children;
60 | Type type;
61 | Element parent;
62 | int nestLevel = 0;
63 |
64 | public Element(String text, int type) {
65 | this.text = text;
66 | this.type = Type.fromInteger(type);
67 | }
68 |
69 | public void setParent(Element element) {
70 | this.parent = element;
71 | }
72 |
73 | public void setChildren(Element[] children) {
74 | this.children = children;
75 | }
76 |
77 | public void addAttribute(String name, String value) {
78 | attributes.put(name, value);
79 | }
80 |
81 | public String getAttribute(String name) {
82 | return attributes.get(name);
83 | }
84 |
85 | public Element getParent() {
86 | return parent;
87 | }
88 |
89 | public String getText() {
90 | return text;
91 | }
92 |
93 | public int size() {
94 | if (children != null) {
95 | return children.length;
96 | }
97 | return 0;
98 | }
99 |
100 | public Type getType() {
101 | return type;
102 | }
103 |
104 | public boolean isBlockElement() {
105 | return (type.value & 0x100) == 0x000;
106 | }
107 |
108 | public boolean isSpanElement() {
109 | return (type.value & 0x100) == 0x100;
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/element.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2013 Uncodin, Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | #ifndef BYPASS_ELEMENT_H
18 | #define BYPASS_ELEMENT_H
19 |
20 | #include
21 | #include
22 | #include