1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Code Tags

Discussion in 'Site Issues & Feedback' started by jpanhalt, Dec 23, 2015.

  1. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
  2. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
    I did a little fiddling this morning:
    Capture.PNG
    You can get the color to change, but cannot change back easily.

    Code (asm):

    movlw      ETO,f
    movwf      AACC
    call       Santa
    nop
    NOP
    'This almost works'
    But, it doesn't work well
     
    Last edited: Dec 26, 2015
  3. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    In my last post including code I tried the same with bad results.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE

    I have tried various things too. One complication is that there are reserved "words" like "NOP" and "call" as illustrated. Single quotes seem to make the code magenta and are reversible. I will probably just use them for highlighting.

    The only option I found that works with the color tag is to exit the colored code section and begin another that is not colored. That is not very satisfactory to me.

    John
     
  6. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    I resort now to this: get the excerpt with Irfan View and highlight / scratch with Paint. Maybe less than two minutes (search in the PC not counting).


    Sample for John P.png
     
  7. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
    In Win7, I just use the "clip/capture" function that also allows editing. You can even erase using a white marker, but then it is easy to lose track of where the cursor is. The problem is that with lengthy code, a posted image is quite long; whereas, posted code opens in a window that can be scrolled. Of course, both approaches are workarounds.

    John
     
    • Agree Agree x 1
  8. atferrari

    atferrari Well-Known Member

    Joined:
    Oct 8, 2003
    Messages:
    2,816
    Likes:
    121
    Location:
    Buenos Aires - Argentina
    Yes, you have a point there.
     
  9. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    ONLINE
    Hi,

    I am happy to see a discussion about code tags.

    The problem i always have is the spacing of the letters gets all messed up. For example, if i type out a word like "Hello" and then 10 spaces, then another word "Goodby" when i go to read it most of the 10 spaces will be gone, only one space maybe, or maybe what looks like a couple. This normally happens when i paste text though, so if i type that hello/goodby line with 10 spaces in Notepad for example then copy and paste it into the text editor here, it always messes up the spacing.
    Any thoughts one what i can do to prevent this? It usually requires a lot of work to go back and retype all the spaces. This is especially a problem if i want to show a table or a text based schematic.
    It used to work just fine several years back. Am i doing something wrong or what?
     
  10. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
    Do a snip/image and paste it.

    If it is code, remember that you can direct the editor to use different formats depending on the type of code. At least that works for Assembly (i.e., {code=asm}) and C. Haven't tried or don't know about other languages.

    John
     
  11. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,514
    Likes:
    507
    Location:
    Vermont (GMT-5:00)
    Hi guys, I'm doing a little digging and will keep you posted.

    I have also brought this thread to Dave's attention.

    Thanks,
    Matt
     
  12. Inquisitive

    Inquisitive Super Moderator

    Joined:
    Aug 31, 2011
    Messages:
    947
    Likes:
    87
    Location:
    Georgia, USA
    I believe to do tables there is an add-on package for Zenforo that does this. Don't think we have it.

    Regards,
    Les
     
  13. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    FYI, when you want to post examples of tags I.E. [code] but not have them interpreted you can use the [plain] tags.

    Mike.
     
  14. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,514
    Likes:
    507
    Location:
    Vermont (GMT-5:00)
    Code (text):
    line 1
    line 2
    line 3
    [PLAIN][B]line4[/B][/PLAIN]
    line 5
     
  15. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,514
    Likes:
    507
    Location:
    Vermont (GMT-5:00)
    As you can see from post #13 "PLAIN" will remove all formatting from whatever is withing the tags, so you won't be able to make it bold or change the color that way.
     
  16. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
    Code (asm):

    movlw     line 1
    movlw     line 2
    movlw    [PLAIN]line 4[/PLAIN]
    line 5     [B]line 5[/B]
     
    The PLAIN tags may work outside code tags, and that is good to know, but they do not seem to affect what goes on inside code tags. In other words, the BOLD tags within code tags don't work even without the plain tags.

    If I were guessing, CODE tags must have a priority property higher than FONT/TYPEFACE or COLOR tags.

    John
     
    • Agree Agree x 1
  17. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,161
    Likes:
    340
    Location:
    Brisbane Australia
    I wasn't posting it for use within code tags, just as a tag that most people don't seem to know exists.

    Mike.
     
    • Agree Agree x 1
  18. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    ONLINE
    As you can see, spaces are all messed up:

    Code (text):

    o---R1---+---o
                       |
                       C1
                       |
    o---------+---o


    o---R1---+---o
      |
      C1
      |
    o--------+---o


     
    One LP filter was typed here, the other pasted from an external editor. The problem only seems to be that the spaces are not right.

    Capture.PNG
     
  19. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,069
    Likes:
    523
    Location:
    Cleveland, OH, USA
    ONLINE
    Pommie, I understood you to mean outside the code tags, but it was still worth testing.
    MrAl
    I don't think there is any way to get hyphens, underscores, and such to line up WYSIWYG in a forum. I think the only way is to post an image. I tried to figure out the rgb # for ETO's background so the image looks like text. This is as close as I could get:

    Capture.PNG

    Maybe Dave will give us the proper hex value.

    John
     
  20. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,514
    Likes:
    507
    Location:
    Vermont (GMT-5:00)
    John, background color is HEX #F5F5FF, or RGB (245, 245, 255). I expect text is simply black (#000000)
     
  21. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,049
    Likes:
    961
    Location:
    NJ
    ONLINE
    Hi John,

    Well there's no problem with the hyphens and other chars, just with the spaces. The spaces are not right. It's like you type a Courier New space (which is a proportional font) and you get a Arial font space instead. It's just nuts too.
    Not only that, but it WORKED FINE for years and years, until they switched to this new software which broke this functionality. It's probably easy to fix too.

    Just to mention a few details..

    Courier New is a proportional font, so everything typed has the same horizontal width. This is often used in programming environments where text lines up vertically because in any lines typed the chars have the same width. I could show countless examples.

    MOST other fonts are not proportional, so they produce different widths depending on the character. For example, the capital "M" will be usually fairly wide, while the period "." will be very narrow. That means if you type an M on one line and a dot on the next line, the very next char you type on each line will not line up with the one above or below it because the first char was of a variable width. Fonts that cause this are like Arial, MS Sans Serif, Verdana, Times New Roman, etc.

    Now the 'space' character in any of these non proportional fonts is much more narrow then the other characters except maybe small ones like punctuation. For that one font however, Courier New, the space is EXACTLY the same width as the other characters, including the M and the period, because that is the way the font is designed.

    Now before the 'new' software, typing a space with Courier New would act just like in any other editor, it would be the same width as the other chars. Once the new software came in, the space now types (and pastes) differently, so that it acts like a non proportional font space would act.
    If this space char would be fixed when using the Courier New font, all would be well again.

    It's kind of ridiculous when you think about it, because EVERY editor i use does the space correctly, such as Notepad and Wordpad.
     

Share This Page