summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Angeletti <florian.angeletti@inria.fr>2021-09-07 21:29:22 +0200
committerFlorian Angeletti <florian.angeletti@inria.fr>2021-09-09 11:08:58 +0200
commit712764af1669a6c508a2733188b3f33fa8f74f35 (patch)
tree47a429cfa2920b3ee108725821d3aee7b1735f58
parentea31d8bfe0d4589195ad5339b11a57d606634225 (diff)
downloadocaml-712764af1669a6c508a2733188b3f33fa8f74f35.tar.gz
manual: fewer hevea-generated css classes (#10605)
* use css classes in syntax environment * manual: name all css classes outside of tables * webman: fix chapter identification * manual: use \textnormal to remove font style * manual: unify machine and tt environment on the html side (cherry picked from commit 1be4fa768f84f4cc04a289d2b766665e832d096f)
-rw-r--r--Changes3
-rw-r--r--manual/src/html_processing/scss/manual.scss35
-rw-r--r--manual/src/html_processing/src/process_manual.ml2
-rw-r--r--manual/src/macros.hva22
-rw-r--r--manual/src/macros.tex1
-rw-r--r--manual/src/manual.tex2
-rw-r--r--manual/styles/syntaxdef.hva6
7 files changed, 44 insertions, 27 deletions
diff --git a/Changes b/Changes
index 754b2aa2d5..ebb5bd6dc9 100644
--- a/Changes
+++ b/Changes
@@ -298,6 +298,9 @@ OCaml 4.13.0
- #10497: Styling changes in the post-processed HTML manual (webman)
(Wiktor Kuchta, review by Florian Angeletti)
+- #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:
- #1737, #2092, #7852, #7859, #10405, #10417: Update locations during
diff --git a/manual/src/html_processing/scss/manual.scss b/manual/src/html_processing/scss/manual.scss
index 67c2750bd7..d9db692ffb 100644
--- a/manual/src/html_processing/scss/manual.scss
+++ b/manual/src/html_processing/scss/manual.scss
@@ -48,7 +48,7 @@
span {
color:#c88b5f;
}
- span.c003{
+ span.syntax-token{
color:#564233;
}
}
@@ -293,7 +293,7 @@ blockquote.quote{
border-spacing: 6px;
border-collapse: separate;
}
-span.c003{
+span.syntax-token{
color:#564233;
font-family: $font-mono;
border-radius:6px
@@ -306,47 +306,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;
}
.center table {
margin-left: inherit;
margin-right: inherit;
}
-td .c014 {
+td .font-bold {
font-weight: bold;
}
-.c016 {
+.c003 {
text-align: center;
}
.cellpadding1 tr td {
diff --git a/manual/src/html_processing/src/process_manual.ml b/manual/src/html_processing/src/process_manual.ml
index 2ba37b6688..2b36b6c36a 100644
--- a/manual/src/html_processing/src/process_manual.ml
+++ b/manual/src/html_processing/src/process_manual.ml
@@ -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 =
diff --git a/manual/src/macros.hva b/manual/src/macros.hva
index d564ae30ce..104b3ec5f1 100644
--- a/manual/src/macros.hva
+++ b/manual/src/macros.hva
@@ -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}}
@@ -180,6 +180,8 @@
\newcommand{\ocamlcomment}{\@span{class="ocamlcomment"}}
\newcommand{\ocamlstring}{\@span{class="ocamlstring"}}
+\newcommand{\?}{\@span{class=ocamlprompt}\#}
+\newstyle{.ocamlprompt}{color:black;}
%%% End of code example
@@ -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}}
@@ -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
@@ -301,3 +305,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;}
diff --git a/manual/src/macros.tex b/manual/src/macros.tex
index e716b7aed5..f0b68cc7c5 100644
--- a/manual/src/macros.tex
+++ b/manual/src/macros.tex
@@ -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}
diff --git a/manual/src/manual.tex b/manual/src/manual.tex
index 1215a3f175..6c5b28cafa 100644
--- a/manual/src/manual.tex
+++ b/manual/src/manual.tex
@@ -123,7 +123,6 @@
\fi
}{}
-\newcommand{\?}{\color{black}\normalsize\tt\#{}}
\ifocamldoc\else
\lstnewenvironment{ocamlcodeblock}{
@@ -183,7 +182,6 @@
\usepackage[strings,nohyphen]{underscore}
%\makeatletter \def\@wrindex#1#2{\xdef \@indexfile{\csname #1@idxfile\endcsname}\@@wrindex#2||\\}\makeatother
-\def\th{^{\hbox{\scriptsize th}}}
\raggedbottom
diff --git a/manual/styles/syntaxdef.hva b/manual/styles/syntaxdef.hva
index 7266d7ef62..a886fa7b39 100644
--- a/manual/styles/syntaxdef.hva
+++ b/manual/styles/syntaxdef.hva
@@ -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
@@ -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\{}