Markdown Lorem Ipsum generator? - html

There are dozens of html/text Lorem ipsum generators around; However something I haven't found which I find strange with the prevalence of Markdown online is a Markdown Lorem Ipsum generator.
Does anyone know of one online somewhere or of any reason one wouldn't exist?

I recently came across this awesome markdown lorem ipsum generator called Lorem Markdownum.
It's configurable and includes random generation of all markdown elements using Markov chains and other cool stuff.
Here's a sample output:
Amoris Pindusque spreta Denique et positus quoniam
Inquit Tyriis cervos circuit Hyrie ocius sitientes
Renuente feruntur fontibus pares, ait tertia lacunabant animo, est. Limina
pulvere victima fores Aeacidae. Cum sua muneris spargit albis
glomerabat novercae puniceo. Vel quae
hac valuisse et artus intexuit ramosam Herculeos umbras. Ferarum niger.
Vestigia votorum turbatusque putes haeremusque matrem fateor
Iam natam sic fataliter uterque exiliis una
Proceres aethera
Amando littera solantia iam Paridis priorem dixisse
Illis altior bracchia lapides decus increpat ignota. Lucis suis eheu nec, sive
dicta villosa deos flexi me parvo tendere, talibus semper Polydegmona ait.
Refert versato vultus, percussit pavor, primum matrem care grande, iam adeundi
est arenti! Dracones hinnitus soleo sequenti, Arethusae me morte sanguine;
inscripsere summa: ego.
logicPim = imapOptical(19 - laserIconSpreadsheet, text_technology(
yobibyte_regular_hyperlink, icio_gbps_compiler),
swipeOdbcInterface.gnutella_copyright(backside_netmask,
abend_camelcase, mbrCycleTag) + smmFileMemory);
waveform_server(mini_degauss_paper(ccMegapixel + default_minisite_ieee,
script_system));
rtf_restore_crossplatform(barBlu, css);
Quod res fulmen in, hunc, atque vivum. Quid aequor captivo illum, clausit in
dubitas mixta. Est penates est celas, modo perque reticere
orbem timore neptis refero. Sperneret viridis iaculis avis Phrygiisque alto!

I did this little thing while learning emberjs. Hope it helps!
http://juanda.me/tests/ember-lipsum-md/

This http://www.lorem-ipsum-html.com/ it is simple and clean, This provides code snippets with html like this:
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam tincidunt mauris eu risus.
Vestibulum auctor dapibus neque.

Related

How to preserve leading whitespace in Jinja variable?

I have a variable source containing multiple lines containing indentation (i.e. leading whitespaces):
.. admonition:: Lorem ipsum dolor sit amet
Consectetur adipiscing elit. Aenean in dolor
id massa convallis eleifend sed eu mauris.
However, when printed with {{ source }}, Jinja actually prints
.. admonition:: Lorem ipsum dolor sit amet
Consectetur adipiscing elit. Aenean in dolor
id massa convallis eleifend sed eu mauris.
i.e. it strips leading whitespaces! How to preserve them?
Try:
{{ source|indent }}
See jinja documentation indent (default indentation is four spaces, the first and blank lines are not indented - which is exactly what you need)
When reproducing your example this way:
import jinja2
source = """
.. admonition:: Lorem ipsum dolor sit amet
Consectetur adipiscing elit. Aenean in dolor
id massa convallis eleifend sed eu mauris.
"""
template = jinja2.Template("""Content of 'source': {{ source }}
jinja2 version {{ version }} was used.""")
result = template.render(source=source, version=jinja2.__version__)
print(result)
the output was
Content of 'source':
.. admonition:: Lorem ipsum dolor sit amet
Consectetur adipiscing elit. Aenean in dolor
id massa convallis eleifend sed eu mauris.
jinja2 version 2.11.3 was used.
(so the indentation of source was not modified by jinja2).

Kendo Grid does not accept

