Skip to content

Commit

Permalink
upgrading asciidoctorj, adding additional logging for errors (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 committed Feb 15, 2019
1 parent 987e5bf commit 78290f0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ See https://github.com/asciidoctor/asciidoctor-intellij-plugin/wiki/Support-proj
== Release notes

=== 0.24.1

- Upgrade to AsciidoctorJ 1.6.2 and JRuby 9.2.6.0 (it's still backed by Asciidoctor 1.5.8)
- Upgrade to asciidoctor diagram 1.5.12
- Additional logging to analyze errors (#236)

=== 0.24.0

- Upgrade to AsciidoctorJ 1.6.1 and JRuby 9.2.5.0 (it's still backed by Asciidoctor 1.5.8)
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ intellij {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.asciidoctor:asciidoctorj-diagram:1.5.11'
compile 'org.asciidoctor:asciidoctorj:1.6.1'
compile 'org.asciidoctor:asciidoctorj-diagram:1.5.12'
compile 'org.asciidoctor:asciidoctorj:1.6.2'
compile 'commons-io:commons-io:2.4'
compile 'org.jruby:jruby-complete:9.2.5.0'
compile 'org.jruby:jruby-complete:9.2.6.0'
compile 'org.pegdown:pegdown:1.4.2'
compile 'org.parboiled:parboiled-core:1.1.6'
testCompile 'junit:junit:4.12'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public class AsciiDocPreviewEditor extends UserDataHolderBase implements FileEdi
public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("asciidoctor",
NotificationDisplayType.NONE, true);

private Logger log = Logger.getInstance(AsciiDocPreviewEditor.class);

/** single threaded with one task queue (one for each editor window) */
private final LazyApplicationPoolExecutor LAZY_EXECUTOR = new LazyApplicationPoolExecutor();

Expand Down Expand Up @@ -174,7 +176,8 @@ public void run() {
Thread.currentThread().interrupt();
}
catch (Exception ex) {
String message = "Error rendering asciidoctor: " + ex.getMessage();
String message = "Error rendering preview: " + ex.getMessage();
log.error(message, ex);
Notification notification = NOTIFICATION_GROUP.createNotification("Error rendering asciidoctor", message,
NotificationType.ERROR, null);
// increase event log counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

public class JavaFxHtmlPanel extends AsciiDocHtmlPanel {

private Logger log = Logger.getInstance(JavaFxHtmlPanel.class);

private static final NotNullLazyValue<String> MY_SCRIPTING_LINES = new NotNullLazyValue<String>() {
@NotNull
@Override
Expand Down Expand Up @@ -140,7 +142,8 @@ public JavaFxHtmlPanel(Document document, Path imagesPath) {
myFontAwesomeCssLink = "<link rel=\"stylesheet\" href=\"" + JavaFxHtmlPanel.class.getResource("font-awesome/css/font-awesome.min.css") + "\">";
myDejavuCssLink = "<link rel=\"stylesheet\" href=\"" + JavaFxHtmlPanel.class.getResource("dejavu/dejavu.css") + "\">";
} catch (IOException e) {
String message = "Error rendering asciidoctor: " + e.getMessage();
String message = "Unable to combine CSS resources: " + e.getMessage();
log.error(message, e);
Notification notification = AsciiDocPreviewEditor.NOTIFICATION_GROUP
.createNotification("Error rendering asciidoctor", message, NotificationType.ERROR, null);
// increase event log counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ui.UIUtil;
import org.asciidoc.intellij.editor.AsciiDocHtmlPanel;
import org.asciidoc.intellij.editor.AsciiDocPreviewEditor;
import org.asciidoc.intellij.editor.javafx.JavaFxHtmlPanel;
import org.asciidoc.intellij.settings.AsciiDocApplicationSettings;
import org.jetbrains.annotations.NotNull;

Expand All @@ -29,6 +31,8 @@
final class JeditorHtmlPanel extends AsciiDocHtmlPanel {
private static final int FOCUS_ELEMENT_DY = 100;

private Logger log = Logger.getInstance(JeditorHtmlPanel.class);

@NotNull
private final JEditorPane jEditorPane;
@NotNull
Expand Down Expand Up @@ -92,8 +96,9 @@ public void setHtml(@NotNull String html) {
try {
kit.read(new StringReader(html), doc, 0);
}
catch (IOException e) {
String message = "Error rendering asciidoctor: " + e.getMessage();
catch (IOException ex) {
String message = "Error setting HTML: " + ex.getMessage();
log.error(message, ex);
Notification notification = AsciiDocPreviewEditor.NOTIFICATION_GROUP
.createNotification("Error rendering asciidoctor", message, NotificationType.ERROR, null);
// increase event log counter
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2" url="https://github.com/asciidoctor/asciidoctor-intellij-plugin">
<id>org.asciidoctor.intellij.asciidoc</id>
<name>AsciiDoc</name>
<version>0.24.0</version>
<version>0.24.1</version>
<vendor email="[email protected]" url="http://asciidoctor.org">Asciidoctor Project</vendor>

<description><![CDATA[
Expand Down Expand Up @@ -29,6 +29,9 @@ Therefore, JetBrains OpenJDK pre-bundled with your IDE is recommended.

<change-notes><![CDATA[
<ul>
<li>0.24.1 Upgrade to AsciidoctorJ 1.6.2 and JRuby 9.2.6.0 (it's still backed by Asciidoctor 1.5.8)
<br>Upgrade to asciidoctor diagram 1.5.12
<br>Additional logging to analyze errors (#236)
<li>0.24.0 Upgrade to AsciidoctorJ 1.6.1 and JRuby 9.2.5.0 (it's still backed by Asciidoctor 1.5.8)
<br>Upgrade to asciidoctor diagram 1.5.11
<br>Updated parser for old style multiline headings to be more specific (#233)
Expand Down

0 comments on commit 78290f0

Please sign in to comment.