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

manual: fewer hevea-generated css classes #10605

Merged
merged 8 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -86,6 +86,9 @@ Working version
in case of concurrent modifications.
(Xavier Leroy, report by whitequark, review by David Allsopp)

- #10605: manual, name few css classes to ease styling and maintainability.
(Florian Angeletti, review by Wiktor Kuchta and Gabriel Scherer)

### Compiler user-interface and warnings:

- #10328: Give more precise error when disambiguation could not possibly work.
Expand Down
35 changes: 17 additions & 18 deletions manual/src/html_processing/scss/manual.scss
Expand Up @@ -48,7 +48,7 @@
span {
color:#c88b5f;
}
span.c003{
span.syntax-token{
color:#564233;
}
}
Expand Down Expand Up @@ -294,7 +294,7 @@ blockquote.quote{
border-spacing: 6px;
border-collapse: separate;
}
span.c003{
span.syntax-token{
color:#564233;
font-family: $font-mono;
border-radius:6px
Expand All @@ -307,47 +307,46 @@ div.caml-example.toplevel div.caml-input::before{
span.number{
padding-right: 1ex;
}
span.c004, span.c005, span.c007 {
span.syntax-token {
font-family: $font-mono;
}
span.c003, span.c005 {
span.syntax-token {
color: rgba(91, 33, 6, 0.87);
}
span.c002{
span.ocamlprompt{
color:#888
}
span.c006{
span.font-bold .machine{
font-weight:700;
color:#564233;
font-family: $font-mono;
}
.c008 {
.osvariant {
font-family: $font-sans;
}
span.c010 {
.font-it {
font-style: italic;
}
.font-tt {
font-family: $font-mono;
}
span.authors{
font-style:italic;
background-color:inherit
}
span.c011 {
font-style: italic;
}
.c012 {
font-style: italic;
span.nonterminal {
font-style: oblique;
}
span.c013{
font-style: italic;
.font-sl {
font-style: oblique;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PDF version, "c012" actually had italic font, not slanted. But again, this doesn't matter with the current web font.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more a mismatch on the diff, I generalized the span.font-it rule to .font-it.

}
.center table {
margin-left: inherit;
margin-right: inherit;
}
td .c014 {
td .font-bold {
font-weight: bold;
}
.c016 {
.c003 {
text-align: center;
}
.cellpadding1 tr td {
Expand Down
2 changes: 1 addition & 1 deletion manual/src/html_processing/src/process_manual.ml
Expand Up @@ -42,7 +42,7 @@ let preg_anyspace =
let preg_emspace = "\\(\u{2003}\\| \\)"
(* What hevea inserts between "Chapter" and the chapter number: *)
let preg_chapter_space = "\\(\u{2004}\u{200d}\\|" ^ preg_anyspace ^ "\\)"
let writtenby_css = "span.c010" (* "span.c009" for hevea 2.32 *)
let writtenby_css = "span.font-it" (* "span.c009" for hevea 2.32 *)

(* Remove number: "Chapter 1  The core language" ==> "The core language" *)
let remove_number s =
Expand Down
22 changes: 18 additions & 4 deletions manual/src/macros.hva
Expand Up @@ -160,7 +160,7 @@
%%% Code examples
\newcommand{\input@color}{\htmlcolor{006000}}
\newcommand{\output@color}{\maroon}
\newcommand{\machine}{\tt}
\newcommand{\machine}{\@span{class=machine}\tt}
\newenvironment{machineenv}{\begin{alltt}}{\end{alltt}}
\newcommand{\var}[1]{\textit{#1}}

Expand All @@ -180,6 +180,8 @@
\newcommand{\ocamlcomment}{\@span{class="ocamlcomment"}}
\newcommand{\ocamlstring}{\@span{class="ocamlstring"}}

\newcommand{\?}{\@span{class=ocamlprompt}\#}
\newstyle{.ocamlprompt}{color:black;}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous definition of \? also used \normalsize, is anything lost here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As seen in my table above, this was translated in css to

color:black;

thus nothing has been lost as far as I can see.


%%% End of code example

Expand All @@ -191,8 +193,9 @@


%%venant de macros.tex

\def\versionspecific#1{\begin{quote}\textsf{#1:}\quad}
\newcommand{\osvariant}{\@span{class=osvariant}}
\newstyle{.osvariant}{font-family:sans-serif}
\def\versionspecific#1{\begin{quote}{\osvariant{}#1:}\quad}
\def\unix{\versionspecific{Unix}}
\def\endunix{\end{quote}}
\def\windows{\versionspecific{Windows}}
Expand Down Expand Up @@ -252,7 +255,8 @@
\def\ikwd#1{\indexentry{\jobname.kwd}{#1}}
% nth

\def\th{^{\mbox{\scriptsize th}}}
\def\th{^{\mbox{\@span{class=th}th}}}
\newstyle{.th}{font-size:small;}
\renewcommand{\hbox}[1]{\mbox{#1}}

% Notations pour les metavariables
Expand Down Expand Up @@ -302,3 +306,13 @@
\else
\newcommand{\stddocitem}[2]{\docitem{libref/Stdlib}{#1}{#2}}
\fi

\renewcommand{\tt}{\@span{class=font-tt}}
\newstyle{.font-tt}{font-family:monospace;}
\renewcommand{\it}{\@span{class=font-it}}
\newstyle{.font-it}{font-style:italic;}
\renewcommand{\bf}{\@span{class=font-bold}}
\newstyle{.font-bold}{font-weight:bold;}
\renewcommand{\sl}{\ifmath\ifmathml\@span{class='sl-math'}%
\else\@span{class="font-sl"}\fi\else\@span{class="font-sl"}\fi}
\newstyle{.font-sl}{font-style:oblique;}
1 change: 1 addition & 0 deletions manual/src/macros.tex
Expand Up @@ -247,6 +247,7 @@
\newcommand{\ocamlhighlight}{\bfseries\uline}
\newcommand{\ocamlerror}{\bfseries}
\newcommand{\ocamlwarning}{\bfseries}
\newcommand{\?}{\color{black}\normalsize\tt\#{}}

\definecolor{gray}{gray}{0.5}
\newcommand{\ocamlcomment}{\color{gray}\normalfont\small}
Expand Down
2 changes: 0 additions & 2 deletions manual/src/manual.tex
Expand Up @@ -127,7 +127,6 @@
\fi
}{}

\newcommand{\?}{\color{black}\normalsize\tt\#{}}

\ifocamldoc\else
\lstnewenvironment{ocamlcodeblock}{
Expand Down Expand Up @@ -187,7 +186,6 @@
\usepackage[strings,nohyphen]{underscore}

%\makeatletter \def\@wrindex#1#2{\xdef \@indexfile{\csname #1@idxfile\endcsname}\@@wrindex#2||\\}\makeatother
\def\th{^{\hbox{\scriptsize th}}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this uses hbox but the macros.hva version (old and new) use mbox. Does it make a difference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably be using the latex macro hbox rather the tex one (mbox) but this doesn't really make a difference in html mode. Using hbox or mbox yields the same generated html.



\raggedbottom
Expand Down
6 changes: 4 additions & 2 deletions manual/styles/syntaxdef.hva
Expand Up @@ -27,7 +27,8 @@
\newif\ifspace
\def\addspace{\ifspace\;\spacefalse\fi}
\ifhtml
\newcommand{\token}[1]{\texttt{\blue#1}}
\newcommand{\token}[1]{\textnormal{\@span{class=syntax-token}#1}}
\newstyle{.syntax-token}{color:blue;font-family:monospace}
\else
\newcommand{\token}[1]{\texttt{#1}}
\fi
Expand Down Expand Up @@ -133,7 +134,8 @@
\def\@anchor{}
\fi
%%%Format non-terminal
\def\nt#1{\textit{\maroon#1}}
\def\nt#1{\textnormal{\@span{class=nonterminal}#1}}
\newstyle{.nonterminal}{color:maroon;font-style:oblique}
%%%Link for non-terminal and format
\def\nonterm#1{\addspace\nt{\@anchor{#1}}\spacetrue}
\def\brepet{\addspace\{}
Expand Down