Skip to content
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

General formatting improvements in the spec #3984

Merged
merged 5 commits into from
Sep 18, 2014

Conversation

gourlaysama
Copy link
Contributor

The spec always needs some love, so here I go:

This is only about formatting, it does not change content or even wording.

  • syntax highlighting for scala code, using highlight.js:
    • this is done in a way that interacts nicely with MathJax: one can use latex inside code blocks without problem (and still get syntax highlighting),
    • uses the latest highlight.js 8.2, with the Scala support freshly revamped by @non,
  • individual HTML pages now have titles,
  • no more broken links,
  • fix or work around some latex problems with MathJax,
  • mass-removal of trailing whitespace, while I was at it...

I uploaded a preview of the result here to make reviewing easier.

@gourlaysama
Copy link
Contributor Author

PLS REBUILD/pr-scala@e11fe9b

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55616510)
🐱 Roger! Rebuilding pr-scala for e11fe9b. 🚨

@gourlaysama
Copy link
Contributor Author

PLS REBUILD/pr-scala@e11fe9b

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55710532)
🐱 Roger! Rebuilding pr-scala for e11fe9b. 🚨

@retronym
Copy link
Member

PLS SYNCH

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55844967)
🐱 Synchronaising! 🙏

@retronym
Copy link
Member

The code blocks exemplifiying the named arguments transformation are not displayed on a single line.

Before:

image

After:

image

@retronym
Copy link
Member

I'm looking at the W3C link checker's report on your published static site.

Looking quite good now!

Here's one wrong link out to Scaladoc:
Wrong: http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.StringLike
Should be: http://www.scala-lang.org/api/current/#scala.collection.immutable.StringLike

We still generate duplicate anchors, particular for examples. e.g in section 3, Types:

image

I see you changed section titles to avoid this problem when we needed to link to an example. I guess we can leave the untargetted examples as is for now (rather than coming up with unique names for them.)

@retronym
Copy link
Member

Overall, this is an amazing contribution. Thank you, Antoine!

@retronym retronym self-assigned this Sep 17, 2014
This adds syntax highlighting for all code scala blocks. Highlighting is
done after MathJax is done rendering so that latex can be used in code
blocks (and it currently *is* used).

Sadly Scala isn't common enough to be bundled in the highlight.min.js
available from CDNs, so we commit a local version of version 8.2 with
only scala bundled in it. The only other language used (ebnf) isn't
supported by highlight.js.
Two things worth mentioning:

 - `\em` and `emph` are not supported by MathJax,
 - and things like `\mathcal{C}_0` require escaping the `_`,
   otherwise markdown sees it as the beginning of  `_some string_`.
   It doesn't happen without the closing bracket in front, e.g. in `b_0`.
For examples, the "name" of the example (like "Example Ordered") is only
used to derived its html id so that one can link to it (see
`layouts/default.yml`). Ideally all examples should have a name; here I
only added enough to satisfy existing links.
@gourlaysama
Copy link
Contributor Author

@retronym I fixed the code block problem and the various other comments.

@gourlaysama
Copy link
Contributor Author

PLS REBUILD/pr-scala@6e19162

@gourlaysama
Copy link
Contributor Author

PLS REBUILD/pr-scala@d24ad90

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55896162)
🐱 Roger! Rebuilding pr-scala for 6e19162. 🚨

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55896181)
🐱 Roger! Rebuilding pr-scala for d24ad90. 🚨

@soc
Copy link
Contributor

soc commented Sep 17, 2014

@gourlaysama Looks nice. Just as a note regarding examples: It would be nice if we could get rid of the examples-as-headings approach, but after spending a few hours on it, it looks like Jekyll supports exactly those parsers which make this impossible.

Two reasons for not having examples-as-headings:

  • Better formatting options via stylesheets
  • Not cluttering up the index

Status quo is that I have given up on a real solution for now and just converted all Example headings to h6 headings, which I don't show in my spec fork anyway.

Looks like the spec situation keeps regressing.

@soc
Copy link
Contributor

soc commented Sep 17, 2014

PLS REBUILD/pr-scala@d24ad90

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 55918698)
🐱 Roger! Rebuilding pr-scala for d24ad90. 🚨

@retronym
Copy link
Member

LGTM, a big improvement to the state of the art.

I would love to see a sidebar with navigation between sections. Any idea how to make that a reality?

retronym added a commit that referenced this pull request Sep 18, 2014
General formatting improvements in the spec
@retronym retronym merged commit 379dbb0 into scala:2.11.x Sep 18, 2014
@retronym
Copy link
Member

FYI, these changes are published to http://www.scala-lang.org/files/archive/spec/2.11/ (that happens automatically after merging). I needed to do a force browser refresh to see the code highlighting. I assume the browser was caching a Javascript resource that we'd updated in the PR.

@som-snytt
Copy link
Contributor

Me too. Maybe there's a place on the doc page for a notice.

@gourlaysama
Copy link
Contributor Author

@retronym I'm looking into a navigation sidebar. It should be possible with some Jekyll and jQuery magic.

@soc I agree examples as headings aren't great, but Markdown doesn't give a lot of options for encoding that kind of semantic information. At least it should be possible to keep them out the navigation. What kind of special formatting did you have in mind for code examples?

@soc
Copy link
Contributor

soc commented Sep 19, 2014

@gourlaysama I settled on using block-quotes for now: http://oxnrtr.de/scala-spec/01-lexical-syntax.html (also note the navigation sidebar and the outline).

That means block-quotes can't be used for anything else except examples anymore, but I haven't found another use-case for them anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants