Skip to content

Commit

Permalink
change package name
Browse files Browse the repository at this point in the history
  • Loading branch information
tohosokawa committed Apr 1, 2015
1 parent 431c7af commit 693f6cb
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
26 changes: 13 additions & 13 deletions keymaps/markdown-preview.cson
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
'atom-workspace, atom-workspace atom-text-editor':
'ctrl-M': 'markdown-preview-pandoc:toggle'
'ctrl-E': 'rst-preview-pandoc:toggle'

'.platform-darwin .markdown-preview-pandoc':
'cmd-+': 'markdown-preview-pandoc:zoom-in'
'cmd-=': 'markdown-preview-pandoc:zoom-in'
'cmd--': 'markdown-preview-pandoc:zoom-out'
'cmd-_': 'markdown-preview-pandoc:zoom-out'
'cmd-0': 'markdown-preview-pandoc:reset-zoom'
'.platform-darwin .rst-preview-pandoc':
'cmd-+': 'rst-preview-pandoc:zoom-in'
'cmd-=': 'rst-preview-pandoc:zoom-in'
'cmd--': 'rst-preview-pandoc:zoom-out'
'cmd-_': 'rst-preview-pandoc:zoom-out'
'cmd-0': 'rst-preview-pandoc:reset-zoom'

'.platform-win32 .markdown-preview-pandoc, .platform-linux .markdown-preview-pandoc':
'ctrl-+': 'markdown-preview-pandoc:zoom-in'
'ctrl-=': 'markdown-preview-pandoc:zoom-in'
'ctrl--': 'markdown-preview-pandoc:zoom-out'
'ctrl-_': 'markdown-preview-pandoc:zoom-out'
'ctrl-0': 'markdown-preview-pandoc:reset-zoom'
'.platform-win32 .rst-preview-pandoc, .platform-linux .rst-preview-pandoc':
'ctrl-+': 'rst-preview-pandoc:zoom-in'
'ctrl-=': 'rst-preview-pandoc:zoom-in'
'ctrl--': 'rst-preview-pandoc:zoom-out'
'ctrl-_': 'rst-preview-pandoc:zoom-out'
'ctrl-0': 'rst-preview-pandoc:reset-zoom'
28 changes: 14 additions & 14 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@ module.exports =

activate: ->
atom.commands.add 'atom-workspace',
'markdown-preview-pandoc:toggle': =>
'rst-preview-pandoc:toggle': =>
@toggle()
'markdown-preview-pandoc:copy-html': =>
'rst-preview-pandoc:copy-html': =>
@copyHtml()

previewFile = @previewFile.bind(this)
atom.commands.add '.tree-view .file .name[data-name$=\\.markdown]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.md]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mdown]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mkd]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mkdown]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.ron]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.txt]', 'markdown-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.markdown]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.md]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mdown]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mkd]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.mkdown]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.ron]', 'rst-preview-pandoc:preview-file', previewFile
atom.commands.add '.tree-view .file .name[data-name$=\\.txt]', 'rst-preview-pandoc:preview-file', previewFile

atom.workspace.addOpener (uriToOpen) ->
try
{protocol, host, pathname} = url.parse(uriToOpen)
catch error
return

return unless protocol is 'markdown-preview-pandoc:'
return unless protocol is 'rst-preview-pandoc:'

try
pathname = decodeURI(pathname) if pathname
Expand All @@ -85,13 +85,13 @@ module.exports =
editor = atom.workspace.getActiveTextEditor()
return unless editor?

grammars = atom.config.get('markdown-preview-pandoc.grammars') ? []
grammars = atom.config.get('rst-preview-pandoc.grammars') ? []
return unless editor.getGrammar().scopeName in grammars

@addPreviewForEditor(editor) unless @removePreviewForEditor(editor)

uriForEditor: (editor) ->
"markdown-preview-pandoc://editor/#{editor.id}"
"rst-preview-pandoc://editor/#{editor.id}"

