pandoc | How to convert nested tables? | longtable vs tabular - pandoc

I’ve successfully converted Jupyter HTML-format simple tables to LaTex-format tables using pandoc.read(raw.text, ‘html’).blocks in a lua filter. The resulting LaTex is \begin(longtable} … That’s okay for simple tables, but longtable does not support nested tables, which I do need.
How to convert to LaTex tabular tables (which support nested tables) rather than to longtable tables (which do not)? Or is there some other solution to converting nested tables?

I've come to better overall solution. Rather than have pandoc convert HTML tables to LaTex tables, I've coded the tables in both HTML and LaTex format within the Jupyter notebook. The HTML representation will be rendered when running Jupyter; the LaTex representation will be copied as-is by pandoc when converting from Jupyter-format to LaTeX format.
x = data.frame(a=c(1,2,3), b=c(10,20,30), c=c(100,200,300))
x.html = kable(x, format=“html”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from HTML”, row.names=FALSE, table.attr=“style="white-space: nowrap;"”)
x.latex = kable_styling(latex_options=c(“hold_position”),
kable(x, format=“latex”, escape=FALSE, align=rep(“r”, ncol(x)), caption=“This is from LaTex”, row.names=FALSE))
mbx = list(data=list(“text/html”=as.character(x.html), “text/latex”=as.character(x.latex)), metadata=NULL)
publish_mimebundle(mbx$data, mbx$metadata)

Related

SSAS Appending Queries

I would like to add a table to my SSAS model by appending two excel tables/sheets.
Import
Appended
Result
Doing this adds the three tables as Expressions and the two tables I wanted to be appended, not the appended table to my model.
I know I can append them using UNION and avoid the problem, I was just hoping someone could explain what's happening and how I can use expressions instead (if possible). Power Query in Excel and Power BI behave differently because there I can hide the two appended tables in the editor and the appended will be added to the model.
Thanks in advance,
Anders

Trouble converting yaml file to toml file

I am trying to convert a yaml file into a toml file in python3.
My plan is to use toml.dumps() which expects a dictionary, then write to an output file.
I need to be able to match the input toml requirements for a tool that I need to plug into.
This tool expects inline tables at certain instances like this:
[states.Started]
outputs = { on = true, running = false }
[[states.Started.transitions]]
inputs = { go = true }
target = "Running"
I understand how to generate the tables [] and array of tables [[]] but I am having a hard time figuring out how to create the inline tables.
TOML documentation says that inline tables are the same as tables. So for example, with the array of tables above (states.Started.Transitions) I figured inputs would be a table within the overall list, however the TOML format will break it into separate tables at the output.
Can anyone help me figure out how to configure my dictionary to output the inline table?
EDIT***
I am not sure I fully understand what I am doing wrong. Here is my code
table = {'a':5,'b':3}
inline_table = toml.TomlDecoder().get_empty_inline_table()
inline_table['Values'] = table
encoder = toml.TomlPreserveInlineDictEncoder()
toml_config = toml.dumps(inline_table,encoder = encoder)
however this does not create an inline table, but a regular table in the output.
[Values]
a = 5
b = 3
This tool expects inline tables at certain instances like this
Then it is not a TOML tool. As you discovered yourself, inline tables are semantically equivalent to normal tables, so if the tool conforms to the TOML specification, it must not care whether the tables are inline or not. If it does, this is not a TOML question.
That being said, you can create the dicts that should become inline tables via
TomlDecoder().get_empty_inline_table()
The returned object is a dict subclass and can be used as such.
When you finished creating your structure, use TomlPreserveInlineDictEncoder for dumping and don't ask why this is suddenly called InlineDict instead of InlineTable.

Convert Oracle Standard Report output from text to excel

I have a user requirement to convert oracle standard report (Transaction Historical Summary)'s output into Excel
I have tried to change output to xml to get the xml tags so to make rdf but it ends in error.
What are the steps to convert a standard report's output to excel?
You'd use Report Builder's DESFORMAT=SPREADSHEET parameter; it works for Reports 10gR2 onwards.
Here's a tutorial which shows how to do that: "Building a Report for Spreadsheet Output" (https://docs.oracle.com/cd/B14099_19/bi.1012/b13895/orbr_paptoexcel.htm).
It doesn't make sense to copy/paste all those steps over here, so - have a look, follow the instructions.
If you're on lower version, you'd create a CSV (comma-separated-values) file (choose any delimiter you want, such as comma or semi-colon). Although it is not a XSL(X) file, Excel is capable of opening it nicely.

Insert image into a csv column ruby

I'm currently doing a crawler for a website, and my goal is to have a CSV, with a name in the first column and an image the second one, which is inserted with a Ruby script using the CSV#open method.
I have already used this method but I don't know, and I don't find information about the problematic that is to insert an image into a column.
Is it really possible? If not, which functionality would you use to have a list with string + image after crawling?
A CSV (Comma Separated Values) file is a TEXT file which as the name implies has various values separated by commas, expressed using plain ASCII, or sometimes unicode. It is intended as a light weight way to transfer tabular data between different computer systems or programs. You can use it to spit out a table in a database, or the VALUES in something like a spreadsheet. The normal convention is for the first row(line) of the file to contain names or labels that represent what that column contains, and then data in the subsequent rows.
As such, there really is no practical way to embed an image within a CSV file. This is not a limitation of Ruby or Watir, but a limitation of textfiles which spans pretty much all languages and operating systems.
To do what you want you would be better off to save the images into a specific directory using unique filenames and insert those filenames into the CSV file.

How to generate plain text reports with (fixed-width) tables

I'm looking to easily define forms with fixed-width output. Most of my forms end up looking something like this:
[title]
text
some more text
A B CDE E
-------------------------------
1 2 text text
3 4.50 text text
some more text
With all output being plain text.
Since there are many different (and yet similar) forms, I'd like to use a templating engine with a simple interface for generating fixed-width textual tables. Are there engines which support easily creating such tables? Or perhaps other ways to generate such tables?

Resources