initial version of texcount

This commit is contained in:
Henrique Dias
2015-06-08 18:35:24 -03:00
parent f707ad0926
commit 25d73ab6f9
5 changed files with 86 additions and 1 deletions

View File

@@ -36,3 +36,20 @@ describe "Syncing", ->
)
done()
describe "wordcount file", ->
it "should return wordcount info", (done) ->
Client.wordcount @project_id, "main.tex", (error, result) ->
throw error if error?
expect(result).to.deep.equal(
texcount: {
encode: "ascii"
textWords: 2
headWords: 0
outside: 0
headers: 0
elements: 0
mathInline: 0
mathDisplay: 0
}
)
done()

View File

@@ -90,3 +90,12 @@ module.exports = Client =
@compile project_id, req, callback
wordcount: (project_id, file, callback = (error, pdfPositions) ->) ->
request.get {
url: "#{@host}/project/#{project_id}/wordcount"
qs: {
file: file
}
}, (error, response, body) ->
return callback(error) if error?
callback null, JSON.parse(body)