Skip to content

Commit

Permalink
Release 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoDanin committed Jul 10, 2016
1 parent cda23fd commit 337d954
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 31 deletions.
17 changes: 5 additions & 12 deletions README.md
@@ -1,4 +1,4 @@
## #{htmlEntities for lua}
## htmlEntities for lua [![Build Status](https://travis-ci.org/TiagoDanin/htmlEntities-for-lua.svg?branch=master)](https://travis-ci.org/TiagoDanin/htmlEntities-for-lua) [![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/TiagoDanin/htmlEntities-for-lua/blob/master/LICENSE) [![Luarocks](https://img.shields.io/badge/Luarocks-html--entities-yellow.svg)](http://luarocks.org/modules/tiagodanin/html-entities)
**Module for lua, decoding html entities :)**

Module for decoding of text using entities html
Expand All @@ -9,9 +9,8 @@ or encode of text to entities html :V
## Requires
Written for Lua5.x


## Setup
Use the terminal(luarocks) `$ `
Use the terminal(luarocks) `$ luarocks install html-entities`

Or Makefile(Debian):

Expand All @@ -27,17 +26,11 @@ The same goes for remove `$ make unistall5.x`


## Releases
[htmlEntities-for-lua BETA](https://github.com/TiagoDanin/htmlEntities-for-lua/tree/master)

[htmlEntities-for-lua V0.1.0](https://github.com/TiagoDanin/htmlEntities-for-lua/releases/tag/1.0.1)

[htmlEntities-for-lua V0.4.0](https://github.com/TiagoDanin/htmlEntities-for-lua/releases/tag/0.4.0)

[htmlEntities-for-lua V0.3.1](https://github.com/TiagoDanin/htmlEntities-for-lua/releases/tag/0.3.1)
[BETA](https://github.com/TiagoDanin/htmlEntities-for-lua/tree/master)

[htmlEntities-for-lua V0.2.0](https://github.com/TiagoDanin/htmlEntities-for-lua/releases/tag/0.2)
[Stable](https://github.com/TiagoDanin/htmlEntities-for-lua/releases)

[htmlEntities-for-lua V0.1.0](https://github.com/TiagoDanin/htmlEntities-for-lua/releases/tag/0.1)
[Luarocks](http://luarocks.org/modules/tiagodanin/html-entities)


## DOC
Expand Down
27 changes: 27 additions & 0 deletions rockspecs/html-entities-git-1.0.2-0.rockspec
@@ -0,0 +1,27 @@
package = "html-entities"
version = "1.0.2-0"

source = {
url = "https://github.com/TiagoDanin/htmlEntities-for-lua/archive/1.0.2.tar.gz",
dir = "htmlEntities-for-lua-1.0.2"

}

description = {
summary = "Module for lua, decoding html entities :)",
detailed = "Module for decoding of text using entities html or encode of text to entities html :V",
homepage = "https://TiagoDanin.github.io/htmlEntities-for-lua/",
maintainer = "Tiago Danin <TiagoDanin@outlook.com>",
license = "MIT"
}

dependencies = {
"lua >= 5.1"
}

build = {
type = "builtin",
modules = {
["htmlEntities"] = "src/htmlEntities.lua"
}
}
@@ -1,5 +1,5 @@
package = "html-entities"
version = "1.0.1-4"
version = "git-1"

source = {
url = "https://github.com/TiagoDanin/htmlEntities-for-lua.git"
Expand Down
30 changes: 15 additions & 15 deletions src/htmlEntities.lua
Expand Up @@ -31,7 +31,7 @@ Copyright (c) 2016 Tiago Danin
]==]--

local htmlEntities = {
version = '1.0.1',
version = '1.0.2',
name = 'htmlEntities-for-lua',
author = 'Tiago Danin - 2016',
license = 'MIT',
Expand Down Expand Up @@ -2314,20 +2314,6 @@ local htmlEntities_table = {
['&#8482;'] = ''
}

function htmlEntities.ASCII_DEC (input)
if not input then
if error_msg_htmlEntities then error('htmlEntities[ASCII_DEC] >> ERRO: input is value nil') end
return false
end
if string.len(input) == 2 then
input = tonumber(input, 16)
local output = htmlEntities.ASCII_HEX(input)
return output
else
return input
end
end

function htmlEntities.ASCII_HEX (input)
if not input then
if error_msg_htmlEntities then error('htmlEntities[ASCII_HEX] >> ERRO: input is value nil') end
Expand All @@ -2348,6 +2334,20 @@ function htmlEntities.ASCII_HEX (input)
end
end

function htmlEntities.ASCII_DEC (input)
if not input then
if error_msg_htmlEntities then error('htmlEntities[ASCII_DEC] >> ERRO: input is value nil') end
return false
end
if string.len(input) == 2 then
input = tonumber(input, 16)
local output = htmlEntities.ASCII_HEX(input)
return output
else
return input
end
end

function htmlEntities.decode (input)
if not input then
if error_msg_htmlEntities then error('htmlEntities[decode] >> ERRO: input is value nil') end
Expand Down
4 changes: 2 additions & 2 deletions tests/test.lua
@@ -1,4 +1,4 @@
htmlEntities = require('htmlEntities')
htmlEntities = require('htmlEntities')--require('src/htmlEntities')

print('\n\nInit test htmlEntities')
local text = [[&amp;&#88;&#65;&#77;&#80;&#76;&#69; text
Expand Down Expand Up @@ -60,7 +60,7 @@ function type()
dec = string.format('%02X', hex)
local x_1 = htmlEntities.ASCII_HEX(hex)
table.insert(char, x_1)
local x_2 =utf8 htmlEntities.ASCII_DEC(dec)
local x_2 = htmlEntities.ASCII_DEC(dec)
table.insert(char, x_2)
end
local time_1 = io.popen('date +%S.%N'):read('*all')
Expand Down
2 changes: 1 addition & 1 deletion tests/travis.lua
Expand Up @@ -18,7 +18,7 @@ for i = 33, 255 do
dec = string.format('%02X', hex)
local x_1 = htmlEntities.ASCII_HEX(hex)
table.insert(char, x_1)
local x_2 =utf8 htmlEntities.ASCII_DEC(dec)
local x_2 = htmlEntities.ASCII_DEC(dec)
table.insert(char, x_2)
end
local encode = {'&micro;', '&yen;', '&uuml;', '&lrm;', '&#8482;', '&lceil;', '&#45;'}
Expand Down

0 comments on commit 337d954

Please sign in to comment.