Post Reply 
Code formatting messed up...
09-12-2018, 07:31 PM
Post: #1
Code formatting messed up...
When I view this article which I wrote recently, some of the text in the code blocks was not formatted correctly, and I checked and there are no extraneous spaces or tabs. Also, Greek character alpha ( α ) is shown in bold in one of the code blocks. In addition, when I try to add newlines between the elements in a bulleted list, they do nothing and the list's contents are stacked right on top of each other, which is quite ugly.

Is there any way to fix this?

Thanks,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-12-2018, 08:03 PM (This post was last modified: 09-12-2018 08:21 PM by Dieter.)
Post: #2
RE: Code formatting messed up...
(09-12-2018 07:31 PM)Jonathan Busby Wrote:  When I view this article which I wrote recently, some of the text in the code blocks was not formatted correctly, and I checked and there are no extraneous spaces or tabs. Also, Greek character alpha ( α ) is shown in bold in one of the code blocks.

The only alpha I see is not bold.
A look at the page's source code also shows no tags for bold text there.

Regarding the formatting and blanks: please note that the museum's editor uses a proportinal font, while the final result (when the article is displayed) is shown with a fixed width font. So the message editor is not "WYSIWYG"!. It's a good idea to prepare such code blocks in an external editor (that is set to a fixed-width font) and finally copy the code block from there into the museum's message editor. That's the way I do it.

By the way, you should start your code right after the intial [ code ] tag, and not in the next line. Otherwise the code block will start with a blank line, as shown in your post.

(09-12-2018 07:31 PM)Jonathan Busby Wrote:  In addition, when I try to add newlines between the elements in a bulleted list, they do nothing and the list's contents are stacked right on top of each other, which is quite ugly.

That's the way HTML works. ;-)
But there is a way:
  • First
    Blablablabla....
     
  • Second
    Blablablabla....
     
  • Third
    Blablablabla....
The basic idea is not to have a completely blank line between the points but a "hard blank". For instance a non-breaking space: hold down the "Alt" key and type 0160 on the numeric keypad. Then release the Alt key. This inserts a non-breaking space.

Another hint: use the "Preview Post" button before posting a message. This will show you how the final result will look like. Don't press the "Post Reply" button until you're satisfied with the result.

Dieter
Find all posts by this user
Quote this message in a reply
09-12-2018, 08:27 PM (This post was last modified: 09-12-2018 08:32 PM by Jonathan Busby.)
Post: #3
RE: Code formatting messed up...
(09-12-2018 08:03 PM)Dieter Wrote:  
(09-12-2018 07:31 PM)Jonathan Busby Wrote:  When I view this article which I wrote recently, some of the text in the code blocks was not formatted correctly, and I checked and there are no extraneous spaces or tabs. Also, Greek character alpha ( α ) is shown in bold in one of the code blocks. In addition, when I try to add newlines between the elements in a bulleted list, they do nothing and the list's contents are stacked right on top of each other, which is quite ugly.

Is there any way to fix this?

Quote:The only alpha I see is not bold.
A look at the page's source code also shows no tags for bold text there.

Well, I'm using the latest version of Firefox on a Linux machine and in this line

Code:
I = I + α ( Correct I to point after embedded object where α is the length of the object )

The alphas are displayed in bold for some reason. I've attached a screenshot :

   

Quote:Regarding the formatting and blanks: please note that the museum's editor uses a proportinal font, while the final result (when the article is displayed) is shown with a fixed width font. So the message editor is not "WYSIWYG"!. It's a good idea to prepare such code blocks in an external editor (that is set to a fixed-width font) and finally copy the code block from there into the museum's message editor. That's the way I do it.

Yes, I know this, and I use always use Gedit or XeD, but, that still didn't fix the problem.

Quote:By the way, you should start your code right after the intial [ code ] tag, and not in the next line. Otherwise the code block will start with a blank line, as shown in your post.

Thanks for the tip but it doesn't help in my case and I don't see a blank line from the browser I'm using.

Quote:Another hint: use the "Preview Post" button before posting a message. This will show you how the final result will look like. Don't press the "Post Reply" button until you're satisfied with the result.

I know you probably don't mean it, but I don't like being patronized and I've been using the web for decades and I'm familiar with forums -- I used to post regularly on the old HP Museum forums, which are now archived...

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-12-2018, 08:43 PM
Post: #4
RE: Code formatting messed up...
(09-12-2018 08:03 PM)Dieter Wrote:  
(09-12-2018 07:31 PM)Jonathan Busby Wrote:  In addition, when I try to add newlines between the elements in a bulleted list, they do nothing and the list's contents are stacked right on top of each other, which is quite ugly.

