How to reformat asciidoc without breaking tables - vim

I am working on an asciidoc document with long lines and several tables, and I'd like to reformat the paragraphs to fit into 80 columns.
If I use Vim's formatting command, it breaks all asciidoc tables, because they exceed 80 columns as well.
Is there a tool that can reformat asciidoc?
What would be the best way to achive this?

Related

Create formatted excel file from PL/SQL

I'm trying to create excel file formatted like this:
I tried to use https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:769425837805, but it is good for putting ONLY simple table in report - I need data like Info1/2/3 etc.
I tried csv, sperated by ';', but that makes excel unformatted, and it is unreadable.
Any ideas?
PS If there is a way to paint cell - great, but if not - it isn't necessary.
PS2 2nd thought - column number in bottom part of raport varies between diffrent input data. So that makes tool from link useless
You might want to check out the following tzwo options:
Free as part the Alexandria tools: https://github.com/mortenbra/alexandria-plsql-utils/blob/master/ora/xlsx_builder_pkg.pkb
Commercial option: https://www.oraexcel.com

Delete column of data from MacVim

I downloaded geo data from a site that has them set up in text files. When I copy paste these files into excel, they show up in each individual column:
My main problem with excel is that it is very bad with large data. My data file is 100+ MB. Therefore, I use MacVim. MacVim shows the data like so:
How can I delete or even select a column of data using MacVim. Is there a way to distinguish columns using MacVim in the same way that excel distinguishes them?
Thank you, your help is much appreciated
There seems to be a nice library for dealing with csv files within vim at: https://github.com/chrisbra/csv.vim
I'd also suggest looking at the csvkit tools by Chris Groskopf:
https://csvkit.readthedocs.org/
Make the invisible tab character look like "| " using listchars setting. That way, it'll get easier to visually distinguish columns. Then, you can use blockwise visual mode to select columns. This may still not work in cases where the columns are not aligned correctly due to the length of text in previous cells. You can solve that by potentially replacing one tab by two tabs, but then you will see less data, obviously.
The columns are apparently TAB separated.
To delete the first column, you can :%s/\S*\t//
To delete the e. g. 4th column, you can :%s/\(\(\S*\t\)\{3}\)\S*\t*/\1/
To delete all but the e. g. 4th column, you can :%s/\(\S*\t\)\{3}\(\S*\).*/\2/
To delete all but the first column, you can :%s/\(\S*\).*/\1/

Batch replace using DXL in Lotus Notes Design elements or turn columns to shared columns?

I have a bunch of views that have a bunch of columns that I would like to turn into shared columns. I have noticed that I can edit the DXL and simply put the tag around the column. This works fine for one or two columns in one or two views but I have several columns to change over a couple of dozen views. I have Team Studio but it seems to be limited on the amount of text that can be but into the find and replace text fields.
Is there an existing utility that would let me turn a regular column into a shared column? Or at least batch mode change of a large amount of DXL text? I already figured that I might need to be creative in that I already have some views with shared columns and I would not want to put an extra set of sharedcolumn tags around those.
Although not a free tool, Ytria viewEZ does this (and more).

how to work with csv files in vim

I want csv file to be opened in vim in the same way it opens in microsoft office . Data should be in column format and commas should not be seen and its should be traversed easily. Is it possible in vim with help of any plug-ins?
I am probably a little bit later answering that question, but for completeness I'll answer anyway. I have made the csv plugin that should make it possible to do what you want.
Among others, it allows:
Display on which column the cursor is as well as number of columns
Search for text within a column using :SearchInColumn command
Highlight the column on which the cursor is using :HiColumn command
Visually arrange all columns using :ArrangeColumn command
Delete a Column using :DeleteColumn command
Display a vertical or horizontal header line using :Header or :VHeader command
Sort a Column using :Sort command
Copy Column to register using :Column command
Move a column behind another column using :MoveCol command
Calculate the Sum of all values within a column using :SumCol command (you can also define your own custom aggregate functions)
Move through the columns using the normal mode commands (W forwards, H backwards, K upwards, J downwards)
sets up a nice syntax highlighting, concealing the delimiter, if your Vim supports it
I've tried Christian's csv plugin, and it is useful for quick looks at csv files, especially when you need to look at many different files.
However, when I'm going to be looking at the same csv file more than a few times, I import the file into sqlite3, which makes further analysis much faster and easier to perform.
For instance, if my file looks like this:
file.csv:
field1name, field2name, field3name
field1data, field2data, field3data
field1data, field2data, field3data
I create a new sqlite db (from the command line):
commandprompt> sqlite3 mynew.db
Then create a table in the db to import the file into:
sqlite> create table mytable (field1name, field2name, field3name);
sqlite> .mode csv
sqlite> .headers ON
sqlite> .separator ,
sqlite> .import file.csv mytable
Now the new table 'mytable' contains the data from the file, but the first row is storing the header, which you don't typically want, so you need to delete it (use single quotes around the field value; if you use double quotes you'll delete all rows):
sqlite> delete from mytable where field1name = 'field1name';
Now you can easily look at the data, filter by complex formulas, sort by multiple fields, etc.
sqlite> select * from mytable limit 30;
(Sorry this turned into a sqlite tutorial but it seems like every time that I don't import into sqlite, I end up spending much more time using vim/less/grep/sort/cut than I would have had I just imported in the first place).
There's also exist rainbow_csv vim plugin. It will highlight csv/tsv file columns in different "rainbow" colors and will allow you to write SQL-like SELECT and UPDATE queries using Python or JavaScript expressions.
You probably want to look at sc as an alternative.. Have a look at this linux journal page
Here's some tips for working with CSV files in vim:
http://vim.wikia.com/wiki/Working_with_CSV_files
I'm not sure if there's a way to display it in columns, without commas, though the tips in that link allow vim to traverse and manipulate CSV very easily.
I use #chrisbra's plugin,
" depending on your package manager
dein#add('chrisbra/csv.vim')
and I add a quick command on page load;
could be risky on large records.
autocmd BufRead *.csv :%ArrangeColumn

Convert richtext strings to excel

I have a form that has TinyMCE for richtext formatting. All of our data is available to export as an HTML report, PDF Report, and Excel Spreadsheet (report).
The fields, that we allow richtext in, show up as the formatted values in both the HTML and PDF reports, but in Excel we show them as strings. For instance:
<b>this part is bold</b><br />line 2 here.
I need a way to make that show up as bold/line-break in excel rather then just showing that string, or at least a way to strip the HTML tags out of there and just show plain text (though I would really like to at least keep the line breaks). Is there some type of macro I can include in the excel download or some C++ program that can convert it or something?
Thanks for your time!
I've done something similar with PHPExcel
The trick is to take your formatted data and find a pattern. In your case, it would probably be table rows/table cells. Iterate through that structure setting the excel cell values as you go. For complex formatting you could fairly simply regex replace what is necessary to get formatted as you desire. The theory may sound a little complicated, but once you get down to it, it's only an hour or two's worth of work.
Certainly there are equivalent programs based on other server technologies. But this one has worked brilliantly for me over the years, and I trust it to work on sites for very big clients with crazy inbound traffic numbers...and it's never failed. It's the only reliable way I've found to write perfect, properly formatted Excel without requiring the user to jump through hoops to get a specific browser.

Resources