nightwhistler / htmlspanner Goto Github PK
View Code? Open in Web Editor NEWAndroid HTML rendering library with CSS support
Home Page: http://nightwhistler.github.io/HtmlSpanner/
Android HTML rendering library with CSS support
Home Page: http://nightwhistler.github.io/HtmlSpanner/
<pre> tags should still display HTML entities correctly... right now the raw codes are displayed.
Hello, i've encountered following error using your library.
https://gist.github.com/jasminsuljic/aa88da39408e86041c88
Maybe it would be great idea to use async task as way to load images.
I would do it myself but i've started android development last thursday so i dont know what really need to be done.
I'll be grateful it you fix this issue
Let say we have few character codes in html like கா ('கா') while converting this to spannable string, it remains the same.
can u help?
I am using Android studio but still failed to import the library,
I have review the multiple issue related to same issue but failed,
Also i tried to use jitpack
but failed to add the dependency which supposed to be
compile 'com.github.User:Repo:Tag' ( didn;t get the Tag text? )
can you help please??
I'm trying to load Epub on a TextView but images display [OBJ]
HtmlSpanner htmlSpanner = new HtmlSpanner();
ImageHandler imgHandler = new ImageHandler();
htmlSpanner.registerHandler("img", imgHandler);
htmlSpanner.registerHandler("image", imgHandler);
Spannable spannable = htmlSpanner.fromHtml(content);
textView.setText(spannable);
java.lang.NullPointerException
at net.nightwhistler.htmlspanner.SystemFontResolver.getFont(SystemFontResolver.java:59)
at net.nightwhistler.htmlspanner.HtmlSpanner.getFont(HtmlSpanner.java:110)
at net.nightwhistler.htmlspanner.handlers.FontHandler.handleTagNode(FontHandler.java:47)
at net.nightwhistler.htmlspanner.handlers.StyledTextHandler.handleTagNode(StyledTextHandler.java:74)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:327)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:244)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:198)
at net.nightwhistler.pageturner.catalog.Catalog.loadBookDetails(Catalog.java:100)
at net.nightwhistler.pageturner.catalog.BookDetailsFragment.doSetFeed(BookDetailsFragment.java:220)
at net.nightwhistler.pageturner.catalog.BookDetailsFragment.setNewFeed(BookDetailsFragment.java:234)
at net.nightwhistler.pageturner.activity.CatalogActivity.loadFakeFeed(CatalogActivity.java:92)
at net.nightwhistler.pageturner.activity.CatalogActivity.onFeedReplaced(CatalogActivity.java:76)
at net.nightwhistler.pageturner.catalog.CatalogFragment.setNewFeed(CatalogFragment.java:486)
at net.nightwhistler.pageturner.catalog.LoadOPDSTask.doOnPostExecute(LoadOPDSTask.java:178)
at net.nightwhistler.pageturner.catalog.LoadOPDSTask.doOnPostExecute(LoadOPDSTask.java:41)
at net.nightwhistler.pageturner.scheduling.QueueableAsyncTask.onPostExecute(QueueableAsyncTask.java:54)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Hi,
I am trying to capture event for link ("a") so i have registered event handler for it with htmlspanner.
HtmlSpanner htmlSpanner = new HtmlSpanner();
data = htmlSpanner.fromHtml(sb.toString());
htmlSpanner.registerHandler("a", new AnchorHandler(new LinkTagHandler()));
but i am not getting any event on click of link in LingTagHandler.
could you please tell me what i am doing wrong here ?
Thanks
I have trouble getting images loaded from the Internet into TextView. Local images are just fine, so there is always the option to delay TextView rendering until images are preloaded, but it does not seem like a good idea since there might be many of them. I have tried this (using koush's Ion):
public class AsyncImageHandler extends TagNodeHandler {
private Context context;
public AsyncImageHandler(MyApplication context) {
this.context = context;
}
@Override
public void handleTagNode(TagNode node, final SpannableStringBuilder builder, final int start, final int end, final SpanStack stack) {
String src = node.getAttributeByName("src");
builder.append("\uFFFC");
Ion.with(context, src).asBitmap().setCallback(new FutureCallback<Bitmap>() {
@Override
public void onCompleted(Exception e, Bitmap bitmap) {
if (bitmap != null) {
Drawable drawable = new BitmapDrawable(bitmap);
drawable.setBounds(0, 0, bitmap.getWidth() - 1, bitmap.getHeight() - 1);
stack.pushSpan(new ImageSpan(drawable), start, end);
}
}
});
}
}
But obviously, the TextView is already rendered when the image is loaded, so nothing happens (except for the \uFFFC, of course). Is there any way around that, without having to wait for pre-load? Thank you!
How to implement "page-break-before" tag in HtmlSpanner in epub library
When Using RTL epub Books,
Many Text are Miss-Aligned. ( Not all )
Tested on Page Turner too, the same issue exist.
I am not sure if that could be the case Because TextView be Default Auto-Adapt the Alignment.
So some Alignments are inverted.
Thanks in Advance
My HTML contains vowels like that, but the only characters it lets through are Ő and Ű.
It removes every other accented character.
Considering it relies on a CSS parser and HtmlCleaner, I have no idea where the problem is coming from, I just know this library does not suit my purposes due to its arcane bug.
That will be very helpful to see changes
compile 'net.nightwhistler.htmlspanner:htmlspanner:+' not working in gradle file
It's used a lot in book headers.
i'am working on epub reader based on epublib and using HTMLSpanner for rendering epub to android textview.
but css stiles and images didn't applied when showing in text view i used a path corrector to correct image and css link paths, then image issue solved but css stiles still doesn't apply to text view.
what should i do ? thank you.
Hi,
I have a span with inline style in it.
Do you support it?
<span style="font-family:.SFUIText-Bold;font-size:13"> some text </span>
I have created simple Epub image loader like this:
public class EpubImageHandler extends ImageHandler {
private Book book;
public EpubImageHandler(Book book) {
this.book = book;
}
@Override
protected Bitmap loadBitmap(String url) {
Bitmap bitmap = null;
try {
Resource resource = book.getResources().getByHref(url);
byte[] data = resource.getData();
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
} catch (Exception e) {
JHGTools.logError(e);
}
return bitmap;
}
}
It is registered:
htmlSpanner = new HtmlSpanner();
htmlSpanner.registerHandler("img", new EpubImageHandler(book));
If I try to load the bitmap to ImageView, it is displayed properly (so the handler is obviously called by HtmlSpanner), however the TextView still shows [OBJ] instead of the image.
Do I do anything wrong?
I want to give inline styling using HtmlSpanner.
<span style="background-color: #FFFF00">Yellow text.</span>
How may I achieve this using this library.
private String getMessage(String message) {
String messagestr = "";
if (other_user_id.equals("0")) {
String str_css = "<style> @font-face { font-family: MyFont; src: url(\"file:///android_asset/font/VAG-ROUNDED-STD-LIGHT.TTF\") }"
+ ".btn-primary {color: #fff; background-color: #643C7B; border: 0 solid transparent; display: inline-block;"
+ " margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; cursor: pointer;border: 0 "
+ "solid transparent; white-space: nowrap; font-family: MyFont; padding: 4px 10px; "
+ "font-size: 13px; line-height: 16px; border-radius: 4px;text-decoration: none;} "
+ ".btn-sec {color: #fff; background-color: #D48000; border: 0 solid transparent; display: inline-block;"
+ " margin-bottom: 0; font-weight: normal; text-align: center; vertical-align: middle; cursor: pointer;border: 0 "
+ "solid transparent; white-space: nowrap; font-family: MyFont; padding: 4px 10px; "
+ "font-size: 13px; line-height: 16px; border-radius: 4px;text-decoration: none;}"
+ "a{color:#914DB8} body{font-family:MyFont !important;color:#4A4A4A} </style>";
String subStringfirst = "<html><head>";
String subStringlast = "</head></html>";
System.out.println("log " + message.substring(0, 6));
if (message.substring(0, 6).equals("<html>")) {
String messagestring = message.substring(12);
messagestr = subStringfirst + str_css + messagestring;
} else {
String messagestring = message;
messagestr = subStringfirst + str_css + messagestring + subStringlast;
}
System.out.println("message " + subStringfirst + str_css + str_message);
} else {
messagestr = message;
}
return messagestr;
}
The fix for #14 seems to have broken paraphraph rendering:
Boxed chapter titles (as found in http://generation.feedbooks.com/book/2082.epub were displaying pretty nicely in the prior beta but in this one they display with the large number sitting on top of the smaller word “Chapter” rather than beside it. Also, the indenting of the first line of paragraphs is gone. And there’s no extra little spacing between paragraphs. That along with the missing indents makes it hard to tell when a new paragraph begins.
Hi Alex,
I forked your project under https://github.com/dschuermann/HtmlSpanner and made several changes to fit my needs. I think you will not like every change, so I did not make a pull request. I just want to inform you about my changes:
Table can't be displayed completely on OS 3.x device. (Motorola Xoom with OS 3.0.1 & Samsung Galaxy Tablet 8.9 with OS 3.2)
Many thanks for this fantastic lib.
I got a problem disabling CSS parsing.
I'm setting setAllowStyling(false) and setUseColoursFromStyle(false), but in log it is writing "Looking for matching CSS rules for node".
Is there a flag where i can disable css parsing completely?
I seem to have a problem with CSS implementation.
I have CSS like this:
p {
text-indent: 0;
margin-left: 0;
margin-right: 0;
text-align: justify;
margin-top: 0;
margin-bottom: .38em;
font-family: monospace;
font-size:73%;
line-height:115%
}
But the output looks like this:
https://dl.dropboxusercontent.com/u/11388416/margin-bottom.png
The paragraphs are not separated by new line. It is above the last line instead. Also, the text is not justified. I have been searching all over the source codes and found out that the justification might not be actually possible in TextView, but the margin-bottom remains a mystery. Do you have any idea?
On android, the following returns "Test.Test2".
It's removing the spaces. If this is part of a paragraph, the sentences are merged together.
TextUtil.replaceHtmlEntities("Test.\u00a0 Test2.", false)
Tag or Style text-decoration: underline does not work, there is a way to make it work?
Caused by: java.lang.ArrayIndexOutOfBoundsException: index=1
at java.util.regex.Matcher.appendEvaluated(Matcher.java:153)
at java.util.regex.Matcher.appendReplacement(Matcher.java:115)
at net.nightwhistler.htmlspanner.TextUtil.replaceHtmlEntities(TextUtil.java:55)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContentNode(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:273)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:262)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:262)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:262)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:262)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:219)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:196)
at net.nightwhistler.pageturner.view.bookview.BookView$CalculatePageNumbersTask$2.onLoadResource(BookView.java:1402)
at net.nightwhistler.pageturner.epub.ResourceLoader.load(ResourceLoader.java:86)
at net.nightwhistler.pageturner.view.bookview.BookView$CalculatePageNumbersTask.getOffsets(BookView.java:1436)
at net.nightwhistler.pageturner.view.bookview.BookView$CalculatePageNumbersTask.doInBackground(BookView.java:1343)
at net.nightwhistler.pageturner.view.bookview.BookView$CalculatePageNumbersTask.doInBackground(BookView.java:1329)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more
That's not supported on Android 2.2
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1096)
Caused by: java.lang.NoSuchMethodError: java.lang.String.isEmpty
at com.osbcp.cssparser.CSSParser.parse(CSSParser.java:47)
at net.nightwhistler.htmlspanner.handlers.StyleNodeHandler.parseCSSFromText(StyleNodeHandler.java:37)
at net.nightwhistler.htmlspanner.handlers.StyleNodeHandler.handleTagNode(StyleNodeHandler.java:27)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:327)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:244)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:209)
at net.nightwhistler.pageturner.view.bookview.TextLoader.getText(TextLoader.java:360)
at net.nightwhistler.pageturner.view.bookview.BookView$LoadTextTask.doInBackground(BookView.java:1320)
at net.nightwhistler.pageturner.view.bookview.BookView$LoadTextTask.doInBackground(BookView.java:1240)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more
java.lang.NoSuchMethodError: java.lang.String.isEmpty
at com.osbcp.cssparser.CSSParser.parse(CSSParser.java:47)
at net.nightwhistler.htmlspanner.handlers.StyleNodeHandler.parseCSSFromText(StyleNodeHandler.java:37)
at net.nightwhistler.htmlspanner.handlers.StyleNodeHandler.handleTagNode(StyleNodeHandler.java:27)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:327)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:322)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:300)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:244)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:209)
at net.nightwhistler.pageturner.view.bookview.TextLoader.getText(TextLoader.java:360)
at net.nightwhistler.pageturner.view.bookview.BookView$LoadTextTask.doInBackground(BookView.java:1320)
at net.nightwhistler.pageturner.view.bookview.BookView$LoadTextTask.doInBackground(BookView.java:1240)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1096)
Is there a way through which we can add expandable text in the library. For example a new tag can be set to define expanded and collapsed content inside a paragraph. Can you help in this thing?
Thank you.
It'd be nice to add this lib to my project using
compile 'com.nightwhistler:HtmlSpanner:1.0'
new HtmlSpanner()).fromHtml("
<pre>
String dateChangeString = getDateChangeTextIfNeeded(position);
if (!TextUtils.isEmpty(dateChangeString)) {
holder.mDateChangeText.setText(dateChangeString);
holder.mDateChangeLayout.setVisibility(View.VISIBLE);
} else {
holder.mDateChangeLayout.setVisibility(View.GONE);
}
</pre>         ");
Produces: "\n\n"
android.os.NetworkOnMainThreadException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2540)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.access$900(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5748)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
Caused by: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1166)
at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
at java.net.InetAddress.getAllByName(InetAddress.java:214)
at com.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:409)
at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:362)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:308)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179)
at java.net.URL.openStream(URL.java:470)
at net.nightwhistler.htmlspanner.handlers.ImageHandler.loadBitmap(ImageHandler.java:69)
at net.nightwhistler.htmlspanner.handlers.ImageHandler.handleTagNode(ImageHandler.java:49)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:345)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:339)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:339)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:260)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:201)
at com.example.htmltest.MainActivity$1.run(MainActivity.java:25)
at android.app.Activity.runOnUiThread(Activity.java:5052)
at com.example.htmltest.MainActivity.onCreate(MainActivity.java:21)
at android.app.Activity.performCreate(Activity.java:5600)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2504)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.access$900(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5748)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
Looks like a bug introduced in earlier whitespace fixes.
Just thought you might want to add it to the documentation.
I kept getting blank output when trying to use HtmlSpanner with HtmlCleaner 2.4
Works perfect with HtmlCleaner 2.2 though
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1102)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at java.lang.String._getChars(String.java:1017)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:160)
at java.lang.StringBuffer.append(StringBuffer.java:215)
at java.util.regex.Matcher.appendReplacement(Matcher.java:145)
at net.nightwhistler.htmlspanner.HtmlSpanner.getEditedText(HtmlSpanner.java:225)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:265)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:193)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:159)
at net.nightwhistler.pageturner.view.BookView$LoadTextTask.doInBackground(BookView.java:893)
at net.nightwhistler.pageturner.view.BookView$LoadTextTask.doInBackground(BookView.java:849)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at java.lang.String._getChars(String.java:1017)
at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:160)
at java.lang.StringBuffer.append(StringBuffer.java:215)
at java.util.regex.Matcher.appendReplacement(Matcher.java:145)
at net.nightwhistler.htmlspanner.HtmlSpanner.getEditedText(HtmlSpanner.java:225)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:265)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.applySpan(HtmlSpanner.java:287)
at net.nightwhistler.htmlspanner.HtmlSpanner.handleContent(HtmlSpanner.java:270)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromTagNode(HtmlSpanner.java:193)
at net.nightwhistler.htmlspanner.HtmlSpanner.fromHtml(HtmlSpanner.java:159)
at net.nightwhistler.pageturner.view.BookView$LoadTextTask.doInBackground(BookView.java:893)
at net.nightwhistler.pageturner.view.BookView$LoadTextTask.doInBackground(BookView.java:849)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1102)
Thanks for the awesome project NIghtWhistler.
Is there any plan to to add a toHtml() function? I would love to be able to use HtmlSpanner to save spanned text from an EditText
fromHtml will convert the HTML to span. Is there any API to convert back to HTML.
Please Update .gradle for Sonar Runner as it is NOT WORKING now with Andorid Studio 2.3 and Gradle
Change according to documentation
https://plugins.gradle.org/plugin/org.sonarqube
Thanks
I have downloaded the jar file and included it to my gradle, Everything is synced. But when run the project it gives me the "error: package com.osbcp.cssparser does not exist". What am i doing wrong? Please help me out.
Problem facing in rendering epub file.
CSSLinkhandler not received css rules of the tag <p>
class in the <a>
tag, like font, test_decoration etc.
<div class="abc">
<p class="cont_ct"><a href="05_preface.xhtml">Preface</a></p>
<p class="cont_ct"><a href="part1.html" >Part 1</a></p>
<p class="cont_ct"><a href="part2.html" >Part 2</a></p>
<p class="cont_ct"><a href="part3.html" >Part 3</a></p>
<p class="cont_ct"><a href="part4.html" >Part 4</a></p>
</div>
Iam also use html like this, but no positive response are there.
`
if we put spanner.registerHandler("link", new CSSLinkHandler(this)); then link active without css and when put spanner.registerHandler("a", new CSSLinkHandler(this)); then css work fine but link is not working.
Please give me solution.
If I want to modify the look and color of heading and also I want to load image from asset instead of from url. Can do so in your code. Is this modification allowed as per the licence?
If not how to add these modifications?
I'm trying to debug my application but it's just impossible with all the debug messages from SpanStack. Is there a good way how to disable them? I have tried
System.setProperty("log.tag.SpanStack", "WARN");
but it does not work. Pure filtering in LogCat does not discard the messages, so even if I switch to "info" mode, the messages buffer will run out of memory and discard my precious info.
I'm ready to make a static variable DEBUG_LOG somewhere and rewrite all debug logs into IF conditions on that variable. Should I do it? Is it the only possibility?
Some css style is missing. e.g.
img
{
float:right;
}
div.boxnote-2 {
border: double;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.