That's the way HTML works. ;-)
'

Well, this is technically not HTML, it's proprietary bbcode, which gets converted to HTML Smile

Quote:But there is a way:
  • First
    Blablablabla....
     
  • Second
    Blablablabla....
     
  • Third
    Blablablabla....
The basic idea is not to have a completely blank line between the points but a "hard blank". For instance a non-breaking space: hold down the "Alt" key and type 0160 on the numeric keypad. Then release the Alt key. This inserts a non-breaking space.

Thanks for this tip, but it still doesn't work for me...

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-12-2018, 08:46 PM
Post: #5
RE: Code formatting messed up...
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Well, I'm using the latest version of Firefox on a Linux machine and in this line

Code:
I = I + α ( Correct I to point after embedded object where α is the length of the object )

The alphas are displayed in bold for some reason. Here is a screenshot : [Image: Screenshot_from_2018-09-12_15-17-00.png]

Hm... here the same line has a "normal" alpha character. Both on an old Firefox and on v61.
Maybe that's related to the particular font on your system?
But I'm just guessing.

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Yes, I know this, and I use always use Gedit or XeD, but, that still didn't fix the problem.

That's strange. Maybe someone else can say more about this.

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  
Quote:By the way, you should start your code right after the intial [ code ] tag, and not in the next line. Otherwise the code block will start with a blank line, as shown in your post.

Thanks for the tip but it doesn't help in my case and I don't see a blank line from the browser I'm using.

Do the following two code blocks look the same on your browser?

Code:

Line 1
Line 2
Line 3

Code:
Line 1
Line 2
Line 3

The first block starts with a blank line, the second one doesn't.
At least that's what I see here.

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  I know you probably don't mean it, but I don't like being patronized and I've been using the web for decades and I'm familiar with forums -- I used to post regularly on the old HP Museum forums, which are now archived...

Sorry, I was only trying to be helpful. The forum software said this was your 6th post so I assumed you were not familiar with some of its ...peculiarities.

Regarding the bullet point problem: I added a solution to my post while you wrote your reply. I can't say if the mentioned method of inserting a hard blank will work on Linux, but I think you will. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
09-12-2018, 09:35 PM
Post: #6
RE: Code formatting messed up...
(09-12-2018 08:46 PM)Dieter Wrote:  [quote='Jonathan Busby' pid='103819' dateline='1536784045']
Well, I'm using the latest version of Firefox on a Linux machine and in this line

Code:
I = I + α ( Correct I to point after embedded object where α is the length of the object )

The alphas are displayed in bold for some reason. Here is a screenshot : [Image: Screenshot_from_2018-09-12_15-17-00.png]

Quote:Hm... here the same line has a "normal" alpha character. Both on an old Firefox and on v61.
Maybe that's related to the particular font on your system?
But I'm just guessing.

I don't know what's causing it either :/

Quote:
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Thanks for the tip but it doesn't help in my case and I don't see a blank line from the browser I'm using.

Do the following two code blocks look the same on your browser?

Code:

Line 1
Line 2
Line 3

Code:
Line 1
Line 2
Line 3
[/code]

That's the weird thing : on the page for the article I wrote the same characters in the code blocks appear misaligned, but, here, I can see a difference as the first code block has a blank line...Strange...

Quote:The first block starts with a blank line, the second one doesn't.
At least that's what I see here.

That's what I see as well, here at least....

Quote:
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  I know you probably don't mean it, but I don't like being patronized and I've been using the web for decades and I'm familiar with forums -- I used to post regularly on the old HP Museum forums, which are now archived...

Sorry, I was only trying to be helpful. The forum software said this was your 6th post so I assumed you were not familiar with some of its ...peculiarities.

I also apologize for being impulsive. I'm an Aspie and it's hard enough for me to read non-verbal affect or someone's face, so, you can imagine when I'm just limited to text and emoticons Smile

Quote:Regarding the bullet point problem: I added a solution to my post while you wrote your reply. I can't say if the mentioned method of inserting a hard blank will work on Linux, but I think you will. ;-)

Dieter

