plaintext

Rendering Plaintext as HTML maintaining whitespace – without <pre>

这一生的挚爱 提交于 2019-12-03 12:59:52
Given any arbitrary text file full of printable characters, how can this be converted to HTML that would be rendered exactly the same (with the following requirements)? Does not rely on any but the default HTML whitespace rules No <pre> tag No CSS white-space rules <p> tags are fine, but not required ( <br /> s and/or <div> s are fine) Whitespace is maintained exactly. Given the following lines of input (ignore erroneous auto syntax highlighting): Line one Line two, indented four spaces A browser should render the output exactly the same, maintaining the indentation of the second line and the

Extracting the body of an email from mbox file, decoding it to plain text regardless of Charset and Content Transfer Encoding

佐手、 提交于 2019-12-03 10:01:28
问题 I am trying to use Python 3 to extract the body of email messages from a thunderbird mbox file. It is an IMAP account. I would like to have the text part of the body of the email available to process as a unicode string. It should 'look like' the email does in Thunderbird, and not contain escaped characters such as \r\n =20 etc. I think that it is the Content Transfer Encodings that I don't know how to decode or remove. I receive emails with a variety of different Content Types, and different

Plain text autocomplete in Atom (Github)

末鹿安然 提交于 2019-12-03 07:43:27
I've auto-complete and auto-complete+ installed on the latest version of Atom. Unfortunately, these packages don't auto-complete or suggest words while typing plain text as open office or some sublime packages do. For instance, if I am typing repo and the word repository already appears in the current document, I would like to have some sort of auto-completion / intellisense to show up. I looked, in vain, for package in atom achieving that. So, the question is, do you know any package to do that in atom or any intuitions on how to create it ? Thanks. phw Actually the autocomplete-plus package

How to remove duplicate words from a plain text file using linux command

好久不见. 提交于 2019-12-03 03:13:56
问题 I have a plain text file with words, which are separated by comma, for example: word1, word2, word3, word2, word4, word5, word 3, word6, word7, word3 i want to delete the duplicates and to become: word1, word2, word3, word4, word5, word6, word7 Any Ideas? I think, egrep can help me, but i'm not sure, how to use it exactly.... 回答1: Assuming that the words are one per line, and the file is already sorted: uniq filename If the file's not sorted: sort filename | uniq If they're not one per line,

How do I encrypt plaintext with GnuPG?

扶醉桌前 提交于 2019-12-02 15:51:32
I've been working a great deal with GnuPG lately and have come to depend on its ability to encrypt files, etc. However, I am currently working on a couple of projects that involve communication (i.e. chat,email, etc) where I'd like to use existing keys to encrypt/decrypt text itself as opposed to a "container" such as a file or disk image. I suppose I could encrypt the container, convert the stream to base64 (or something appropriate) then mark the text as such, but I would guess there is a more straightforward solution. I'm sure there is something simple I'm missing, but, well, I'm missing it

Set format as plain text

只愿长相守 提交于 2019-12-02 13:15:30
function A1format() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var mainsheet = ss.getSheetByName("Sheet1"); var G = mainsheet.getRange("C15:BH3000").getGridId(); var illa = mainsheet.getRange("A13"); Logger.log(G); illa.copyFormatToRange(G, 16, 3,200, 30); } This doesnt Work and gives some strange Server error. Please help ldo Green answer above is right : in your code the end row is smaller than the start row...(columns are wrong too but it strangely accept this small negative difference) this is indeed not valid. Using the autocomplete feature in the editor will remind you the

Office 365 Rest API - Retrieving plain text Email

旧城冷巷雨未停 提交于 2019-12-02 05:54:03
问题 Is there currently anyway to with the Office 365 Rest APIs to retrieve the plain text part of an email message? From the API documents it states that the 'Body' object contains the 'ContentType' field which can either be Text or HTML . https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#ItemBody However whenever a multipart (HTML + plain text) message is retrieved the API only ever returns the HTML part as shown bellow: { "@odata.context": "", "@odata.id":

Convert TXT File of Unknown Encoding to String

梦想的初衷 提交于 2019-12-01 20:39:00
How can I convert Plain Text (.txt) files to a string if the encoding type is unknown? I'm working on a feature that would allow users to import txt files into my app. This means the file could have been created in any number of apps, utilizing any of a variety of encodings that would be considered valid for a plain text file. My understanding is this could include (ASCII, UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, or EBCDIC?!) Things had been going well using the following: NSString *txtFileAsString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding

How to extract plain text from ckeditor generated html in JAVA

痞子三分冷 提交于 2019-12-01 06:21:34
I am using ckeditor to compose the emails, I am using the html generated by it to send the html emails ad i also need the text version also, So having both html and plain text version in emails will avoid the spam. What is the way to get the text from ckeditor html code in java. This is quite simple JavaScript call: CKEDITOR.instances.yourEditorInstance.getData() Returns: <h1>Apollo 11</h1> <p><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en

How to extract plain text from ckeditor generated html in JAVA

蓝咒 提交于 2019-12-01 05:07:22
问题 I am using ckeditor to compose the emails, I am using the html generated by it to send the html emails ad i also need the text version also, So having both html and plain text version in emails will avoid the spam. What is the way to get the text from ckeditor html code in java. 回答1: This is quite simple JavaScript call: CKEDITOR.instances.yourEditorInstance.getData() Returns: <h1>Apollo 11</h1> <p><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en