From 4487ad17d31618794425f9b3bfc7024441c0a9fc Mon Sep 17 00:00:00 2001 From: Aliaksei Shytkin Date: Fri, 22 May 2015 21:36:46 +0300 Subject: [PATCH] Make first version --- README.md | 20 ++++++++++++-------- linter.py | 29 ++++++++++++----------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index d542b24..80f9d52 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,37 @@ -SublimeLinter-contrib-mdl -================================ +# SublimeLinter-contrib-mdl -[![Build Status](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-mdl.svg?branch=master)](https://travis-ci.org/SublimeLinter/SublimeLinter-contrib-mdl) +[![Build Status](https://travis-ci.org/roadhump/SublimeLinter-contrib-mdl.svg?branch=master)](https://travis-ci.org/roadhump/SublimeLinter-contrib-mdl) -This linter plugin for [SublimeLinter][docs] provides an interface to [mdl](__linter_homepage__). It will be used with files that have the “__syntax__” syntax. +This linter plugin for [SublimeLinter][docs] provides an interface to [Markdown lint tool (mdl)](https://github.com/mivok/markdownlint). It will be used with files that have the “Markdown” syntax. ### Installation + SublimeLinter 3 must be installed in order to use this plugin. If SublimeLinter 3 is not installed, please follow the instructions [here][installation]. ### Linter installation + Before using this plugin, you must ensure that `mdl` is installed on your system. To install `mdl`, do the following: 1. Install [Ruby](http://www.ruby-lang.org). 1. Install `mdl` by typing the following in a terminal: + ``` [sudo] gem install mdl ``` 1. If you are using `rbenv` or `rvm`, ensure that they are loaded in your shell’s correct startup file. See [here](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#shell-startup-files) for more information. - -**Note:** This plugin requires `mdl` __version__ or later. +**Note:** This plugin requires `mdl` 0.2.1 or later. ### Linter configuration + In order for `mdl` to be executed by SublimeLinter, you must ensure that its path is available to SublimeLinter. Before going any further, please read and follow the steps in [“Finding a linter executable”](http://sublimelinter.readthedocs.org/en/latest/troubleshooting.html#finding-a-linter-executable) through “Validating your PATH” in the documentation. Once you have installed and configured `mdl`, you can proceed to install the SublimeLinter-contrib-mdl plugin if it is not yet installed. ### Plugin installation + Please use [Package Control][pc] to install the linter plugin. This will ensure that the plugin will be updated when new versions are available. If you want to install from source so you can modify the source code, you probably know what you are doing so we won’t cover that here. To install via Package Control, do the following: @@ -38,16 +41,17 @@ To install via Package Control, do the following: 1. When the plugin list appears, type `mdl`. Among the entries you should see `SublimeLinter-contrib-mdl`. If that entry is not highlighted, use the keyboard or mouse to select it. ## Settings + For general information on how SublimeLinter works with settings, please see [Settings][settings]. For information on generic linter settings, please see [Linter Settings][linter-settings]. In addition to the standard SublimeLinter settings, SublimeLinter-contrib-mdl provides its own settings. Those marked as “Inline Setting” or “Inline Override” may also be [used inline][inline-settings]. |Setting|Description|Inline Setting|Inline Override| |:------|:----------|:------------:|:-------------:| -|foo|Something.|✓| | -|bar|Something else.| |✓| +|bundle-exec|runs mdl as "bundle exec mdl" instead of "mdl"| |✓| ## Contributing + If you would like to contribute enhancements or fixes, please do the following: 1. Fork the plugin repository. diff --git a/linter.py b/linter.py index 986f223..10db907 100644 --- a/linter.py +++ b/linter.py @@ -2,40 +2,35 @@ # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # -# Written by roadhump -# Copyright (c) 2015 roadhump +# Written by Aliaksei Shytkin +# Copyright (c) 2015 Aliaksei Shytkin # # License: MIT # -"""This module exports the Mdl plugin class.""" +"""This module exports the mdl plugin class.""" -from SublimeLinter.lint import RubyLinter, util +from SublimeLinter.lint import RubyLinter class Mdl(RubyLinter): """Provides an interface to mdl.""" - syntax = ('markdown') + syntax = ('markdown', 'markdown gfm', 'multimarkdown') executable = 'mdl' version_args = '--version' version_re = r'(?P\d+\.\d+\.\d+)' version_requirement = '>= 0.2.1' - regex = r'^.+?:(?P\d+): (?P[^`]*)' - # multiline = True + regex = r'^.+?:(?P\d+): (?P(?P[^`]*))' + config_file = ('--config', '.mdlrc', '~') line_col_base = (1, 1) tempfile_suffix = 'md' - error_stream = util.STREAM_BOTH - selectors = {} - word_re = None - defaults = {} - inline_settings = None - inline_overrides = None - comment_re = r'\s*#' + inline_overrides = ('bundle-exec') def cmd(self): - if self.get_view_settings().get('bundle-exec', False): - return ('bundle', 'exec', self.executable) - return (self.executable_path) + """Support bundle-exec.""" + if self.get_view_settings().get('bundle-exec', False): + return ('bundle', 'exec', self.executable) + return (self.executable_path)