Code block from file in GitPitch - github

There are two ways to insert code blocks from file In GitPitch: Code Delimiter Slide and GIST Delimiter slide (source: https://github.com/gitpitch/gitpitch/wiki/Code-Presenting). Both of them create a new slide with a code block at the top. Is there a way to insert code from source file making slide more flexible i.e. add some title or another content before the code block? Or it was designed following security reasons?

You have asked a number of questions here so I will try to answer each of them in turn.
Is there a way to insert code from source file making slide more flexible i.e. add some title
Absolutely. You can specify a title parameter on your code or gist delimiter and that title text will automatically be rendered directly above the code in your slide.
Here is an example of how to do that using a GIST delimiter:
---?gist=onetapbeyond/494e0fecaf0d6a2aa2acadfb8eb9d6e8&lang=Scala&title=Scala Snippet
You can use this exact same approach to inject some title text using a CODE delimiter.
Is there a way to insert code from source file making slide more flexible i.e. ...or another content before
While you can use the title parameter as just described to inject some title text before your code block, on CODE and GIST delimiter slides you can not add any other content before the code block.
However, you can add any content you want on a CODE or GIST delimiter slide using just regular markdown like you would on any slide following the slide delimiter in your PITCHME.md.
It is also probably worth pointing out for completeness sake that you can also use GitPitch code-presenting with annotations as a way to add content to your slide. Your annotations will be directly injected onto your slide immediate following your code block.
Finally, to your last question:
Or it was designed following security reasons?
No. As you can see above you can add limited content above (titles) and arbitrary content after your CODE or GIST delimiter code blocks.
You can check out the example Let Your GISTs Do The Talking GitPitch presentation to see these features in action. As with every GitPitch, the markdown source is in the corresponding Git repo.
Thanks for asking this question. I realize that I need to update the Wiki to document the use of the title parameter on these delimiters.

Related

How can I have a code block with a vertical scrolling feature in the Markdown on GitHub?

I'm dealing with one issue on GitHub and for that, the moderator is requesting me to share the output of certain bash commands in the comments. I'm sharing the output of requested commands in the form of code blocks and I know how to insert code block in Markdown:
The output of the command
.
.
.
However, the problem with the above syntax is that if the command output has let say 500 lines then it will display all the 500 lines in the Markdown output. In fact, there total of 3 such long code blocks in my comment. Because of that, code blocks consume a significant amount of space in my comment and my comment seems too long.
So, is there any way that my code block would display only a limited number of lines with a scrolling feature specific to that block only e.g. it should display only 10 lines, and for the rest of the lines, it should have vertical scrolling. Through this, my comment won't seem too long and the moderator would also be to focus on other non-command text (i.e. content other than code blocks) in my comment.
GitHub Flavored Markdown allows you to use html tags. So you can use details html block to hide your long code.
<details>
<summary>
summary
</summary>
details
</details>
It looks like this collapsed:
and expanded:

Page numbers in scribble/acmart

I'm creating a pdf with the scribble/acmart language. How can I add page numbers to my document?
Make a LaTeX file with the line \settopmatter{printfolios=true}
If the file is named texstyle.tex, invoke Scribble with the command:
scribble ++style texstyle.tex --pdf FILE.scrbl
The rendered FILE.pdf should have line numbers.
(If you already had a ++style file, just add the \settopmatter line to that.)
The solution Ben gave is one way. But you can actually do this without modifying your texstyle.tex file.
If you add the following lines to your document, the appropriate topmatter will be added to your pdf file:
#para[#:style 'pretitle]{
#elem[#:style "settopmatter"]{
printfolios=true}}
You can see it doing this by running:
> scribble --latex myfile.scrbl
If you do this, you will notice the following line in your pdf file:
\settopmatter{printfolios=true}\titleAndVersionAndAuthors{Hello}{6.9.0.4}{\SNumberOfAuthors{1}\SAuthor{World}}
(Where Hello and World is the name and author of your paper, and the \title... macro runs \maketitle.)
This works because the 'pretitle style (when given to a paragraph), pulls its entire body above the title.
And whenever a string is given as the style for an element, it maps to the a latex command.
That is, this scribble code:
#elem[#:style "mycommand"]{Thebody}
Maps to:
\mycommand{Thebody}
The result of composing these two forms together is to drag this to the top of the file.
And because you've done this in scribble rather than latex, you can use Racket's semantics to add page numbers. For example, if you use your own #lang, you can now have the language decide whether or not you want pages.

Generate link to table of contents from a headline in Org

When I export my org file to HTML, it generates a table of contents from my headlines. However, I want every headline to have a link back to its entry in the table of content. Is there a way to do this?
I found the answer here: http://lists.gnu.org/archive/html/emacs-orgmode/2014-01/msg00028.html
I realized what I need is a floating table of content. And worg.css provides just that: http://orgmode.org/worg/style/worg.css
This is an awesome CSS.

Is there an option to control output page orientation (using knitr->pander->pandoc->docx)

