Two columns in leafpad or geany ??

Using applications, configuring, problems
Message
Author
User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#41 Post by fredx181 »

greengeek wrote:
fredx181 wrote:but I think an improvement would be to add 2 lines to the exported styled html after <table class=... so becomes:

Code: Select all

<table class="table table-striped table-bordered">
  <col width="50%">
  <col width="50%">
Then column width is 50/50
Where would i be putting this code please? I can't see an existing "<table class" definition anywhere.
cheers!
If you export to html from Dillinger and the markdown input is a table, then "<table class" should be there in the html output.

Fred

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#42 Post by greengeek »

Thanks Fred, it's finally getting into my head now. Interesting approach.

I tried using a split of 60% column width for "Work" and 40% for "Personal" and I am happy with that.

The issue I would like to get rid of is that the table structure allocates a single row for each item in the in,md file and this results in rows getting "vertically whitespaced" when the same row in the other corresponding column is wrapping several lines.

I think this is going to work best for me if i have only ONE data row - and accumulate my list items in that one row. This way i can have many items in col1 row1 and it will not affect col2 row1 wrapping (hope that makes sense... :? )

Do I somehow need to change the css style for the table, or do i simply restructure the in.md file wthout the pipe characters delimiting each line?

cheers!

EDIT It appears that in order to ensure that only one row exists - i need to have all "work" entries on one single line, then one pipe character, then all of the personal items on one single line.
This is somewhat tricky to type and irritating to read so I tried to use the enter key to make it more readable but that added line feeds that seemed to stuff up the markdown conversion. I need to find a way to format the list in a way that the necessary line breaks are respected correctly when assembled into the html table.
Attachments
css_style_output.jpg
(23.98 KiB) Downloaded 191 times
Last edited by greengeek on Fri 26 Apr 2019, 09:56, edited 4 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#43 Post by greengeek »

Hi Fred - i am just experimenting with formatting (thinking about how i might build a useable table from my work/personal lists) - and I wondered if you would have time to view the output of the following in.md file:

Code: Select all

# Header....

| Work     |  Personal           |
| :----------------|  :--------------- |
|1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10|A<br>B<br>C<br>D<br>E<br>F<br>G<br>
I was surprised at the different vertical positioning of the rows in the two columns. I expected col 1 and col 2 to align at row 1.

The rows are not even aligned on line boundaries ("half-stepped" instead)

Any thoughts??
Attachments
Halfstep_columns.jpg
(15.97 KiB) Downloaded 173 times
vertically_centralised_columns.jpg
(16.84 KiB) Downloaded 173 times

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#44 Post by fredx181 »

greengeek wrote:Hi Fred - i am just experimenting with formatting (thinking about how i might build a useable table from my work/personal lists) - and I wondered if you would have time to view the output of the following in.md file:

Code: Select all

# Header....

| Work     |  Personal           |
| :----------------|  :--------------- |
|1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>10|A<br>B<br>C<br>D<br>E<br>F<br>G<br>
I was surprised at the different vertical positioning of the rows in the two columns. I expected col 1 and col 2 to align at row 1.

The rows are not even aligned on line boundaries ("half-stepped" instead)

Any thoughts??
Hi greengeek, I tried that and my guess is (but I don't know much about markdown how exactly it works) that it may look like mutiple rows but in fact it's only one and markdown conversion to html just makes the text in the right hand column center vertically. (you get better view of that when exporting as styled html from Dillinger)
Nice, btw, that is possible to mix it with html code, I'v seen that before, but not the way you did.
Markdown has it's limitations, but maybe with some more experimenting you can make it work as desired.

Fred

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#45 Post by fredx181 »

Hi greengeek, here's another possible way using pure html (no markdown) as I think the "table" thing is not exactly what you want.
Inspired by proposed solution using <textarea> here (thanks 6502coder !):
http://murga-linux.com/puppy/viewtopic. ... 03#1023403
At top of script you can change the text to display for left and right column.
Running it will create out.html

Code: Select all

#!/bin/bash

# textarea for left column, edit as you wish
COLUMN1='
1) Long text: All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically.
2) Second line: Short text
3) Long text again: All on one line, wraps automatically. All on one line, wraps automatically All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically
4) Next line has no text:
5)
6) Hello World
'

