diff options
Diffstat (limited to 'lib/erl_docgen/priv')
28 files changed, 1333 insertions, 357 deletions
diff --git a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript index 8e1e35bcdd..ce9303f86e 100755 --- a/lib/erl_docgen/priv/bin/codeline_preprocessing.escript +++ b/lib/erl_docgen/priv/bin/codeline_preprocessing.escript @@ -2,7 +2,7 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2016. All Rights Reserved. +%% Copyright Ericsson AB 2009-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ %% Function: main/1 %% Description: %%---------------------------------------------------------------------- -main([InFile, OutFile]) -> +main([CPath, InFile, OutFile]) -> InDev = case file:open(InFile, [read]) of {ok,ID} -> @@ -38,7 +38,6 @@ main([InFile, OutFile]) -> _ -> halt(5) end, - CPath=filename:dirname(InFile), OutDev = case file:open(OutFile, [write]) of {ok,OD} -> diff --git a/lib/erl_docgen/priv/bin/github_link.escript b/lib/erl_docgen/priv/bin/github_link.escript new file mode 100755 index 0000000000..e0f5a2f471 --- /dev/null +++ b/lib/erl_docgen/priv/bin/github_link.escript @@ -0,0 +1,51 @@ +#!/usr/bin/env escript +%% -*- erlang -*- +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010-2018. All Rights Reserved. +%% +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. +%% +%% %CopyrightEnd% +%%---------------------------------------------------------------------- +%% File : github_link.escript +%% +%% Created : 12 Dec 2017 by Lukas Larsson +%%---------------------------------------------------------------------- + +main([In, Filename, Sha, Out]) -> + {ok, Bin} = file:read_file(In), + + TagsToAnnotate = ["description", "func", "datatype", "section"], + + Subs = subs(TagsToAnnotate, Filename, Sha, re:split(Bin,[$\n])), + + file:write_file(Out, Subs). + +subs([], _, _, Bin) -> + lists:join("\n", Bin); +subs([Pat|Pats], Fn, Sha, Bin) -> + subs(Pats, Fn, Sha, sub(Bin, Pat, Fn, Sha)). + +sub(Bin, Pat, Fn, Sha) -> + sub(Bin, Pat, Fn, Sha, 1). +sub([], _Pat, _Fn, _Sha, _Cnt) -> + []; +sub([H|T], Pat, Fn, Sha, Cnt) -> + %% We use the maint branch here, it is not as exact as the tag, + %% but it is the best we can do as github does not allow doing + %% pullrequests on anything but branches. + [re:replace(H,["<",Pat,">"], + ["<",Pat," ghlink=\"maint/",Fn,"#L", + integer_to_list(Cnt),"\">"],[{return,list}]) | + sub(T, Pat, Fn, Sha, Cnt+1)]. diff --git a/lib/erl_docgen/priv/bin/xml_from_edoc.escript b/lib/erl_docgen/priv/bin/xml_from_edoc.escript index b930ae3818..38e4f2d923 100755 --- a/lib/erl_docgen/priv/bin/xml_from_edoc.escript +++ b/lib/erl_docgen/priv/bin/xml_from_edoc.escript @@ -2,7 +2,7 @@ %% -*- erlang -*- %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2016. All Rights Reserved. +%% Copyright Ericsson AB 2010-2018. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ %% Records %%====================================================================== -record(args, {suffix=".xml", + dir=".", layout=docgen_edoc_xml_cb, def=[], includes=[], @@ -85,7 +86,7 @@ module(File, Args) -> {app_default, "OTPROOT"}, {file_suffix, Args#args.suffix}, - {dir, "."}, + {dir, Args#args.dir}, {layout, Args#args.layout}], edoc:file(File, Opts); false -> @@ -118,7 +119,7 @@ users_guide(File, Args) -> Text = edoc_lib:run_layout(F, Opts), OutFile = "chapter" ++ Args#args.suffix, - edoc_lib:write_file(Text, ".", OutFile, Encoding); + edoc_lib:write_file(Text, Args#args.dir, OutFile, Encoding); false -> io:format("~s: not a regular file\n", [File]), usage() @@ -139,6 +140,8 @@ parse(["-def", Key, Val |RawOpts], Type, Args) -> parse(["-i", Dir |RawOpts], Type, Args) -> Args2 = Args#args{includes=Args#args.includes++[Dir]}, parse(RawOpts, Type, Args2); +parse(["-dir", Dir |RawOpts], Type, Args) -> + parse(RawOpts, Type, Args#args{dir=Dir}); parse(["-preprocess", Bool |RawOpts], Type, Args) when Bool == "true"; Bool == "false" -> parse(RawOpts, Type, Args#args{preprocess=list_to_atom(Bool)}); diff --git a/lib/erl_docgen/priv/css/Makefile b/lib/erl_docgen/priv/css/Makefile index c317411d32..e3d2ee7e3f 100644 --- a/lib/erl_docgen/priv/css/Makefile +++ b/lib/erl_docgen/priv/css/Makefile @@ -39,7 +39,8 @@ RELSYSDIR = $(RELEASE_PATH)/lib/erl_docgen-$(VSN) CSS_FILES = \ - otp_doc.css + otp_doc.css \ + highlight.css # ---------------------------------------------------- diff --git a/lib/erl_docgen/priv/css/highlight.css b/lib/erl_docgen/priv/css/highlight.css new file mode 100644 index 0000000000..d5bd1d2a9a --- /dev/null +++ b/lib/erl_docgen/priv/css/highlight.css @@ -0,0 +1,96 @@ +/* + +Atom One Light by Daniel Gamage +Original One Light Syntax theme from https://github.com/atom/one-light-syntax + +base: #fafafa +mono-1: #383a42 +mono-2: #686b77 +mono-3: #a0a1a7 +hue-1: #0184bb +hue-2: #4078f2 +hue-3: #a626a4 +hue-4: #50a14f +hue-5: #e45649 +hue-5-2: #c91243 +hue-6: #986801 +hue-6-2: #c18401 + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #383a42; + background: #fafafa; +} + +.hljs-comment, +.hljs-quote { + color: #a0a1a7; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #a626a4; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e45649; +} + +.hljs-literal { + color: #0184bb; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #50a14f; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #c18401; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #986801; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #4078f2; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/lib/erl_docgen/priv/css/otp_doc.css b/lib/erl_docgen/priv/css/otp_doc.css index 219740a557..17d9f8dd56 100644 --- a/lib/erl_docgen/priv/css/otp_doc.css +++ b/lib/erl_docgen/priv/css/otp_doc.css @@ -1,34 +1,39 @@ /* standard OTP style sheet */ body { - background: white; - font-family: Verdana, Arial, Helvetica, sans-serif; + background: #fefefe; + color: #1a1a1a; + font-family: sans-serif; margin: 0; padding: 0; border: 0; overflow: scroll; height: 100%; max-height: 100%; + line-height: 1.2em; + font-size: 16px; } -th { font-family: Verdana, Arial, Helvetica, sans-serif } -td { font-family: Verdana, Arial, Helvetica, sans-serif } -p { font-family: Verdana, Arial, Helvetica, sans-serif } +h1, h2, h3, h4, h5, h6{ + line-height: 1.2em; +} + +p { max-width: 42em } -.header { background: #222; color: #fff } +.header { background: #222; color: #fefefe } .top { background: #efe } .otp { background: #efe } .erlang { background: #ffe } .otp2 { background: #efe } .app { background: #ffe } -a:link { color: blue; text-decoration: none } -a:active { color: blue; text-decoration: none } -a:visited { color: blue; text-decoration: none } +a:link { color: #1862ab; text-decoration: none } +a:active { color: #1c7cd6; text-decoration: none } +a:visited { color: #1b6ec2; text-decoration: none } #container { width: 100%; margin: 0; - background-color: #fff; + background-color: #fefefe; } #leftnav { @@ -41,11 +46,12 @@ a:visited { color: blue; text-decoration: none } overflow:auto; margin: 0; padding: 1px; - border-right: 1px solid red; + border-right: 1px solid #ccc; } #content { margin-left: 340px; /* set left value to WidthOfFrameDiv */ + max-width: 42em; } .frontpage @@ -61,66 +67,100 @@ a:visited { color: blue; text-decoration: none } .footer { margin: 15px; /* Magins for inner DIV inside each DIV (to provide padding) */ + text-align: center; +} + +.bold_code { font-family: mono, Courier, monospace; font-weight: bold } + +/* Invisible table for function specs, + * just to get since-version out in right margin */ +.func-table, .func-tr, .func-td, .cfunc-td, .func-since-td { + width: 200%; + border: 0; + padding: 0; + margin: 0; +} + +.func-tr:nth-child(n) { + background: inherit /* turn off zebra striped rows */ +} + +.func-td { + width: 50%; } -span.bold_code { font-family: Courier, monospace; font-weight: bold } -span.code { font-family: Courier, monospace; font-weight: normal } +.cfunc-td { + width: 50%; + padding-left: 100px; + text-indent: -100px; +} + +.func-since-td { + width: 50%; + padding-left: 1em +} + +.func-td:hover { + background-color: #f5f5f5; +} + +.code { + font-family: mono, Courier, monospace; + font-weight: normal; + background-color: #f3f3f3; +} .note, .warning, .do, .dont { - border: solid black 1px; - margin: 1em 3em; + border: 1px solid #495057; + margin: 1em 0; } .note .label { - background: #30d42a; - color: white; + background-color: #2b8a3e; + color: #fefefe; font-weight: bold; - padding: 5px 10px; + padding: 0.5em 1em; } .note .content { - background: #eafeea; - color: black; + background: #f8f9fa; line-height: 120%; - font-size: 90%; - padding: 5px 10px; + font-size: 0.9em; + padding: 0.5em 1em; } .warning .label { - background: #C00; - color: white; + background: #c92a2a; + color: #fefefe; font-weight: bold; - padding: 5px 10px; + padding: 0.5em 1em; } .warning .content { - background: #FFF0F0; - color: black; + background-color: #f8f9fa; line-height: 120%; - font-size: 90%; - padding: 5px 10px; + font-size: 0.9em; + padding: 0.5em 1em; } .do .label { - background: #30d42a; - color: white; + background-color: #2b8a3e; + color: #fefefe; font-weight: bold; - padding: 5px 10px; + padding: 0.5em 1em; } .do .content { - background: #eafeea; - color: black; + background: #f8f9fa; line-height: 120%; - font-size: 90%; - padding: 5px 10px; + font-size: 0.9em; + padding: 0.5em 1em; } .dont .label { - background: #C00; - color: white; + background: #c92a2a; + color: #fefefe; font-weight: bold; - padding: 5px 10px; + padding: 0.5em 1em; } .dont .content { - background: #FFF0F0; - color: black; + background-color: #f8f9fa; line-height: 120%; - font-size: 90%; - padding: 5px 10px; + font-size: 0.9em; + padding: 0.5em 1em; } .quote { @@ -128,19 +168,157 @@ span.code { font-family: Courier, monospace; font-weight: normal } } .example { - background-color:#eeeeff; - padding: 0px 10px; + background-color:#f1f3f5; + border: 1px solid #dee2e6; + padding: 0.5em 1em; + margin: 1em 0; + font-size: 0.7em; } .extrafrontpageinfo { color: #C00; font-weight: bold; - font-size: 120%; + font-size: 1.2em; } -pre { font-family: Courier, monospace; font-weight: normal } +pre { + font-family: mono, Courier, monospace; + font-weight: normal; + margin: 0; +} -.REFBODY { margin-left: 13mm } -.REFTYPES { margin-left: 8mm } +.exports-body, .data-types-body, .REFBODY{ + margin-left: 2em; +} +.REFTYPES { margin-left: 1.5em } footer { } + +.erlang-logo-wrapper{ + text-align: center; + margin-bottom: 1em; +} + +.main-title{ + text-align: center; +} + +.main-description{ + text-align: center; + margin: 2em 0; + font-size: 1.5em; + line-height: 1.5em; +} + +.doc-table-wrapper, .doc-image-wrapper{ + width: 100%; +} + +.doc-image-wrapper{ + text-align: center; +} + +.doc-table, .doc-image{ + min-width: 50%; + margin: 0 auto; + font-size: 0.7em; +} + +.doc-table-caption, .doc-image-caption{ + margin-top: 1em; + font-style: italic; + text-align: center; +} + +table { + border-collapse: collapse; + min-width: 50%; + margin: 1em; +} + +table, th, td { + border: 1px solid #666; +} + +th, td { + padding: 0.5em; + text-align: left; +} + +tr:hover { + background-color: #f5f5f5; +} + +tr:nth-child(even) { + background-color: #f2f2f2; +} + +th { + background-color: #777; + color: #fefefe; +} + +.section-title, .section-subtitle, .section-version{ + text-align: center; + margin: 0; +} + +.section-title{ + font-weight: bold; +} + +.section-version{ + font-size: small; +} + +.expand-collapse-items{ + font-size: small; +} + +.title_link { + color: #1a1a1a !important; + outline: none; +} + +.ghlink { + margin-left: -2.7em; /* .pencil.font-size + .pencil.padding.left + .pencil.padding.right = 2.7 */ + visibility: hidden; +} + +.pencil:before { + transform: rotateZ(90deg); + content: "\270E"; + color: #1a1a1a !important; + font-weight: bold; + font-size: 1.5em; + padding: .3em .6em .6em; + line-height: 1em; + font-family: mono; +} + +hr{ + border: 0; + border-top: 1px solid #aaa; +} + +.section-links, .panel-sections, .expand-collapse-items{ + padding: 0 1em; +} + +.section-links, .panel-sections{ + margin-top: 0; +} + +a > .code { + color: #1862ab; +} + +.func-types-title{ + font-size: 1em; +} + +.since{ + color: gray; + font-weight: normal; + font-size: small; +}
\ No newline at end of file diff --git a/lib/erl_docgen/priv/dtd/book.dtd b/lib/erl_docgen/priv/dtd/book.dtd index aa07d38658..326bf3369a 100644 --- a/lib/erl_docgen/priv/dtd/book.dtd +++ b/lib/erl_docgen/priv/dtd/book.dtd @@ -30,7 +30,7 @@ insidecover?, pagetext, preamble, - (applications|parts|headline|pagetext)+, + (applications|parts|internals|headline|pagetext)+, (listoffigures?, listoftables?, listofterms?, @@ -56,6 +56,7 @@ <!ELEMENT applications (include)* > <!ELEMENT parts (title?,description?,(include|onepart)*) > <!ATTLIST parts lift (yes|no) "no" > +<!ELEMENT internals (include)* > <!ELEMENT headline (#PCDATA) > <!ELEMENT index EMPTY > <!ELEMENT listoffigures EMPTY > diff --git a/lib/erl_docgen/priv/dtd/chapter.dtd b/lib/erl_docgen/priv/dtd/chapter.dtd index a4c9e4040d..3e9113d798 100644 --- a/lib/erl_docgen/priv/dtd/chapter.dtd +++ b/lib/erl_docgen/priv/dtd/chapter.dtd @@ -31,7 +31,8 @@ <!-- Structure --> <!ELEMENT chapter (header,(%block;|quote|warning|note|dont|do|br| - image|marker|table)*,section+) > + image|marker|table)*,section*) > <!ELEMENT section (marker*,title, (%block;|quote|warning|note|dont|do|br|image|marker| table|section)*) > +<!ATTLIST section ghlink CDATA #IMPLIED> diff --git a/lib/erl_docgen/priv/dtd/common.dtd b/lib/erl_docgen/priv/dtd/common.dtd index b1578ad9d4..0ccd52068b 100644 --- a/lib/erl_docgen/priv/dtd/common.dtd +++ b/lib/erl_docgen/priv/dtd/common.dtd @@ -25,7 +25,7 @@ <!ENTITY % block "p|pre|code|list|taglist|codeinclude| erleval" > <!ENTITY % inline "#PCDATA|c|i|em|strong|term|cite|br|path|seealso| - url|marker|anno" > + url|marker|anno|image" > <!-- XXX --> <!ELEMENT p (%inline;)* > <!ELEMENT pre (#PCDATA|seealso|url|input|anno)* > diff --git a/lib/erl_docgen/priv/dtd/common.image.dtd b/lib/erl_docgen/priv/dtd/common.image.dtd index d97057590e..138da3609b 100644 --- a/lib/erl_docgen/priv/dtd/common.image.dtd +++ b/lib/erl_docgen/priv/dtd/common.image.dtd @@ -18,5 +18,7 @@ $Id$ --> <!ELEMENT image (icaption) > -<!ATTLIST image file CDATA #REQUIRED > +<!ATTLIST image + file CDATA #REQUIRED + width CDATA #IMPLIED > <!ELEMENT icaption (#PCDATA) > diff --git a/lib/erl_docgen/priv/dtd/common.refs.dtd b/lib/erl_docgen/priv/dtd/common.refs.dtd index 4f87007a09..07c876a17f 100644 --- a/lib/erl_docgen/priv/dtd/common.refs.dtd +++ b/lib/erl_docgen/priv/dtd/common.refs.dtd @@ -26,8 +26,10 @@ %common.header; <!ELEMENT description (%block;|quote|br|marker|warning|note|dont|do)* > +<!ATTLIST description ghlink CDATA #IMPLIED> <!ELEMENT funcs (func)+ > <!ELEMENT func (name+,fsummary,(type|type_desc)*,desc?) > +<!ATTLIST func ghlink CDATA #IMPLIED> <!-- ELEMENT name is defined in each ref dtd --> <!ELEMENT fsummary (#PCDATA|c|i|em|anno)* > <!ELEMENT type (v,d?)* > @@ -42,8 +44,11 @@ <!ELEMENT email (#PCDATA) > <!ELEMENT section (marker*,title,(%block;|quote|br|marker| warning|note|dont|do|section)*) > -<!ELEMENT datatypes (datatype)+ > +<!ATTLIST section ghlink CDATA #IMPLIED> +<!ELEMENT datatypes (datatype_title?,datatype)+ > +<!ELEMENT datatype_title (#PCDATA) > <!ELEMENT datatype (name+,desc?) > +<!ATTLIST datatype ghlink CDATA #IMPLIED> <!ELEMENT type_desc (#PCDATA|anno|c|seealso)* > <!ATTLIST type_desc variable CDATA #IMPLIED name CDATA #IMPLIED> diff --git a/lib/erl_docgen/priv/dtd/cref.dtd b/lib/erl_docgen/priv/dtd/cref.dtd index 5ccd98ed89..d392081807 100644 --- a/lib/erl_docgen/priv/dtd/cref.dtd +++ b/lib/erl_docgen/priv/dtd/cref.dtd @@ -30,6 +30,8 @@ <!-- `name' is used in common.refs.dtd and must therefore be defined in each *ref. dtd --> <!ELEMENT name (ret,nametext) > +<!ATTLIST name since CDATA #IMPLIED> + <!ELEMENT ret (#PCDATA) > <!ELEMENT nametext (#PCDATA) > diff --git a/lib/erl_docgen/priv/dtd/erlref.dtd b/lib/erl_docgen/priv/dtd/erlref.dtd index 615b88b61a..8202ea5a4d 100644 --- a/lib/erl_docgen/priv/dtd/erlref.dtd +++ b/lib/erl_docgen/priv/dtd/erlref.dtd @@ -25,6 +25,7 @@ <!ELEMENT erlref (header,module,modulesummary,description, (section|funcs|datatypes)*,authors?) > <!ELEMENT module (#PCDATA) > +<!ATTLIST module since CDATA #IMPLIED> <!ELEMENT modulesummary (#PCDATA) > <!-- `name' is used in common.refs.dtd and must therefore @@ -33,4 +34,6 @@ <!ATTLIST name name CDATA #IMPLIED arity CDATA #IMPLIED clause_i CDATA #IMPLIED + anchor CDATA #IMPLIED + since CDATA #IMPLIED n_vars CDATA #IMPLIED> diff --git a/lib/erl_docgen/priv/images/erlang-logo.gif b/lib/erl_docgen/priv/images/erlang-logo.gif Binary files differindex abf5f225d7..ae13168429 100644 --- a/lib/erl_docgen/priv/images/erlang-logo.gif +++ b/lib/erl_docgen/priv/images/erlang-logo.gif diff --git a/lib/erl_docgen/priv/images/erlang-logo.png b/lib/erl_docgen/priv/images/erlang-logo.png Binary files differindex 56291aac15..41bba97417 100644 --- a/lib/erl_docgen/priv/images/erlang-logo.png +++ b/lib/erl_docgen/priv/images/erlang-logo.png diff --git a/lib/erl_docgen/priv/js/flipmenu/Makefile b/lib/erl_docgen/priv/js/flipmenu/Makefile index 06a13defca..ad6d4acb6c 100644 --- a/lib/erl_docgen/priv/js/flipmenu/Makefile +++ b/lib/erl_docgen/priv/js/flipmenu/Makefile @@ -76,6 +76,7 @@ release_spec: opt release_docs_spec: $(INSTALL_DIR) "$(RELEASE_PATH)/doc/js/flipmenu" $(INSTALL_DATA) $(JS_FILES) $(GIF_FILES) "$(RELEASE_PATH)/doc/js/flipmenu" + $(INSTALL_DATA) ../highlight.js ../highlight.pack.js "$(RELEASE_PATH)/doc/js/" release_tests_spec: diff --git a/lib/erl_docgen/priv/js/flipmenu/flip_closed.gif b/lib/erl_docgen/priv/js/flipmenu/flip_closed.gif Binary files differindex 9a27c7c25d..a75107a782 100644 --- a/lib/erl_docgen/priv/js/flipmenu/flip_closed.gif +++ b/lib/erl_docgen/priv/js/flipmenu/flip_closed.gif diff --git a/lib/erl_docgen/priv/js/flipmenu/flip_open.gif b/lib/erl_docgen/priv/js/flipmenu/flip_open.gif Binary files differindex 9dda60e73a..1274637fe0 100644 --- a/lib/erl_docgen/priv/js/flipmenu/flip_open.gif +++ b/lib/erl_docgen/priv/js/flipmenu/flip_open.gif diff --git a/lib/erl_docgen/priv/js/flipmenu/flip_static.gif b/lib/erl_docgen/priv/js/flipmenu/flip_static.gif Binary files differindex 2b3ddb5382..4cc914a50a 100644 --- a/lib/erl_docgen/priv/js/flipmenu/flip_static.gif +++ b/lib/erl_docgen/priv/js/flipmenu/flip_static.gif diff --git a/lib/erl_docgen/priv/js/highlight.js b/lib/erl_docgen/priv/js/highlight.js new file mode 100644 index 0000000000..0594b42aa3 --- /dev/null +++ b/lib/erl_docgen/priv/js/highlight.js @@ -0,0 +1,39 @@ +/*globals document, window*/ +window.addEventListener("load", function () { + "use strict"; + var body = document.body, + base = window.__otpTopDocDir || "/doc/js/", + cssLink = document.createElement('link'), + script = document.createElement('script'), + intervalId, attempts = 0; + + cssLink.rel = "stylesheet"; + cssLink.href = base + "../highlight.css"; + script.src = base + "highlight.pack.js"; + + body.appendChild(cssLink); + body.appendChild(script); + + function doHighlight() { + attempts += 1; + + if (attempts > 20) { + window.clearInterval(intervalId); + return; + } + + if (!window.hljs) { + return; + } + + window.clearInterval(intervalId); + + var i, len, nodes = document.querySelectorAll('.example'); + for (i = 0, len = nodes.length; i < len; i += 1) { + window.hljs.highlightBlock(nodes[i]); + } + + } + + intervalId = window.setInterval(doHighlight, 50); +}); diff --git a/lib/erl_docgen/priv/js/highlight.pack.js b/lib/erl_docgen/priv/js/highlight.pack.js new file mode 100644 index 0000000000..073d39e644 --- /dev/null +++ b/lib/erl_docgen/priv/js/highlight.pack.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.7.0 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||R(i))return i}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset<r[0].offset?e:r:"start"===r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}l+="<"+t(e)+w.map.call(e.attributes,r).join("")+">"}function u(e){l+="</"+t(e)+">"}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):E(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var l=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var a=r?"":y.classPrefix,i='<span class="'+a,o=t?"":C;return i+=e+'">',i+n+o}function p(){var e,t,r,a;if(!E.k)return n(B);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)a+=n(B.substr(t,r.index-t)),e=g(E,r),e?(M+=e[1],a+=h(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return a+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?B+=n:(a.rE||a.eE||(B+=n),b(),a.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"<unnamed>")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=i||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substr(O,I.index-O),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},a=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"<br>":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function p(e){var n,t,r,o,s,p=i(e);a(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="</span>",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("erlang",function(e){var r="[a-z'][a-zA-Z0-9_']*",c="("+r+":"+r+"|"+r+")",b={keyword:"after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun if let not of orelse|10 query receive rem try when xor",literal:"false true"},i=e.C("%","$"),n={cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},a={b:"fun\\s+"+r+"/\\d+"},d={b:c+"\\(",e:"\\)",rB:!0,r:0,c:[{b:c,r:0},{b:"\\(",e:"\\)",eW:!0,rE:!0,r:0}]},o={b:"{",e:"}",r:0},t={b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0},f={b:"[A-Z][a-zA-Z0-9_]*",r:0},l={b:"#"+e.UIR,r:0,rB:!0,c:[{b:"#"+e.UIR,r:0},{b:"{",e:"}",r:0}]},s={bK:"fun receive if try case",e:"end",k:b};s.c=[i,a,e.inherit(e.ASM,{cN:""}),s,d,e.QSM,n,o,t,f,l];var u=[i,a,s,d,e.QSM,n,o,t,f,l];d.c[1].c=u,o.c=u,l.c[1].c=u;var h={cN:"params",b:"\\(",e:"\\)",c:u};return{aliases:["erl"],k:b,i:"(</|\\*=|\\+=|-=|/\\*|\\*/|\\(\\*|\\*\\))",c:[{cN:"function",b:"^"+r+"\\s*\\(",e:"->",rB:!0,i:"\\(|#|//|/\\*|\\\\|:|;",c:[h,e.inherit(e.TM,{b:r})],starts:{e:";|\\.",k:b,c:u}},i,{b:"^-",e:"\\.",r:0,eE:!0,rB:!0,l:"-"+e.IR,k:"-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn -import -include -include_lib -compile -define -else -endif -file -behaviour -behavior -spec",c:[h]},n,e.QSM,l,t,f,o,{b:/\.$/}]}});hljs.registerLanguage("erlang-repl",function(e){return{k:{built_in:"spawn spawn_link self",keyword:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"meta",b:"^[0-9]+> ",r:10},e.C("%","$"),{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},e.ASM,e.QSM,{b:"\\?(::)?([A-Z]\\w*(::)?)+"},{b:"->"},{b:"ok"},{b:"!"},{b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{b:"[A-Z][a-zA-Z0-9_']*",r:0}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\._]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});
\ No newline at end of file diff --git a/lib/erl_docgen/priv/xsl/Makefile b/lib/erl_docgen/priv/xsl/Makefile index d0dd227169..d381bd4cf7 100644 --- a/lib/erl_docgen/priv/xsl/Makefile +++ b/lib/erl_docgen/priv/xsl/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2009-2016. All Rights Reserved. +# Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -44,7 +44,8 @@ XSL_FILES = \ db_html.xsl \ db_html_params.xsl \ db_man.xsl \ - db_eix.xsl + db_eix.xsl \ + db_funcs.xsl # ---------------------------------------------------- diff --git a/lib/erl_docgen/priv/xsl/db_eix.xsl b/lib/erl_docgen/priv/xsl/db_eix.xsl index b496614854..6bce577f08 100644 --- a/lib/erl_docgen/priv/xsl/db_eix.xsl +++ b/lib/erl_docgen/priv/xsl/db_eix.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2016. All Rights Reserved. + # Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -199,11 +199,34 @@ <xsl:template name="name"> <xsl:param name="lastfuncsblock"/> + <xsl:variable name="signature"> + <xsl:variable name="signature1"> + <xsl:choose> + <xsl:when test="ancestor::cref"> + <xsl:value-of + select="normalize-space(nametext)"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of + select="normalize-space(substring-before(., '->'))"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:choose> + <xsl:when test="string-length($signature1) > 0"> + <xsl:value-of select="$signature1"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="normalize-space(.)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:variable name="tmpstring"> - <xsl:value-of select="substring-before(substring-after(., '('), '->')"/> + <xsl:value-of select="substring-after($signature, '(')"/> </xsl:variable> - <xsl:variable name="ustring"> + <xsl:variable name="argstring"> <xsl:choose> <xsl:when test="string-length($tmpstring) > 0"> <xsl:call-template name="remove-paren"> @@ -219,10 +242,19 @@ </xsl:variable> <xsl:variable name="arity"> - <xsl:call-template name="calc-arity"> - <xsl:with-param name="string" select="substring-before($ustring, ')')"/> - <xsl:with-param name="no-of-pars" select="0"/> - </xsl:call-template> + <xsl:choose> + <xsl:when + test="string-length(substring-before(., '->')) > 0"> + <xsl:call-template name="calc-arity"> + <xsl:with-param + name="string" + select="substring-before($argstring, ')')"/> + <xsl:with-param name="no-of-pars" select="0"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> <xsl:variable name="fname"> @@ -250,10 +282,18 @@ </xsl:variable> <xsl:text> {"</xsl:text><xsl:value-of select="$fname"/> + <xsl:text>", "</xsl:text> + <xsl:call-template name="escape-doublequotes"> + <xsl:with-param name="string" select="$signature"/> + </xsl:call-template> <xsl:text>", "</xsl:text><xsl:value-of select="$fname"/> - <xsl:text>(</xsl:text><xsl:value-of select="normalize-space($tmpstring)"/> - <xsl:text>", "</xsl:text><xsl:value-of select="$fname"/> - <xsl:text>-</xsl:text><xsl:value-of select="$arity"/><xsl:text>"}</xsl:text> + <xsl:choose> + <xsl:when test="string-length($arity) > 0"> + <xsl:text>-</xsl:text><xsl:value-of select="$arity"/> + </xsl:when> + <xsl:otherwise/> + </xsl:choose> + <xsl:text>"}</xsl:text> <xsl:choose> <xsl:when test="($lastfuncsblock = 'true') and (position() = last())"> @@ -345,6 +385,27 @@ </xsl:template> + <xsl:template name="escape-doublequotes"> + <xsl:param name="string"/> + <xsl:param name="pPat">"</xsl:param> + <xsl:param name="pRep">\"</xsl:param> + + <xsl:choose> + <xsl:when test="not(contains($string, $pPat))"> + <xsl:copy-of select="$string"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="substring-before($string, $pPat)"/> + <xsl:copy-of select="$pRep"/> + <xsl:call-template name="escape-doublequotes"> + <xsl:with-param + name="string" + select="substring-after($string, $pPat)"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- default content handling --> <xsl:template match="text()"/> diff --git a/lib/erl_docgen/priv/xsl/db_funcs.xsl b/lib/erl_docgen/priv/xsl/db_funcs.xsl new file mode 100644 index 0000000000..8178ce44fb --- /dev/null +++ b/lib/erl_docgen/priv/xsl/db_funcs.xsl @@ -0,0 +1,136 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + # + # %CopyrightBegin% + # + # Copyright Ericsson AB 2009-2017. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # + # %CopyrightEnd% + + --> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:erl="http://erlang.org" + xmlns:func="http://exslt.org/functions" + extension-element-prefixes="func" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> + + <!-- Used from code template to trim the newline/cr after the tag + and spaces/tabs between them + --> + <xsl:variable name="newlinechars" select="' '" /> + <xsl:variable name="spacechars" select="'	 '" /> + + <func:function name="erl:code_trim"> + <xsl:param name="string" /> + + <xsl:variable name="leftresult" select="erl:code_ltrim($string, $string)"/> + <xsl:variable name="result" select="erl:code_rtrim($leftresult, $leftresult)"/> + + <func:result select="$result"/> + </func:function> + + <func:function name="erl:code_rtrim"> + <xsl:param name="string" /> + <xsl:param name="origstring" /> + + <xsl:variable name="length" select="string-length($string)" /> + + <xsl:variable name="result"> + <xsl:if test="$length > 0"> + <xsl:choose> + <xsl:when test="contains($spacechars, substring($string, $length, 1))"> + <xsl:value-of select="erl:code_rtrim(substring($string, 1, $length - 1), $origstring)" /> + </xsl:when> + <xsl:when test="contains($newlinechars, substring($string, $length, 1))"> + <xsl:value-of select="erl:code_rtrim_1(substring($string, 1, $length - 1))" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$origstring" /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + + <func:result select="$result" /> + </func:function> + + <func:function name="erl:code_rtrim_1"> + <xsl:param name="string" /> + + <xsl:variable name="length" select="string-length($string)" /> + + <xsl:variable name="result"> + <xsl:if test="$length > 0"> + <xsl:choose> + <xsl:when test="contains($newlinechars, substring($string, $length, 1))"> + <xsl:value-of select="erl:code_rtrim_1(substring($string, 1, $length - 1))" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="erl:code_rtrim($string, $string)" /> + <!--xsl:value-of select="$string" /--> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + + <func:result select="$result" /> + </func:function> + + <func:function name="erl:code_ltrim"> + <xsl:param name="string" /> + <xsl:param name="origstring" /> + + <xsl:variable name="result"> + <xsl:if test="string-length($string) > 0"> + <xsl:choose> + <xsl:when test="contains($spacechars, substring($string, 1, 1))"> + <xsl:value-of select="erl:code_ltrim(substring($string, 2), $origstring)" /> + </xsl:when> + <xsl:when test="contains($newlinechars, substring($string, 1, 1))"> + <xsl:value-of select="erl:code_ltrim_1(substring($string, 2))" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$origstring" /> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + + <func:result select="$result" /> + </func:function> + + <func:function name="erl:code_ltrim_1"> + <xsl:param name="string" /> + + <xsl:variable name="result"> + <xsl:if test="string-length($string) > 0"> + <xsl:choose> + <xsl:when test="contains($newlinechars, substring($string, 1, 1))"> + <xsl:value-of select="erl:code_ltrim_1(substring($string, 2))" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="erl:code_ltrim($string, $string)" /> + <!--xsl:value-of select="$string" /--> + </xsl:otherwise> + </xsl:choose> + </xsl:if> + </xsl:variable> + + <func:result select="$result" /> + </func:function> + +</xsl:stylesheet> diff --git a/lib/erl_docgen/priv/xsl/db_html.xsl b/lib/erl_docgen/priv/xsl/db_html.xsl index edab8e1c7e..18bc8cd1cf 100644 --- a/lib/erl_docgen/priv/xsl/db_html.xsl +++ b/lib/erl_docgen/priv/xsl/db_html.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2016. All Rights Reserved. + # Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <xsl:include href="db_html_params.xsl"/> + <xsl:include href="db_funcs.xsl"/> <func:function name="erl:flip_first_char"> <xsl:param name="in"/> @@ -53,6 +54,24 @@ <func:result select="$result"/> </func:function> + <func:function name="erl:lower-case"> + <xsl:param name="str"/> + + <xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> + <xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/> + + <xsl:variable name="result"> + <xsl:value-of select="translate($str, $uppercase, $lowercase)"/> + </xsl:variable> + + <func:result select="$result"/> + </func:function> + + <func:function name="erl:to-link"> + <xsl:param name="text"/> + <func:result select="translate(erl:lower-case($text),'?: /()" ','--------')"/> + </func:function> + <!-- Used from template menu.funcs to sort a module's functions for the lefthand index list, from the module's .xml file. Returns a value on which to sort the entity in question (a <name> element). @@ -66,6 +85,10 @@ Additionally, callbacks may be included, as in gen_server.xml: <name>Module:handle_call(Request, From, State) -> Result</name> + For C reference pages the name tag has a substructure where the nametext tag + is used in the sort, as in erl_nif.xml + <name><ret>void *</ret><nametext>enif_alloc(size_t size)</nametext></name> + So first, get the name from either the attribute or the element value. Then, reverse the case of the first character. This is because xsltproc, used for processing, orders uppercase before lowercase (even when the 'case-order="lower-first"' option @@ -82,12 +105,19 @@ <xsl:variable name="base"> <xsl:choose> - <xsl:when test="string-length($elem/@name) > 0"> - <xsl:value-of select="$elem/@name"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$elem"/> - </xsl:otherwise> + <xsl:when test="ancestor::cref"> + <xsl:value-of select="$elem/nametext"/> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="string-length($elem/@name) > 0"> + <xsl:value-of select="$elem/@name"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-before($elem, '(')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:otherwise> </xsl:choose> </xsl:variable> @@ -160,6 +190,8 @@ <xsl:template name="spec_name"> <xsl:variable name="name" select="@name"/> <xsl:variable name="arity" select="@arity"/> + <xsl:variable name="anchor" select="@anchor"/> + <xsl:variable name="since" select="@since"/> <xsl:variable name="spec0"> <xsl:call-template name="find_spec"/> </xsl:variable> @@ -186,27 +218,54 @@ </xsl:otherwise> </xsl:choose> + <!-- Insert an anchor for "anchor" attribute --> + <xsl:if test="string-length($anchor) > 0"> + <a name="{$anchor}"></a> + </xsl:if> + <xsl:variable name="global_types" select="ancestor::erlref/datatypes"/> <xsl:variable name="local_types" select="../type[string-length(@name) > 0]"/> - <xsl:apply-templates select="$spec/contract/clause/head"> + <xsl:apply-templates select="$spec/contract/clause/head"> + <xsl:with-param name="ghlink" select="ancestor-or-self::*[@ghlink]/@ghlink"/> <xsl:with-param name="local_types" select="$local_types"/> <xsl:with-param name="global_types" select="$global_types"/> - </xsl:apply-templates> + <xsl:with-param name="since" select="$since"/> + </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="head"> + <xsl:param name="ghlink"/> <xsl:param name="local_types"/> <xsl:param name="global_types"/> - <span class="bold_code"> - <xsl:apply-templates mode="local_type"> - <xsl:with-param name="local_types" select="$local_types"/> - <xsl:with-param name="global_types" select="$global_types"/> - </xsl:apply-templates> - </span> - <br/> + <xsl:param name="since"/> + <xsl:variable name="id" select="concat(concat(concat(concat(../../../name,'-'),../../../arity),'-'),generate-id(.))"/> + <table class="func-table"> + <tr class="func-tr"> + <td class="func-td"> + <div class="bold_code func-head" + onMouseOver="document.getElementById('ghlink-{$id}').style.visibility = 'visible';" + onMouseOut="document.getElementById('ghlink-{$id}').style.visibility = 'hidden';"> + <xsl:call-template name="ghlink"> + <xsl:with-param name="ghlink" select="$ghlink"/> + <xsl:with-param name="id" select="$id"/> + </xsl:call-template> + <xsl:apply-templates mode="local_type"> + <xsl:with-param name="local_types" select="$local_types"/> + <xsl:with-param name="global_types" select="$global_types"/> + </xsl:apply-templates> + </div> + </td> + <td class="func-since-td"> + <xsl:if test="string-length($since) > 0"> + <span class="since"><xsl:value-of select="$since"/> + </span> + </xsl:if> + </td> + </tr> + </table> </xsl:template> <!-- The *last* <name name="..." arity=".."/> --> @@ -234,7 +293,8 @@ <!-- It is assumed there is no support for overloaded specs (there is no spec with more than one clause) --> <xsl:if test="count($clause/guard) > 0 or count($type) > 0"> - <div class="REFBODY"><p>Types:</p> + <div class="REFBODY fun-types"> + <h3 class="func-types-title">Types</h3> <xsl:choose> <xsl:when test="$output_subtypes"> @@ -327,13 +387,13 @@ <xsl:for-each select="$subtype"> <xsl:variable name="tname" select="typename"/> - <div class="REFTYPES"> - <span class="bold_code"> - <xsl:apply-templates select="string" mode="local_type"> - <xsl:with-param name="local_types" select="$local_types"/> - <xsl:with-param name="global_types" select="$global_types"/> - </xsl:apply-templates> - </span> + <div class="REFTYPES rt-1"> + <span class="bold_code bc-2"> + <xsl:apply-templates select="string" mode="local_type"> + <xsl:with-param name="local_types" select="$local_types"/> + <xsl:with-param name="global_types" select="$global_types"/> + </xsl:apply-templates> + </span> </div> <xsl:apply-templates select="$type_desc[@variable = $tname]"/> </xsl:for-each> @@ -345,7 +405,7 @@ <xsl:param name="global_types"/> <xsl:for-each select="$local_types"> - <div class="REFTYPES"> + <div class="REFTYPES rt-2"> <xsl:call-template name="type_name"> <xsl:with-param name="mode" select="'local_type'"/> <xsl:with-param name="local_types" select="$local_types"/> @@ -366,7 +426,7 @@ <!-- Similar to <d> --> <xsl:template match="type_desc"> - <div class="REFBODY"> + <div class="REFBODY rb-1"> <xsl:apply-templates/> </div> </xsl:template> @@ -375,7 +435,7 @@ <xsl:template match="all_etypes"> <xsl:for-each select= "$i//type"> <pre> - <span class="bold_code"> + <span class="bold_code bc-3"> <xsl:apply-templates select="typedecl"/> </span><xsl:text> </xsl:text> @@ -385,16 +445,37 @@ <!-- Datatypes --> <xsl:template match="datatypes"> - <h3> - <xsl:text>DATA TYPES</xsl:text> - </h3> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Data Types</xsl:with-param> + </xsl:call-template> <xsl:apply-templates/> </xsl:template> + <!-- Datatype Title, is the really needed? not used by anything --> + <xsl:template match="datatype_title"> + <xsl:variable name="title" select="."/> + <h4> + <xsl:call-template name="title_link"> + <xsl:with-param name="title"><xsl:apply-templates/></xsl:with-param> + <xsl:with-param name="link" select="$title"/> + </xsl:call-template> + </h4> + </xsl:template> + <!-- Datatype --> <xsl:template match="datatype"> - <p><xsl:apply-templates select="name"/></p> - <xsl:apply-templates select="desc"/> + <xsl:variable name="id" select="concat('type-',name/@name)"/> + <div class="data-types-body"> + <div class="data-type-name" + onMouseOver="document.getElementById('ghlink-{$id}').style.visibility = 'visible';" + onMouseOut="document.getElementById('ghlink-{$id}').style.visibility = 'hidden';"> + <xsl:call-template name="ghlink"> + <xsl:with-param name="id" select="$id"/> + </xsl:call-template> + <xsl:apply-templates select="name"/> + </div> + <div class="data-type-desc"><xsl:apply-templates select="desc"/></div> + </div> </xsl:template> <!-- The "mode" attribute of apply has been used to separate the case @@ -454,7 +535,7 @@ </xsl:template> <xsl:template match="typehead"> - <span class="bold_code"> + <span class="bold_code bc-4"> <xsl:apply-templates/> </span><br/> </xsl:template> @@ -462,7 +543,7 @@ <xsl:template match="typehead" mode="local_type"> <xsl:param name="local_types"/> <xsl:param name="global_types"/> - <span class="bold_code"> + <span class="bold_code bc-5"> <xsl:apply-templates mode="local_type"> <xsl:with-param name="local_types" select="$local_types"/> <xsl:with-param name="global_types" select="$global_types"/> @@ -473,7 +554,7 @@ <!-- Not used right now --> <!-- local_defs --> <xsl:template match="local_defs"> - <div class="REFBODY"> + <div class="REFBODY rb-2"> <xsl:apply-templates> </xsl:apply-templates> </div> @@ -481,8 +562,8 @@ <!-- Not used right now --> <xsl:template match="local_def"> - <div class="REFTYPES"> - <span class="bold_code"> + <div class="REFTYPES rt-3"> + <span class="bold_code bc-6"> <xsl:apply-templates/> </span> </div> @@ -659,7 +740,7 @@ </xsl:otherwise> </xsl:choose> </head> - <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"> + <body> <div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="{$topdocdir}/js/flipmenu/flipmenu.js"/> @@ -734,6 +815,8 @@ </div> </div> + <script type="text/javascript"><xsl:text>window.__otpTopDocDir = '</xsl:text><xsl:value-of select="$topdocdir"/><xsl:text>/js/';</xsl:text></script> + <script type="text/javascript" src="{$topdocdir}/js/highlight.js"/> </body> </html> </xsl:template> @@ -753,6 +836,10 @@ <!-- .../part --> <xsl:call-template name="part.content" /> </xsl:if> + <xsl:if test="$lname = 'internal'"> + <!-- .../internals --> + <xsl:call-template name="internal.content" /> + </xsl:if> <xsl:if test="$lname = 'chapter'"> <!-- .../part/chapter --> <xsl:call-template name="chapter.content"> @@ -776,12 +863,24 @@ <xsl:param name="chapnum"/> <xsl:param name="curModule"/> <xsl:if test="(local-name() = 'part') or ((local-name() = 'chapter') and ancestor::part)"> - <!-- .../part or.../part/chapter --> + <!-- .../part or .../part/chapter --> <xsl:call-template name="menu.ug"> <xsl:with-param name="chapnum" select="$chapnum"/> </xsl:call-template> </xsl:if> - <xsl:if test="(local-name() = 'application') or (local-name() = 'erlref')or (local-name() = 'comref')or (local-name() = 'cref')or (local-name() = 'fileref')or (local-name() = 'appref')"> + <xsl:if test="(local-name() = 'internal' and descendant::chapter) or ((local-name() = 'chapter') and ancestor::internal)"> + <!-- .../internal or .../internal/chapter --> + <xsl:call-template name="menu.internal.ug"> + <xsl:with-param name="chapnum" select="$chapnum"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="(local-name() = 'internal' and descendant::erlref) or (((local-name() = 'erlref') or (local-name() = 'comref') or (local-name() = 'cref') or (local-name() = 'fileref') or (local-name() = 'appref')) and ancestor::internal)"> + <!-- .../internal,.../internal/erlref, .../internal/comref or .../internal/cref or .../internal/fileref or .../internal/appref --> + <xsl:call-template name="menu.internal.ref"> + <xsl:with-param name="curModule" select="$curModule"/> + </xsl:call-template> + </xsl:if> + <xsl:if test="(local-name() = 'application') or (((local-name() = 'erlref') or (local-name() = 'comref') or (local-name() = 'cref') or (local-name() = 'fileref') or (local-name() = 'appref')) and ancestor::application)"> <!-- .../application,.../application/erlref, .../application/comref or .../application/cref or .../application/fileref or .../application/appref --> <xsl:call-template name="menu.ref"> <xsl:with-param name="curModule" select="$curModule"/> @@ -796,36 +895,45 @@ </xsl:template> - <xsl:template name="menu_top"> + <xsl:template name="erlang_logo"> <xsl:choose> <xsl:when test="string-length($logo) > 0"> - <img alt="Erlang logo" src="{$topdocdir}/{$logo}"/> + <div class="erlang-logo-wrapper"> + <a href="{$topdocdir}/index.html"><img alt="Erlang Logo" src="{$topdocdir}/{$logo}" class="erlang-logo"/></a> + </div> </xsl:when> <xsl:otherwise> - <img alt="Erlang logo" src="{$topdocdir}/erlang-logo.png"/> + <div class="erlang-logo-wrapper"> + <a href="{$topdocdir}/index.html"><img alt="Erlang Logo" src="{$topdocdir}/erlang-logo.png" class="erlang-logo"/></a> + </div> </xsl:otherwise> </xsl:choose> - <br/> - <small> + </xsl:template> + + <xsl:template name="menu_top"> + <ul class="panel-sections"> <xsl:if test="boolean(/book/parts/part)"> - <a href="users_guide.html">User's Guide</a><br/> + <li><a href="users_guide.html">User's Guide</a></li> </xsl:if> <xsl:if test="boolean(/book/applications)"> - <a href="index.html">Reference Manual</a><br/> + <li><a href="index.html">Reference Manual</a></li> + </xsl:if> + <xsl:if test="boolean(/book/internals)"> + <li><a href="internal_docs.html">Internal Documentation</a></li> </xsl:if> <xsl:if test="boolean(/book/releasenotes)"> - <a href="release_notes.html">Release Notes</a><br/> + <li><a href="release_notes.html">Release Notes</a></li> </xsl:if> <xsl:choose> <xsl:when test="string-length($pdfname) > 0"> - <a href="{$pdfdir}/{$pdfname}.pdf">PDF</a><br/> + <li><a href="{$pdfdir}/{$pdfname}.pdf">PDF</a></li> </xsl:when> <xsl:otherwise> - <a href="{$pdfdir}/{$appname}-{$appver}.pdf">PDF</a><br/> + <li><a href="{$pdfdir}/{$appname}-{$appver}.pdf">PDF</a></li> </xsl:otherwise> </xsl:choose> - <a href="{$topdocdir}/index.html">Top</a> - </small> + <li><a href="{$topdocdir}/index.html">Top</a></li> + </ul> </xsl:template> <xsl:template name="menu_middle"> @@ -841,10 +949,11 @@ </xsl:when> </xsl:choose> </small --> - <br/> - <a href="javascript:openAllFlips()">Expand All</a><br/> - <a href="javascript:closeAllFlips()">Contract All</a> + <ul class="expand-collapse-items"> + <li><a href="javascript:openAllFlips()">Expand All</a></li> + <li><a href="javascript:closeAllFlips()">Contract All</a></li> + </ul> </xsl:template> @@ -852,6 +961,7 @@ <xsl:template match="/book"> <xsl:apply-templates select="parts"/> <xsl:apply-templates select="applications"/> + <xsl:apply-templates select="internals"/> <xsl:apply-templates select="releasenotes"/> </xsl:template> @@ -865,9 +975,14 @@ <xsl:apply-templates select="application"/> </xsl:template> + <!-- Internals --> + <xsl:template match="internals"> + <xsl:apply-templates select="internal"/> + </xsl:template> + <!-- Header --> <xsl:template match="header"/> - + <!-- Section/Title --> <xsl:template match="section/title"/> @@ -880,10 +995,12 @@ <xsl:for-each select="marker"> <xsl:call-template name="marker-before-title"/> </xsl:for-each> - <a name="{generate-id(title)}"> - <xsl:value-of select="$chapnum"/>.<xsl:number/>  - <xsl:value-of select="title"/> - </a> + <xsl:call-template name="title_link"> + <xsl:with-param name="title"> + <xsl:value-of select="$chapnum"/>.<xsl:number/>  + <xsl:value-of select="title"/> + </xsl:with-param> + </xsl:call-template> </h3> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> @@ -900,7 +1017,9 @@ <xsl:call-template name="marker-before-title"/> </xsl:for-each> <!-- xsl:value-of select="$partnum"/>.<xsl:value-of select="$chapnum"/>.<xsl:value-of select="$sectnum"/>.<xsl:number/ --> - <xsl:value-of select="title"/> + <xsl:call-template name="title_link"> + <xsl:with-param name="title" select="title"/> + </xsl:call-template> </h4> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> @@ -930,11 +1049,11 @@ <xsl:for-each select="marker"> <xsl:call-template name="marker-before-title"/> </xsl:for-each> - <a name="{generate-id(title)}"> - <xsl:value-of select="title"/> - </a> + <xsl:call-template name="title_link"> + <xsl:with-param name="title" select="title"/> + </xsl:call-template> </h3> - <div class="REFBODY"> + <div class="REFBODY rb-3"> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> </xsl:apply-templates> @@ -948,7 +1067,7 @@ <h4> <xsl:value-of select="title"/> </h4> - <div class="REFBODY"> + <div class="REFBODY rb-4"> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> </xsl:apply-templates> @@ -1110,7 +1229,14 @@ <xsl:variable name="codenum"> <xsl:number level="any" from="chapter" count="code"/> </xsl:variable> - <div class="example"><pre><xsl:apply-templates/></pre></div> + <xsl:choose> + <xsl:when test="not(descendant::anno)"> + <div class="example"><pre><xsl:value-of select="erl:code_trim(text())"/></pre></div> + </xsl:when> + <xsl:otherwise> + <div class="example"><pre><xsl:apply-templates/></pre></div> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- Pre --> @@ -1129,7 +1255,8 @@ <xsl:variable name="tabnum"> <xsl:number level="any" from="chapter" count="table"/> </xsl:variable> - <table border="1" cellpadding="2" cellspacing="0"> + <div class="doc-table-wrapper"> + <table class="doc-table"> <!-- tbody--> <xsl:apply-templates select="row"> <xsl:with-param name="chapnum" select="$chapnum"/> @@ -1141,6 +1268,7 @@ <xsl:with-param name="chapnum" select="$chapnum"/> <xsl:with-param name="tabnum" select="$tabnum"/> </xsl:apply-templates> + </div> </xsl:template> <xsl:template match="row"> @@ -1160,11 +1288,11 @@ <xsl:param name="chapnum"/> <xsl:param name="tabnum"/> - <em>Table + <p class="doc-table-caption">Table <xsl:value-of select="$chapnum"/>.<xsl:value-of select="$tabnum"/>:   <xsl:apply-templates/> - </em> + </p> </xsl:template> @@ -1175,12 +1303,21 @@ <xsl:number level="any" from="chapter" count="image"/> </xsl:variable> - <img alt="IMAGE MISSING" src="{@file}"/><br/> + <div class="doc-image-wrapper"> + <xsl:choose> + <xsl:when test="@width"> + <img alt="IMAGE MISSING" width="{@width}" src="{@file}" class="doc-image"/> + </xsl:when> + <xsl:otherwise> + <img alt="IMAGE MISSING" src="{@file}" class="doc-image"/> + </xsl:otherwise> + </xsl:choose> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> <xsl:with-param name="fignum" select="$fignum"/> </xsl:apply-templates> + </div> </xsl:template> @@ -1190,15 +1327,99 @@ <xsl:param name="chapnum"/> <xsl:param name="fignum"/> - <p><em>Figure + <p class="doc-image-caption">Figure <xsl:value-of select="$chapnum"/>.<xsl:value-of select="$fignum"/>:   <xsl:apply-templates/> - </em></p> + </p> + + </xsl:template> + + + <!-- Internal Docs --> + + <!-- Part --> + <xsl:template match="internal"> + + <xsl:document href="{$outdir}/internal_docs.html" method="html" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"> + <xsl:call-template name="pagelayout"/> + </xsl:document> + </xsl:template> + + + <!-- Part content--> + <xsl:template name="internal.content"> + <div class="frontpage"/> + + <center><h1><xsl:value-of select="/book/header/title"/> Internal Docs</h1></center> + + <center><h4>Version <xsl:value-of select="$appver"/></h4></center> + <center><h4><xsl:value-of select="$gendate"/></h4></center> + <div class="extrafrontpageinfo"> + <center><xsl:value-of select="$extra_front_page_info"/></center> + </div> + + <xsl:apply-templates select="chapter|erlref"/> + + </xsl:template> + + <!-- Menu.internal.chapter --> + <xsl:template name="menu.internal.ug"> + <xsl:param name="chapnum"/> + <div id="leftnav"> + <div class="innertube"> + + <xsl:call-template name="erlang_logo"/> + + <p class="section-title"><xsl:value-of select="/book/header/title"/></p> + <p class="section-subtitle">Internal Documentation</p> + <p class="section-version">Version <xsl:value-of select="$appver"/></p> + + <xsl:call-template name="menu_top"/> + + <xsl:call-template name="menu_middle"/> + + <h3>Chapters</h3> + + <ul class="flipMenu" imagepath="{$topdocdir}/js/flipmenu"> + <xsl:call-template name="menu.chapter"> + <xsl:with-param name="entries" select="/book/internals/internal/chapter[header/title]"/> + <xsl:with-param name="chapnum" select="$chapnum"/> + </xsl:call-template> + </ul> + </div> + </div> </xsl:template> + <!-- Menu.internal.ref --> + <xsl:template name="menu.internal.ref"> + <xsl:param name="curModule"/> + <div id="leftnav"> + <div class="innertube"> + + <xsl:call-template name="erlang_logo"/> + + <p class="section-title"><xsl:value-of select="/book/header/title"/></p> + <p class="section-subtitle">Reference Manual</p> + <p class="section-version">Version <xsl:value-of select="$appver"/></p> + <xsl:call-template name="menu_top"/> + + <xsl:call-template name="menu_middle"/> + + <h3>Table of Contents</h3> + + <ul class="flipMenu"> + <xsl:call-template name="menu.ref2"> + <xsl:with-param name="entries" select="/book/internals/internal/erlref[module]|/book/internals/internal/cref[lib]|/book/internals/internal/comref[com]|/book/internals/internal/fileref[file]|/book/internals/internal/appref[app]"/> + <!--xsl:with-param name="genFuncMenu" select="true"/--> + <xsl:with-param name="curModule" select="$curModule"/> + </xsl:call-template> + </ul> + </div> + </div> + </xsl:template> <!--Users Guide --> @@ -1244,21 +1465,17 @@ <div id="leftnav"> <div class="innertube"> - <xsl:call-template name="menu_top"/> + <xsl:call-template name="erlang_logo"/> - <p> - <strong><xsl:value-of select="/book/header/title"/></strong><br/> - <strong>User's Guide</strong><br/> - <small>Version <xsl:value-of select="$appver"/></small> - </p> + <p class="section-title"><xsl:value-of select="/book/header/title"/></p> + <p class="section-subtitle">User's Guide</p> + <p class="section-version">Version <xsl:value-of select="$appver"/></p> + + <xsl:call-template name="menu_top"/> <xsl:call-template name="menu_middle"/> - <p> - <small> - <strong>Chapters</strong> - </small> - </p> + <h3>Chapters</h3> <ul class="flipMenu" imagepath="{$topdocdir}/js/flipmenu"> <xsl:call-template name="menu.chapter"> @@ -1315,7 +1532,7 @@ <xsl:param name="chapter_file"/> <xsl:for-each select="$entries"> <li title="{title}"> - <a href="{$chapter_file}.html#{generate-id(title)}"> + <a href="{$chapter_file}.html#{erl:to-link(title)}"> <xsl:value-of select="title"/> </a> </li> @@ -1409,21 +1626,17 @@ <div id="leftnav"> <div class="innertube"> - <xsl:call-template name="menu_top"/> + <xsl:call-template name="erlang_logo"/> - <p> - <strong><xsl:value-of select="/book/header/title"/></strong><br/> - <strong>Reference Manual</strong><br/> - <small>Version <xsl:value-of select="$appver"/></small> - </p> + <p class="section-title"><xsl:value-of select="/book/header/title"/></p> + <p class="section-subtitle">Reference Manual</p> + <p class="section-version">Version <xsl:value-of select="$appver"/></p> + + <xsl:call-template name="menu_top"/> <xsl:call-template name="menu_middle"/> - <p> - <small> - <strong>Table of Contents</strong> - </small> - </p> + <h3>Table of Contents</h3> <ul class="flipMenu"> <xsl:call-template name="menu.ref2"> @@ -1773,8 +1986,10 @@ <!-- Module --> <xsl:template match="module"> <xsl:param name="partnum"/> - <h3>MODULE</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Module</xsl:with-param> + </xsl:call-template> + <div class="REFBODY module-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1785,19 +2000,33 @@ <!-- Modulesummary --> <xsl:template match="modulesummary"> <xsl:param name="partnum"/> - <h3>MODULE SUMMARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Module Summary</xsl:with-param> + </xsl:call-template> + <div class="REFBODY module-summary-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> </div> + <!-- Since --> + <xsl:if test="string-length(../module/@since) > 0"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Since</xsl:with-param> + </xsl:call-template> + <div class="REFBODY module-since"> + Module <xsl:value-of select="../module"/> was introduced in + <xsl:value-of select="../module/@since"/>. + </div> + </xsl:if> </xsl:template> <!-- Lib --> <xsl:template match="lib"> <xsl:param name="partnum"/> - <h3>C LIBRARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">C Library</xsl:with-param> + </xsl:call-template> + <div class="REFBODY c-library-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1808,8 +2037,10 @@ <!-- Libsummary --> <xsl:template match="libsummary"> <xsl:param name="partnum"/> - <h3>LIBRARY SUMMARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Library Summary</xsl:with-param> + </xsl:call-template> + <div class="REFBODY library-summary-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1819,8 +2050,10 @@ <!-- Com --> <xsl:template match="com"> <xsl:param name="partnum"/> - <h3>COMMAND</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Command</xsl:with-param> + </xsl:call-template> + <div class="REFBODY command-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1831,8 +2064,10 @@ <!-- Comsummary --> <xsl:template match="comsummary"> <xsl:param name="partnum"/> - <h3>COMMAND SUMMARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Command Summary</xsl:with-param> + </xsl:call-template> + <div class="REFBODY command-summary-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1842,8 +2077,10 @@ <!-- File --> <xsl:template match="file"> <xsl:param name="partnum"/> - <h3>FILE</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">File</xsl:with-param> + </xsl:call-template> + <div class="REFBODY file-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1854,8 +2091,10 @@ <!-- Filesummary --> <xsl:template match="filesummary"> <xsl:param name="partnum"/> - <h3>FILE SUMMARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">File Summary</xsl:with-param> + </xsl:call-template> + <div class="REFBODY file-summary-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1866,8 +2105,10 @@ <!-- App --> <xsl:template match="app"> <xsl:param name="partnum"/> - <h3>APPLICATION</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Application</xsl:with-param> + </xsl:call-template> + <div class="REFBODY application-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1878,8 +2119,10 @@ <!-- Appsummary --> <xsl:template match="appsummary"> <xsl:param name="partnum"/> - <h3>APPLICATION SUMMARY</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Application Summary</xsl:with-param> + </xsl:call-template> + <div class="REFBODY application-summary-body"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -1889,8 +2132,10 @@ <!-- Description --> <xsl:template match="description"> <xsl:param name="partnum"/> - <h3>DESCRIPTION</h3> - <div class="REFBODY"> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Description</xsl:with-param> + </xsl:call-template> + <div class="REFBODY description-body"> <p> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> @@ -1903,13 +2148,15 @@ <xsl:template match="funcs"> <xsl:param name="partnum"/> - <h3> - <xsl:text>EXPORTS</xsl:text> - </h3> + <xsl:call-template name="h3_title_link"> + <xsl:with-param name="title">Exports</xsl:with-param> + </xsl:call-template> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> + <div class="exports-body"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </div> </xsl:template> @@ -1917,10 +2164,10 @@ <xsl:template match="func"> <xsl:param name="partnum"/> - <p><xsl:apply-templates select="name"/> - <xsl:apply-templates - select="name[string-length(@arity) > 0 and position()=last()]" - mode="types"/></p> + <xsl:apply-templates select="name"/> + <xsl:apply-templates + select="name[string-length(@arity) > 0 and position()=last()]" + mode="types"/> <xsl:apply-templates select="fsummary|type|desc"> <xsl:with-param name="partnum" select="$partnum"/> @@ -1979,14 +2226,22 @@ <xsl:choose> <xsl:when test="ancestor::cref"> - <a name="{substring-before(nametext, '(')}"> - <span class="bold_code"> - <xsl:value-of select="ret"/> - <xsl:call-template name="maybe-space-after-ret"> - <xsl:with-param name="s" select="ret"/> - </xsl:call-template> - <xsl:value-of select="nametext"/> - </span></a><br/> + <table class="func-table"> + <tr class="func-tr"> + <td class="cfunc-td"> + <span class="bold_code bc-7"> + <xsl:call-template name="title_link"> + <xsl:with-param name="link" select="substring-before(nametext, '(')"/> + </xsl:call-template> + </span> + </td> + <td class="func-since-td"> + <xsl:if test="string-length(@since) > 0"> + <span class="since"><xsl:value-of select="@since"/></span> + </xsl:if> + </td> + </tr> + </table> </xsl:when> <xsl:when test="ancestor::erlref"> <xsl:variable name="fname"> @@ -2007,32 +2262,45 @@ </xsl:variable> <xsl:choose> <xsl:when test="ancestor::datatype"> - <a name="type-{$fname}"></a><span class="bold_code"><xsl:apply-templates/></span><br/> + <div class="bold_code bc-8"> + <xsl:call-template name="title_link"> + <xsl:with-param name="link" select="concat('type-',$fname)"/> + <xsl:with-param name="title"> + <xsl:apply-templates/> + </xsl:with-param> + </xsl:call-template> + </div> </xsl:when> <xsl:otherwise> - <a name="{$fname}-{$arity}"></a><span class="bold_code"><xsl:apply-templates/></span><br/> + <table class="func-table"> + <tr class="func-tr"> + <td class="func-td"> + <div class="bold_code fun-type"> + <xsl:call-template name="title_link"> + <xsl:with-param name="link" select="concat(concat($fname,'-'),$arity)"/> + <xsl:with-param name="title"> + <xsl:apply-templates/> + </xsl:with-param> + </xsl:call-template> + </div> + </td> + <td class="func-since-td"> + <xsl:if test="string-length(@since) > 0"> + <span class="since"><xsl:value-of select="@since"/></span> + </xsl:if> + </td> + </tr> + </table> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> - <span class="bold_code"><xsl:value-of select="."/></span> + <div class="bold_code bc-10"><xsl:value-of select="."/></div> </xsl:otherwise> </xsl:choose> </xsl:template> - <xsl:template name="maybe-space-after-ret"> - <xsl:param name="s"/> - <xsl:variable name="last_char" - select="substring($s, string-length($s), 1)"/> - <xsl:choose> - <xsl:when test="$last_char != '*'"> - <xsl:text> </xsl:text> - </xsl:when> - </xsl:choose> - </xsl:template> - - <!-- Type --> <xsl:template match="type"> <xsl:param name="partnum"/> @@ -2040,12 +2308,13 @@ <!-- The case where @name != 0 is taken care of in "type_name" --> <xsl:if test="string-length(@name) = 0 and string-length(@variable) = 0"> - <div class="REFBODY"><p>Types:</p> + <div class="REFBODY rb-5"> + <h3 class="func-types-title">Types</h3> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> - </div> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </div> </xsl:if> @@ -2055,8 +2324,8 @@ <!-- V --> <xsl:template match="v"> <xsl:param name="partnum"/> - <div class="REFTYPES"> - <span class="bold_code"> + <div class="REFTYPES rt-4"> + <span class="bold_code fun-param-type"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> @@ -2067,17 +2336,69 @@ <!-- D --> <xsl:template match="d"> <xsl:param name="partnum"/> - <div class="REFBODY"> + <div class="REFBODY rb-6"> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> </xsl:apply-templates> </div> </xsl:template> + <xsl:template name="h3_title_link"> + <xsl:param name="title"/> + <h3> + <xsl:call-template name="title_link"> + <xsl:with-param name="title" select="$title"/> + <xsl:with-param name="link" select="erl:to-link($title)"/> + </xsl:call-template> + </h3> + </xsl:template> + + <xsl:template name="title_link"> + <xsl:param name="title" select="'APPLY'"/> + <xsl:param name="link" select="erl:to-link(title)"/> + <xsl:param name="ghlink" select="ancestor-or-self::*[@ghlink][position() = 1]/@ghlink"/> + <xsl:variable name="id" select="concat(concat($link,'-'), generate-id(.))"/> + <span onMouseOver="document.getElementById('ghlink-{$id}').style.visibility = 'visible';" + onMouseOut="document.getElementById('ghlink-{$id}').style.visibility = 'hidden';"> + <xsl:call-template name="ghlink"> + <xsl:with-param name="id" select="$id"/> + <xsl:with-param name="ghlink" select="$ghlink"/> + </xsl:call-template> + <a class="title_link" name="{$link}" href="#{$link}"> + <xsl:choose> + <xsl:when test="$title = 'APPLY'"> + <xsl:apply-templates/> <!-- like <ret> and <nametext> --> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$title"/> + </xsl:otherwise> + </xsl:choose> + </a> + </span> + </xsl:template> + + <xsl:template name="ghlink"> + <xsl:param name="id"/> + <xsl:param name="ghlink" select="ancestor-or-self::*[@ghlink][position() = 1]/@ghlink"/> + <xsl:choose> + <xsl:when test="string-length($ghlink) > 0"> + <span id="ghlink-{$id}" class="ghlink"> + <a href="https://github.com/erlang/otp/edit/{$ghlink}" + title="Found an issue with the documentation? Fix it by clicking here!"> + <span class="pencil"/> + </a> + </span> + </xsl:when> + <xsl:otherwise> + <span id="ghlink-{$id}"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + <!-- Desc --> <xsl:template match="desc"> <xsl:param name="partnum"/> - <div class="REFBODY"> + <div class="REFBODY rb-7"> <p> <xsl:apply-templates> <xsl:with-param name="partnum" select="$partnum"/> @@ -2094,7 +2415,7 @@ <xsl:template match="input"> - <span class="bold_code"><xsl:apply-templates/></span> + <span class="bold_code bc-12"><xsl:apply-templates/></span> </xsl:template> <xsl:template match="seealso"> @@ -2113,7 +2434,7 @@ <xsl:when test="string-length($app_part) > 0"> <!-- "AppPart:ModPart#Linkpart" --> <xsl:variable name="mod_part"><xsl:value-of select="substring-after($filepart, ':')"/></xsl:variable> - <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html#{$linkpart}');"><xsl:apply-templates/></a></span> + <span class="bold_code bc-13"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html#{$linkpart}');"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> <!-- "Filepart#Linkpart (there is no ':' in Filepart) --> @@ -2133,7 +2454,7 @@ <xsl:variable name="app" select="key('mod2app', $filepart)"/> <xsl:choose> <xsl:when test="string-length($app) > 0"> - <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app}','{$filepart}.html#{$linkpart}');"><xsl:value-of select="$this"/></a></span> + <span class="bold_code bc-14"><a href="javascript:erlhref('{$topdocdir}/../','{$app}','{$filepart}.html#{$linkpart}');"><xsl:value-of select="$this"/></a></span> </xsl:when> <xsl:otherwise> <!-- Unknown application --> @@ -2146,11 +2467,11 @@ </xsl:when> <xsl:when test="string-length($linkpart) > 0"> <!-- Still Filepart#Linkpart (there is no ':' in Filepart --> - <span class="bold_code"><a href="{$filepart}.html#{$linkpart}"><xsl:apply-templates/></a></span> + <span class="bold_code bc-15"><a href="{$filepart}.html#{$linkpart}"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> <!-- "Filepart#" (there is no ':' in Filepart --> - <span class="bold_code"><a href="{$filepart}.html"><xsl:apply-templates/></a></span> + <span class="bold_code bc-16"><a href="{$filepart}.html"><xsl:apply-templates/></a></span> </xsl:otherwise> </xsl:choose> </xsl:otherwise> @@ -2158,7 +2479,7 @@ </xsl:when> <!-- string-length($filepart) > 0 --> <xsl:when test="string-length($linkpart) > 0"> <!-- "#Linkpart" --> - <span class="bold_code"><a href="#{$linkpart}"><xsl:apply-templates/></a></span> + <span class="bold_code bc-17"><a href="#{$linkpart}"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> <!-- "AppPart:Mod" or "Mod" (there is no '#') --> @@ -2168,11 +2489,11 @@ <xsl:when test="string-length($app_part) > 0"> <!-- "App:Mod" --> <xsl:variable name="mod_part"><xsl:value-of select="substring-after(@marker, ':')"/></xsl:variable> - <span class="bold_code"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html');"><xsl:apply-templates/></a></span> + <span class="bold_code bc-18"><a href="javascript:erlhref('{$topdocdir}/../','{$app_part}','{$mod_part}.html');"><xsl:apply-templates/></a></span> </xsl:when> <xsl:otherwise> <!-- "Mod" --> - <span class="bold_code"><a href="{@marker}.html"><xsl:apply-templates/></a></span> + <span class="bold_code bc-19"><a href="{@marker}.html"><xsl:apply-templates/></a></span> </xsl:otherwise> </xsl:choose> </xsl:otherwise> @@ -2181,7 +2502,7 @@ </xsl:template> <xsl:template match="url"> - <span class="bold_code"><a href="{@href}"><xsl:apply-templates/></a></span> + <span class="bold_code bc-20"><a href="{@href}"><xsl:apply-templates/></a></span> </xsl:template> <xsl:template match="marker"> @@ -2256,21 +2577,17 @@ <div id="leftnav"> <div class="innertube"> - <xsl:call-template name="menu_top"/> + <xsl:call-template name="erlang_logo"/> - <p> - <strong><xsl:value-of select="/book/header/title"/></strong><br/> - <strong>Release Notes</strong><br/> - <small>Version <xsl:value-of select="$appver"/></small> - </p> + <p class="section-title"><xsl:value-of select="/book/header/title"/></p> + <p class="section-subtitle">Release Notes</p> + <p class="section-version">Version <xsl:value-of select="$appver"/></p> + + <xsl:call-template name="menu_top"/> <xsl:call-template name="menu_middle"/> - <p> - <small> - <strong>Chapters</strong> - </small> - </p> + <h3>Chapters</h3> <ul class="flipMenu" imagepath="{$topdocdir}/js/flipmenu"> <xsl:call-template name="menu.chapter"> @@ -2486,4 +2803,46 @@ <xsl:value-of select="normalize-space(.)"/> </xsl:template> + <xsl:template match="ret"> + <xsl:value-of select="."/> + <xsl:variable name="last_char" select="substring(., string-length(.), 1)"/> + <xsl:if test="$last_char != '*'"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:template> + + <xsl:template match="nametext"> + <xsl:value-of select="substring-before(.,'(')"/> + <xsl:text>(</xsl:text> + <xsl:variable name="arglist" select="substring-after(.,'(')"/> + <xsl:choose> + <xsl:when test="$arglist = ')' or $arglist = 'void)'"> + <xsl:value-of select="$arglist"/> + </xsl:when> + <xsl:otherwise> + <br/> + <xsl:call-template name="cfunc-arglist"> + <xsl:with-param name="text" select="$arglist"/> + </xsl:call-template> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <!-- Format C function argument list with <br> after comma --> + <xsl:template name="cfunc-arglist"> + <xsl:param name="text"/> + <xsl:variable name="line" select="normalize-space($text)"/> + <xsl:choose> + <xsl:when test="contains($line,',')"> + <xsl:value-of select="substring-before($line,',')"/>,<br/> + <xsl:call-template name="cfunc-arglist"> + <xsl:with-param name="text" select="substring-after($line,',')"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$line"/> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + </xsl:stylesheet> diff --git a/lib/erl_docgen/priv/xsl/db_man.xsl b/lib/erl_docgen/priv/xsl/db_man.xsl index 03b6b0691d..27b2bd4066 100644 --- a/lib/erl_docgen/priv/xsl/db_man.xsl +++ b/lib/erl_docgen/priv/xsl/db_man.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2016. All Rights Reserved. + # Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -271,6 +271,12 @@ <xsl:apply-templates/> </xsl:template> + <!-- Datatype Title--> + <xsl:template match="datatype_title"> + <xsl:text> .SS </xsl:text> + <xsl:apply-templates/> + </xsl:template> + <!-- Datatype --> <xsl:template match="datatype"> <xsl:apply-templates/> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 99263847fb..1b91d768e3 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2016. All Rights Reserved. + # Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -23,12 +23,16 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" - extension-element-prefixes="exsl" - xmlns:fo="http://www.w3.org/1999/XSL/Format"> + xmlns:func="http://exslt.org/functions" + xmlns:erl="http://erlang.org" + extension-element-prefixes="exsl func" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <xsl:output method="xml" indent="yes"/> <xsl:include href="db_pdf_params.xsl"/> + <xsl:include href="db_funcs.xsl"/> <!-- Start of Dialyzer type/spec tags. See also the templates matching "name" and "seealso" as well as @@ -295,6 +299,13 @@ <xsl:apply-templates/> </xsl:template> + <!-- Datatype Title--> + <xsl:template match="datatype_title"> + <fo:block xsl:use-attribute-sets="h4"> + <xsl:apply-templates/> + </fo:block> + </xsl:template> + <!-- Datatype --> <xsl:template match="datatype"> <fo:block xsl:use-attribute-sets="function-name"> @@ -687,7 +698,7 @@ <fo:block xsl:use-attribute-sets="cover.inner.copyrightnotice"> <xsl:value-of select="/book/header/legalnotice"/> - <!-- + <!-- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -744,12 +755,12 @@ <fo:bookmark internal-destination="{generate-id(header/title)}" starting-state="hide"> <fo:bookmark-title><xsl:value-of select="header/title"/></fo:bookmark-title> - + <xsl:call-template name="bookmarks2"> <xsl:with-param name="entries" select="chapter[header/title]"/> </xsl:call-template> - + </fo:bookmark> </xsl:for-each> </xsl:if> @@ -1122,52 +1133,60 @@ <!-- Note --> <xsl:template match="note"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="note"> - <fo:block xsl:use-attribute-sets="note-warning-title"> - <xsl:text>Note:</xsl:text> - </fo:block> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> + <fo:block xsl:use-attribute-sets="note-warning"> + <fo:block xsl:use-attribute-sets="note-title"> + <xsl:text>Note:</xsl:text> + </fo:block> + <fo:block xsl:use-attribute-sets="note-warning-content"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> </fo:block> </xsl:template> <!-- Warning --> <xsl:template match="warning"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="warning"> - <fo:block xsl:use-attribute-sets="note-warning-title"> - <xsl:text>Warning:</xsl:text> - </fo:block> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> + <fo:block xsl:use-attribute-sets="note-warning"> + <fo:block xsl:use-attribute-sets="warning-title"> + <xsl:text>Warning:</xsl:text> + </fo:block> + <fo:block xsl:use-attribute-sets="note-warning-content"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> </fo:block> </xsl:template> <!-- Do --> <xsl:template match="do"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="do"> - <fo:block xsl:use-attribute-sets="note-warning-title"> - <xsl:text>Do:</xsl:text> - </fo:block> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> + <fo:block xsl:use-attribute-sets="note-warning"> + <fo:block xsl:use-attribute-sets="note-title"> + <xsl:text>Do:</xsl:text> + </fo:block> + <fo:block xsl:use-attribute-sets="note-warning-content"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> </fo:block> </xsl:template> <!-- Dont --> <xsl:template match="dont"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="dont"> - <fo:block xsl:use-attribute-sets="note-warning-title"> - <xsl:text>Don't:</xsl:text> - </fo:block> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> + <fo:block xsl:use-attribute-sets="note-warning"> + <fo:block xsl:use-attribute-sets="warning-title"> + <xsl:text>Don't:</xsl:text> + </fo:block> + <fo:block xsl:use-attribute-sets="note-warning-content"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> </fo:block> </xsl:template> @@ -1226,7 +1245,14 @@ </xsl:variable> <fo:block xsl:use-attribute-sets="code"> - <xsl:apply-templates select="text()"/> + <xsl:choose> + <xsl:when test="not(descendant::anno)"> + <xsl:value-of select="erl:code_trim(text())"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates/> + </xsl:otherwise> + </xsl:choose> </fo:block> <xsl:if test="@caption"> @@ -1630,8 +1656,14 @@ </xsl:variable> <fo:block xsl:use-attribute-sets="image"> - <fo:external-graphic content-width="scale-down-to-fit" inline-progression-dimension.maximum="100%" src="{@file}"/> - + <xsl:choose> + <xsl:when test="@width"> + <fo:external-graphic content-width="scale-to-fit" width="{@width}" inline-progression-dimension.maximum="100%" src="{@file}"/> + </xsl:when> + <xsl:otherwise> + <fo:external-graphic content-width="scale-down-to-fit" inline-progression-dimension.maximum="100%" src="{@file}"/> + </xsl:otherwise> + </xsl:choose> <xsl:apply-templates> <xsl:with-param name="chapnum" select="$chapnum"/> <xsl:with-param name="fignum" select="$fignum"/> diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index d9a150d2d9..9bfa991b54 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- +<!-- # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2016. All Rights Reserved. + # Copyright Ericsson AB 2009-2018. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ # limitations under the License. # # %CopyrightEnd% - + --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" @@ -45,7 +45,7 @@ <xsl:param name="page-width">210mm</xsl:param> <!-- Paper size: US Letter (279x216 mm) --> - <!-- + <!-- <xsl:param name="page-height">11in</xsl:param> <xsl:param name="page-width">8.5in</xsl:param> --> @@ -139,6 +139,7 @@ <xsl:attribute-set name="image"> <xsl:attribute name="space-after">0.5em</xsl:attribute> <xsl:attribute name="space-before">0.5em</xsl:attribute> + <xsl:attribute name="text-align">center</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="listblock"> @@ -248,86 +249,82 @@ </xsl:attribute-set> <xsl:attribute-set name="code"> - <xsl:attribute name="background-color">#e0e0ff</xsl:attribute> + <xsl:attribute name="background-color">#f1f3f5</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="border-color">#dee2e6</xsl:attribute><!-- dee2e6--> + <xsl:attribute name="border-width">0.3mm</xsl:attribute> <xsl:attribute name="font-family">DejaVuSansMono, monospace</xsl:attribute> <xsl:attribute name="font-size">0.8em</xsl:attribute> - <xsl:attribute name="keep-together.within-page">auto</xsl:attribute> + <xsl:attribute name="keep-together.within-page">3</xsl:attribute> <xsl:attribute name="linefeed-treatment">preserve</xsl:attribute> - <xsl:attribute name="padding-before">0em</xsl:attribute> - <xsl:attribute name="padding-after">1em</xsl:attribute> - <xsl:attribute name="space-after">1em</xsl:attribute> - <xsl:attribute name="space-before">2em</xsl:attribute> - <xsl:attribute name="margin-left">0.5em</xsl:attribute> - <xsl:attribute name="margin-right">0.5em</xsl:attribute> + <xsl:attribute name="padding-before">1.5mm</xsl:attribute> + <xsl:attribute name="padding-after">1mm</xsl:attribute> + <xsl:attribute name="padding-left">1mm</xsl:attribute> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + <xsl:attribute name="margin-left">1mm</xsl:attribute> + <xsl:attribute name="margin-right">1mm</xsl:attribute> <xsl:attribute name="white-space-collapse">false</xsl:attribute> <xsl:attribute name="white-space-treatment">preserve</xsl:attribute> <xsl:attribute name="wrap-option">no-wrap</xsl:attribute> + <xsl:attribute name="space-after">0.5em</xsl:attribute> + <xsl:attribute name="space-before">0.5em</xsl:attribute> </xsl:attribute-set> - - <xsl:attribute-set name="toc.level1"> <xsl:attribute name="space-before">1em</xsl:attribute> - </xsl:attribute-set> - -<xsl:attribute-set name="note"> - <xsl:attribute name="background-color">#d0fed0</xsl:attribute> - <xsl:attribute name="space-after">1em</xsl:attribute> - <xsl:attribute name="space-before">2em</xsl:attribute> - <xsl:attribute name="text-align">justify</xsl:attribute> - <xsl:attribute name="padding-before">1em</xsl:attribute> - <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">0.5em</xsl:attribute> - <xsl:attribute name="padding-right">0.5em</xsl:attribute> - <xsl:attribute name="margin-left">0.5em</xsl:attribute> - <xsl:attribute name="margin-right">0.5em</xsl:attribute> - <xsl:attribute name="keep-together.within-page">always</xsl:attribute> </xsl:attribute-set> -<xsl:attribute-set name="warning"> - <xsl:attribute name="background-color">#ffd6d6</xsl:attribute> - <xsl:attribute name="space-after">1em</xsl:attribute> - <xsl:attribute name="space-before">2em</xsl:attribute> - <xsl:attribute name="text-align">justify</xsl:attribute> - <xsl:attribute name="padding-before">1em</xsl:attribute> - <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">0.5em</xsl:attribute> - <xsl:attribute name="padding-right">0.5em</xsl:attribute> - <xsl:attribute name="margin-left">0.5em</xsl:attribute> - <xsl:attribute name="margin-right">0.5em</xsl:attribute> - <xsl:attribute name="keep-together.within-page">always</xsl:attribute> + <xsl:attribute-set name="note-title"> + <xsl:attribute name="space-before">0.5em</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="border-bottom-width">0mm</xsl:attribute> + <xsl:attribute name="border-color">#495057</xsl:attribute> + <xsl:attribute name="background-color">#2b8a3e</xsl:attribute> + <xsl:attribute name="font-weight">bold</xsl:attribute> + <xsl:attribute name="color">#fefefe</xsl:attribute> + <xsl:attribute name="padding-before">1mm</xsl:attribute> + <xsl:attribute name="padding-after">0.5mm</xsl:attribute> + <xsl:attribute name="padding-left">1mm</xsl:attribute> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + <xsl:attribute name="margin-left">1mm</xsl:attribute> + <xsl:attribute name="margin-right">1mm</xsl:attribute> + <xsl:attribute name="font-size">1.33em</xsl:attribute> </xsl:attribute-set> -<xsl:attribute-set name="do"> - <xsl:attribute name="background-color">#d0fed0</xsl:attribute> - <xsl:attribute name="space-after">1em</xsl:attribute> - <xsl:attribute name="space-before">2em</xsl:attribute> - <xsl:attribute name="text-align">justify</xsl:attribute> - <xsl:attribute name="padding-before">1em</xsl:attribute> - <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">0.5em</xsl:attribute> - <xsl:attribute name="padding-right">0.5em</xsl:attribute> - <xsl:attribute name="margin-left">0.5em</xsl:attribute> - <xsl:attribute name="margin-right">0.5em</xsl:attribute> + <xsl:attribute-set name="note-warning"> <xsl:attribute name="keep-together.within-page">always</xsl:attribute> </xsl:attribute-set> -<xsl:attribute-set name="dont"> - <xsl:attribute name="background-color">#ffd6d6</xsl:attribute> - <xsl:attribute name="space-after">1em</xsl:attribute> - <xsl:attribute name="space-before">2em</xsl:attribute> - <xsl:attribute name="text-align">justify</xsl:attribute> - <xsl:attribute name="padding-before">1em</xsl:attribute> - <xsl:attribute name="padding-after">0.3em</xsl:attribute> - <xsl:attribute name="padding-left">0.5em</xsl:attribute> - <xsl:attribute name="padding-right">0.5em</xsl:attribute> - <xsl:attribute name="margin-left">0.5em</xsl:attribute> - <xsl:attribute name="margin-right">0.5em</xsl:attribute> - <xsl:attribute name="keep-together.within-page">always</xsl:attribute> + <xsl:attribute-set name="warning-title"> + <xsl:attribute name="space-before">0.5em</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="border-bottom-width">0mm</xsl:attribute> + <xsl:attribute name="border-color">#495057</xsl:attribute> + <xsl:attribute name="background-color">#c92a2a</xsl:attribute> + <xsl:attribute name="font-weight">bold</xsl:attribute> + <xsl:attribute name="color">#fefefe</xsl:attribute> + <xsl:attribute name="padding-before">1mm</xsl:attribute> + <xsl:attribute name="padding-after">0.5mm</xsl:attribute> + <xsl:attribute name="padding-left">1mm</xsl:attribute> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + <xsl:attribute name="margin-left">1mm</xsl:attribute> + <xsl:attribute name="margin-right">1mm</xsl:attribute> + <xsl:attribute name="font-size">1.33em</xsl:attribute> </xsl:attribute-set> - <xsl:attribute-set name="note-warning-title"> - <xsl:attribute name="font-size">1.33em</xsl:attribute> + <xsl:attribute-set name="note-warning-content"> + <xsl:attribute name="space-after">0.5em</xsl:attribute> + <xsl:attribute name="border-style">solid</xsl:attribute> + <xsl:attribute name="border-top-width">0mm</xsl:attribute> + <xsl:attribute name="border-color">#495057</xsl:attribute> + <xsl:attribute name="background-color">#f8f9fa</xsl:attribute> + <xsl:attribute name="text-align">justify</xsl:attribute> + <xsl:attribute name="padding-before">1mm</xsl:attribute> + <xsl:attribute name="padding-after">0.5mm</xsl:attribute> + <xsl:attribute name="padding-left">1mm</xsl:attribute> + <xsl:attribute name="padding-right">1mm</xsl:attribute> + <xsl:attribute name="margin-left">1mm</xsl:attribute> + <xsl:attribute name="margin-right">1mm</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="module-header"> @@ -354,7 +351,7 @@ <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> <xsl:attribute name="space-after">0.25em</xsl:attribute> <!-- xsl:attribute name="space-before">1.5em</xsl:attribute --> - </xsl:attribute-set> + </xsl:attribute-set> <xsl:attribute-set name="type-listblock"> <xsl:attribute name="provisional-distance-between-starts">1.8em</xsl:attribute> |