TTStyledText that recognizes URLs without http:// scheme - iphone

I am using TTStyledText to display text with potential markup on a TTStyledTextLabel.
If text contains something like "http://stackoverflow.com" TTStyledText autogenerates the markup and linkifies said text.
The problem is I also want "www.stackoverflow.com" to appear as valid hyperlinks, as well as anything that reasonably resembles an http URL, even if the scheme is missing.
Any way to do that with TTStyleText or do I need to recognize the URL and reformat the text myself?

I've always found TTStyledText to be woefully underpowered and missing a lot of functionality. This is a good example. I think in order to make this work you'll need to as you say pre-format the text portion before you pass it in.

Related

What API does facebook use for displaying the full Wikipedia articles?

I couldn't find any api that return the article in a usable HTML form. Most of them return extracts which have very poor HTML formatting which makes them useless for anything.
There is no way to tell what Facebook did exactly, but the easiest way to grab the HTML contents of an article is by using the render action, i.e. by appending action=render to the URL:
https://en.wikipedia.org/wiki/Cooking?action=render
This produces the exact same HTML you can see on Wikipedia, but omits the non-content part (sidebar etc). If you need to reproduce the layout of an article more faithfully, you need to reuse parts of Wikipedia's CSS, and there is no easy way to do that.
Since just a few days there is a REST API for getting the html. It is available at https://rest.wikimedia.org/
Since it is so new, Facebook is probably not using it (yet) but if you want to get it for yourself I suggest you start exploring there.

How to remove special characters from URL permalinks

I am starting with jekyll and i'll appreciate any kind of help.
I am making a blog site but not in english language.
Default language will be Czech so in post tittles there will be characters like ĚŠČŘŽÝÁÍ.
I want to use pretty permalinks with post tittle in it, but actualy it doesn't work
properly in Safari browser. I am getting error 500 from server.
How to resolve it? Is there any plugin which can convert these characters in ascii symbols escrzyai and how to install it?
I believe permalinks are determined by settings + post file names, not settings + post titles.
So you should have files names like
_posts\2014-04-12-hello-world.md
instead of
_posts\2014-04-12-je-každoročně-tak-veliký.md
Inside the post, you can still use post title in Czech.
Permalinks' documentation is here, note if you have Czech categories and you use them in permalinks, you will still get into trouble, so it's better to avoid Czech categories in permalinks.

How to define custom wicket tag

I could not find a wicket tag like wicket:include? Can anyone suggest me anything? I want to include/inject raw source into html files? If there is no such utility, any suggestions to develop it?
update
i am looking for sth like jsp:include. this inclusion is expected to be handled on the server side.
To do this, you'll need to implement your own IComponentResolver.
This blog article shows an example somewhat resembling what you're after.
Is it raw markup that you want to include, or Wicket content?
If it's raw markup, even a simple Label can do that for you. If you call setEscapeModelStrings( false), the string value of the model will be copied straight in the markup. (Watch out for potential XSS attacks though.)
"Including" Wicket markup is done via Panels (or occasionally Fragments)
Update: If you add more detail about the actual problem you need to solve, there's a good chance that we can find a more "wickety" solution, after all, JSP and Wicket are two different worlds and the mindset of one doesn't work very well in the other.

Sanitizing title URLs in ExpressionEngine 1.6.x

I run a blog where the blog title is either an external link or an internal link to a longer piece similar to what you’ve seen on similar blogs. For some reason, ExpressionEngine (1.6.x) does nothing to sanitize such things as ampersands in the URLs provided.
I use Markdown in the body text, which seems to do a great job of sanitizing all URLs. Yet, ExpressionEngine’s own handling of the titles doesn’t cut it. I have tried formatting the “title URLs” in Markdown and failed miserable, and damn if I know what the hell it is in ExpressionEngine that prevents me from using it.
So the question boils down to what other ExpressionEngine 1.6.x users do and have done, or whether someone can come up with a MacGyver-esque solution. Because I’ve been stumped upwards of half a year.
The XML Encode Plugin for EE1 from Rick Ellis of EllisLab will convert your special characters to HTML entities.
The plugin was originally designed to convert reserved XML characters to HTML entities in the ExpressionEngine RSS templates, but should work for what you need.
To use the plugin, wrap your {title_link} custom field in between its tag pairs:
{exp:xml_encode}
{title_link}
{/exp:xml_encode}
This would result in:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Being converting into:
http://www.google.com/search?q=nytimes&btnG=Google+Search
Other EE1 Plugins which offer more similar but advanced features are Cleaner by utilitEEs (Oliver Heine) or Low Replace by Lodewijk Schutte.

What kind of Markup should i use for the Notes in my WebApp?

i am building a webapp that will have notes fields all over the place, but i dont know what kind of markup i should use.
these are my requirements
User must be able to change the text style (bold, italic, underlined)
User must be able to create bullet lists
User must be able to create numbered lists
User must be able to change the font-size or use pre-definded headings
User must be able to add links
User must have a WYSIWYG - Editor that hides the actual markup
the last one is the most important requirement, my target users struggle even with word, so using markup style input like here on stackoverflow is not an option.
so what kind`s of markup do you know that fits ans has some fancy WYSIWYG - Editor?
if you think that i missed a important requirement please feel free to suggest it.
tia
You'll need to check out tinyMCE.
It's the best javascript-based WYSIWYG editor I've found.