I am playing with Tal's intro to producing word tables with as little overhead as possible in real world situations. (Please see for reproducible examples there - Thanks, Tal!) In real application, tables are to wide to print them on a portrait-oriented page, but you might not want to split them.
Sorry if I have overlooked this in the pandoc or pander documentation, but how do I control page orientation (portrait/landscape) when writing from R to a Word .docx file?
I maybe should add tat I started using knitr+markdown, and I am not yet familiar with LaTex syntax. But I'm trying to pick up as much as possible while getting my stuff done.
I am pretty sure the docx writer has no section breaks implemented, also as far as I understand --reference-docx allows for customizing styles and not the page layout (but I might also be wrong here), this is from pandocs guide on --reference-docx:
--reference-docx=FILE
Use the specified file as a style reference in producing a docx file.
For best results, the reference docx should be a modified version of a
docx file produced using pandoc. The contents of the reference docx
are ignored, but its stylesheets are used in the new docx. If no
reference docx is specified on the command line, pandoc will look for
a file reference.docx in the user data directory (see --data-dir). If
this is not found either, sensible defaults will be used. The
following styles are used by pandoc: [paragraph] Normal, Title,
Authors, Date, Heading 1, Heading 2, Heading 3, Heading 4, Heading 5,
Block Quote, Definition Term, Definition, Body Text, Table Caption,
Image Caption; [character] Default Paragraph Font, Body Text Char,
Verbatim Char, Footnote Ref, Link.
Which are styles that are saved in the /word/styles.xml component of the docx document.
The page layout on the other hand is saved in the /word/document.xml component in the <w:sectPr> tag, but pandoc's docx writer ignores this part as far as I can tell.
The docx writer builds by default a continuous document, with elements such as headers, paragraphs, simple tables and so on ... much like a html output.
Option #1 (doesn't solve the page orientation problem):
The only page layout option that you can define through styles is the pageBreakBefore which will add a page break before a certain style
Option #2 (seems elegant but hasn't been tested):
Recently the custom writer has been added that allows for a custom lua script, where you should be able to define how certain Pandoc blocks will be written into the output file ... meaning you could potentially define section breaks and page layout for a specific block inserting the sectPr tag into the document. I haven't tried this out but it would be worth investigating. On pandoc github you can check out a sample lua script file for custom html output.
However, this means, you have to have lua installed, learn the language, and it is up to you if you think its worth the time investment.
Optin #3 (a couple of clicks in Word might just do):
As you will probably spend quite some time setting up how to insert sections and what would be the right size, margins, and figuring how to fit the table to such a layout ... I recommend that you use pandoc to put write your document.docx, that you open in Word, and do the layout by hand:
select the table you want on the landscape page
go to Layout > Margins
> select Apply to: Selected text
> choose Page Setup > select Landscape
Now a new section with a landscape orientation should surround your table.
What you would anyway also probably want to do is styling the table and table caption a little (font-size,...), to achieve the best result (all text styling can be already applied with pandoc where --reference-docx comes handy).
Option #4 (in situation when you can just use pdf instead of docx):
As far as I could figure out is that with pandoc does a good job with tables in md -> docx (alignment, style, ... ), in tex -> docx it had some trouble sometimes. However if your option allows for a pdf output latex will be your greatest friend. For example your problem is solved as easily as just using
\usepackage{pdflscape}
and adding this around your table
\begin{landscape}
...
\end{landscape}
This are the options that I could think of so far.
I would always recommend using the pdf format for reports, as you can style it to your liking with latex and the layout will stay the way you want it to be.
However, I also know that for various reasons word documents are still the main way of reviewing manuscripts in many fields ... so i would most likely just go with my suggested option 3, mostly cause it is a lazy and quick solution and because I usually don't have many documents with tons of giant tables with awkward placement and styling.
Good luck ;-)
Based on Taleb's answer here and some officer package functions, I created a little gist that one can use like this:
---
title: "Example"
author: "Dan Chaltiel"
output:
word_document:
pandoc_args:
'--lua-filter=page-break.lua'
---
I'm in portrait
\endLandscape
I'm in landscape
\endPortrait
I'm in portrait again
With page-breaks.lua being the file hosted here: https://gist.github.com/DanChaltiel/e7505e62341093cfdc489265963b6c8f
This is far from perfect (for instance it won't work without the last portrait section), but it is quite useful sometimes.

OO:Doc -perl module for Openoffic

I want to automate some writer tasks. I need to create a .odt writer
document with oo:doc using methods such as create paragraph and append
paragraph. The problem is that append paragraph and create paragraph does not
allow text to start at middle of page or at a certain column, ie
Name Surname Address
When I unzip the "master" document I want to to create, when I inspect the content.xml file i see the xml equivalent is
" <text:p text:style-name="Text_20_body"><text:s text:c="115"/><text:span text:style-name="T1"><text:s/>Hallo how are you today</text:span></text:p><text:p text:style-name="P1"><text:s text:c="116"/>I hope you are well also</text:p><text:p text:style-name="P1""
How do I set the text:c and text:s element(s) from within oo::doc
Question2:
How do i set the formatting of a paragraph
to only extend from ie column 20 to column 80
thanks
Those elements are for runs of non-breaking spaces. the text:c attribute says how many spaces there are.
That doesn't strike me as a solution to what you want, which is to change the margins and position of a paragraph, yes?
Do you have a document that you want to use as a template, where the text will be inserted? Or ar you trying to create the entire page from scratch?
I think you want to use OpenOffice.org to create a Writer document that has the structure you want, then look at the XML to see what the markup is that accomplishes that. Look at paragraph-level styles or even frames if that is what is used. You might be able to create insertion points for your generated content by then adding magic-text phrases that you can scan for.
Then figure out how to get that done with the perl module.