Skip to content

Commit

Permalink
manual: fewer hevea-generated css classes (#10605)
Browse files Browse the repository at this point in the history
* 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 1be4fa7)
  • Loading branch information
Octachron committed Sep 9, 2021
1 parent ea31d8b commit 712764a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 27 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 17 additions & 18 deletions manual/src/html_processing/scss/manual.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
span {
color:#c88b5f;
}
span.c003{
span.syntax-token{
color:#564233;
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion manual/src/html_processing/src/process_manual.ml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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;}

%%% 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 @@ -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;}
1 change: 1 addition & 0 deletions manual/src/macros.tex
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
\fi
}{}
\newcommand{\?}{\color{black}\normalsize\tt\#{}}
\ifocamldoc\else
\lstnewenvironment{ocamlcodeblock}{
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions manual/styles/syntaxdef.hva
Original file line number Diff line number Diff line change
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

0 comments on commit 712764a

Please sign in to comment.