For some reason even that doesn't work. :/

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-13-2018, 12:22 AM
Post: #7
RE: Code formatting messed up...
I don't see bold alphas either (on Windows/Firefox, Android/Chrome or IOS/Safari.) I notice that some first lines are indented more than following lines, but when I quote the message I see 8 spaces in the first line and tabs on the following lines. I'm guessing this is due to the age-old debate as to whether tab stops should be 4 or 8 characters?
Visit this user's website Find all posts by this user
Quote this message in a reply
09-13-2018, 12:25 AM
Post: #8
RE: Code formatting messed up...
Wild guess on the alpha - maybe there is no alpha in your default display font so your browser or rendering system is grabbing an alpha from some font that it thinks is similar?
Visit this user's website Find all posts by this user
Quote this message in a reply
09-13-2018, 05:44 AM (This post was last modified: 09-13-2018 06:00 AM by brickviking.)
Post: #9
RE: Code formatting messed up...
I took a very quick look through the CSS (global.css:449) for the post, and the monospaced fonts listed for code sections are: Monaco, Consolas, Courier, and monospace. Depending on your version of Linux, you should have at least one of those four installed (or something that says it is), and that font should include the greek letters. As David has suggested, I suspect a font is missing, or that font doesn't have the coverage needed, so Firefox is substituting in the next best thing it can find.

The list of fonts that Firefox should normally use are listed in the General Preferences, click on "Fonts and Colors->Advanced" to see the detail. I suspect you've done this already, but it doesn't hurt to cover bases anyhow. I use "Preview Post" all the time, it's how I found out that trick of starting code content directly after the [code] section.

(Post 280)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
Visit this user's website Find all posts by this user
Quote this message in a reply
09-13-2018, 05:41 PM
Post: #10
RE: Code formatting messed up...
(09-13-2018 12:22 AM)Dave Hicks Wrote:  I notice that some first lines are indented more than following lines, but when I quote the message I see 8 spaces in the first line and tabs on the following lines. I'm guessing this is due to the age-old debate as to whether tab stops should be 4 or 8 characters?

Hmmm... That's strange because I'm sure that, at least when I wrote the article text, that I only used spaces -- 4 for indentation -- and I didn't use any actual tabs.

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-13-2018, 06:37 PM
Post: #11
RE: Code formatting messed up...
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Well, I'm using the latest version of Firefox on a Linux machine and in this line

Code:
I = I + α ( Correct I to point after embedded object where α is the length of the object )

The alphas are displayed in bold for some reason. I've attached a screenshot :

Here is how it looks like on Windows / Firefox 62 (click to view the full size image).

   

You can see that
  • the code blocks start with a blank line. This is also what the HTML source reflects (starts with a "<br />" tag).
    So this is the way it is supposed to be displayed.
     
  • the lines in the code blocks are indented, either by 4 or by 8 characters. This is also reflected in the HTML code where these lines start with 4 or 8 "&nbsp;" hard spaces.
    So this is the way it is supposed to be displayed.
     
But this does not agree with what you reported about what you see in your browser:

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Thanks for the tip but it doesn't help in my case and I don't see a blank line from the browser I'm using.

So you do not see the blank lines in the code blocks, as shown in my screenshot?

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  ...I use always use Gedit or XeD, but, that still didn't fix the problem.

When you edited the code in your external editor, did you possibly use tabs to get these indentations? Or does this editor maybe replace multiple spaces with tabs?

Your screenshot also shows that the code blocks are displayed with a serif font, maybe Courier. Maybe you can write something in a word processor with this font, including the alpha character. How is it displayed there?

Just another test: do you see some or all of the following characters in bold?

α β γ Δ Γ
α β γ Δ Γ
α β γ Δ Γ
α β γ Δ Γ

I = I + α
I = I + α
I = I + α

Finally, here is the second code block of your RPL inner loop article, composed on a Windows system and formatted without indentations:

Code:
PROLOG -> PROLOG ( The prolog address at the start of the prolog code points to itself )
IF O + Δ =/= PC
THEN GOTO INDIRECT ( Test for direct execution )
O = I - Δ ( Correct O to point to start of embedded object )
I = I + α ( Correct I to point after embedded object where α is the length of the object )
INDIRECT ( rest of prolog )

How does this look like on your system? Do you still see bold alphas?

I think we will get all this resolved... sooner or later. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
09-13-2018, 06:48 PM
Post: #12
Wink RE: Code formatting messed up...
Well, I fixed most of the formatting problems. Dieter's suggestion of using a non-breaking space finally started working. Also, for some reason, even though I had entered spaces in the code blocks, somehow, they had gotten translated into tabs. The only remaining problem is why the Greek alpha is bold in my browser.

