<commit_before>{CompositeDisposable} = require "atom"

config = require "./config"
basicConfig = require "./config-basic"

module.exports =
  config: basicConfig

  modules: {} # To cache required modules
  disposables: null # Composite disposable

  activate: ->
    @disposables = new CompositeDisposable()

    @registerWorkspaceCommands()
    @registerEditorCommands()

  deactivate: ->
    @disposables?.dispose()
    @disposables = null
    @modules = {}

  registerWorkspaceCommands: ->
    workspaceCommands = {}

    ["draft", "post"].forEach (file) =>
      workspaceCommands["markdown-writer:new-#{file}"] =
        @registerView("./views/new-#{file}-view", optOutGrammars: true)

    ["open-cheat-sheet", "create-default-keymaps", "create-project-configs"].forEach (command) =>
      workspaceCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/#{command}", optOutGrammars: true)

    @disposables.add(atom.commands.add("atom-workspace", workspaceCommands))

  registerEditorCommands: ->
    editorCommands = {}

    ["tags", "categories"].forEach (attr) =>
      editorCommands["markdown-writer:manage-post-#{attr}"] =
        @registerView("./views/manage-post-#{attr}-view")

    ["link", "footnote", "image-file", "image-clipboard", "table"].forEach (media) =>
      editorCommands["markdown-writer:insert-#{media}"] =
        @registerView("./views/insert-#{media}-view")

    ["code", "codeblock", "bold", "italic", "strikethrough", "keystroke","deletion","addition","substitution","comment","highlight"].forEach (style) =>
      editorCommands["markdown-writer:toggle-#{style}-text"] =
        @registerCommand("./commands/style-text", args: style)

    ["h1", "h2", "h3", "h4", "h5", "ul", "ol", "task", "taskdone", "blockquote"].forEach (style) =>
      editorCommands["markdown-writer:toggle-#{style}"] =
        @registerCommand("./commands/style-line", args: style)

    ["previous-heading", "next-heading", "next-table-cell", "reference-definition"].forEach (command) =>
      editorCommands["markdown-writer:jump-to-#{command}"] =
        @registerCommand("./commands/jump-to", args: command)

    ["insert-new-line", "indent-list-line"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/edit-line",
          args: command, skipList: ["autocomplete-active"])

    ["correct-order-list-numbers", "format-table"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/format-text", args: command)

    ["publish-draft", "open-link-in-browser", "insert-image"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/#{command}")

    @disposables.add(atom.commands.add("atom-text-editor", editorCommands))

  registerView: (path, options = {}) ->
    (e) =>
      if (options.optOutGrammars || @isMarkdown()) && !@inSkipList(options.skipList)<commit_msg>a simple implementation of commands to create criticmarkup tags<commit_after>{CompositeDisposable} = require "atom"

config = require "./config"
basicConfig = require "./config-basic"

module.exports =
  config: basicConfig

  modules: {} # To cache required modules
  disposables: null # Composite disposable

  activate: ->
    @disposables = new CompositeDisposable()

    @registerWorkspaceCommands()
    @registerEditorCommands()

  deactivate: ->
    @disposables?.dispose()
    @disposables = null
    @modules = {}

  registerWorkspaceCommands: ->
    workspaceCommands = {}

    ["draft", "post"].forEach (file) =>
      workspaceCommands["markdown-writer:new-#{file}"] =
        @registerView("./views/new-#{file}-view", optOutGrammars: true)

    ["open-cheat-sheet", "create-default-keymaps", "create-project-configs"].forEach (command) =>
      workspaceCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/#{command}", optOutGrammars: true)

    @disposables.add(atom.commands.add("atom-workspace", workspaceCommands))

  registerEditorCommands: ->
    editorCommands = {}

    ["tags", "categories"].forEach (attr) =>
      editorCommands["markdown-writer:manage-post-#{attr}"] =
        @registerView("./views/manage-post-#{attr}-view")

    ["link", "footnote", "image-file", "image-clipboard", "table"].forEach (media) =>
      editorCommands["markdown-writer:insert-#{media}"] =
        @registerView("./views/insert-#{media}-view")

    ["code", "codeblock", "bold", "italic", "strikethrough", "keystroke", "deletion", "addition", "substitution", "comment", "highlight"].forEach (style) =>
      editorCommands["markdown-writer:toggle-#{style}-text"] =
        @registerCommand("./commands/style-text", args: style)

    ["h1", "h2", "h3", "h4", "h5", "ul", "ol", "task", "taskdone", "blockquote"].forEach (style) =>
      editorCommands["markdown-writer:toggle-#{style}"] =
        @registerCommand("./commands/style-line", args: style)

    ["previous-heading", "next-heading", "next-table-cell", "reference-definition"].forEach (command) =>
      editorCommands["markdown-writer:jump-to-#{command}"] =
        @registerCommand("./commands/jump-to", args: command)

    ["insert-new-line", "indent-list-line"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/edit-line",
          args: command, skipList: ["autocomplete-active"])

    ["correct-order-list-numbers", "format-table"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/format-text", args: command)

    ["publish-draft", "open-link-in-browser", "insert-image"].forEach (command) =>
      editorCommands["markdown-writer:#{command}"] =
        @registerCommand("./commands/#{command}")

    @disposables.add(atom.commands.add("atom-text-editor", editorCommands))

  registerView: (path, options = {}) ->
    (e) =>
      if (options.optOutGrammars || @isMarkdown()) && !@inSkipList(options.skipList)
{'fraction_non_alphanumeric': 0.19137959727076054, 'fraction_numerical': 0.0016641704110500915, 'mean_word_length': 4.1632302405498285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7027763', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1814, 'n_words': 278}