Removing Blank Paragraph after appendTable() - google-apps-script

I'm merging two Google Docs together, by appending each of the elements from one document to the other. This works great, except for when I use appendTable() I'm getting an extra blank line after each table. After some digging, I discovered that this is actually a blank paragraph element.
In trying to remove this blank paragraph I thought maybe I could, after appending the table, remove the next sibling, like so:
var table = body.appendTable(element);
body.removeChild(table.getNextSibling());
However, I'm greeted with a, Can't remove the last paragraph in a document section. message when I try this method.
Has anyone else figured out a way to remove this blank paragraph after using appendTable()?

Developers documentations says that a Google Doc can't end with a paragraph, so one will always be automatically inserted.

Related

In what cases do browsers create multiple adjacent text nodes?

According to MDN,
New documents have a single Text node for each block of text. Over time, more Text nodes may be created as the document's content changes
I'm running into a rare bug in a project that I think is triggered by multiple text nodes being created in a single element when I only expect there to be one, but I can't reproduce it. Is there any way I can trigger this browser behavior, particularly in iOS Safari?
To illustrate, I manually made a div with two text nodes. I'm trying to figure out when the browser would take a single text node and split it in two like in the attached image
At least one case of particularly Safari/WebKit unexpectedly breaking textNodes seems to be documented somehow in WebCore’s HTMLConstructionSite.cpp lines 584–592, which refers to WebKit bug #55898. The limit comes from Text.h which sets defaultLengthLimit to 1 << 16 (65536).
I’m not entirely sure which part triggers this, since adding long text to node using textContent or appendChild(textNode) both created a single text node even with long text. However, I did manage to replicate this behavior with innerHTML.
Example:
// empty <p> element
let p = document.getElementById("test");
p.innerHTML = "a".repeat(65536+100);
console.log(p.childNodes.length); // 2
Obviously HTMLConstructionSite.cpp is related to parsing HTML so it would make sense that it applies to innerHTML, but I have no idea if some other places in WebCore use the text splitting textNode creation too. I hope this helps to track down the problem at least.

entering a new sentence without using <br> or <p>

If there are a number of links on a webpage, is it possible to break onto a new line while the link is either fully on either side?
For example: This blog http://northskie.blogspot.com/ shows a series of links using the standard A HREF="http://www... " etc .
But, you'll notice that on the first line, Chapin's Inferno appears on BOTH sentence line A, AND line B. This could easily be corrected by adding a BR, of course. BUT, what if I'm working on a huge number of links, such as http://asmrluv.blogspot.com/ ? Now, I'd prefer NOT to to simply add BR or P between each Breaking line. Also note, many sites could be added to the list later. This is why BR lines should be avoided here.
Can any code be implemented which automatically prevents a link from appearing on both lines? (of course, adding a CLASS or ID would along with code would be acceptable). I'm trying to avoid the problem of a link appearing halfway on one sentence, then on the next line as well.

Conditionally adding a line to text box with bulleted list in SSRS

I'm a competent C# developer, but new to SSRS, so my inability to figure out this stupid little issue is kinda killing me here.
I've got a report that's basically a printed quote. There's a terms and conditions section at the bottom that looks like
some static text
some static text
some static text
With certain quote types, we want to add one more line to the bottom of that. I've tried a bunch of ways to get this to work, but can't seem to get it to work within the bulleted list. If I add a new line with the bullet, I've got a blank bullet when the quote type doesn't call for that item. If I clear the bullet and try to manually add it with chr(9) for tabs, it doesn't work. The closest I could get to it was this:
=iif(Trim(First(Fields!QuoteTypeCode.Value, "QuoteDetailsDataSet")) = "N", " • Prices Subject to Change", "")
Problem is, that still leaves an unwanted blank line. Ideally, I'd think my solution would be to put my «expr» at the end of the last static text line and trigger a line break that would add another bullet and my text, or, after that line, with html, add a <li>my text</li>, but none of that works.
Is there something silly that I'm missing here?
I could easily just create two versions of this box, one with that line, one without, and conditionally display the appropriate one, depending on what type of quote it is, but that feels "dirty". At this point though, as simple as this task is, I'm ready to go dirty rather than spin my wheels for too much longer over something so trivial. :(
I would Create a separate dataset, ex. Italicsdataset
select "bullet text formatted in html" as Option1, "bullet option 2" as Option 2...
then in your text box select create an expression such as
IIF(fields!Field.value = 1, fields!option1.value, 0)

Replacing text with a wildcard

I need every instance of <tag%/tag> inside of a column to be replaced with nothing ('' or deleted). The content inside of the tag varies. How do I do this while keeping the text that surrounds it?
For example: CONTENT <tag>various stuff</tag> CONTENT. I want to keep all content but remove the tags and everything inside of them, resulting in CONTENT CONTENT.
Edit: What? This has nothing to do with special characters.
I've worked around my problem by just exporting the table, opening it in a text editor, search+replacing and importing. I'm still unaware of any way to do this in SQL.
Unfortunately this isn't possible. See this question and answer for a link to a possible solution (installing a UDF.)

Close tags dropping below highlighted line

I have minimal experience with HTML script so this may all go horribly wrong here.
Alright so I have a very simple yet very time consuming task of taking complete papers and converting them into HTML script. I'm using Sublime Text 3 with Emmet plugin.
Basically,
This is the first header
This is the first paragraph that needs to be tagged
This is the second header
This is the second paragraph that needs to be tagged
So super simple I need to put header tags on the headers and paragraph tags on the paragraphs.
What I have been doing is holding Ctrl and manually highlighting the desired text as it is all rather random. Problem is that takes forever to manually highlight the text like that.
I am aware of other ways to highlight such as Ctrl + L for the line. Problem is my close tags end up under the highlighted line.
Example:
<h2>This is the first header
</h2><p>This is the first paragraph that needs to be tagged
</p>
It's not a big deal but it makes the code harder to go through later and really chaotic.
The same problem persists if I click the corresponding number of the line.
Seeing as I have hundreds of pages to enter and even more headers, paragraphs, and pictures to properly tag; I'm looking for a solution to the tag dropping below the line or a faster method to entering text.
So, is there a fast method for entering text from a word document to Sublime text and quickly get the corresponding tags? e.g. <h2>,<h3>,<p>,<ul>,<li> and so on.
Any help will save my sanity, thanks.
When you select a line with CtrlL, it automatically selects the entire line, and moves the cursor down to the first position on the following line. There are two ways around this. The first is to place the cursor in the first position on the line you want to select, then just hit ShiftEnd and the line will be selected, with the cursor now sitting in the last position on that same line. Alternatively, use CtrlL, then hit Shift← (left arrow) to move the cursor from the first position on the next line to the last position on the selected line. Either way, you can now hit the key combo in Emmet for inserting a tag pair, and you're all set.