# textarea for right column, edit as you wish
COLUMN2='
1) First line: Short text
2) Long text: All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically.
3) Third line: Short text
4) Next line has no text:
5) 
6) Long text again: All on one line, wraps automatically. All on one line, wraps automatically All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically
7) Hello World
'

# create out.html with textarea from COLUMN1 and COLUMN2
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<style>
textarea {
	width: 100%;
}
table {
  width: 100%;
  margin: 6px auto;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  padding: 4px;
  border: solid 1px #D2D5D8;
  text-align: center;
}
</style>
<body>
   
<table>
<tbody><tr>
    <th>Work</th>
    <th>Personal</th>
</tr>
<tr>
    <td><textarea cols="80" rows="50">
'"$COLUMN1"'

</textarea></td>
    <td><textarea cols="80" rows="50">
'"$COLUMN2"'

</textarea></td>
</tr>
</tbody></table>

</body></html>
' > out.html
EDIT: This one has some changes in the style, looks a bit better IMO.

Code: Select all

#!/bin/bash

# textarea for left column, edit as you wish
COLUMN1='
1) Long text: All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically.
2) Second line: Short text
3) Long text again: All on one line, wraps automatically. All on one line, wraps automatically All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically
4) Next line has no text:
5)
6) Hello World
'

# textarea for right column, edit as you wish
COLUMN2='
1) First line: Short text
2) Long text: All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically.
3) Third line: Short text
4) Next line has no text:
5)
6) Long text again: All on one line, wraps automatically. All on one line, wraps automatically All on one line, wraps automatically. All on one line, wraps automatically. All on one line, wraps automatically
7) Hello World
'

# create out.html with textarea from COLUMN1 and COLUMN2
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<style>
textarea {
font-family: Sans, sans-serif;
   width: 100%;
padding-left: 5px;
 padding-right: 5px; 
box-sizing: border-box;

}
table {
  width: 100%;
  table-layout: fixed;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  border: solid 1px #D2D5D8;
  text-align: center;
}
</style>
<body>
   
<table>
<tbody><tr>
    <th>Work</th>
    <th>Personal</th>
</tr>
<tr>
    <td><textarea cols="80" rows="50">
'"$COLUMN1"'

</textarea></td>
    <td><textarea cols="80" rows="50">
'"$COLUMN2"'

</textarea></td>
</tr>
</tbody></table>

</body></html>
' > out.html
Fred
Attachments
columns-html.png
(128.89 KiB) Downloaded 131 times

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#46 Post by wiak »

I suspect you can arrange JOEs editor to display two columns, but I'm not sure:

https://joe-editor.sourceforge.io/

Anyway, lots of editors of all kinds can be found at site I suggested here:

http://www.murga-linux.com/puppy/viewto ... 61#1026561

wiak

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#47 Post by musher0 »

wiak wrote:I suspect you can arrange JOEs editor to display two columns, but I'm not sure:(...)
wiak
Yep.

Two columns in the Joe Editor:

http://www.murga-linux.com/puppy/viewto ... &id=122995
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#48 Post by greengeek »

Sorry all, I'm getting a bit behind here. I will try to catch up. Some neat suggestions and i am keen to try them all.
cheers!

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#49 Post by greengeek »

