initial version of texcount
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user