Two columns in leafpad or geany ??

Using applications, configuring, problems
Message
Author
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

Burunduk
Posts: 80
Joined: Sun 21 Aug 2011, 21:44

#61 Post by Burunduk »

Maybe it's OK to mention this old utility here.

Code: Select all

pr -mt -S"|  " <(fold -s -w30 left.txt) <(fold -s -w30 right.txt) | expand >merged.txt

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

#62 Post by greengeek »

Burunduk wrote:Maybe it's OK to mention this old utility here.

Code: Select all

pr -mt -S"|  " <(fold -s -w30 left.txt) <(fold -s -w30 right.txt) | expand >merged.txt
That is really clever. Thanks!

The only problem is that i cannot seem to get text editors to handle Landscape mode. The lines wrap too early. I really need to be able to use Landscape.

EDIT: Also this method has a similar issue to musher0's earlier suggestion - it means that when i am re-editing the document i must pay very careful attention to what is happening with "insert" and movement / overwriting of the pipe characters.

Nonetheless - it seems these methods could be useful if I am maintaining WorkToDO and PersonalToDo as separate text files ready for inclusion into the merged output document..

thanks!
Attachments
merged_text.jpg
(25.11 KiB) Downloaded 318 times

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

#63 Post by greengeek »

Burunduk wrote:Maybe it's OK to mention this old utility here.

Code: Select all

pr -mt -S"|  " <(fold -s -w30 left.txt) <(fold -s -w30 right.txt) | expand >merged.txt
Hi Burunduk - do you have any idea why the pipe characters are "stuck" in column 34? I can see how the "w30" parameter determines the wrapping of the text contents, but i see no way to move the pipe characters to make a wider column in the merged output.
cheers!

(ps: maybe this is some sort of fixed kernel parameter related to console functions?)
- seems like page_width maxes out at 72 characters. I am struggling to understand why the pr output seems limited to 72 characters when leafpad can be forced to print landscape up to around 130 or 140 characters. Confusing :?
Last edited by greengeek on Thu 02 May 2019, 19:30, edited 1 time in total.

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

#64 Post by greengeek »

Just for future reference i will list here the syntax i found that lets me print the leafpad output as Landscape orientation (direct to whatever is set up as the default printer):

Code: Select all

lp -olandscape -ofp12 -ovsi5.45 -otl66 -ohsi9.5 myfile.txt
It prints with narrow margins which suits my needs perfectly. Apparently the number of characters accommodated across the page is determined by the choice of character set (which is one of those funny parameter strings in the code above...)

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

#65 Post by musher0 »

g\g?

What's your source for this?

Also, would you care to provide some details about what the parms do?

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

Post Reply