removePreviewForEditor: (editor) ->
uri = @uriForEditor(editor)
Expand All @@ -107,7 +107,7 @@ module.exports =
previousActivePane = atom.workspace.getActivePane()
options =
searchAllPanes: true
if atom.config.get('markdown-preview-pandoc.openPreviewInSplitPane')
if atom.config.get('rst-preview-pandoc.openPreviewInSplitPane')
options.split = 'right'
atom.workspace.open(uri, options).done (markdownPreviewView) ->
if isMarkdownPreviewView(markdownPreviewView)
Expand All @@ -121,7 +121,7 @@ module.exports =
@addPreviewForEditor(editor)
return

atom.workspace.open "markdown-preview-pandoc://#{encodeURI(filePath)}", searchAllPanes: true
atom.workspace.open "rst-preview-pandoc://#{encodeURI(filePath)}", searchAllPanes: true

copyHtml: ->
editor = atom.workspace.getActiveTextEditor()
Expand Down
26 changes: 13 additions & 13 deletions lib/markdown-preview-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ renderer = require './renderer'
module.exports =
class MarkdownPreviewView extends ScrollView
@content: ->
@div class: 'markdown-preview-pandoc native-key-bindings', tabindex: -1
@div class: 'rst-preview-pandoc native-key-bindings', tabindex: -1

constructor: ({@editorId, @filePath}) ->
super
Expand Down Expand Up @@ -51,8 +51,8 @@ class MarkdownPreviewView extends ScrollView
@emitter.on 'did-change-markdown', callback

on: (eventName) ->
if eventName is 'markdown-preview-pandoc:markdown-changed'
Grim.deprecate("Use MarkdownPreviewView::onDidChangeMarkdown instead of the 'markdown-preview-pandoc:markdown-changed' jQuery event")
if eventName is 'rst-preview-pandoc:markdown-changed'
Grim.deprecate("Use MarkdownPreviewView::onDidChangeMarkdown instead of the 'rst-preview-pandoc:markdown-changed' jQuery event")
super

subscribeToFilePath: (filePath) ->
Expand Down Expand Up @@ -89,7 +89,7 @@ class MarkdownPreviewView extends ScrollView
@disposables.add atom.grammars.onDidUpdateGrammar _.debounce((=> @renderMarkdown()), 250)
@disposables.add @editor.onDidChangeScrollTop =>
@scrollToEditorPos() if atom.config.get(
'markdown-preview-pandoc.scrollWithEditor')
'rst-preview-pandoc.scrollWithEditor')

atom.commands.add @element,
'core:move-up': =>
Expand All @@ -101,13 +101,13 @@ class MarkdownPreviewView extends ScrollView
@saveAs()
'core:copy': (event) =>
event.stopPropagation() if @copyToClipboard()
'markdown-preview-pandoc:zoom-in': =>
'rst-preview-pandoc:zoom-in': =>
zoomLevel = parseFloat(@css('zoom')) or 1
@css('zoom', zoomLevel + .1)
'markdown-preview-pandoc:zoom-out': =>
'rst-preview-pandoc:zoom-out': =>
zoomLevel = parseFloat(@css('zoom')) or 1
@css('zoom', zoomLevel - .1)
'markdown-preview-pandoc:reset-zoom': =>
'rst-preview-pandoc:reset-zoom': =>
@css('zoom', 1)

changeHandler = =>
Expand All @@ -122,12 +122,12 @@ class MarkdownPreviewView extends ScrollView
@disposables.add @file.onDidChange(changeHandler)
else if @editor?
@disposables.add @editor.getBuffer().onDidStopChanging =>
changeHandler() if atom.config.get 'markdown-preview-pandoc.liveUpdate'
changeHandler() if atom.config.get 'rst-preview-pandoc.liveUpdate'
@disposables.add @editor.onDidChangePath => @emitter.emit 'did-change-title'
@disposables.add @editor.getBuffer().onDidSave =>
changeHandler() unless atom.config.get 'markdown-preview-pandoc.liveUpdate'
changeHandler() unless atom.config.get 'rst-preview-pandoc.liveUpdate'
@disposables.add @editor.getBuffer().onDidReload =>
changeHandler() unless atom.config.get 'markdown-preview-pandoc.liveUpdate'
changeHandler() unless atom.config.get 'rst-preview-pandoc.liveUpdate'

