From 1bdd3f11b66a556cdfe5eafe443a2e4c89c2a388 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Sun, 28 Dec 2014 15:14:44 +0000 Subject: [PATCH] markdown/preferences: Added support to disable MultiMarkdown metadata parsing --- .../src/winterwell/markdown/pagemodel/MarkdownPage.java | 7 +++++-- .../markdown/preferences/MarkdownPreferencePage.java | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugin/src/winterwell/markdown/pagemodel/MarkdownPage.java b/plugin/src/winterwell/markdown/pagemodel/MarkdownPage.java index a27996b..b7cbd67 100755 --- a/plugin/src/winterwell/markdown/pagemodel/MarkdownPage.java +++ b/plugin/src/winterwell/markdown/pagemodel/MarkdownPage.java @@ -208,7 +208,6 @@ public enum KLineType { private List lineTypes; private Map pageObjects = new HashMap(); - private boolean multiMarkdownSupport = true; // TODO meta-data, footnotes, tables, link & image attributes private static Pattern multiMarkdownTag = Pattern.compile("^([\\w].*):(.*)"); private Map multiMarkdownTags = new HashMap(); @@ -252,8 +251,12 @@ private void setText(String text) { // Identify line types int lineNum = 0; + // Check if we should support the Multi-Markdown Metadata + boolean multiMarkdownMetadataSupport = + pStore.getBoolean(MarkdownPreferencePage.PREF_MULTIMARKDOWN_METADATA); + // Multi-markdown header - if (multiMarkdownSupport) { + if (multiMarkdownMetadataSupport) { // The key is the text before the colon, and the data is the text // after the // colon. In the above example, notice that there are two lines of diff --git a/plugin/src/winterwell/markdown/preferences/MarkdownPreferencePage.java b/plugin/src/winterwell/markdown/preferences/MarkdownPreferencePage.java index 8318787..36dadbc 100755 --- a/plugin/src/winterwell/markdown/preferences/MarkdownPreferencePage.java +++ b/plugin/src/winterwell/markdown/preferences/MarkdownPreferencePage.java @@ -50,6 +50,7 @@ public class MarkdownPreferencePage public static final String PREF_CODE_BG = "Pref_Code_Background"; public static final String PREF_GITHUB_SYNTAX = "Pref_Github_Syntax"; + public static final String PREF_MULTIMARKDOWN_METADATA = "Pref_MultiMarkdown_Metadata"; private static final RGB DEF_DEFAULT = new RGB(0, 0, 0); private static final RGB DEF_COMMENT = new RGB(128, 0, 0); @@ -74,6 +75,7 @@ public static void setDefaultPreferences(IPreferenceStore pStore) { pStore.setDefault(PREF_MARKDOWN_COMMAND, MARKDOWNJ); pStore.setDefault(PREF_SECTION_NUMBERS, true); pStore.setDefault(PREF_GITHUB_SYNTAX, true); + pStore.setDefault(PREF_MULTIMARKDOWN_METADATA, false); PreferenceConverter.setDefault(pStore, PREF_DEFUALT, DEF_DEFAULT); PreferenceConverter.setDefault(pStore, PREF_COMMENT, DEF_COMMENT); @@ -154,6 +156,12 @@ public void createFieldEditors() { "Support Github Syntax", getFieldEditorParent()); addField(fd); + + // Multi-Markdown support + fd = new BooleanFieldEditor(PREF_MULTIMARKDOWN_METADATA, + "Support Multi-Markdown Metadata", + getFieldEditorParent()); + addField(fd); } /* (non-Javadoc)