fredx181 wrote: here's another possible way using pure html (no markdown) as I think the "table" thing is not exactly what you want.
Inspired by proposed solution using <textarea> here (thanks 6502coder !):
http://murga-linux.com/puppy/viewtopic. ... 03#1023403
At top of script you can change the text to display for left and right column.
Running it will create out.html
Thanks Fred and 6502, i gave this a try and it's pretty good. I tinkered around and made some changes - reduced pixel padding and changed table to "variable" and modified the ratio of "Work" width to "Personal" width to give more room for the work list.
(Also got rid of the "Work" and "Personal" headers as I don't really need them)

Here is the result:

Code: Select all

# create out.html with textarea from COLUMN1 and COLUMN2
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<style>
textarea {
   width: 100%;
}
table {
  width: 100%;
  margin: 1px auto;
  table-layout: variable;
}

table,
td,
th {
  border-collapse: collapse;
}

th,
td {
  text-align: center;
}
</style>
<body>
   
<table>
<tbody>
<tr>
    <td><textarea cols="80" rows="100">
'"$COLUMN1"'

</textarea></td>
    <td><textarea cols="60" rows="100">
'"$COLUMN2"'

</textarea></td>
</tr>
</tbody></table>

</body></html>
' > out.html
Attachments
Fred6502Mod.jpg
(30.42 KiB) Downloaded 273 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#50 Post by musher0 »

Hi greengeek.

You typed that in Firefox directly using fredx' template?
You didn't need an html editor?

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#51 Post by greengeek »

musher0 wrote:Hi greengeek.

You typed that in Firefox directly using fredx' template?
You didn't need an html editor?
Yes and No.

Yes - the template script is all that is required.

No - an HTML editor is not required. The script automatically builds the webpage with two columns, ready for the users typed information to be dumped into each column.

No - I did not type the list data into the columns. The script contains two "variables" eg: "COLUMN1" and "COLUMN2" which contain all of the text to be included in each column. At the moment Fred typed all that text into the script, but the intention seems to be that each working day I would type new data into the variables before running the script - and that would update the columns.
(EDIT - you can see that column data in Freds examples on previous pages but i left it out of the snippet in my previous post just to improve visual clarity of my script alterations)

However - I would think that the possibility exists for the script to 'reference' data from other files rather than me having to open the script and edit the data directly. So potentially I could have a "WorkToDo" text file, and also a "PersonalToDo" text file and the script would populate the two COLUMN variables with the contents of each file as appropriate.

The biggest issues I have with this html approach are:
- it's a bit longwinded (but i am sure that can be improved as i get used to it)
- when i print the list from the browser i seem to have inadequate control of margins which brings me back to my initial problem of trying to avoid wasted whitespace on my daily job sheet.

On the other side of the coin - the best part of the html approach is the portability - i should be able to view the list on all sorts of devices.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#52 Post by musher0 »

Thanks for the explanation, g\g.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#53 Post by fredx181 »

Hi greengeek, perhaps the most convenient is (instead of having to edit a script everytime) is to source a file on top of the script containing your notes, say create "/root/mynotes.txt" for example with contents:

Code: Select all

# mynotes.txt

# textarea for left column
COLUMN1='
1) Line 1
2) Line 2
3) Line 3
4) Line 4
5) Line 5
6) Line 6
'
# textarea for right column
COLUMN2='
1) Line 1
2) Line 2
3) Line 3
4) Line 4
5) Line 5
6) Line 6
7) Line 7
'
Then source it on top of script:

Code: Select all

# source /root/mynotes.txt to get the the COLUMN1 and COLUMN2 variables
. /root/mynotes.txt

# create out.html with textarea from COLUMN1 and COLUMN2
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
.....
.....
.....
' > out.html
Then just edit the mynotes.txt file, click on the script and done.

Fred

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#54 Post by greengeek »

fredx181 wrote:Then just edit the mynotes.txt file, click on the script and done.
I have decided to do it in a similar but slightly different way.

I will maintain my work list in a file such as ToDoWork.txt and my personal list in a file such as ToDoPersonal.txt - these will be simple leafpad files.

I have made a gtk gui which allows each of those files to be selected.

Then the user can save the html output as the default name (or they can modify the file name as desired).

The current date/time stamp is appended to the ToDo list html output file.

Remove the fake .gz suffix, make executable and click on the gui script.

Thanks all for the help!
(And please give me any other suggestions for ways to build a two pane ToDo list. cheers!)

EDIT : Newer version of this gui is available four posts further down
Attachments
ToDo_HTML_gui_gg-0.1.gz
*** Deprecated - Better to use version 0.2 further down the page ***
(3.5 KiB) Downloaded 83 times
gui_screenshot.jpg
(25.86 KiB) Downloaded 202 times
Last edited by greengeek on Sat 04 May 2019, 17:15, edited 4 times in total.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#55 Post by greengeek »

