How to disable header on frontpage of rst2pdf document? - restructuredtext

I am generating some PDF's and I would like to disable the header on the frontpage. I know there are built-in templates in rst2pdf and one template is called coverPage but I don't seem to be able to get it to work.
The manual is saying you should use a
..raw:: pdf
PageBreak coverPage
statement but that will insert a empty before the coverpage, so how can I have a coverpage without a header and without using the oddeven directive (I want to use the same header on all remaining pages).
Thanks for your suggestions!

That's how you change the stylesheet after the cover page. You'll need to create a custom stylesheet that specifies what is the format of the first page and then change the style for the rest of document. Have a look at chapter 15 of the manual.

Note: current accepted answer contains broken link (linked website has gone).
The correct answer is simple:
1) In you style-file define:
pageSetup:
firstTemplate: coverPage
2) Then in your template, when you want to start using header/footer add:
..raw:: pdf
PageBreak cutePage
Make sure cutePage has set header/footer to true.

Related

In RMarkdown Word document, how to make table of contents appear later

When an RMarkdown document is knit to Word, the Table of Contents (if there is one) always appears at the beginning of the document. If I want to, say, make the Table of Contents appear on the second page of the document, how do I do so?
If I was knitting to HTML I could use this method, but it doesn't seem to work for Word. Meaning, I create a Word template to be used in the reference_docx YAML argument and put the Table of Contents at the bottom of this template, but when I knit a report the Table of Contents appears at the front of the document.
Preferably, I'd like to use a solution that doesn't rely on VBA/VBS and instead uses RMarkdown and (if necessary) a reference_docx file only.
As explained here, based on this and this, you could change the style of the date in the Word document to add a page break after it.
Of course, that only separates the title page from the table of contents and if you want to insert other pages between those two, it wouldn't work.
But at least that's an idea to start from.
I've just been playing around with this issue myself. Unfortunately, I don't think Word allows you to modify a style to insert a break after a style, only before.
However, the TOC header is a style that is created when a TOC is included and can be modified. If you change the TOC header style to include a page break before, save this as your reference style document and run it forces the TOC onto a new page when knit.
As #Ben notes though this only allow you to move the TOC off the title page, not insert it where you want within the document.
I was searching for a solution to this today and came across Garrick Aden‑Buie's blog post and render_toc() function.
Full details of which can be found here or his gist
This function allowed me to move the TOC later in to the document.

Preserve original website formatting inside ckeditor?

I'm trying to do a simple wysiwyg editor and I am trying to edit this page.
I inserted that code into my editor and included the original css file from the website, yet it seems like ckeditor is putting its own tags around the overall content which breaks the original design. Is there a simple way to overcome this?
Thanks
Inline editing is what you want to do there. Simply render the website (component) in your admin panel, using your default, frontend styles and create inline editors for all editable fields. Finally serialize contents of editors.
CKEditor uses CSS from ckeditor/contents.css - you have to add your CSS there.
Your file is visible at http://makehugeprofit.com/editor/ckeditor/contents.css?t=E0LB and as you can see, it doesn't contain much. How did do "included the original css file from the website"? Merge it with contents.css and you'll have greater luck.
The editable area is an iframe and thus not in the same CSS space as your surrounding site.

Parsing page data into sidebar - wordpress

What would be the proper procedure for accessing the current page html data and picking up all of a certain tag and throwing them into the sidebar as links?
I'm not sure your proficiency with php, but I'll give you and overview of what you'd probably want to do.
First, you need the HTML. I'm assuming you're running this on a page (in a page.php file or single.php file, or similar), this means that you have access to the global variable $post, which contains the html of the page in it. To access it you can use the helper function get_the_content(), this returns the html being displayed.
Next you need to parse through this to get the h2 tags. A simple regex can handle this, something like <h2[^>]*>(.*)</h2>. It's important to remember that this regex is very picky, so format your html correctly, no multiline h2s.
So now you have the html, and have parsed it with a regex to get the h2s. Now you need to generate the list from the results, and prepend it to the top of the content of the page. There are a ton of ways to do this, the easiest being just running the code in the right spot in the template file.
Of course there are probably better ways of doing this, I'd recommend you look at say a FAQ plugin (if that's what this is for), or do the lists manually (as this system can be broken), or possibly use a custom post type; but for your question, that's how I'd do it.

How not to inherit format when pasting into CKEditor?

Problem: When a user copies a load of code from another website and pastes it into CKEditor it includes a load of inline styles which refer to the style of the content on the website it was copied from. When the pasted content is then saved and shown on my website it doesn't use my styles but the copied inline ones which conflict.
I've had a look through the CKEditor documentation, and to be honest I don't find the documentation to narrow down to what I'm looking for. There is a paste function available which removes formatting but this is an optional button in the menu, whereas most users will just post into the main large area, so its pretty worthless.
Main Question: is there a way to set CKEditor to strip formatting when pasting?
Ah, I found the answer:
// Apply editor instance settings.
CKEDITOR.config.forcePasteAsPlainText = true;

Appending header and footer to pdf add on in Plone

I am using the aws.pdfbook add on in plone. This add on uses htmldoc and converts a page to pdf which can be printed or downloaded. I would like to append a header and a footer to the pdf-ed content. How can i do this?. I am fairly new to plone and do not know where the code for add ons is stored. I would also be grateful if anyone can give me the code to append a header and a footer to the pdf. I am using plone 4.2 on a linux box.Thanks.
Fixed. This is quite straightforward. Go to ZMI> portal_view_customizations> printlayout (aws.pdfbook.interfaces.IAWSPDFBOOKLayer) and add the header in tag.
Well, you could actually check the HTMLDOC documentation yourself.
Headers and Footers are configurable using HTML comments.
Since aws.pdfbook uses custom templates per content-types
https://svn.plone.org/svn/collective/aws.pdfbook/trunk/aws/pdfbook/browser/templates/
you should be able to customize the related template by using z3c.jbot inside your own policy package in order to override one of these templates.

Resources