Skip to content

Commit

Permalink
markdown/preferences: Added support to disable MultiMarkdown metadata…
Browse files Browse the repository at this point in the history
… parsing
  • Loading branch information
oliviermartin committed Jan 25, 2015
1 parent c411f8b commit 1bdd3f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugin/src/winterwell/markdown/pagemodel/MarkdownPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ public enum KLineType {
private List<KLineType> lineTypes;
private Map<Integer,Object> pageObjects = new HashMap<Integer, Object>();

private boolean multiMarkdownSupport = true;
// TODO meta-data, footnotes, tables, link & image attributes
private static Pattern multiMarkdownTag = Pattern.compile("^([\\w].*):(.*)");
private Map<String, String> multiMarkdownTags = new HashMap<String, String>();
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1bdd3f1

Please sign in to comment.