|
|
Luc Pattyn wrote: also suggest, and this is new, you automatically replace CODE tags by PRE tags as soon as they span a newline
Adding to Luc's suggestion, we should also remove one PRE(or CODE) tag automatically if it's followed by another one immediately. In Q&A, many times, people put PRE tag to code part explicitly (for second time) even though when by default code gets formatted by a PRE tag while pasting.
Ex:
<pre lang="cs">protected void SampleCodeSnippet(object sender, EventArgs e)
{
}
HTML presentation of above:
<pre><pre lang="cs"> protected void SampleCodeSnippet(object sender, EventArgs e)
{
// some code
} </pre></pre>
Above highlighted part can be formatted internally(i.e. remove one PRE tag)
modified on Wednesday, September 29, 2010 2:31 AM
|
|
|
|
|
Yep - good idea. Added to the TODO
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
You need to pay more attention to the discussion. We're not talking about the pre blocks. Those need to be colourized, where the colour adds a great deal to the clarity of the reader. By contrast, the code tag is for marking, as I said, usage of code within the article text.
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
Thanks for the subtle hint. I wouldn't have thought to specify lang="text".
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
I never said the FAQ article said the CODE block supported a lang attribute, i was merely pointing you to a list of attribute values for the various languages.
I think some authors get mixed up when to use CODE and PRE and as a result some of the articles look too coloured.
Agree that only code should be colourised using the CODE(for single inline statements, parameters, function names etc) and PRE for blocks of code.
(Off Topic: Not fed up of Wonderware InTouch yet? we are ditching it as our main system in preference of Emerson DeltaV, although our turbine HMI's still use Intouch)
Dave
Find Me On: Web| Facebook| Twitter| LinkedIn
CPRepWatcher now available as Packaged Chrome Extension, visit my articles for link.
|
|
|
|
|
Oh. Well, thanks for the heads up, but I actually did give it a cursory read before I published my article. A good thing, too, because I was initially colorizing the code within the pre blocks using the CSS classes. Manually.
As for InTouch, we often don't get to choose. When we do choose, we go with Windows Forms. But sometimes our customers buy our furnace and insist on integrating our Level 2 HMI within their existing SCADA system.
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
Silver members and above can edit that article. I've gone and added the magic few words.
knockNrod wrote: When articles apply all the color-coding -- far from adding clarity -- they actually take away from the article by over-focusing the reader's attention on the colors, pulling the reader out of the context of that article.
I've gone back and forwards on this a few times. I'm leaning towards removing it again.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
The inline coloring seems useless much of the time. One of the editors did that to one of my articles and I felt it reduced the quality of the article. I could have changed it, but of course that becomes more difficult once an editor gets his/her grubby hands all over it. It can be useful to color code (or, say, italisize) code when it is needed, such as when emphasis is desired or when the term is ambiguous. But that doesn't always apply. For example, it is common practice to uppercase SQL terms when writing SQL code, and that's a practice I carry over to articles. Emphasizing that additionally by adding color is just too distracting, unnecessary, and purposeless. Especially if the article is already broken into small chunks of text with lots of PRE blocks (with so much emphasis, where's a reader to focus?).
|
|
|
|
|
I don't mind a single distinct color for highlighting .NET class names, C# keywords, or identifiers that should be taken literally and not be confused with the regular English words. So a teacher can explain about class and Form and bool initialized in class.
Unfortunately I had to add a lang="text" twice to get the above CODE snippets all in a single color, otherwise it would have looked like this:
I don't mind a single distinct color for highlighting class names, keywords, or identifiers that should be taken literally and not be confused with the regular English words. So a teacher can explain about class and Form and bool initialized in class.
|
|
|
|
|
Agreed. The former is much nicer looking.
3x12=36
2x12=24
1x12=12
0x12=18
|
|
|
|
|
I understand. I went back and forth a couple times writing the article. In the end, I remembered something I learned about typesetting from the perspective of an editor: four fonts and two colors is enough. (Fonts here includes weight, point size, and italics -- extremely minimalist.) Any deviation should have a compelling justification.
The reasoning is that the article should allow the reader to focus on the content, put them in the zone. Any deviation at all (including the four fonts and two colors) draws attention at the expense of pulling the reader out of the zone. (Note this doesn't preclude more, it's just that when you see more you should consider it the editorial equivalent of a code-smell.)
I'm not saying that this opinion is right, but I've never heard a compelling contending argument. Hey, newspapers and magazines were successful for hundreds of years -- they must have learned some useful lessons.
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
My feeling is that the "two colours" rule doesn't always hold, especially for technical content that needs to be visually broken (eg comments and code).
In any case, colourisation for CODE blocks has been removed and I'm hoping to do a final test and upload today.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Your colourizer is stumbling over arrays.
Private Sub InteropIsothermControl_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim IsothermColors As Double(,)
If Me.DesignMode Then
IsothermColors = New Double(,) {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
Else
IsothermColors = IsothermDataProvider.GetIsothermTemperatures()
End If
Check out the spans on the zeros. Only the last in each row is properly colourized.
Without darkness, there are no dreams.
-Karla Kuban
|
|
|
|
|
Added to the bug list.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
This[^] user posts answers in Q&A point only to his blog with contributing nothing else and he also tries to lure people in the Lounge into this!
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Thanks
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Most weeks I respond to the Code project news letter by clicking the link for the survey.
I can vote but the vote would be ignored because I am not logged in and I can not log in from that page.
|
|
|
|
|
Can we get a sort options implementation so we can list articles/blogs/tips sorted by :
Date Voted
Date Bookmarked
Date Posted
Date Modified
Score
Number of Views
Number of Bookmarks
Popularity
Number of Downloads
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
yeah, basically sortable by any piece of information provided. As if it were a DataGridView.
|
|
|
|
|
Tips/Tricks are no longer showing scores.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
A small but vocal group calling themselves the Downvoted and Downtrodden Tips and Tricks threatened a class action saying that but publicising their voting status and encouraging members to choose Tips with a higher score we were, in fact, discriminating against a minority group which was no only illegal and immoral but also unconstitutional.
Things escalated from email campaigns, posters taped to local fire hydrants, and finally escalated out of control with a Facebook group and, the final straw, tweets about the issue.
I had no choice. I caved.
(and I'll add it to the biug list)
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
|
|
|
|
|
Don't you just hate political action groups?
You know if you need to squash an uprising, all you gotta do is ask me (you've already cited the appropriate forum message)...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
0) When you go to your My Articles page, click the Tips tab, click one of your tips, and then click the Back button in your browser, you are taken back to your "Articles" tab. This is highly annoying.
1) Let's say that when you go to your Tips tab, and scroll down to a tip, click the tip, and then click the browser's Back button, you are taken back to your Article tab, but the page seems to remember how far you scrolled your Tip tab to find the tip you wanted to click on (despite showing your Article tab.
Since I'm one of the few people on the site with enough Tips posted to find this problem, you'll probably have to go to my My Articles page to see these bugs in action.
JSOP's Articles Page[^]
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
In fact I noticed both phenomena early on, but since you would be the main victim here, I left you the privilege to report them.
BTW: A similar tab-control-returns-to-tabpage-zero phenomenon occurs on the home page, when looking at the latest blogs or tips, or the ones needing approval.
|
|
|
|
|