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. |
|||
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:
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 |
|||
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. Quote:The only alpha I see is not bold. 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. |
|||
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. Well, this is technically not HTML, it's proprietary bbcode, which gets converted to HTML Quote:But there is a way: Thanks for this tip, but it still doesn't work for me... Jonathan Aeternitas modo est. Longa non est, paene nil. |
|||
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 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. Do the following two code blocks look the same on your browser? Code:
Code: Line 1 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 |
|||
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'] Quote:Hm... here the same line has a "normal" alpha character. Both on an old Firefox and on v61. 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. 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. 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... 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 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. ;-) For some reason even that doesn't work. :/ Regards, Jonathan Aeternitas modo est. Longa non est, paene nil. |
|||
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?
|
|||
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?
|
|||
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) |
|||
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. |
|||
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 Here is how it looks like on Windows / Firefox 62 (click to view the full size image). You can see that
(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 ) 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 |
|||
09-13-2018, 06:48 PM
Post: #12
|
|||
|
|||
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 Jonathan Aeternitas modo est. Longa non est, paene nil. |
|||
09-13-2018, 07:58 PM
(This post was last modified: 09-13-2018 08:12 PM by Jonathan Busby.)
Post: #13
|
|||
|
|||
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 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. 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 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: Everything looks fine except the bold alphas :/ Quote:I think we will get all this resolved... sooner or later. ;-) Thanks for your help! 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. |
|||
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 . 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. |
|||
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 . 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. 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 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 |
|||
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: I think you're right. Here's the output of fc-match on my Linux box : Code: $ fc-match Monaco Jonathan Aeternitas modo est. Longa non est, paene nil. |
|||
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 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. |
|||
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. |
|||
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 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. |
|||
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). |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)