When I load my Express webpage I'm getting the following error:
Express
500 Error: /app/views/index.jade:114 112| td 2 113| td 4 years > 114| input is self closing and should not have content.
112| td 2
113| td 4 years
> 114|
input is self closing and should not have content.
at Object.Compiler.visitTag (/app/node_modules/jade/lib/compiler.js:434:15)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitBlock (/app/node_modules/jade/lib/compiler.js:278:12)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitTag (/app/node_modules/jade/lib/compiler.js:443:12)
at Object.Compiler.visitNode (/app/node_modules/jade/lib/compiler.js:210:37)
at Object.Compiler.visit (/app/node_modules/jade/lib/compiler.js:197:10)
at Object.Compiler.visitBlock (/app/node_modules/jade/lib/compiler.js:278:12)
This doesn't show up when run locally with foreman start, only when its on the server.
Looks like you've got content inside your input tags. In HTML, input tags can't have content, therefore you should delete any whitespace or characters following input tags in your jade file.
Ex:
input(type="text",name="whatever") something
should be input(type="text",name="whatever",value="something")
Sometimes the answer is a little tricker than just some content after the tag on the same line (such as a few spaces). Watch out for the line following the input tag being indented by mistake!
After running into the same error I was checking the line of jade template marked in error report. It was actually containing input definition, but that definition was fine for there wasn't any whitespace and printable content succeeding it. The following line was even less indented (two levels up for starting another row of form) and thus there was definitely no content to input element defined in marked line.
However there was another input succeeding this marked one a few lines down the template. And that input element indeed was having some subordinated content. Removing content there was fixing somewhat false positive "here".
I had a similar problem I solved with this:
div
+inputWithTextContent('whatever', 'something')
mixin inputWithTextContent(name, message)
!='<input type="text" name="'+name+'">'+message+'</input>'
Another solution is to create a label after the input and then display it inline. This will sit the label along side the control. This is how I solved the issue with a checkbox input in jade.
JADE (Bootstrap):
.checkbox
label
input(type='checkbox', value='remember-me',)
label.inlineLabel Remember me
SASS:
label.inlineLabel
display: inline
Related
I want to know what to get some content not include quote content.
https://forumd.hkgolden.com/view.aspx?type=BW&message=7219211
The following picture is the example
I want to get only "唔提冇咩人記得", but I use the following code will get both content.
content = driver_blank.find_element_by_xpath('/html/body/form/div[5]/div/div/div[2]/div[1]/div[5]/table[24]/tbody/tr/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/div')
print(content.text)
The following code is what I want to capture content:
<div class="ContentGrid">
<blockquote><div style="color: #0000A0;"><blockquote><div style="color: #0000A0;">腦魔都俾你地bam咗啦<img data-icons=":~(" src="/faces/cry.gif" alt=":~("></div></blockquote><br>珠。。。。。</div></blockquote><br>唔提冇咩人記得
<br><br><br>
</div>
Can anyone help me? Thanks~~~
Can not(starts-with 's method be solved?
Use below line of code to extract only text node content
element = driver.find_element_by_css_selector('div.ContentGrid')
text = driver.execute_script("return arguments[0].childNodes[3].textContent", element);
print(text)
Selenium won't allow you to directly locate an element using text node. Though you can use some JavaScript code to make it happen.
Code Explanation:
arguments[0].childNodes[3] indicates 3rd child element of your context node which is div.ContentGrid. Please note first 2 child element of the context node are blank (tried with the HTML code shared by you) that's why index 3 used.
So far I was parsing the NotesCalendarEntry ics manually and overwriting certain properties, and it worked fine. Today i stumbled upon a problem, where a long summary name of the appointment gets split into multiple lines, and my parsing goes wrong, it replaces the part up to the first line break and the old part is still there.
Here's how I do this "parsing":
NotesCalendarEntry calEntry = cal.getEntryByUNID(apptuid);
String iCalE = calEntry.read();
StringBuilder sb = new StringBuilder(iCalE);
int StartIndex = iCalE.indexOf("BEGIN:VEVENT"); // care only about vevent
tmpIndex = sb.indexOf("SUMMARY:") + 8;
LineBreakIndex = sb.indexOf(Character.toString('\n'), tmpIndex);
if(sb.charAt(LineBreakIndex-1) == '\r') // take \r\n into account if exists
LineBreakIndex--;
sb.delete(tmpIndex, LineBreakIndex); // delete old content
sb.insert(tmpIndex, subject); // put my new content
It works when line breaks are where they are supposed to be, but somehow with long summary name, line breaks are put into the summary (not literal \r\n characters, but real line breaks).
I split the iCalE string by \r\n and got this (only a part obviously):
SEQUENCE:6
ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN="test/Test";RSVP=FALSE:
mailto:test#test.test
ATTENDEE;CUTYPE=ROOM;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED
;CN="Room 2/Test";RSVP=TRUE:mailto:room2#test.test
CLASS:PUBLIC
DESCRIPTION:Test description\n
SUMMARY:Very long name asdjkasjdklsjlasdjlasjljraoisjroiasjroiasjoriasoiruasoiruoai Mee
ting long name
LOCATION:Room 2/Test
ORGANIZER;CN="test/Test":mailto:test#test.test
Each line is one array element from iCalE.split("\\r\\n");. As you can see, the Summary field got split into 2 lines, and a space was added after the line break.
Now I have no idea how to parse this correctly, I thought about finding the index of next : instead of a new line break, and then finding the first line break before that : character, but that wouldn't work if the summary also contained a : after the injected line-break, and also wouldn't work on fields like that ORGANIZER;CN= as it doesn't use : but ;
I tried importing external ical4j jar into my xpage to overcome this problem, and while everything is recognized in Domino Designer it resulted in lots of NoClassDefFound exceptions after trying to reach my xpage service, despite the jars being in the build path and all.
java.lang.NoClassDefFoundError: net.fortuna.ical4j.data.CalendarBuilder
How can I safely parse this manually, or how can I properly import ical4j jar to my xpage? I just want to modify 3 fields, the DTSTART, DTEND and SUMMARY, with the dates I had no problems so far. Fields like Description are using literal \n string to mark new lines, it should be the same in other fields...
Update
So I have read more about iCalendar, and it seems that there is a standard for this called line folds, these are crlf line endings followed by a space. I made a while loop checking until the last line-break not followed by a space, and it works great so far. Will use this unless there's a better solution (ical4j is one, but I can't get it working with Domino)
I'm making a simple Node JS app.
It logs a lots of informations on console. I would like to know if it's possible to add a horizontal lines in Node JS command line without using any extra packages or dependencies.
If command prompt supports HTML elements, then I could use something like console.log("<hr>"); for adding a horizontal line but it does not support HTML.
Is there any way ?
To create the string for the horizontal line:
const line = '-'.repeat(process.stdout.columns)
.repeat() method repeats the string.
process.stdout.columns returns the number of columns.
To use it:
console.log(line)
The console does not support rendering HTML elements.
That does not prevent you from making a custom line however!
const lineBreak = '----------------------'
console.log(lineBreak)
Of course, customize the linebreak however you'd like:
______ //Underscores!
----- //Hyphens!
====== //Equals!
For grouping related data, refer to the docs here: console reference
Example:
function name(obj) {
console.group('name');
console.log('first: ', obj.first);
console.log('middle: ', obj.middle);
console.log('last: ', obj.last);
console.groupEnd();
}
name({"first":"Wile","middle":"E","last":"Coyote"});
Will output grouped data to the console, visually giving it a line break & arrow to collapse the group. I think this would work well for your use case.
Working off on the same vane as #sergey above:
If your output has a header of a determinable length you can use the .length method.
const header="This is my header";
console.log(header);
console.log('-'.repeat(header.length);
I have an Excel file that will be saved as an .csv file for importation into an email automation system. In a function I need to return a piece of HTML code as text.
=IF(A2<0,"CHECKMARK CODE",A2)
The "CHECKMARK CODE" needs to be replaced by:
> < span style="font-size:16px">& #10003;</span>.
For this post, spaces were added to prevent code from display as a checkmark.
However, all my attempts at the format_text function or adding apostrophes only yields errors.
How do I return this as text exactly as needed by the email automation system?
Please try escaping the double quotes:
=IF(A2<0,"<span style=""font-size:16px"">& #10003;</span>",A2)
Got a groovy script that is pulling some text from a soap connection and I am trying to add a bullet point before any bullet points. Here is the code I have but it does not work and it may never work, but thought I would ask.
td (it.#detail.toString().replaceAll('>', '>').replaceAll("•", "\n •"))
That should work.
ie, try:
println it.#detail.toString().replaceAll('>', '>').replaceAll("•", "\n •")
To see it working in the console output.
I guess you're viewing this in HTML with a browser?
Newlines don't appear in HTML normally, so you'd need to wrap the text in a <pre> tag.
Assuming this is with StreamingMarkupBuilder or similar, try:
td {
pre( it.#detail.toString().replaceAll('>', '>').replaceAll("•", "\n •") )
}