ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > PopUp Wisdom

Parsing of Fortune Files

<< < (2/3) > >>

transitionality:
Paying attention to this problem, I also notice a couple of other things.

* When a quote is displayed, a newline is appended to the bottom of it. Is this by design, or is it an oversight? When the quote is copied and pasted, the newline makes it different from the quote as copied and pasted from the quotes file. If the newline at the bottom is by design -- to put some space between the text and the buttons at the bottom -- perhaps it can be used for display purposes, but not appended to the copied text when the copy button is pressed.

* As quotes are parsed from a BSD-style fortunes file, it would be useful to ignore all whitespace from the % to the first non-whitespace character, and again, ignore all whitespace from the last non-whitespace character to the next %. That way,

%



"The time you enjoy wasting is not wasted time."

-- Bertrand Russell


%


--- End quote ---

gets parsed as

"The time you enjoy wasting is not wasted time."

-- Bertrand Russell

--- End quote ---

which is probably a sensible way to do it. There's a reference to this in the source I gave in the previous message, but it's a suggestion rather than a rule. What do people think?

mouser:
easy to do and makes sense to me.

mouser:
Can you try this new version and let me know if the issues have been fixed:
https://www.donationcoder.com/Software/Mouser/PopUpWisdom/downloads/PopUpWisdomSetup.exe

(see help file bottom for list of changes)

transitionality:
I uninstalled the previous version and installed the latest version in a clean directory, so there would be no complications.

I created a fortune file with %% delimiters, and unfortunately it did not work. Every separate non-blank line was parsed as a separate quote, even lines containing the %% delimiter.

When I search-and-replaced the %% delimiters with the % delimiter, the program failed in a different way. The whitespace preceding and trailing the quote were ignored, as expected, but the newlines within the quotes were not respected except for the author line (starting with a dash), instead they were substituted with spaces. So:


--- ---
.....

%

"Do I contradict myself?
Very well then I contradict myself,
(I am large, I contain multitudes.)"

-- Walt Whitman, from _Song of Myself_

%

.....

got displayed as:


--- ---"Do I contradict myself? Very well then I contradict myself, (I am large, I contain multitudes.)"
 -- Walt Whitman, from _Song of Myself_

(with one space at the beginning of the author line, substituting for the newline that was supposed to be before it)

Clearly, some things are amiss.

Edit: I think I figured out the problem. For %-using fortune files, within the quote, you're substituting a space for single newlines, but you are displaying newlines if two or more consecutive newlines are involved (except the very first newline gets substituted with a space again). Why you're doing it this way, I don't know. It's probably a bug.

mouser:
i just uploaded a minor update.

it should fix the space at begining of line problem.

the conversion of normal newlines into spaces is by design since fortune files seem to be most often formatted with hard newlines for linebreaks which isn't appropriate for popup wisdom.

you have a couple of choices for forcing newlines in these files. you can manually put a \n where you want a newline, or you can start lines which should start on a new line with a space or you can put 2 newlines (or more) to indicate a break.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version