How can I make a grid of content in Pelican? - pelican

I am trying to use Pelican to generate a static webpage that would have rows of content.
I want it to look something like this (WIP)
Currently I have just manually created the necessary HTML.
How could I have a single content file that would generate this page ?

Pelican uses the Jinja template system, so the first step is to create your own theme, putting your existing HTML structure into the base.html template. You'll likely want to customize your page.html template as well.
Once your theme's templates are customized to your liking, you can then create pages in any of the formats that Pelican supports: Markdown, reStructuredText, and Asciidoc. It's not always easy to use these markup formats to get precisely the HTML you want, so you might start with Markdown, since that format allows you to put HTML directly inside your content.

To make a table grid in Markdown-formatted file, add the Pelican just_table plugin.
If your existing PLUGINS is defined to something like:
PLUGINS = ['sitemap', 'code_include', 'tag_cloud']
just add , 'just_table' to PLUGINS set to make a:
PLUGINS = ['sitemap', 'code_include', 'tag_cloud', 'just_table']
and in creating your first Markdown text file named my-first-grid-table.md, take your CSV-formatted content and wrap it with [jtable]/[/jtable] tags. Such working example is:
Title: My first grid table
Date: 2018-11-06 11:00
Tags: grid, table
Category: blog
My grid looks like:
[jtable]
Name, Age, Description
John, 40, Cantankerous
Jill, 35, Bruised from tumbling down the hill
Basket, 120, an inanimated object
[/jtable]

Related

IntelliJ Live Template groovy script cut'n paste from clipboard

I know this can be done because I've done it before but can't remember how.
You create a live template in IntelliJ and you set a variable called $GROOVY$ which takes the output of this expression:
groovyScript([Some file path])
Then you write a Groovy script at the file path in question. The idea is that I'm going to copy some Ivy style dependencies and then paste them as maven style dependencies such that colon separated Ivy specs become XML maven when I paste them.
Specifically what I cannot remember is how to get the live template to pull content from the clipboard.
I'm not sure that I completely follow what you are trying to do but I think the crux of it is this:
how to get the live template to pull content from the clipboard.
You can do this by defining a parameter named, for example, $clipboard$ and then associating this variable with the Live Template method: clipboard().
For example, given the following live template:
// Here are the contents of the $clipboard$
With this value in the system clipboard:
foobarbas
Then engaging the live template will result in the following ouput:
// Here are the contents of the foobarbas
Here are some screenshots showing it in action:
Define the live template:
Use the template:
Here's the result:
groovyScript("return _1.replace(\"-\", \".\")", clipboard())
Pull data from example-clipboard-body to example.clipboard.body.

Netsuite PDF Templating: get number of pages as attribute

I am templating pdfs in Netsuite using freemarker and I want to display the footer only on the last page. I have been doing some research, but couldn't find a solution (since looks like the environment does not allow me to include or import libs), so I thought that just comparing the number of the page with the total pages in an if tag would be a nice and easy workaround. I already know how to display the numbers by using the <pagenumber/> and <totalpages/> tags, but still cannot get them as values so I can use them like this:
<#if (pagenumber == totalpages) >
... footer html...
</#if>
Any ideas of how or where can I get those values from?
The approach you are trying won't work, because you are mixing BFO and Freemarker syntax. Netsuite uses two different "engines" to process PDF Templates. The first step is Freemarker, which merges the record fields with your template and produces an XML file, which is then converted by BFO into a PDF file. The <totalpages/> element is meaningless to Freemarker, as it is only converted into a number by BFO later.
Unfortunately, the ability to add a footer to only the last page of a document is currently a limitation of BFO, as per the BFO FAQ:
At the moment we do not have a facility for explicitly assigning a
footer or header to the last page in a document when the number of
pages is unknown.
You CAN add it after a page break - and put the page break at the end of the body
<pbr footer="nlfooter" footer-height="25%"></pbr>
</body>
The issue here is - on a one page output - you will get 2 pages minimum... it will always ADD a page for the disclaimer / footer...

PHPExcel write html file into existing xlsx file

I have a template file that I fill using PHPExcel. But I have terms and conditions that are saved in database with html tags and inline css. Now these terms and conditions are subject to change so I cant put it into template. So only solution is t take it from database and put it inside created template but I have no clue how to open xlsx file and insert .html file inside it perhaps as second sheet.
This is my current code:
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save($outputFileName);
And of course there is lot of code that specifically deal with writing data to excel file but that is working perfectly.
Could someone please explain how could I go about doing it.
Thanks
You can't simply insert an HTML file inside an xlsx file
The latest develop branch of PHPExcel does include an HTML to Rich Text wizard that will take a block of HTML markup and convert it to a Rich Text object that can then be stored in a cell, and /Examples/42richText.php demonstrates how it can be used. At present, this only covers basic markup tags (<br />, <font>, <b>, <i>, <em>, <strong>, <sub>, <sup>, <ins>, <del>, etc) and doesn't handle inline style in any way. However, it might provide the basis for what you want with some additional work.

Impresspages - set meta title/description from plugin's PublicController?

Is there any way to set page-specific attributes for plugin in PublicController, like seo meta tags (title, description, keywords) or push it to breadcrumbs? I figured that I can easily set layout file for plugin, but can't go any deeper.
If you return an \Ip\Response\Layout object in your controller, you can use methods like ->setKeywords(), ->setDescription() ...
If you simply return a string leaving the layout to be generated by ImpressPages, you can add a filter which would add required meta information before outputing it. Here is an example that sets favicon https://github.com/impresspages-plugins/Favicon/blob/master/Filter.php

prestashop mail customisation, and module translation

i have two question
1 - i installed referral program module , and i would like to customise the referralprogram-invitation.html mail template
so i putted the new template under : prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but i doesn't work !
2 - i would like to add some extra text to the program page of referral program module
so i copied the file already included with the module under
prestashop_root/themes/my_theme/modules/referralprogram/translations/fr.php and I added the new text translation in this form
$_MODULE['<{referralprogram}prestashop>program_MD5'] = 'new text';
and it does not work?!!
You only forgot the language folder. Your mail templates must not be in :
prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but in
prestashop_root/themes/my_theme/modules/referralprogram/mails/fr/referralprogram-invitation.html
If you want to add text to the program page, you must:
First, make a copy of the file : prestashop_root/modules/referralprogram/views/templates/front/program.tpl to prestashop_root/themes/my_theme/modules/referralprogram/views/templates/front/program.tpl
Then, you need to modify this file and add the text you want, where you want. To be translatable, your text must be added like this {l s='new text' mod='referralprogram'}.
Finally, you need to translate this text via the Localization > Traductions page of your BO and not directly in the fr.php file.
Do not hesitate if you need more information,
Paul.