wsdjeg/GitHub.vim

How to remove new lines?

wsdjeg opened this issue · 3 comments

I have a vim file like this.

""
" @public
" Create an issue
"
" Github API : POST /repos/:owner/:repo/issues
"
" Input:
" {
"
"  "title": "Found a bug",
"
"  "body": "I'm having a problem with this.",
"
"  "assignee": "octocat",
"
"  "milestone": 1,
"
"  "labels": [
"
"    "bug"
"
"  ]
"
" }
function! githubapi#issues#Create(owner,repo,user,password,json) abort
    return githubapi#util#Get('repos/' . a:owner . '/' . a:repo . '/issues',
                \ ' -X POST -d ' . shellescape(a:json)
                \ . ' -u ' . a:user . ':' . a:password)
endfunction

after run vimdoc ., I get

githubapi#issues#Create({owner}, {repo}, {user}, {password}, {json})
                                                   *githubapi#issues#Create()*
  Create an issue

  Github API : POST /repos/:owner/:repo/issues

  Input: {

   "title": "Found a bug",

   "body": "I'm having a problem with this.",

   "assignee": "octocat",

   "milestone": 1,

   "labels": [

     "bug"

   ]

  }

but I want

githubapi#issues#Create({owner}, {repo}, {user}, {password}, {json})
                                                   *githubapi#issues#Create()*
  Create an issue

  Github API : POST /repos/:owner/:repo/issues

  Input: 
       {
          "title": "Found a bug",
          "body": "I'm having a problem with this.",
          "assignee": "octocat",
          "milestone": 1,
          "labels": [
               "bug"
           ]
       }

I have tried

""
" @public
" Create an issue
"
" Github API : POST /repos/:owner/:repo/issues
"
" Input:
"        {
"              "title": "Found a bug",
"              "body": "I'm having a problem with this.",
"              "assignee": "octocat",
"              "milestone": 1,
"              "labels": [
"                     "bug"
"               ]
"        }
function! githubapi#issues#Create(owner,repo,user,password,json) abort
    return githubapi#util#Get('repos/' . a:owner . '/' . a:repo . '/issues',
                \ ' -X POST -d ' . shellescape(a:json)
                \ . ' -u ' . a:user . ':' . a:password)
endfunction

but it does not work.

Surround it with > and <, like this:

" Input: >
"   {
"    "title": "Found a bug",
"    "body": "I'm having a problem with this.",
"    "assignee": "octocat",
"    "milestone": 1,
"    "labels": [
"      "bug"
"    ]
"   }
" <

Normally this is intended for a block of vim ex-commands (see :help help-writing), but it works okay for other blocks of pre-formatted content.

@dbarnett thanks ,it works well for me.