Oh darn. The html output does not respect the line feeds present in the leafpad files. More testing required.
(EDIT - converting the LF to CR/LF windows style seems to improve the problem. Don't like using windows syntax though :-( )

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#56 Post by MochiMoppel »

Recently Smithy has unearthed RtfEdit, a lightweight editor that should do what you want. When you activate the table tools from the toolbar menu you will be able to create a 2-column table. Text in each cell will be word wrapped within the cell without affecting other cell(s).
Attachments
RtfEdit.png
(26.74 KiB) Downloaded 217 times

User avatar
6502coder
Posts: 677
Joined: Mon 23 Mar 2009, 18:07
Location: Western United States

#57 Post by 6502coder »

greengeek wrote:Oh darn. The html output does not respect the line feeds present in the leafpad files. More testing required.
(EDIT - converting the LF to CR/LF windows style seems to improve the problem. Don't like using windows syntax though :-( )
In your script you have

Code: Select all

STARTTIME=$(echo `date +%Y-%m-%d_%H%M%S`)
#gxmessage "start time = $STARTTIME"

COLUMN1=$(echo `cat "$LEFTCOLUMNTEXTFILE"`)
COLUMN2=$(echo `cat "$RIGHTCOLUMNTEXTFILE"`)
Remove the echo stuff so it looks like

Code: Select all

STARTTIME=`date +%Y-%m-%d_%H%M%S`
#gxmessage "start time = $STARTTIME"

COLUMN1=`cat "$LEFTCOLUMNTEXTFILE"`
COLUMN2=`cat "$RIGHTCOLUMNTEXTFILE"`

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#58 Post by greengeek »

6502coder wrote:Remove the echo stuff so it looks like

Code: Select all

STARTTIME=`date +%Y-%m-%d_%H%M%S`
#gxmessage "start time = $STARTTIME"

COLUMN1=`cat "$LEFTCOLUMNTEXTFILE"`
COLUMN2=`cat "$RIGHTCOLUMNTEXTFILE"`
Thanks! Yes that corrected the misunderstandings around LF and CR/LF.
cheers!

Version 0.2
Remove fake .gz
Make executable
Click script.
Attachments
ToDo_HTML_gui_gg-0.2.gz
Remove fake .gz
Make executable
Click script.
(3.61 KiB) Downloaded 86 times
gui_2.jpg
(30.53 KiB) Downloaded 113 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#59 Post by musher0 »

Oh my God!

A dialog panel.
They're losing the subject of the thread!

Someone call the paramedics, quick!

:lol:
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#60 Post by greengeek »

MochiMoppel wrote:... RtfEdit, a lightweight editor that should do what you want. ... Text in each cell will be word wrapped within the cell without affecting other cell(s).
Thanks for the suggestion. I have trialled RTFed in the past but was concerned about its' level of readiness due to some program crashes ("invalid memory access") and the risk of incompatibility with other RTF capable word processors.

In your example above there is not actually a complete separation between the contents of each column - the text in one cell is vertically aligned to the centre of the text in the other cell. This is useable but it is irritating (especially when there is a large disparity between list length in column 1 versus column 2). However, in trying RTFed again I see that this problem can be eliminated by using the last icon in the table tools that you highlighted - that last icon allows the user to select text alignment in each cell, so if I set it to "Top" the lists start at the top of the cell which is helpful.

I used to be a big fan of RTF until i had major problems with incompatibilities between Abiword, Softmaker Office and other RTF readers struggling to read each others files. I feel inclined to avoid RTF mostly now.

RTFed seems to have similar compatibility issues.

If i create a file using RTFed it can be read by LibreOffice, but the reverse appears impossible. With LibreOffice being my current default RTF editor it means that any RTF ToDo file opens in LibreOffice, allowing editing, but thereafter I cannot edit the file in RTFed.

The rtf file created by RTFed can also be read (with mixed results) by Abiword - but again the format is not adequately common between the two WPs - therefore leads to formatting errors.

But then i thought why not use Abiword in it's ".abw" format??

That way I don't need to load some other bulky word processing suite, the file will never try to default to LibreOffice, and in any case Abiword is already on my system.

I hate to say it but this may be the simplest and most lightweight answer.

Abiword also gives me the best control over page orientation and margins. The output looks quite clean and tidy.

(but i do love the html utilities - they may come in handy for some other uses too....)
Attachments
ABW.jpg
(33.95 KiB) Downloaded 83 times

Post Reply