Skip to content

Commit

Permalink
Merge pull request #1 from ScottPJones/spj/format
Browse files Browse the repository at this point in the history
This is a beginning of my addition of formatting interpolation
  • Loading branch information
ScottPJones committed Mar 11, 2016
2 parents e829998 + 3b6484b commit 6f53ac3
Show file tree
Hide file tree
Showing 10 changed files with 1,495 additions and 12 deletions.
7 changes: 6 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Copyright (c) 2016 Gandalf Software, Inc. (Scott P. Jones)
Portions based on code that is part of Julia, licensed under the MIT license,
and also Eric Forgy's StringInterpolations.jl package.

Portions are based on code submitted as a PR to the Formatting.jl package,
also under MIT "Expat" license: Copyright (c) 2015 Tom Breloff

Portions are based on the Formatting.jl package, also under MIT "Expat" license:
Copyright (c) 2014: Dahua Lin and contributors.

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
Expand All @@ -22,4 +28,3 @@ and also Eric Forgy's StringInterpolations.jl package.
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ Finally, I have added two new ways of representing characters in the literal str
This makes life a lot easier when you want to keep the text of a program in ASCII, and
also to be able to write programs using those characters that might not even display
correctly in their editor.

This now has some initial formatting capability, based on Tom Breloff's wonderful PR #10 to the
JuliaLang/Formatting.jl package (by Dahua Lin and other contributors).
`\%(arguments)` is interpolated as a call to fmt(arguments).

I also plan on adding support for `\%c(arguments)`, where c is a C style formatting character.
I'm debating if I should make it take the full C style syntax, with leading 0, width/precision,
etc, before the single character.

13 changes: 13 additions & 0 deletions src/StringUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,17 @@ export @u_str, @sinterpolate
export s_unescape_string, s_escape_string, s_print_unescaped, s_print_escaped

include("literals.jl")
include("unicodenames.jl")

# From Formatting.jl
import Base.show

export cfmt, fmt, fmt_default, fmt_default!

include("cformat.jl" )
include("fmtspec.jl")
include("fmtcore.jl")
include("formatexpr.jl")
include("fmt.jl")

end
Loading

0 comments on commit 6f53ac3

Please sign in to comment.