-
-
Notifications
You must be signed in to change notification settings - Fork 747
$(D code) -> code
#2877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$(D code) -> code
#2877
Conversation
|
I should probably diff the original and new .html files. Right as soon as I figure out why my DMD is not building. |
|
Gotta say, looks pretty neat. |
|
Are backticks supported by |
|
It seems you did not catch all cases with nested parenthesis. See std/array.d:29. I spend some time to come up with this beast. This seemed to work. |
|
I'm seeing unexpected differences in the output, which seems to indicate that the backtick syntax is not synonymous with the |
|
Ping @adamdruppe |
|
Where is I doubt they're identical though, unless you defined the |
According to git grep, it's defined in 7 places (twice in the same file, on consecutive lines).
Ah, I can work with that! Thanks. |
|
Hmm, I made this test file: The command: So it looks like there's something magical about |
|
There's something magical about "true" so you may want to try another word. "$(D ...)" is not magical. |
|
How odd. Indeed, this doesn't apply to all keywords. Anyway, the However, there are more differences. For example, the current symbol is no longer highlighted in green. See e.g. std.algorithm.map: original and with backticks. There's also some weird interaction between raw HTML in Ddoc and backticks. Here's std.datetime - I think someone needs to take another look at the DMD side of things before we move forward on this front. |
|
On Sat, Jan 17, 2015 at 04:04:47AM -0800, Vladimir Panteleev wrote:
That was actually intentional, I turned off all the highlighting We could change my call to highlightCode3 over to plain highlightCode
I don't know what's going on with that yet. |
It seems to me that this is a mutually-exclusive choice. Do we want the backticks to not be D-specific, or do we want them to be synonymous with |
|
On Sat, Jan 17, 2015 at 04:04:47AM -0800, Vladimir Panteleev wrote:
OK, the closing > is translated into > by dmd for some reason. Something I've never actually understood is why ddoc cares if That code is definitely responsible, but I don't know why it |
|
On Sat, Jan 17, 2015 at 06:28:51AM -0800, Vladimir Panteleev wrote:
$(D) itself is a middle ground - the current symbol is highlighted, |
I guess it is so the embedded HTML "feature" works with partial escaping outside it. I guess it is logical if you're into embedded html. Regardless, this was an off by one bug - the for loop incremented the counter, missing the opening |
|
There are merge conflicts due to recently merged PRs. Please rebase? (You might have to redo std/algorithm/* from scratch, though -- git doesn't understand the concept of moving content between files and gets very confused when stuff is moved around, like when std.algorithm got split up.) |
|
Recreating this pull request is not a problem, but I'm waiting for dlang/dmd#4306 to be merged first. |
|
GitHub tags are silly. |
|
heh |
|
rebase, after that we should be good to go |
|
so what's blocking this? |
|
Nothing, in my queue |
|
@adamdruppe I found another problem, apparently it can't handle newlines? This says: The error message is also misleading. There's a lot of line breaks (for word wrapping) inside |
|
I think I figured out the error message: a newline silently terminates a |
|
On Mon, Jan 26, 2015 at 05:08:33PM -0800, Vladimir Panteleev wrote:
My first draft did it differently, but this current behavior matches Was also needed for linker error copy pasta that goes like `foo'.
But yes, it shouldn't do that, I'll look into it probably tomorrow. |
|
OK, this introduces an inconvenience: If you have text such as: and you want to add text before the |
|
What's going on? |
|
We need to decide whether to make the backticks work more like on GitHub, or more like |
|
The current implementation of |
I suppose I could restrict this pull to just blocks of code without whitespace, then? |
|
That would be a good start, yes. Though the question of whether or not linebreaks should be allowed, is probably something to be discussed. |
|
Hmm. @adamdruppe Guess what, I found another problem. The leading underscores are not handled at all between backticks: /// No backticks : _foo
/// With backticks: `_foo`
int foo;The second line emits a _ in the output HTML. |
|
Another problem, it doesn't work inside macro definitions: This will print the backticks verbatim. |
|
As hacky as it sounds, maybe it would have been easier to make even backticks be synonymous with |
1a4e461 to
7f07a35
Compare
|
This is because ddoc comments are (conceptually) processed in two stages: first the ddoc-specific engine parses the raw text and inserts things like code markup macros when code snippets are encountered, parse section headings and bracket them with heading macros, etc.. This stage is also where backticks are processed. The second stage is the macro expansion, which only knows about So basically, if you put backticks inside a macro definition, by the time the backticks are expanded we're already in the macro expansion stage, so the backtick code doesn't trigger. |
|
Rebased with just the changes compatible with the current compiler. Merge quickly :) |
|
oops, wrong button, sorry about that |
|
One middle ground is to allow at most one line difference between the opening and closing backtick. The problem I'm trying to avoid is some unmatched backtick "matching" one 30 lines below. |
|
Why not having backticks on one line only? As it is a shortcut, the documentation writer can happily decide whether to use them. If there has to be a limit (and I agree there should be), let the rule be very simple. |
|
Because then other documentation writers may be forced to go and convert backticks into |
|
Yes, this would be the case. I suspect this to be rare. Furthermore, the On Mon, Feb 16, 2015 at 10:30 AM, Vladimir Panteleev <
|
|
I guess this is going nowhere. If someone changes their mind, this patch is easy enough to recreate on top of master. |
http://forum.dlang.org/post/m9btie$pcl$1@digitalmars.com