marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.01k stars 793 forks source link

Remove comma separator from 'render_html.js' script and insert it in using CSS #457

Closed mahdavipanah closed 5 years ago

mahdavipanah commented 5 years ago

Not all languages use , character as the comma. So it's better to insert the comma separator between author's name and its citation's title (in quote blocks) using CSS tricks so, in order to change the comma character in the translation process, there is no need to change the _renderhtml.js script and only the stylesheets.

marijnh commented 5 years ago

I'm a bit concerned about that not being copy-pasteable (the same goes for the quotes, I'm aware, but missing those is less disruptive than having author and source mashed together without any kind of separator).

How about we do a thing where there's a separate configuration .js file that specifies things like this, and the renderer takes the separator from there?

mahdavipanah commented 5 years ago

It's a very good idea. Or even it can be configurable using a specific template. For example, the whole author and it's source is defined like this as default:

const configs = {
  authorSourceOfQuote: '{author}, {source}',
}

and then for translation it can very straight forward to change it:

const configs = {
  authorSourceOfQuote: '{source} ،{author}',
}
marijnh commented 5 years ago

Right. There's already a templating lib (mold) included, so you could build it on top of that.

mahdavipanah commented 5 years ago

I'll try and do my best. Since the translation is a gradual process, I think it would be better to try and generalize needed parts as I go through the process.

Thanks.