• text reformating

    From Gerrit Kuehn@2:240/12 to Grant Weasner on Sat May 24 15:01:28 2025
    * Originally by: Maurice Kinal (1:153/7001), 24 May 25 03:00.

    Hello Grant!

    24 May 25 03:00, Maurice Kinal wrote to Grant Weasner:


    Have you looked at makeinfo, which comes with the texinfo package? 'makeinfo --help' reports 'makeinfo --plaintext foo.texi' which
    offhand looks to me what you're looking for.

    There is usually a command named "texi2any" (along with texi2dvi and texi2pdf) installed with the texinfo package that does exactly this.


    Regards,
    Gerrit

    ... 3:01PM up 168 days, 21:08, 10 users, load averages: 1.50, 0.87, 0.66

    --- msged/fbsd 6.3 2021-12-02
    * Origin: We are the second generation (2:240/12)
  • From Maurice Kinal@1:153/7001 to Gerrit Kuehn on Tue May 27 22:04:26 2025
    Hey Gerrit!

    There is usually a command named "texi2any"

    On my systems "makeinfo" is a symlink to "texi2any". The little I've used it directly would explain why I posted it as "makeinfo".

    installed with the texinfo package that does exactly this.

    I would hope so! Something would be amiss if that weren't true.

    Life is good,
    Maurice

    o- -o -o -o
    /) (\ (\ (\
    ^^ ^^ ^^ ^^
    ... Ne sceal man to ær forht ne to ær fægen.
    One should not be too soon fearful nor too soon joyful.
    --- GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001)
  • From Kai Richter@2:240/77 to Grant Weasner on Wed May 28 15:03:50 2025
    Hello Grant!

    19 May 25, Grant Weasner wrote to All:

    Gopher friendly:
    1) 64 columns wide.
    2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but indent to the same column as the prior line.

    This seems pretty difficult and I'm wondering how others would
    approch this task.

    Indent to the same column as the prior line - that sounds like the man manpages layout?

    If yes then you may like to peek into the manpage display processes for more hints.

    Regards

    Kai

    --- GoldED+/LNX 1.1.4.7
    * Origin: Monobox (2:240/77)
  • From Grant Weasner@1:138/397 to Kai Richter on Wed Jun 4 10:47:15 2025
    Re: text reformating
    By: Kai Richter to Grant Weasner on Wed May 28 2025 15:03:50

    Hi Kai,


    Gopher friendly:
    1) 64 columns wide.
    2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but
    indent
    to the same column as the prior line.

    Indent to the same column as the prior line - that sounds like the man manpages layout?
    Yes I'm working on the algorithm for the process.

    So far its counting the proceeding whitespace starting at char[0] for the line, and finding any '\t' tabs as well.
    If the next line proceeding whitespace is equal to current line, read the next->next line check for equal whitespace. Repeat the process until whitespace is not equal, or whitespace is equal but directly after whietspace there is a '\n'.
    create new lines with current whitespace for every joined line.



    If yes then you may like to peek into the manpage display processes for more hints.

    I looked at man man, but I wasn't sure what I was looking for. Lots of references to groff within man man.
    --- SBBSecho 3.20-Linux
    * Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)
  • From Maurice Kinal@2:280/464.113 to Grant Weasner on Wed Jun 4 18:20:51 2025
    Hej Grant!

    and finding any '\t' tabs as well.

    'col -x' will replace tabs with spaces.

    $ echo -e '\tSome text.' | wc -c
    12

    $ echo -e '\tSome text.' | col -x | wc -c
    19

    You'll probably want to replace tabs before counting characters.

    Het leven is goed,
    Maurice

    -o o- o- o-
    (\ /) /) /)
    ^^ ^^ ^^ ^^
    ... Gif ðu wille godne hlisan habban, ne fægna ðu nanes yfeles.
    If you want to have a good reputation, don't rejoice in any evil.
    --- GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's EuroPoint @ (2:280/464.113)
  • From Kai Richter@2:240/77 to Grant Weasner on Thu Jun 5 16:53:42 2025
    Hello Grant!

    04 Jun 25, Grant Weasner wrote to Maurice Kinal:

    In my original post I had chosen 64 columns wide is from the link
    below, so my gopher pages could have enough width left over to pretty
    some of the text with boxes.

    This display/format/layout problem is the reason why markup languages have been invented. For example css within html or markdown on github readme.md files.

    If you are not looking for a one time conversion then text processing workflow may be a good idea. You could keep two text files, one for easy human editing and the output of text processing for the gopher files.

    troff/groff have its own markup language. For example:
    .ll 67
    sets the line lenght to 67 chars
    .sp 2
    insert two blank lines.

    The groff system can do macros. Some examples and better than mine explanations can be found here:

    https://www.davebucklin.com/play/2018/03/04/gopher-groff.html

    For the manpages format there is an existing macro set called "groff an.tmac" macro package or man macro package. I think it comes with man usually, because on my outdated system it can be found with "man 7 man". There are macros for relative margin indent and indented paragraph macros.

    Regards

    Kai

    --- GoldED+/LNX 1.1.4.7
    * Origin: Monobox (2:240/77)