timonus / nsattributedstringmarkup Goto Github PK
View Code? Open in Web Editor NEWTurn simple markup into NSAttributedStrings.
License: BSD 3-Clause "New" or "Revised" License
Turn simple markup into NSAttributedStrings.
License: BSD 3-Clause "New" or "Revised" License
tags = [NSSet setWithObject:@".*?"];
could be dispatch_once
'd as a regex and used from then on.
Perhaps introduce an optional "context" object that can be used between calls to this method that stores compiled regexes for common/reused tags.
Should probably be enumerating ranges here instead of taking attributes from the start of the range https://github.com/timonus/NSAttributedStringMarkup/blob/master/NSAttributedString%2BTJFormatting.m#L64
Right now this lib converts from NSString -> NSAttributedString, but could make it operate on NSMutableAttributedStrings with markup in them just as easily.
Removed in 98c051b, causes nested version technically be wrong
The act of tag “discovery” in a string could be separated from attributed string parsing in a way that would improve perf / recycle regexes between calls. Unfortunately this would complicate the API a little bit.
In nesting friendly case some duplicate work is done
Right now the full contents between <
and >
must match in the open and close tags. This could be simplified to be more like HTML by tweaking the regex used by this library.
Things like b, i, u, and URLs.
On top of #9, would be pretty handy!
https://developer.apple.com/documentation/foundation/nsregularexpression?language=objc
Could use something like <(.*?)>(.*?)</(\\1)>
instead of <(.*?)>(.*?)</(.*?)>
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.