Thanks to Dieter and everyone else Smile

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
09-13-2018, 07:58 PM (This post was last modified: 09-13-2018 08:12 PM by Jonathan Busby.)
Post: #13
Wink RE: Code formatting messed up...
(09-13-2018 06:37 PM)Dieter Wrote:  
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Well, I'm using the latest version of Firefox on a Linux machine and in this line

Code:
I = I + α ( Correct I to point after embedded object where α is the length of the object )

The alphas are displayed in bold for some reason. I've attached a screenshot :

Here is how it looks like on Windows / Firefox 62 (click to view the full size image).



You can see that
  • the code blocks start with a blank line. This is also what the HTML source reflects (starts with a "<br />" tag).
    So this is the way it is supposed to be displayed.
     
  • the lines in the code blocks are indented, either by 4 or by 8 characters. This is also reflected in the HTML code where these lines start with 4 or 8 "&nbsp;" hard spaces.
    So this is the way it is supposed to be displayed.
     
But this does not agree with what you reported about what you see in your browser:

(09-12-2018 08:27 PM)Jonathan Busby Wrote:  Thanks for the tip but it doesn't help in my case and I don't see a blank line from the browser I'm using.

So you do not see the blank lines in the code blocks, as shown in my screenshot?

I do see them, but not on the article page :/

Quote:
(09-12-2018 08:27 PM)Jonathan Busby Wrote:  ...I use always use Gedit or XeD, but, that still didn't fix the problem.

When you edited the code in your external editor, did you possibly use tabs to get these indentations? Or does this editor maybe replace multiple spaces with tabs?

Well, the editor I've been using doesn't have the ability to convert spaces to tabs -- it can create spaces instead of tabs when one presses the TAB key though.

Quote:Your screenshot also shows that the code blocks are displayed with a serif font, maybe Courier. Maybe you can write something in a word processor with this font, including the alpha character. How is it displayed there?

Well, in LIbreOffice, the alpha character is not bold.

Quote:Just another test: do you see some or all of the following characters in bold?

α β γ Δ Γ
α β γ Δ Γ
α β γ Δ Γ
α β γ Δ Γ

I = I + α
I = I + α
I = I + α

I see the third line in bold, except for delta. Also, all the alphas are bold.

Quote:Finally, here is the second code block of your RPL inner loop article, composed on a Windows system and formatted without indentations:

Code:
PROLOG -> PROLOG ( The prolog address at the start of the prolog code points to itself )
IF O + Δ =/= PC
THEN GOTO INDIRECT ( Test for direct execution )
O = I - Δ ( Correct O to point to start of embedded object )
I = I + α ( Correct I to point after embedded object where α is the length of the object )
INDIRECT ( rest of prolog )

How does this look like on your system? Do you still see bold alphas?

Everything looks fine except the bold alphas :/

Quote:I think we will get all this resolved... sooner or later. ;-)

Dieter

Thanks for your help! Big Grin I've fixed most of the formatting problems in the article but I'm still puzzled as to why I'm seeing random Greek characters in bold.

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-09-2018, 09:24 PM
Post: #14
RE: Code formatting messed up...
I was editing sections of my RPL inner loop article today, and, what do you know : With the latest version of Firefox under Windows 10 Pro x64, the α ( Greek alpha ) characters are no longer bold Big Grin . On my Linux machine, even with the latest version of Firefox, the alphas are still bold though -- don't know what is going on exactly.

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-10-2018, 10:31 PM (This post was last modified: 11-10-2018 10:42 PM by ijabbott.)
Post: #15
RE: Code formatting messed up...
(11-09-2018 09:24 PM)Jonathan Busby Wrote:  I was editing sections of my RPL inner loop article today, and, what do you know : With the latest version of Firefox under Windows 10 Pro x64, the α ( Greek alpha ) characters are no longer bold Big Grin . On my Linux machine, even with the latest version of Firefox, the alphas are still bold though -- don't know what is going on exactly.

Jonathan

I don't know if Firefox's rendering engine (Gecko) uses the standard Linux desktop font glyph substitution mechanisms, but it probably uses the standard Linux fontconfig to perform font name substitution at least. So out of interest, what does the fc-match command show for "Monaco", "Consolas", "Courier", and "monospace" on your system? On mine, I get:

Code:
$ fc-match Monaco
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ fc-match Courier
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
$ fc-match Consolas
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