renderMarkdown: ->
@showLoading()
Expand All @@ -151,7 +151,7 @@ class MarkdownPreviewView extends ScrollView
@append(domFragment)
@scrollToEditorPos(@editor.getCursorScreenRow())
@emitter.emit 'did-change-markdown'
@originalTrigger('markdown-preview-pandoc:markdown-changed')
@originalTrigger('rst-preview-pandoc:markdown-changed')

scrollToEditorPos: (line) ->
line=(@editor.getFirstVisibleScreenRow()+
Expand All @@ -172,9 +172,9 @@ class MarkdownPreviewView extends ScrollView

getURI: ->
if @file?
"markdown-preview-pandoc://#{@getPath()}"
"rst-preview-pandoc://#{@getPath()}"
else
"markdown-preview-pandoc://editor/#{@editorId}"
"rst-preview-pandoc://editor/#{@editorId}"

getPath: ->
if @file?
Expand Down
4 changes: 2 additions & 2 deletions lib/renderer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ render = (text, filePath, callback) ->
# https://github.com/chjj/marked/issues/354
text = text.replace(/^\s*<!doctype(\s+.*)?>\s*/i, '')

path_ = atom.config.get 'markdown-preview-pandoc.pandocPath'
opts_ = atom.config.get 'markdown-preview-pandoc.pandocOpts'
path_ = atom.config.get 'rst-preview-pandoc.pandocPath'
opts_ = atom.config.get 'rst-preview-pandoc.pandocOpts'
cwd_ = atom.project.getDirectories()
.filter (d) ->
d.contains(filePath)
Expand Down
20 changes: 10 additions & 10 deletions menus/markdown-preview.cson
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
'menu': [
'label': 'Packages'
'submenu': [
'label': 'Markdown Preview Pandoc'
'label': 'reStructuredText Preview Pandoc'
'submenu': [
'label': 'Toggle Preview'
'command': 'markdown-preview-pandoc:toggle'
'command': 'rst-preview-pandoc:toggle'
]
]
]

'context-menu':
'.markdown-preview-pandoc': [
'.rst-preview-pandoc': [
{label: 'Copy As HTML', command: 'core:copy'}
{label: 'Save As HTML\u2026', command: 'core:save-as'}
]
'.tree-view .file .name[data-name$=\\.markdown]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.md]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.mdown]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.mkd]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.mkdown]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.ron]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
'.tree-view .file .name[data-name$=\\.txt]':
[{label: 'Markdown Preview', command: 'markdown-preview-pandoc:preview-file'}]
[{label: 'Markdown Preview', command: 'rst-preview-pandoc:preview-file'}]
8 changes: 4 additions & 4 deletions styles/markdown-preview.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import "syntax-variables";

@font-family: "Helvetica Neue", Helvetica, sans-serif;
.markdown-preview-pandoc {
.rst-preview-pandoc {
font-family: @font-family;
font-size: 14px;
line-height: 1.6;
Expand All @@ -26,9 +26,9 @@
}

// This is styling for generic markdownized text. Anything you put in a
// container with .markdown-preview-pandoc on it should render generally well. It also
// container with .rst-preview-pandoc on it should render generally well. It also
// includes some GitHub Flavored Markdown specific styling (like @mentions)
.markdown-preview-pandoc {
.rst-preview-pandoc {

pre {
background-color: #EEE;
Expand Down Expand Up @@ -176,7 +176,7 @@
}

hr {
background: transparent url("atom://markdown-preview-pandoc/assets/hr.png") repeat-x 0 0;
background: transparent url("atom://rst-preview-pandoc/assets/hr.png") repeat-x 0 0;
border: 0 none;
color: #ccc;
height: 4px;
Expand Down

0 comments on commit 693f6cb

Please sign in to comment.