Removed html from core artifact
This commit is contained in:
		
							parent
							
								
									d48b33e9a5
								
							
						
					
					
						commit
						dc9a4dbf56
					
				@ -18,7 +18,7 @@ import ru.noties.markwon.ext.strikethrough.StrikethroughPlugin;
 | 
				
			|||||||
import ru.noties.markwon.ext.tables.TablePlugin;
 | 
					import ru.noties.markwon.ext.tables.TablePlugin;
 | 
				
			||||||
import ru.noties.markwon.ext.tasklist.TaskListPlugin;
 | 
					import ru.noties.markwon.ext.tasklist.TaskListPlugin;
 | 
				
			||||||
import ru.noties.markwon.gif.GifAwarePlugin;
 | 
					import ru.noties.markwon.gif.GifAwarePlugin;
 | 
				
			||||||
import ru.noties.markwon.html.impl.HtmlPlugin;
 | 
					import ru.noties.markwon.html.HtmlPlugin;
 | 
				
			||||||
import ru.noties.markwon.image.ImagesPlugin;
 | 
					import ru.noties.markwon.image.ImagesPlugin;
 | 
				
			||||||
import ru.noties.markwon.image.gif.GifPlugin;
 | 
					import ru.noties.markwon.image.gif.GifPlugin;
 | 
				
			||||||
import ru.noties.markwon.image.svg.SvgPlugin;
 | 
					import ru.noties.markwon.image.svg.SvgPlugin;
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
<manifest package="ru.noties.markwon.html.impl" />
 | 
					<manifest package="ru.noties.markwon.html" />
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,10 +1,8 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This class will be used to append some text to output in order to
 | 
					 * This class will be used to append some text to output in order to
 | 
				
			||||||
 * apply a Span for this tag. Please note that this class will be used for
 | 
					 * apply a Span for this tag. Please note that this class will be used for
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -8,10 +8,7 @@ import org.commonmark.node.HtmlBlock;
 | 
				
			|||||||
import org.commonmark.node.HtmlInline;
 | 
					import org.commonmark.node.HtmlInline;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.AbstractMarkwonPlugin;
 | 
					import ru.noties.markwon.AbstractMarkwonPlugin;
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					 | 
				
			||||||
