Commits between 1.5.2 and 1.5.4:
* change compat.execute to behave similarly on Lua 5.1 and Lua > 5.1.
* Issue #246: bad/misleading code in examples
* Issue #245 document 'optional'
* split the templating engine in a compile and render step
backward compatible. Minor caveat is that it introduces
2 local variables in the template, but chances of name collissions
are very low.
Additionally: reduced the string concatenation. Only one concat call
is left.
* Merge pull request #249 from Tieske/feat/reuse-template
split the templating engine in a compile and render step
* updated template module
- added the newline option (for single line output)
- merged test files: test-template and test-substitute
- changed compile signature to take a table of options
- improved error reporting: syntax errors report error + code
* Fix global success variable in lapp.
* Added more tests for seq.last
* Minor refactor of seq.last and fixes corner case of
an empty source stream as outlined in issue #252.
* Added tests for List.put, remove, len, clear and contains.
* Added tests for List.split.
* Added tests for List.partition.
* Added missing tests for List.range, reduce and foreach.
* feat(template): handle special case of a constant string
A common scenario is an 'option' for templates, where most
of the use is without it. This change optimizes the render
function in case of constant strings
* Fix error in 'pl.lapp.process_options_string'
Fix error "attempt to concatenate a nil value (local 'vtype')" by
checking making sure vtype is not nil.
* Merge pull request #250 from Tieske/feat/improve-template
feat(template) newline option, better error reporting, cleanup
* Merge pull request #255 from doronbehar/patch-1
Fix error in 'pl.lapp.process_options_string'
* bump version to 1.5.3
* Merge pull request #244 from bungle/master
change compat.execute to behave similarly on Lua 5.1 and Lua > 5.1.
* Merge pull request #251 from IoriBranford/master
Fix global success variable in lapp process_default.
* Merge pull request #254 from greatwolf/list_coverage
List coverage
Changes between 1.5.2 and 1.4.1:
lapp: print left in code
issue #228: bug in file matching for dir.getfiles
issue #243 broken lapp default: little fix to c222e422274c
testclone example assumed global lfs
update changes and version number
issue #226: can use either = or : to separate flag/value
issue #241: little hack to handle no-trailing-comment case
Merge pull request #193 from jvprat/class_tostring
Setup __tostring on class creation instead of per instance.
Merge pull request #240 from urzds/fix/lapp-convert-defaults
lapp: Convert default values using the associated converter function
Merge pull request #242 from tjachmann/workaround-for-pretty.load-error
Workaround for error in pretty.load with a C hook
pretty.load errors out, if a C hook function is installed (Lua 5.1). Reason: debug.gethook() returns a string as first return value in this case. Then debug.sethook complains about the first argument being a string not a function.
lapp: Convert default values using the associated converter function
Also uses quite some hack to catch errors during conversion of default values.
This prevents the application from quitting, if the value provided as default
would be invalid in the current context, while the value provided on the
command line is valid.
Also handles -h and --help early, before parsing command line arguments
Otherwise it would be impossible to show the help, if conversion of the
default value of some argument fails.
Merge pull request #239 from kulla/rename-arg-pattern
dir.lua: Rename arg "pattern" to "shell_pattern"
Fix a test to pass under LuaJIT with Lua 5.2 compat
Merge pull request #237 from Tieske/fix/execute
fix os.execute
Merge branch 'master' of https://github.com/stevedonovan/Penlight into fix/execute
fix os.execute to return proper results when LuaJIT is being used with 52 compatibility enabled
Tweak local declaration in pl.compat
Avoid duplicated variable.
Fix a typo in pl.seq docs [ci skip]
Merge pull request #233 from greatwolf/seq_coverage
Added more test coverage for pl.seq
Added test for seq.printall.
Minor refactor of existing test.
Added missing test case for equal_to and random.
Added tests for seq.random, minmax, enum and copy_tuples.
seq coverage
Merge pull request #231 from greatwolf/bugfix_refactor
Redid PR #230 as a separate branch.
Added more tests for seq.reduce.
Fixed seq.reduce to handle empty case.
Allow passing initial value when calling reduce through seq object.
naming consistency.
redundant checks.
Update version number in docs
Fix typos in pl.lapp docs
Added tests for seq.take.
Just use n as counter.
Added tests for seq.skip.
Fixed bug when skipping past list.
More concise code.
Initial value argument for `tablex.reduce` is going to be added in 1.5.0, not 1.3.2
Merge pull request #213 from gpleiss/reduce-memo
tablex.reduce can take an optional initial memo
tablex.reduce can take an optional initial memo
Add "in progress" changes [ci skip]
Merge pull request #221 from mpeterv/fix-stringx-splitlines
Fix stringx.splitlines
Fix coverage reporting on travis
Tests are now run from project root.
pl.seq() constructor can take an iterator which returns a function _and_ an object
issue #226 lapp respects ':' as well as '='
Merge pull request #225 from kulla/dir-some-fixes
Little fixes in dir.lua
dir.lua: Replace tab with whitespace in docstring.
The tab characters create a strange format in documentatio (cf.
https://stevedonovan.github.io/Penlight/api/libraries/pl.dir.html#getallfiles
)
dir.lua: Remove file execution permission.
Merge pull request #224 from kulla/utils-doctring-fix
Fix usage example of string_lambda().
utils.lua: Fix usage example of string_lambda().
Update docs for template.substitute
Merge pull request #222 from urzds/feature/template-customisable-filename
pl.template: Support customising the chunk "filename" (default: TMP)
pl.template: Support customising the chunk name (default: "TMP")
This can be used to aid debugging, e.g. when the template resides in an actual
file.
Fix handling of __index returning false in pl.strict
Ref #223.
Add a test for tablex.count_map
Merge pull request #214 from urzds/feat/customisable-inline-escape
pl.template: Support customising the inline escape character (default…
pl.data: faster delimiter guessing
Don't count occurrences of potential delims, just use string.find.
Fix error in tablex.count_map
Regression introduced in @6123f9e.
Remove unused localizations, update dependency lists
Don't use globals in 'pl.data' tests
Fix stringx.splitlines
Make stringx.splitlines more compliant with its Python
analogue:
* Recognize "\r\n" as a single line end.
* Return an empty list for an empty string.
* Implement `keep_ends` argument.
Prompted by beta.repology.org.
## 1.4.1
### Changes
- All functions that return instances of `pl.List`, `pl.Map` and
`pl.Set` now require corresponding modules, so that their methods
always work right away.
### Fixes
- Fixed `dir.getallfiles` returning an empty array when called
without `pattern` argument.
## 1.4.0
### Changes
### Fixes
- `pl.path` covers edge cases better (e.g 'path.normpath` was broken)
- `p.dir` shell patterns fixed
- `os.tmpname` broken on modern Windows/MSVC14
- (likewise for `utils.executeex` which depends on it)
- `pretty.write` more robust and does not lose floating-point precision;
saves and restores debug hooks when loading.
- `pl.lexer` fixes: `cpp` lexer now filters space by default
- `tablex.sortv` no longer assumes that the values are all unique
- `stringx.center` is now consistent with Python; `stringx.rfind` and
`string.quote_string` fixed.
- `data.write` had a problem with default delimiter, properly
returns error now.
- `pl.Set` `+` and `-` now have correct semantics
### Features
- `pl.tablex` has `union` and `merge` convenience functions
- `pl.lapp` understands '--' meaning end of parsed arguments
- `utils.quote_arg` quotes command arguments for `os.execute`,
correctly handling all special characters.
- `utils.writefile` has optional `is_bin` argument
- 'pl.lexer' supports line numbers with string argument
- `stringx.endswith` may be passed an array of possible suffixes.
- `data.read` - in CSV mode, assume empty fields are numerical zero
Issues found with existing distfiles:
distfiles/eclipse-sourceBuild-srcIncluded-3.0.1.zip
distfiles/fortran-utils-1.1.tar.gz
distfiles/ivykis-0.39.tar.gz
distfiles/enum-1.11.tar.gz
distfiles/pvs-3.2-libraries.tgz
distfiles/pvs-3.2-linux.tgz
distfiles/pvs-3.2-solaris.tgz
distfiles/pvs-3.2-system.tgz
No changes made to these distinfo files.
Otherwise, existing SHA1 digests verified and found to be the same on
the machine holding the existing distfiles (morden). All existing
SHA1 digests retained for now as an audit trail.
## 1.3.2
### Changes
- now works and passes tests with Lua 5.3
- utils.import will NOT override global symbols (import 'math' caused global type() to be clobbered)
- Updated pl.dir.file_op to return true on success and false on failure...
- workaround for issues with pl.lapp with amalg.lua - will look at global LAPP_SCRIPT if arg[0] is nil
### Fixes
- func was broken: do NOT use ipairs to iterate if __index is overriden!
- issue #133 pretty.read (naively) confused by unbalanced brackets
- xml attribute underscore fix for simple parser
- Fix path.normpath
- lexer: fix parsing block comments/string. fix hang on empty string.
- Fixed utils.execute returning different values for Lua 5.1 and Lua 5.2
- Issue #97; fixed attempt to put a month into a day
- problem with tablex.count_map with custom comparison
### Features
- Add Python style url module for quote and unquote.
- stringx.quote_string, which scans for embedded long-string quote matches and escapes them by creating a long-string quote.
- issue #117: tablex.range now works with decreasing numbers, consistent with numerical for loop
- utils.import will NOT override global symbols (import 'math' caused global type() to be clobbered)
- issue #125: DOCTYPE ignored in xml documents as well
- Allow XML tostring() function to customize the default prefacing with <?xml...>
- More Robust Quoted Strings
- lapp: improved detection of unsupported short flags
## 1.3.0
### Changes
- class: RIP base method - not possible to implement correctly
- lapp: short flags can now always be followed directly by their value, for instance,
`-I/usr/include/lua/5.1`
- Date: new explicit `Date.Interval` class; `toUTC/toLocal` return new object; `Date.__tostring`
always returns ISO 8601 times for exact serialization. `+/-` explicit operators. Date objects
are explicitly flagged as being UTC or not.
### Fixes
- class: super method fixed.
- Date: DST is now accounted for properly.
- Date: weekday calculation borked.
### Features
- All tests pass with no-5.1-compatible Lua 5.2; now always uses `utils.load` and
`utils.unpack` is always available.
- types: new module containing `utils.is_xxx` methods plus new `to_bool`.
- class: can be passed methods in a table (see `test=klass.lua`). This is
particularly convenient for using from Moonscript.
- general documentation improvements, e.g `class`
## 1.2.1
### Changes
- utils.set(get)fenv always defined (_not_ set as globals for 5.2 anymore!).
These are defined in new module pl.compat, but still available through utils.
- class.Frodo now puts 'Frodo' in _current environment_
### Fixes
- lapp.add_type was broken (Pete Kazmier)
- class broke with classes that redefined __newindex
- Set.isdisjoint was broken because of misspelling; default ctor Set() now works as expected
- tablex.transform was broken; result now has same keys as original (CoolistheName007)
- xml match not handling empty matches (royalbee)
- pl.strict: assigning nil to global declares it, as God intended. (Pierre Chapuis)
- tests all work with pl.strict
- 5.2 compatible load now respects mode
- tablex.difference thought that a value of `false` meant 'not present' (Andrew Starke)
### Features
- tablex.sort(t) iterates over sorted keys, tablex.sortv(t) iterates over sorted values (Pete Kazmier)
- tablex.readonly(t) creates a read-only proxy for a table (John Schember)
- utils.is_empty(o) true if o==nil, o is an empty table, or o is an empty string (John Schember)
- utils.executeex(cmd,bin) returns true if successful, return code, plus stdout and stderr output as strings. (tieske)
- class method base for calling inherited methods (theypsilon)
- class supports pre-constructor _create for making a custom self (used in pl.List)
- xml HTML mode improvements - can parse non-trivial well-formed HTML documents.
xml.parsehtml is a parse function, no longer a flag
- if a LOM document has ordered attributes, use these when stringifying
- xml.tostring has yet another extra parm to force prefacing with <?xml...>
- lapp boolean flags may have `true` default
- lapp slack mode where 'short' flags can be multi-char
- test.asserteq etc take extra arg, which is extra level where error must be reported at
- path.currentdir,chdir,rmdir,mkdir and dir as alias to lfs are exported; no dependencies on luafilesystem outside pl.path, making it easier to plug in different implementations.
Changes since 1.1.0 (from git log):
issue #70: boolean flags may have true default
Merge pull request #69 from Tieske/master
general updates, mainly added CONTRIBUTING.md
Merge pull request #1 from mark-otaris/patch-1
Caught red handed, after a shameless copy 😄. Thx for the fix
This is Penlight, not Busted
added - a shameless copy of busted - CONTRIBUTING.md file
renamed docs to doc, to fix luarocks warning
updated readme to md format
changed .txt to .md files
added rockspec, fixed typo in filename
Merge pull request #67 from Tieske/add_executeex
added utils.executeex, which also returns output of stdout and stderr
updated, using readfile now, remove obsolete os.remove commands
Merge pull request #66 from Tieske/fix_temp
windows environment variable TMP is deprecated, use TEMP
mode binary mode optional (binary would require platform specific line endings to be converted which is not very portable, and mostly just text will do)
update: read files in binary mode
added utils.executeex, which also returns output of stdout and stderr
windows environment variable TMP is deprecated, use TEMP
HTML mode skips DOCTYPE; no globals harmed outside pl.utils
Merge pull request #64 from Tieske/fix_dir
fixed makepath creation, added/updated some documentation
fixed dirpath creation, added/updated some documentation
basic parser handles comments, and HTML mode is working nicely with real-world HTML
use LOM ordered attributes when stringifying if present (Danny).
manual merge of John Schember's readonly table support
Merge pull request #61 from user-none/isempty
Thanks, John!
Merge pull request #62 from CoolisTheName007/patch-2
Transform using values as keys.
missing locals
Set.issempty mispelling; default ctor borked; more tests
Transform using values as keys.
Merge remote-tracking branch 'upstream/master' into empty
Add function to check if an object is empty.
Merge pull request #53 from pkazmier/master
Added iterators to allow traversing tables in a sorted manner
Merge pull request #60 from theypsilon/master
base class methods invocation possible not only in method constructor _init
Adding new class method 'base' which can be used for calling base class methods easily
pl.class broke with classes that redefined __newindex; OrderedMap can now use normal indexing to assign keys in order
Merge pull request #54 from CoolisTheName007/patch-1
Typo fixed, libarary->library
Typo fixed.
Added tablex.sort and tablex.sortv to iterate over sorted elements
There are times when it would be convenient to iterate over a table
either by sorted keys or values. There is an example of this in the
PIL book. I added the two functions to tablex module, added two test
cases, and updated the PL manual.
Merge pull request #51 from pkazmier/master
Thanks!
lapp.add_type was broken due to uninitialized table variable.
The variable `types` was not initialized preventing `add_type` from
appending custom types to the variable. I also added a new test to
cover this test case in the future.
Penlight is a set of pure Lua libraries focusing on input data
handling (such as reading configuration files), functional
programming (such as map, reduce, placeholder expressions,etc),
and OS path management. Much of the functionality is inspired
by the Python standard libraries.