It didn't really find a match for "Monaco" at all and just spat out a default in that case, but for the others it at least recognised them as monospaced fonts and did its best to find an appropriate match.

From the small screenshot you posted, it looks like it might have matched Courier to "Nimbus Mono L Regular", which at least for the Type 1 font from Debian's "gsfonts" package, only contains a couple of Greek characters: Δ and μ. So any other Greek characters will be pulled in from other fonts installed on the system.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
11-11-2018, 12:12 AM
Post: #16
RE: Code formatting messed up...
(11-10-2018 10:31 PM)ijabbott Wrote:  I don't know if Firefox's rendering engine (Gecko) uses the standard Linux desktop font glyph substitution mechanisms, but it probably uses the standard Linux fontconfig to perform font name substitution at least. So out of interest, what does the fc-match command show for "Monaco", "Consolas", "Courier", and "monospace" on your system? On mine, I get:

Code:
$ fc-match Monaco
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ fc-match Courier
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
$ fc-match Consolas
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

It didn't really find a match for "Monaco" at all and just spat out a default in that case, but for the others it at least recognised them as monospaced fonts and did its best to find an appropriate match.

From the small screenshot you posted, it looks like it might have matched Courier to "Nimbus Mono L Regular", which at least for the Type 1 font from Debian's "gsfonts" package, only contains a couple of Greek characters: Δ and μ. So any other Greek characters will be pulled in from other fonts installed on the system.

I think you're right. Here's the output of fc-match on my Linux box :
Code:
$ fc-match Monaco
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ fc-match Courier
n022003l.pfb: "Nimbus Mono L" "Regular"
$ fc-match Consolas
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-12-2018, 04:05 PM
Post: #17
RE: Code formatting messed up...
I'm running Linux Mint 18 x64 Cinnamon :

Code:
$ lsb_release -a
No LSB modules are available.
Distributor ID:    LinuxMint
Description:       Linux Mint 18 Sarah
Release:           18
Codename:          sarah

I'm hesitant to issue an "apt-get update && apt-get upgrade && apt-get dist-upgrade" as I'm afraid my system will be borked. Maybe I can just upgrade the fonts package.

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-12-2018, 04:27 PM
Post: #18
RE: Code formatting messed up...
Well, there are quite a few font packages to choose from :

Code:
$ sudo apt-cache search font | grep '^font' | awk '{ print $1 }' | wc -l

produces at least 350 results 8|. Maybe I'm overlooking something simple.

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-12-2018, 04:36 PM
Post: #19
RE: Code formatting messed up...
Well, I tried an apt-file search :

Code:
$ sudo apt-file search LiberationMono-Regular.ttf
fonts-liberation: /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf
fs-uae-arcade: /usr/share/fs-uae-arcade/game_center/res/LiberationMono-Regular.ttf
fs-uae-launcher: /usr/share/fs-uae-launcher/game_center/res/LiberationMono-Regular.ttf
gosa: /usr/share/gosa/html/themes/default/fonts/LiberationMono-Regular.ttf
ttf-liberation: /usr/share/fonts/truetype/ttf-liberation/LiberationMono-Regular.ttf
mint@mint ~ $ sudo apt install fonts-liberation
Reading package lists... Done
Building dependency tree       
Reading state information... Done
fonts-liberation is already the newest version (1.07.4-1).
0 upgraded, 0 newly installed, 0 to remove and 860 not upgraded.

But, apparently, the font package which contains the missing font is installed, or so it seems.

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
11-12-2018, 07:49 PM (This post was last modified: 11-12-2018 07:51 PM by SammysHP.)
Post: #20
RE: Code formatting messed up...
(11-12-2018 04:05 PM)Jonathan Busby Wrote:  I'm hesitant to issue an "apt-get update && apt-get upgrade && apt-get dist-upgrade" as I'm afraid my system will be borked. Maybe I can just upgrade the fonts package.

A bit off-topic, but you should update your system as often as possible. Not only does that fix security issues early, it also makes it easier to determine the source of any errors after updating (which should be a really rare case). Debian is rather stable, so updates fix only minor issues. Similar distros like Ubuntu/Mint tend to include more bleeding-edge versions of common packages, but big issues after updates are rare as well.

Partial upgrades (running "apt-get update" before "apt-get install" without "apt-get dist-upgrade") on the other hand may cause some trouble (binaries linked against different versions, moved/renamed files etc).
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 4 Guest(s)