import ru.noties.markwon.MarkwonVisitor;
 | 
					import ru.noties.markwon.MarkwonVisitor;
 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlParser;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class HtmlPlugin extends AbstractMarkwonPlugin {
 | 
					public class HtmlPlugin extends AbstractMarkwonPlugin {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -43,13 +40,6 @@ public class HtmlPlugin extends AbstractMarkwonPlugin {
 | 
				
			|||||||
        this.parser = parser;
 | 
					        this.parser = parser;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
 | 
					 | 
				
			||||||
        builder
 | 
					 | 
				
			||||||
                .htmlParser(parser)
 | 
					 | 
				
			||||||
                .htmlRenderer(renderer);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void configureVisitor(@NonNull MarkwonVisitor.Builder builder) {
 | 
					    public void configureVisitor(@NonNull MarkwonVisitor.Builder builder) {
 | 
				
			||||||
        builder
 | 
					        builder
 | 
				
			||||||
@ -59,8 +49,7 @@ public class HtmlPlugin extends AbstractMarkwonPlugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                        visitor.visitChildren(document);
 | 
					                        visitor.visitChildren(document);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        final MarkwonConfiguration configuration = visitor.configuration();
 | 
					                        renderer.render(visitor.configuration(), visitor.builder(), parser);
 | 
				
			||||||
                        configuration.htmlRenderer().render(configuration, visitor.builder(), configuration.htmlParser());
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                .on(HtmlBlock.class, new MarkwonVisitor.NodeVisitor<HtmlBlock>() {
 | 
					                .on(HtmlBlock.class, new MarkwonVisitor.NodeVisitor<HtmlBlock>() {
 | 
				
			||||||
@ -79,7 +68,7 @@ public class HtmlPlugin extends AbstractMarkwonPlugin {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private void visitHtml(@NonNull MarkwonVisitor visitor, @Nullable String html) {
 | 
					    private void visitHtml(@NonNull MarkwonVisitor visitor, @Nullable String html) {
 | 
				
			||||||
        if (html != null) {
 | 
					        if (html != null) {
 | 
				
			||||||
            visitor.configuration().htmlParser().processFragment(visitor.builder(), html);
 | 
					            parser.processFragment(visitor.builder(), html);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -7,8 +7,6 @@ import java.util.Collections;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
abstract class HtmlTagImpl implements HtmlTag {
 | 
					abstract class HtmlTagImpl implements HtmlTag {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final String name;
 | 
					    final String name;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -14,18 +14,16 @@ import java.util.Locale;
 | 
				
			|||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag.Block;
 | 
					import ru.noties.markwon.html.HtmlTag.Block;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag.Inline;
 | 
					import ru.noties.markwon.html.HtmlTag.Inline;
 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlParser;
 | 
					import ru.noties.markwon.html.jsoup.nodes.Attribute;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.nodes.Attribute;
 | 
					import ru.noties.markwon.html.jsoup.nodes.Attributes;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.nodes.Attributes;
 | 
					import ru.noties.markwon.html.jsoup.parser.CharacterReader;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.parser.CharacterReader;
 | 
					import ru.noties.markwon.html.jsoup.parser.ParseErrorList;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.parser.ParseErrorList;
 | 
					import ru.noties.markwon.html.jsoup.parser.Token;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.parser.Token;
 | 
					import ru.noties.markwon.html.jsoup.parser.Tokeniser;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.parser.Tokeniser;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static ru.noties.markwon.html.impl.AppendableUtils.appendQuietly;
 | 
					import static ru.noties.markwon.html.AppendableUtils.appendQuietly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @since 2.0.0
 | 
					 * @since 2.0.0
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -11,21 +11,17 @@ import java.util.Map;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.tag.BlockquoteHandler;
 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlParser;
 | 
					import ru.noties.markwon.html.tag.EmphasisHandler;
 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
					import ru.noties.markwon.html.tag.HeadingHandler;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.tag.ImageHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.BlockquoteHandler;
 | 
					import ru.noties.markwon.html.tag.LinkHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.EmphasisHandler;
 | 
					import ru.noties.markwon.html.tag.ListHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.HeadingHandler;
 | 
					import ru.noties.markwon.html.tag.StrikeHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.ImageHandler;
 | 
					import ru.noties.markwon.html.tag.StrongEmphasisHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.LinkHandler;
 | 
					import ru.noties.markwon.html.tag.SubScriptHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.ListHandler;
 | 
					import ru.noties.markwon.html.tag.SuperScriptHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.StrikeHandler;
 | 
					import ru.noties.markwon.html.tag.UnderlineHandler;
 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.StrongEmphasisHandler;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.SubScriptHandler;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.SuperScriptHandler;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.impl.tag.UnderlineHandler;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MarkwonHtmlRendererImpl extends MarkwonHtmlRenderer {
 | 
					public class MarkwonHtmlRendererImpl extends MarkwonHtmlRenderer {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -130,7 +126,7 @@ public class MarkwonHtmlRendererImpl extends MarkwonHtmlRenderer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    handler = tagHandler(inline.name());
 | 
					                    handler = tagHandler(inline.name());
 | 
				
			||||||
                    if (handler != null) {
 | 
					                    if (handler != null) {
 | 
				
			||||||
                        handler.handle(configuration, builder, inline);
 | 
					                        handler.handle(configuration, MarkwonHtmlRendererImpl.this, builder, inline);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -150,7 +146,7 @@ public class MarkwonHtmlRendererImpl extends MarkwonHtmlRenderer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    handler = tagHandler(block.name());
 | 
					                    handler = tagHandler(block.name());
 | 
				
			||||||
                    if (handler != null) {
 | 
					                    if (handler != null) {
 | 
				
			||||||
                        handler.handle(configuration, builder, block);
 | 
					                        handler.handle(configuration, MarkwonHtmlRendererImpl.this, builder, block);
 | 
				
			||||||
                    } else {
 | 
					                    } else {
 | 
				
			||||||
                        // see if any of children can be handled
 | 
					                        // see if any of children can be handled
 | 
				
			||||||
                        apply(block.children());
 | 
					                        apply(block.children());
 | 
				
			||||||
@ -9,12 +9,14 @@ public abstract class TagHandler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public abstract void handle(
 | 
					    public abstract void handle(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag tag
 | 
					            @NonNull HtmlTag tag
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected static void visitChildren(
 | 
					    protected static void visitChildren(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag.Block block) {
 | 
					            @NonNull HtmlTag.Block block) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -26,11 +28,11 @@ public abstract class TagHandler {
 | 
				
			|||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            handler = configuration.htmlRenderer().tagHandler(child.name());
 | 
					            handler = renderer.tagHandler(child.name());
 | 
				
			||||||
            if (handler != null) {
 | 
					            if (handler != null) {
 | 
				
			||||||
                handler.handle(configuration, builder, child);
 | 
					                handler.handle(configuration, renderer, builder, child);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                visitChildren(configuration, builder, child);
 | 
					                visitChildren(configuration, renderer, builder, child);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl;
 | 
					package ru.noties.markwon.html;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static ru.noties.markwon.html.impl.AppendableUtils.appendQuietly;
 | 
					import static ru.noties.markwon.html.AppendableUtils.appendQuietly;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
abstract class TrimmingAppender {
 | 
					abstract class TrimmingAppender {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup;
 | 
					package ru.noties.markwon.html.jsoup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.helper;
 | 
					package ru.noties.markwon.html.jsoup.helper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Locale;
 | 
					import java.util.Locale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.helper;
 | 
					package ru.noties.markwon.html.jsoup.helper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Simple validation methods. Designed for jsoup internal use
 | 
					 * Simple validation methods. Designed for jsoup internal use
 | 
				
			||||||
@ -1,8 +1,8 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.nodes;
 | 
					package ru.noties.markwon.html.jsoup.nodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.helper.Validate;
 | 
					import ru.noties.markwon.html.jsoup.helper.Validate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 A single key + value attribute. (Only used for presentation.)
 | 
					 A single key + value attribute. (Only used for presentation.)
 | 
				
			||||||
@ -1,14 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.nodes;
 | 
					package ru.noties.markwon.html.jsoup.nodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Collections;
 | 
					 | 
				
			||||||
import java.util.Iterator;
 | 
					import java.util.Iterator;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.helper.Validate;
 | 
					import ru.noties.markwon.html.jsoup.helper.Validate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static ru.noties.markwon.html.impl.jsoup.helper.Normalizer.lowerCase;
 | 
					import static ru.noties.markwon.html.jsoup.helper.Normalizer.lowerCase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * The attributes of an Element.
 | 
					 * The attributes of an Element.
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.nodes;
 | 
					package ru.noties.markwon.html.jsoup.nodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.nodes;
 | 
					package ru.noties.markwon.html.jsoup.nodes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * A {@code <!DOCTYPE>} node.
 | 
					 * A {@code <!DOCTYPE>} node.
 | 
				
			||||||
@ -1,6 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.Reader;
 | 
					import java.io.Reader;
 | 
				
			||||||
@ -8,8 +6,8 @@ import java.io.StringReader;
 | 
				
			|||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Locale;
 | 
					import java.util.Locale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.UncheckedIOException;
 | 
					import ru.noties.markwon.html.jsoup.UncheckedIOException;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.helper.Validate;
 | 
					import ru.noties.markwon.html.jsoup.helper.Validate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * CharacterReader consumes tokens off a string. Used internally by jsoup. API subject to changes.
 | 
					 * CharacterReader consumes tokens off a string. Used internally by jsoup. API subject to changes.
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * A Parse Error records an error in the input HTML that occurs in either the tokenisation or the tree building phase.
 | 
					 * A Parse Error records an error in the input HTML that occurs in either the tokenisation or the tree building phase.
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,11 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.helper.Validate;
 | 
					import ru.noties.markwon.html.jsoup.helper.Validate;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.nodes.Attributes;
 | 
					import ru.noties.markwon.html.jsoup.nodes.Attributes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static ru.noties.markwon.html.impl.jsoup.helper.Normalizer.lowerCase;
 | 
					import static ru.noties.markwon.html.jsoup.helper.Normalizer.lowerCase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Parse tokens for the Tokeniser.
 | 
					 * Parse tokens for the Tokeniser.
 | 
				
			||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.helper.Validate;
 | 
					import ru.noties.markwon.html.jsoup.helper.Validate;
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.nodes.CommonMarkEntities;
 | 
					import ru.noties.markwon.html.jsoup.nodes.CommonMarkEntities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Readers the input stream into tokens.
 | 
					 * Readers the input stream into tokens.
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.jsoup.parser;
 | 
					package ru.noties.markwon.html.jsoup.parser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.jsoup.nodes.DocumentType;
 | 
					import ru.noties.markwon.html.jsoup.nodes.DocumentType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * States and transition activations for the Tokeniser.
 | 
					 * States and transition activations for the Tokeniser.
 | 
				
			||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.span;
 | 
					package ru.noties.markwon.html.span;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.text.TextPaint;
 | 
					import android.text.TextPaint;
 | 
				
			||||||
import android.text.style.MetricAffectingSpan;
 | 
					import android.text.style.MetricAffectingSpan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.MarkwonHtmlRendererImpl;
 | 
					import ru.noties.markwon.html.MarkwonHtmlRendererImpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SubScriptSpan extends MetricAffectingSpan {
 | 
					public class SubScriptSpan extends MetricAffectingSpan {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.span;
 | 
					package ru.noties.markwon.html.span;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.text.TextPaint;
 | 
					import android.text.TextPaint;
 | 
				
			||||||
import android.text.style.MetricAffectingSpan;
 | 
					import android.text.style.MetricAffectingSpan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.MarkwonHtmlRendererImpl;
 | 
					import ru.noties.markwon.html.MarkwonHtmlRendererImpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SuperScriptSpan extends MetricAffectingSpan {
 | 
					public class SuperScriptSpan extends MetricAffectingSpan {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1,10 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.TagHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class BlockquoteHandler extends TagHandler {
 | 
					public class BlockquoteHandler extends TagHandler {
 | 
				
			||||||
@ -12,11 +13,12 @@ public class BlockquoteHandler extends TagHandler {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handle(
 | 
					    public void handle(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag tag) {
 | 
					            @NonNull HtmlTag tag) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (tag.isBlock()) {
 | 
					        if (tag.isBlock()) {
 | 
				
			||||||
            visitChildren(configuration, builder, tag.getAsBlock());
 | 
					            visitChildren(configuration, renderer, builder, tag.getAsBlock());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SpannableBuilder.setSpans(
 | 
					        SpannableBuilder.setSpans(
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -8,7 +8,7 @@ import java.util.Map;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
import ru.noties.markwon.html.impl.CssInlineStyleParser;
 | 
					import ru.noties.markwon.html.CssInlineStyleParser;
 | 
				
			||||||
import ru.noties.markwon.image.ImageSize;
 | 
					import ru.noties.markwon.image.ImageSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ImageHandler extends SimpleTagHandler {
 | 
					public class ImageHandler extends SimpleTagHandler {
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -7,8 +7,8 @@ import android.text.TextUtils;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.impl.CssInlineStyleParser;
 | 
					import ru.noties.markwon.html.CssInlineStyleParser;
 | 
				
			||||||
import ru.noties.markwon.html.impl.CssProperty;
 | 
					import ru.noties.markwon.html.CssProperty;
 | 
				
			||||||
import ru.noties.markwon.image.ImageSize;
 | 
					import ru.noties.markwon.image.ImageSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ImageSizeParserImpl implements ImageHandler.ImageSizeParser {
 | 
					class ImageSizeParserImpl implements ImageHandler.ImageSizeParser {
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -1,10 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.TagHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ListHandler extends TagHandler {
 | 
					public class ListHandler extends TagHandler {
 | 
				
			||||||
@ -12,6 +13,7 @@ public class ListHandler extends TagHandler {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handle(
 | 
					    public void handle(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag tag) {
 | 
					            @NonNull HtmlTag tag) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -34,7 +36,7 @@ public class ListHandler extends TagHandler {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        for (HtmlTag.Block child : block.children()) {
 | 
					        for (HtmlTag.Block child : block.children()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            visitChildren(configuration, builder, child);
 | 
					            visitChildren(configuration, renderer, builder, child);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ("li".equals(child.name())) {
 | 
					            if ("li".equals(child.name())) {
 | 
				
			||||||
                // insert list item here
 | 
					                // insert list item here
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
 | 
				
			|||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.TagHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public abstract class SimpleTagHandler extends TagHandler {
 | 
					public abstract class SimpleTagHandler extends TagHandler {
 | 
				
			||||||
@ -14,7 +15,7 @@ public abstract class SimpleTagHandler extends TagHandler {
 | 
				
			|||||||
    public abstract Object getSpans(@NonNull MarkwonConfiguration configuration, @NonNull HtmlTag tag);
 | 
					    public abstract Object getSpans(@NonNull MarkwonConfiguration configuration, @NonNull HtmlTag tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handle(@NonNull MarkwonConfiguration configuration, @NonNull SpannableBuilder builder, @NonNull HtmlTag tag) {
 | 
					    public void handle(@NonNull MarkwonConfiguration configuration, @NonNull MarkwonHtmlRenderer renderer, @NonNull SpannableBuilder builder, @NonNull HtmlTag tag) {
 | 
				
			||||||
        final Object spans = getSpans(configuration, tag);
 | 
					        final Object spans = getSpans(configuration, tag);
 | 
				
			||||||
        if (spans != null) {
 | 
					        if (spans != null) {
 | 
				
			||||||
            SpannableBuilder.setSpans(builder, spans, tag.start(), tag.end());
 | 
					            SpannableBuilder.setSpans(builder, spans, tag.start(), tag.end());
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.text.style.StrikethroughSpan;
 | 
					import android.text.style.StrikethroughSpan;
 | 
				
			||||||
@ -6,6 +6,7 @@ import android.text.style.StrikethroughSpan;
 | 
				
			|||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.TagHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class StrikeHandler extends TagHandler {
 | 
					public class StrikeHandler extends TagHandler {
 | 
				
			||||||
@ -13,11 +14,12 @@ public class StrikeHandler extends TagHandler {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handle(
 | 
					    public void handle(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag tag) {
 | 
					            @NonNull HtmlTag tag) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (tag.isBlock()) {
 | 
					        if (tag.isBlock()) {
 | 
				
			||||||
            visitChildren(configuration, builder, tag.getAsBlock());
 | 
					            visitChildren(configuration, renderer, builder, tag.getAsBlock());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SpannableBuilder.setSpans(
 | 
					        SpannableBuilder.setSpans(
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
@ -1,11 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
import ru.noties.markwon.html.impl.span.SubScriptSpan;
 | 
					import ru.noties.markwon.html.span.SubScriptSpan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SubScriptHandler extends SimpleTagHandler {
 | 
					public class SubScriptHandler extends SimpleTagHandler {
 | 
				
			||||||
    @Nullable
 | 
					    @Nullable
 | 
				
			||||||
@ -1,11 +1,11 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.support.annotation.Nullable;
 | 
					import android.support.annotation.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
import ru.noties.markwon.html.impl.span.SuperScriptSpan;
 | 
					import ru.noties.markwon.html.span.SuperScriptSpan;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SuperScriptHandler extends SimpleTagHandler {
 | 
					public class SuperScriptHandler extends SimpleTagHandler {
 | 
				
			||||||
    @Nullable
 | 
					    @Nullable
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
package ru.noties.markwon.html.impl.tag;
 | 
					package ru.noties.markwon.html.tag;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
import android.text.style.UnderlineSpan;
 | 
					import android.text.style.UnderlineSpan;
 | 
				
			||||||
@ -6,6 +6,7 @@ import android.text.style.UnderlineSpan;
 | 
				
			|||||||
import ru.noties.markwon.MarkwonConfiguration;
 | 
					import ru.noties.markwon.MarkwonConfiguration;
 | 
				
			||||||
import ru.noties.markwon.SpannableBuilder;
 | 
					import ru.noties.markwon.SpannableBuilder;
 | 
				
			||||||
import ru.noties.markwon.html.HtmlTag;
 | 
					import ru.noties.markwon.html.HtmlTag;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
				
			||||||
import ru.noties.markwon.html.TagHandler;
 | 
					import ru.noties.markwon.html.TagHandler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class UnderlineHandler extends TagHandler {
 | 
					public class UnderlineHandler extends TagHandler {
 | 
				
			||||||
@ -13,6 +14,7 @@ public class UnderlineHandler extends TagHandler {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void handle(
 | 
					    public void handle(
 | 
				
			||||||
            @NonNull MarkwonConfiguration configuration,
 | 
					            @NonNull MarkwonConfiguration configuration,
 | 
				
			||||||
 | 
					            @NonNull MarkwonHtmlRenderer renderer,
 | 
				
			||||||
            @NonNull SpannableBuilder builder,
 | 
					            @NonNull SpannableBuilder builder,
 | 
				
			||||||
            @NonNull HtmlTag tag) {
 | 
					            @NonNull HtmlTag tag) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -20,7 +22,7 @@ public class UnderlineHandler extends TagHandler {
 | 
				
			|||||||
        // thus doesn't allow children, we must visit them first
 | 
					        // thus doesn't allow children, we must visit them first
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (tag.isBlock()) {
 | 
					        if (tag.isBlock()) {
 | 
				
			||||||
            visitChildren(configuration, builder, tag.getAsBlock());
 | 
					            visitChildren(configuration, renderer, builder, tag.getAsBlock());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SpannableBuilder.setSpans(
 | 
					        SpannableBuilder.setSpans(
 | 
				
			||||||
@ -14,6 +14,8 @@ import java.util.Map;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import ix.Ix;
 | 
					import ix.Ix;
 | 
				
			||||||
import ix.IxFunction;
 | 
					import ix.IxFunction;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.CssInlineStyleParser;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.CssProperty;
 | 
				
			||||||
import ru.noties.markwon.test.TestUtils;
 | 
					import ru.noties.markwon.test.TestUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.junit.Assert.assertEquals;
 | 
					import static org.junit.Assert.assertEquals;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,8 +5,9 @@ import org.junit.Test;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.HtmlEmptyTagReplacement;
 | 
				
			||||||
import ru.noties.markwon.html.api.HtmlTag;
 | 
					import ru.noties.markwon.html.api.HtmlTag;
 | 
				
			||||||
import ru.noties.markwon.html.impl.HtmlTagImpl.InlineImpl;
 | 
					import ru.noties.markwon.html.HtmlTagImpl.InlineImpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.junit.Assert.assertEquals;
 | 
					import static org.junit.Assert.assertEquals;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,8 @@ import java.util.List;
 | 
				
			|||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
import java.util.Set;
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.HtmlEmptyTagReplacement;
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.MarkwonHtmlParserImpl;
 | 
				
			||||||
import ru.noties.markwon.html.api.HtmlTag;
 | 
					import ru.noties.markwon.html.api.HtmlTag;
 | 
				
			||||||
import ru.noties.markwon.html.api.MarkwonHtmlParser;
 | 
					import ru.noties.markwon.html.api.MarkwonHtmlParser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,8 @@ import org.junit.runner.RunWith;
 | 
				
			|||||||
import org.robolectric.RobolectricTestRunner;
 | 
					import org.robolectric.RobolectricTestRunner;
 | 
				
			||||||
import org.robolectric.annotation.Config;
 | 
					import org.robolectric.annotation.Config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.TrimmingAppender;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.junit.Assert.assertEquals;
 | 
					import static org.junit.Assert.assertEquals;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@RunWith(RobolectricTestRunner.class)
 | 
					@RunWith(RobolectricTestRunner.class)
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,8 @@ import org.junit.runner.RunWith;
 | 
				
			|||||||
import org.robolectric.RobolectricTestRunner;
 | 
					import org.robolectric.RobolectricTestRunner;
 | 
				
			||||||
import org.robolectric.annotation.Config;
 | 
					import org.robolectric.annotation.Config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.jsoup.nodes.CommonMarkEntities;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static org.junit.Assert.assertEquals;
 | 
					import static org.junit.Assert.assertEquals;
 | 
				
			||||||
import static org.junit.Assert.assertTrue;
 | 
					import static org.junit.Assert.assertTrue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,7 @@ import java.util.Collections;
 | 
				
			|||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ru.noties.markwon.html.tag.ImageSizeParserImpl;
 | 
				
			||||||
import ru.noties.markwon.image.ImageSize;
 | 
					import ru.noties.markwon.image.ImageSize;
 | 
				
			||||||
import ru.noties.markwon.renderer.html2.CssInlineStyleParser;
 | 
					import ru.noties.markwon.renderer.html2.CssInlineStyleParser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,10 +3,7 @@ package ru.noties.markwon;
 | 
				
			|||||||
import android.content.Context;
 | 
					import android.content.Context;
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlParser;
 | 
					 | 
				
			||||||
import ru.noties.markwon.html.MarkwonHtmlRenderer;
 | 
					 | 
				
			||||||
import ru.noties.markwon.image.AsyncDrawableLoader;
 | 
					import ru.noties.markwon.image.AsyncDrawableLoader;
 | 
				
			||||||
import ru.noties.markwon.image.AsyncDrawableLoaderNoOp;
 | 
					 | 
				
			||||||
import ru.noties.markwon.image.ImageSizeResolver;
 | 
					import ru.noties.markwon.image.ImageSizeResolver;
 | 
				
			||||||
import ru.noties.markwon.image.ImageSizeResolverDef;
 | 
					import ru.noties.markwon.image.ImageSizeResolverDef;
 | 
				
			||||||
import ru.noties.markwon.spans.LinkSpan;
 | 
					import ru.noties.markwon.spans.LinkSpan;
 | 
				
			||||||
@ -20,8 +17,9 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // creates default configuration
 | 
					    // creates default configuration
 | 
				
			||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
 | 
					    @Deprecated
 | 
				
			||||||
    public static MarkwonConfiguration create(@NonNull Context context) {
 | 
					    public static MarkwonConfiguration create(@NonNull Context context) {
 | 
				
			||||||
        return new Builder(context).build(MarkwonTheme.create(context), new AsyncDrawableLoaderNoOp());
 | 
					        return new Builder(context).build(MarkwonTheme.create(context), AsyncDrawableLoader.noOp());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @NonNull
 | 
					    @NonNull
 | 
				
			||||||
@ -37,8 +35,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
    private final UrlProcessor urlProcessor;
 | 
					    private final UrlProcessor urlProcessor;
 | 
				
			||||||
    private final ImageSizeResolver imageSizeResolver;
 | 
					    private final ImageSizeResolver imageSizeResolver;
 | 
				
			||||||
    private final SpannableFactory factory; // @since 1.1.0
 | 
					    private final SpannableFactory factory; // @since 1.1.0
 | 
				
			||||||
    private final MarkwonHtmlParser htmlParser; // @since 2.0.0
 | 
					 | 
				
			||||||
    private final MarkwonHtmlRenderer htmlRenderer; // @since 2.0.0
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private MarkwonConfiguration(@NonNull Builder builder) {
 | 
					    private MarkwonConfiguration(@NonNull Builder builder) {
 | 
				
			||||||
        this.theme = builder.theme;
 | 
					        this.theme = builder.theme;
 | 
				
			||||||
@ -48,8 +44,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
        this.urlProcessor = builder.urlProcessor;
 | 
					        this.urlProcessor = builder.urlProcessor;
 | 
				
			||||||
        this.imageSizeResolver = builder.imageSizeResolver;
 | 
					        this.imageSizeResolver = builder.imageSizeResolver;
 | 
				
			||||||
        this.factory = builder.factory;
 | 
					        this.factory = builder.factory;
 | 
				
			||||||
        this.htmlParser = builder.htmlParser;
 | 
					 | 
				
			||||||
        this.htmlRenderer = builder.htmlRenderer;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -95,22 +89,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
        return factory;
 | 
					        return factory;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * @since 2.0.0
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @NonNull
 | 
					 | 
				
			||||||
    public MarkwonHtmlParser htmlParser() {
 | 
					 | 
				
			||||||
        return htmlParser;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * @since 2.0.0
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    @NonNull
 | 
					 | 
				
			||||||
    public MarkwonHtmlRenderer htmlRenderer() {
 | 
					 | 
				
			||||||
        return htmlRenderer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @SuppressWarnings("unused")
 | 
					    @SuppressWarnings("unused")
 | 
				
			||||||
    public static class Builder {
 | 
					    public static class Builder {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -123,8 +101,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
        private UrlProcessor urlProcessor;
 | 
					        private UrlProcessor urlProcessor;
 | 
				
			||||||
        private ImageSizeResolver imageSizeResolver;
 | 
					        private ImageSizeResolver imageSizeResolver;
 | 
				
			||||||
        private SpannableFactory factory; // @since 1.1.0
 | 
					        private SpannableFactory factory; // @since 1.1.0
 | 
				
			||||||
        private MarkwonHtmlParser htmlParser; // @since 2.0.0
 | 
					 | 
				
			||||||
        private MarkwonHtmlRenderer htmlRenderer; // @since 2.0.0
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Builder(@NonNull Context context) {
 | 
					        Builder(@NonNull Context context) {
 | 
				
			||||||
            this.context = context;
 | 
					            this.context = context;
 | 
				
			||||||
@ -139,8 +115,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
            this.urlProcessor = configuration.urlProcessor;
 | 
					            this.urlProcessor = configuration.urlProcessor;
 | 
				
			||||||
            this.imageSizeResolver = configuration.imageSizeResolver;
 | 
					            this.imageSizeResolver = configuration.imageSizeResolver;
 | 
				
			||||||
            this.factory = configuration.factory;
 | 
					            this.factory = configuration.factory;
 | 
				
			||||||
            this.htmlParser = configuration.htmlParser;
 | 
					 | 
				
			||||||
            this.htmlRenderer = configuration.htmlRenderer;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @NonNull
 | 
					        @NonNull
 | 
				
			||||||
@ -179,24 +153,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
            return this;
 | 
					            return this;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * @since 2.0.0
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        @NonNull
 | 
					 | 
				
			||||||
        public Builder htmlParser(@NonNull MarkwonHtmlParser htmlParser) {
 | 
					 | 
				
			||||||
            this.htmlParser = htmlParser;
 | 
					 | 
				
			||||||
            return this;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /**
 | 
					 | 
				
			||||||
         * @since 2.0.0
 | 
					 | 
				
			||||||
         */
 | 
					 | 
				
			||||||
        @NonNull
 | 
					 | 
				
			||||||
        public Builder htmlRenderer(@NonNull MarkwonHtmlRenderer htmlRenderer) {
 | 
					 | 
				
			||||||
            this.htmlRenderer = htmlRenderer;
 | 
					 | 
				
			||||||
            return this;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        @NonNull
 | 
					        @NonNull
 | 
				
			||||||
        public MarkwonConfiguration build(@NonNull MarkwonTheme theme, @NonNull AsyncDrawableLoader asyncDrawableLoader) {
 | 
					        public MarkwonConfiguration build(@NonNull MarkwonTheme theme, @NonNull AsyncDrawableLoader asyncDrawableLoader) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -224,16 +180,6 @@ public class MarkwonConfiguration {
 | 
				
			|||||||
                factory = SpannableFactoryDef.create();
 | 
					                factory = SpannableFactoryDef.create();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // @since 2.0.0
 | 
					 | 
				
			||||||
            if (htmlParser == null) {
 | 
					 | 
				
			||||||
                htmlParser = MarkwonHtmlParser.noOp();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // @since 2.0.0
 | 
					 | 
				
			||||||
            if (htmlRenderer == null) {
 | 
					 | 
				
			||||||
                htmlRenderer = MarkwonHtmlRenderer.noOp();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return new MarkwonConfiguration(this);
 | 
					            return new MarkwonConfiguration(this);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,22 @@ import java.util.concurrent.Executors;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public abstract class AsyncDrawableLoader {
 | 
					public abstract class AsyncDrawableLoader {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @since 3.0.0
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @NonNull
 | 
				
			||||||
 | 
					    public static Builder builder() {
 | 
				
			||||||
 | 
					        return new Builder();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @since 3.0.0
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @NonNull
 | 
				
			||||||
 | 
					    public static AsyncDrawableLoader noOp() {
 | 
				
			||||||
 | 
					        return new AsyncDrawableLoaderNoOp();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public abstract void load(@NonNull String destination, @NonNull AsyncDrawable drawable);
 | 
					    public abstract void load(@NonNull String destination, @NonNull AsyncDrawable drawable);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ package ru.noties.markwon.image;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import android.support.annotation.NonNull;
 | 
					import android.support.annotation.NonNull;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class AsyncDrawableLoaderNoOp extends AsyncDrawableLoader {
 | 
					class AsyncDrawableLoaderNoOp extends AsyncDrawableLoader {
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void load(@NonNull String destination, @NonNull AsyncDrawable drawable) {
 | 
					    public void load(@NonNull String destination, @NonNull AsyncDrawable drawable) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user