My Kendo Grid accepts the following json format
{"GetAllStratagyResult":[{"Id":14,"Region":"xxx","Terminal":"NGAY-HG6","Type":1,"VerisonNumber":"5476","VersionDate":"\/Date(1427782421023+0400)\/","VersionName":"Second Version1","content":"<p><span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit<\/span><\/p><p><span>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.<\/span><\/p><p><span>Proin pharetra novnummy pede.<\/span><\/p><p>cccccccccc<\/p>"},{"Id":15,"Region":"yyy","Terminal":"NGAY-HG6","Type":1,"VerisonNumber":"456","VersionDate":"\/Date(1427722608457+0400)\/","VersionName":"Second Version1","content":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit."},{"Id":16,"Region":"zzz","Terminal":"NGAY-HG6","Type":1,"VerisonNumber":"456","VersionDate":"\/Date(1427722395997+0400)\/","VersionName":"Second Version1","content":"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas."}]
but it won't show column value for following json:
{"readexcelbyteResult":"[{\"IFRS\":\"Volume\",\"2001\":\"645645\",\"2002\":\"875\",\"2003\":\"8598\",\"2004\":\"6986\",\"2005\":\"98698\",\"2006\":\"698698\",\"2007\":\"6989698\",\"2008\":\"57487\",\"2009\":\"487487\",\"2010\":\"4875\",\"2011\":\"458\"},{\"IFRS\":\"ipsum \",\"2001\":\"456456\",\"2002\":\"6986\",\"2003\":\"98698\",\"2004\":\"6986\",\"2005\":\"986\",\"2006\":\"98698\",\"2007\":\"698698\",\"2008\":\"6986\",\"2009\":\"98698\",\"2010\":\"69860606\",\"2011\":\"9860\"},{\"IFRS\":\"dolor \",\"2001\":\"366397\",\"2002\":\"4364\",\"2003\":\"98308\",\"2004\":\"467\",\"2005\":\"4086\",\"2006\":\"40874\",\"2007\":\"6487\",\"2008\":\"4984\",\"2009\":\"8749\",\"2010\":\"87598\",\"2011\":\"4874\"},{\"IFRS\":\"amet\",\"2001\":\"646456\",\"2002\":\"875\",\"2003\":\"8598\",\"2004\":\"6986\",\"2005\":\"98698\",\"2006\":\"698698\",\"2007\":\"6989698\",\"2008\":\"57487\",\"2009\":\"487487\",\"2010\":\"4875\",\"2011\":\"458\"},{\"IFRS\":\"consectetuer \",\"2001\":\"645645\",\"2002\":\"6986\",\"2003\":\"98698\",\"2004\":\"6986\",\"2005\":\"986\",\"2006\":\"98698\",\"2007\":\"698698\",\"2008\":\"6986\",\"2009\":\"98698\",\"2010\":\"69860606\",\"2011\":\"9860\"},{\"IFRS\":\"adipiscing \",\"2001\":\"536397\",\"2002\":\"4364\",\"2003\":\"98308\",\"2004\":\"467\",\"2005\":\"4086\",\"2006\":\"40874\",\"2007\":\"6487\",\"2008\":\"4984\",\"2009\":\"8749\",\"2010\":\"87598\",\"2011\":\"4874\"},{\"IFRS\":\"Maecenas \",\"2001\":\"456456\",\"2002\":\"875\",\"2003\":\"8598\",\"2004\":\"6986\",\"2005\":\"98698\",\"2006\":\"698698\",\"2007\":\"6989698\",\"2008\":\"57487\",\"2009\":\"487487\",\"2010\":\"4875\",\"2011\":\"458\"},{\"IFRS\":\"porttitor \",\"2001\":\"564564\",\"2002\":\"6986\",\"2003\":\"98698\",\"2004\":\"6986\",\"2005\":\"986\",\"2006\":\"98698\",\"2007\":\"698698\",\"2008\":\"6986\",\"2009\":\"98698\",\"2010\":\"69860606\",\"2011\":\"9860\"},{\"IFRS\":\"congue \",\"2001\":\"366397\",\"2002\":\"4364\",\"2003\":\"98308\",\"2004\":\"467\",\"2005\":\"4086\",\"2006\":\"40874\",\"2007\":\"6487\",\"2008\":\"4984\",\"2009\":\"8749\",\"2010\":\"87598\",\"2011\":\"4874\"}]"}
All my schemas, model and structure of json response are the same.
Please someone help me
In the second case you have quotes before the array of element { "readexcelbyteResult":"[ , that makes the system understand it as string and not as an array of data. Also, all the elements seems to have an extra escape character before the quotes \"IFRS\":\"Volume\" should be: "IFRS":"Volume"
So, it should looks like:
{"readexcelbyteResult":[{"IFRS":"Volume","2001":"645645","2002":"875","2003":"8598","2004":"6986","2005":"98698","2006":"698698","2007":"6989698","2008":"57487","2009":"487487","2010":"4875","2011":"458"},{"IFRS":"ipsum","2001":"456456","2002":"6986","2003":"98698","2004":"6986","2005":"986","2006":"98698","2007":"698698","2008":"6986","2009":"98698","2010":"69860606","2011":"9860"},{"IFRS":"dolor ","2001":"366397","2002":"4364","2003":"98308","2004":"467","2005":"4086","2006":"40874","2007":"6487","2008":"4984","2009":"8749","2010":"87598","2011":"4874"}, {"IFRS":"amet","2001":"646456","2002":"875","2003":"8598","2004":"6986","2005":"98698","2006":"698698","2007":"6989698","2008":"57487","2009":"487487","2010":"4875","2011":"458"},{"IFRS":"consectetuer ","2001":"645645","2002":"6986","2003":"98698","2004":"6986","2005":"986","2006":"98698","2007":"698698","2008":"6986","2009":"98698","2010":"69860606","2011":"9860"},{"IFRS":"adipiscing ","2001":"536397","2002":"4364","2003":"98308","2004":"467","2005":"4086","2006":"40874","2007":"6487","2008":"4984","2009":"8749","2010":"87598","2011":"4874"},{"IFRS":"Maecenas ","2001":"456456","2002":"875","2003":"8598","2004":"6986","2005":"98698","2006":"698698","2007":"6989698","2008":"57487","2009":"487487","2010":"4875","2011":"458"},{"IFRS":"porttitor ","2001":"564564","2002":"6986","2003":"98698","2004":"6986","2005":"986","2006":"98698","2007":"698698","2008":"6986","2009":"98698","2010":"69860606","2011":"9860"},{"IFRS":"congue ","2001":"366397","2002":"4364","2003":"98308","2004":"467","2005":"4086","2006":"40874","2007":"6487","2008":"4984","2009":"8749","2010":"87598","2011":"4874"}]}

Replace custom tags with html using preg_replace_callback

Am trying to do a replacement of customized tags with html tags in my website as follows:
[block-2] "Donec volutpat nibh sit amet libero ornare non laoreet arcu luctus. Donec id arcu quis mauris". [/block-2]
If the above [block] tag is encountered, it should be replaced by some html tags (using regexp), specifically:
<blockquote class="tm-style2"><span>
"Donec volutpat nibh sit amet libero ornare non laoreet arcu luctus. Donec id arcu quis mauris".
</span></blockquote>
I have tried the following but is not working. Please help:
$article_text = preg_replace_callback(
"(\[block-([0-9]+)\](.+)\[\/block-([0-9]+)\])",
create_function('$p','return "<blockquote class=\"tm-style".$p[1]."\"><span>".$p[2]."</span></blockquote>";'), $article_text);
You don't actually need to use preg_replace_callback function, just preg_replace would be fine.
\[(block-([0-9]+))\](.+?)\[\/\1\]
Then replace the matched characters with
<blockquote class="tm-style\2"><span>\n\3\n</span></blockquote>
DEMO
$re = "~\\[(block-([0-9]+))\\](.+?)\\[\\/\\1\\]~m";
$str = "[block-2] \"Donec volutpat nibh sit amet libero ornare non laoreet arcu luctus. Donec id arcu quis mauris\". [/block-2]";
$subst = '<blockquote class="tm-style\2"><span>'."\n".'\3'."\n".'</span></blockquote>';
$result = preg_replace($re, $subst, $str);
echo $result;
Output:
<blockquote class="tm-style2"><span>
"Donec volutpat nibh sit amet libero ornare non laoreet arcu luctus. Donec id arcu quis mauris".
</span></blockquote>
You need to escape closing tag's backslash in your pattern ...[\/block....
So full pattern is (\[block-([0-9]+)\](.+)\[\/block-([0-9]+)\])

How to insert a piece of HTML code in xml Word document (and not die trying)

this is the scenario
I have a Word document ( .docx ) which i want to convert in a template, saving it as a "XML Word 2003" file. Inside the document content, i put a custom tag named {MY_CONTENT} which will be replaced with HTML code.
When I generate a word document like this, it didn't open properly. This is the HTML code i'm trying to insert into the Word Xml document:
<div style='text-align: center;'>
<b><font size='3'>Contract</font></b>
</div>
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin quis justo elementum,
vehicula ante vel, facilisis ante. Aenean dolor lectus, cursus in mattis sed, ullamcorper ut quam.
Quisque fringilla erat sit amet blandit euismod. Integer nec odio vel erat molestie fringilla.
Aliquam tempor ac urna vitae convallis. Praesent mattis massa eget lectus mattis,
non imperdiet ipsum suscipit. Phasellus gravida eros turpis, et faucibus libero gravida
non.
Aliquam ultricies nisl eget magna tincidunt tincidunt. Proin feugiat interdum nibh nec rutrum.
In hac habitasse platea dictumst. Etiam ac condimentum nisl, et volutpat mauris.
Mauris erat dui, aliquam ut urna vel, euismod placerat est.
<font size='3'></font>
</div>
I tried to "htmlencode" the html code above, but still the document is not opened property.
If it was possible to "traslate" a HTML piece of code into Word xml tags, i think it could be resolved.
... or is there a way to display the html code into the word xml document, without converting it or applying sorcery ?
Thanx in advance.
Thanx for your kind comments. I stored them in my PKDB ( personal knowledge database ) :) for further uses.
Finally, I decided to use ITEXTSHARP library to generate the document, because it gives me the tools to insert HTML code without formatting isues.
I inserted an image template as background, wrote the HTML code, and that's all.
Hope this piece of code to be useful for any person
This is the code
string pathImagenPlantilla = Server.MapPath(<path_of_the_image_template>);
//generar el pdf al vuelo
string filenamePDF = "Your_Document_Name.pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=" + filenamePDF);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
//load the image template
iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(pathImagenPlantilla);
//define your HTML code
StringBuilder strTextoHTML = new StringBuilder();
strTextoHTML.Append("<html>");
strTextoHTML.Append("<body>");
strTextoHTML.Append(<your HTML CODE right here>);
strTextoHTML.Append("</body>");
strTextoHTML.Append("</html>");
// margins, in milimeters
float margenIzquierdo = 25;
float margenDerecho = 25 ;
float margenSuperior = 25 ;
float margenInferior = 10 ;
Document pdfDoc = new Document(PageSize.A4, margenIzquierdo, margenDerecho, margenSuperior, margenInferior);
//Adjust the size of image template , to the screen size
float pageWidth = pdfDoc.PageSize.Width - (margenIzquierdo + margenDerecho);
float pageHeight = pdfDoc.PageSize.Height - (margenInferior + margenSuperior);
jpg.SetAbsolutePosition(margenIzquierdo, margenInferior);
jpg.ScaleToFit(pageWidth, pageHeight);
//If you want to choose image as background then,
jpg.Alignment = iTextSharp.text.Image.UNDERLYING;
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
pdfDoc.NewPage();
//add image template
pdfDoc.Add(jpg);
//add html code
foreach (IElement E in HTMLWorker.ParseToList(new StringReader(strTextoHTML.ToString()), new StyleSheet()))
{
pdfDoc.Add(E);
}
//close doc and display/download
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
Regards,

Rails simple_format and display of 'Read More' link inline with text

Should have been very easy but somehow cannot get it to work. I want to display truncated text on my blog home page with a 'read more' link that shows up inline with the text i.e.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ac tortor et felis aliquet vestibulum sed in sem. Aliquam pharetra ultricies nunc, non pellentesque ... Read More
Since I use simple_format for my text, all breaks in the text get wrapped in tags and I get Read More in a separate line as below
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ac tortor et felis aliquet vestibulum sed in sem. Aliquam pharetra ultricies nunc, non pellentesque ...
Read More
How do I place it inline after a < p > tag. Guess it's more of a CSS question rather than a Rails one. Again, I feel this should be super simple. What am I forgetting?
Here's the code snippet in the view
<%= simple_format truncate(h(feed.description), length: 400, separator: ' ') %><%= link_to "Read More", feed_path(feed)%>
I suspect that you can just put your link inside the simple_format content-parameter link this:
<%= simple_format truncate((h(feed.description) + link_to("Read More", feed_path(feed))), length: 400, separator: ' ') %>
(Note: not tested)