mirror of
https://github.com/adamdruppe/arsd.git
synced 2025-04-26 13:20:05 +03:00
Merge branch 'master' of https://github.com/eskimor/misc-stuff-including-D-programming-language-web-stuff
Conflicts: database.d
This commit is contained in:
commit
f2943b90b3
8 changed files with 73 additions and 22 deletions
17
html.d
17
html.d
|
@ -230,6 +230,21 @@ Html linkify(string text) {
|
|||
return Html(div.innerHTML);
|
||||
}
|
||||
|
||||
Html nl2br(string text) {
|
||||
auto div = Element.make("div");
|
||||
|
||||
bool first = true;
|
||||
foreach(line; splitLines(text)) {
|
||||
if(!first)
|
||||
div.addChild("br");
|
||||
else
|
||||
first = false;
|
||||
div.appendText(line);
|
||||
}
|
||||
|
||||
return Html(div.innerHTML);
|
||||
}
|
||||
|
||||
/// Returns true of the string appears to be html/xml - if it matches the pattern
|
||||
/// for tags or entities.
|
||||
bool appearsToBeHtml(string src) {
|
||||
|
@ -640,7 +655,7 @@ void translateInputTitles(Document document) {
|
|||
void translateInputTitles(Element rootElement) {
|
||||
foreach(form; rootElement.getElementsByTagName("form")) {
|
||||
string os;
|
||||
foreach(e; form.getElementsBySelector("input[type=text][title], textarea[title]")) {
|
||||
foreach(e; form.getElementsBySelector("input[type=text][title], input[type=email][title], textarea[title]")) {
|
||||
if(e.hasClass("has-placeholder"))
|
||||
continue;
|
||||
e.addClass("has-placeholder");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue