diff options
Diffstat (limited to 'lib/erl_docgen')
-rw-r--r-- | lib/erl_docgen/doc/src/doc-build.xml | 5 | ||||
-rwxr-xr-x | lib/erl_docgen/priv/bin/xml_from_edoc.escript | 8 | ||||
-rw-r--r-- | lib/erl_docgen/priv/dtd/common.refs.dtd | 7 | ||||
-rw-r--r-- | lib/erl_docgen/priv/dtd/erlref.dtd | 3 | ||||
-rw-r--r-- | lib/erl_docgen/priv/fop.xconf | 45 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf.xsl | 12 | ||||
-rw-r--r-- | lib/erl_docgen/priv/xsl/db_pdf_params.xsl | 30 | ||||
-rw-r--r-- | lib/erl_docgen/src/Makefile | 4 | ||||
-rw-r--r-- | lib/erl_docgen/src/docgen_edoc_xml_cb.erl | 37 | ||||
-rw-r--r-- | lib/erl_docgen/src/docgen_xmerl_xml_cb.erl | 28 | ||||
-rw-r--r-- | lib/erl_docgen/vsn.mk | 3 |
11 files changed, 128 insertions, 54 deletions
diff --git a/lib/erl_docgen/doc/src/doc-build.xml b/lib/erl_docgen/doc/src/doc-build.xml index 08410a1539..ae1b17dff5 100644 --- a/lib/erl_docgen/doc/src/doc-build.xml +++ b/lib/erl_docgen/doc/src/doc-build.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>1997</year><year>2011</year> + <year>1997</year><year>2013</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -56,7 +56,8 @@ </p> <code> - 1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/codeline_preprocessing.escript ex1.xmlsrc ex1.xml + 1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/codeline_preprocessing.escript \ + ex1.xmlsrc ex1.xml </code> </section> </section> diff --git a/lib/erl_docgen/priv/bin/xml_from_edoc.escript b/lib/erl_docgen/priv/bin/xml_from_edoc.escript index 2cb81be1be..65a580dca2 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-2011. All Rights Reserved. +%% Copyright Ericsson AB 2010-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -100,10 +100,12 @@ module(File, Args) -> users_guide(File, Args) -> case filelib:is_regular(File) of true -> + Enc = epp:read_encoding(File, [{in_comment_only, false}]), + Encoding = [{encoding, Enc} || Enc =/= none], Opts = [{def, Args#args.def}, {app_default, "OTPROOT"}, {file_suffix, Args#args.suffix}, - {layout, Args#args.layout}], + {layout, Args#args.layout}] ++ Encoding, Env = edoc_lib:get_doc_env(Opts), @@ -115,7 +117,7 @@ users_guide(File, Args) -> Text = edoc_lib:run_layout(F, Opts), OutFile = "chapter" ++ Args#args.suffix, - edoc_lib:write_file(Text, ".", OutFile); + edoc_lib:write_file(Text, ".", OutFile, '', Encoding); false -> io:format("~s: not a regular file\n", [File]), usage() diff --git a/lib/erl_docgen/priv/dtd/common.refs.dtd b/lib/erl_docgen/priv/dtd/common.refs.dtd index c1237766e1..93592607df 100644 --- a/lib/erl_docgen/priv/dtd/common.refs.dtd +++ b/lib/erl_docgen/priv/dtd/common.refs.dtd @@ -26,10 +26,12 @@ <!ELEMENT description (%block;|quote|br|marker|warning|note)* > <!ELEMENT funcs (func)+ > -<!ELEMENT func (name+,type_desc+,fsummary,type?,desc?) > +<!ELEMENT func (name+,type_desc*,fsummary,type?,desc?) > <!-- ELEMENT name is defined in each ref dtd --> <!ELEMENT fsummary (#PCDATA|c|em)* > -<!ELEMENT type (v,d?)+ > +<!ELEMENT type (v,d?)* > +<!ATTLIST type variable CDATA #IMPLIED + name_i CDATA #IMPLIED> <!ELEMENT v (#PCDATA) > <!ELEMENT d (#PCDATA|c|em)* > <!ELEMENT desc (%block;|quote|br|marker|warning|note|anno)* > @@ -41,3 +43,4 @@ <!ELEMENT datatypes (datatype)+ > <!ELEMENT datatype (name+,desc?) > <!ELEMENT type_desc (#PCDATA) > +<!ATTLIST type_desc variable CDATA #REQUIRED> diff --git a/lib/erl_docgen/priv/dtd/erlref.dtd b/lib/erl_docgen/priv/dtd/erlref.dtd index 9905086ff4..0cc5cfa06d 100644 --- a/lib/erl_docgen/priv/dtd/erlref.dtd +++ b/lib/erl_docgen/priv/dtd/erlref.dtd @@ -29,3 +29,6 @@ <!-- `name' is used in common.refs.dtd and must therefore be defined in each *ref. dtd --> <!ELEMENT name (#PCDATA) > +<!ATTLIST name name CDATA #IMPLIED + arity CDATA #IMPLIED + clause_i CDATA #IMPLIED> diff --git a/lib/erl_docgen/priv/fop.xconf b/lib/erl_docgen/priv/fop.xconf new file mode 100644 index 0000000000..70ecd608c3 --- /dev/null +++ b/lib/erl_docgen/priv/fop.xconf @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!-- + # + # %CopyrightBegin% + # + # Copyright Ericsson AB 2009-2012. All Rights Reserved. + # + # The contents of this file are subject to the Erlang Public License, + # Version 1.1, (the "License"); you may not use this file except in + # compliance with the License. You should have received a copy of the + # Erlang Public License along with this software. If not, it can be + # retrieved online at http://www.erlang.org/. + # + # Software distributed under the License is distributed on an "AS IS" + # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + # the License for the specific language governing rights and limitations + # under the License. + # + # %CopyrightEnd% + + --> +<!-- NOTE: This is the version of the configuration --> +<fop version="1.0"> + <!-- The substitutions of DejaVu 700 are there because FOP outputs + warnings about doing the substitutions otherwise --> + <fonts> + <substitutions> + <substitution> + <from font-family="DejaVuSans" font-weight="700"/> + <to font-family="DejaVuSans" font-weight="400"/> + </substitution> + <substitution> + <from font-family="DejaVuSansMono" font-weight="700"/> + <to font-family="DejaVuSansMono" font-weight="400"/> + </substitution> + </substitutions> + </fonts> + <renderers> + <renderer mime="application/pdf"> + <fonts> + <auto-detect/> + </fonts> + </renderer> + </renderers> +</fop> diff --git a/lib/erl_docgen/priv/xsl/db_pdf.xsl b/lib/erl_docgen/priv/xsl/db_pdf.xsl index 7de5af2a49..c846bdbf34 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf.xsl @@ -1102,11 +1102,13 @@ <xsl:template match="taglist/item"> <xsl:param name="partnum"/> - <fo:block xsl:use-attribute-sets="tagitem"> - <xsl:apply-templates> - <xsl:with-param name="partnum" select="$partnum"/> - </xsl:apply-templates> - </fo:block> + <fo:block-container> + <fo:block xsl:use-attribute-sets="tagitem"> + <xsl:apply-templates> + <xsl:with-param name="partnum" select="$partnum"/> + </xsl:apply-templates> + </fo:block> + </fo:block-container> </xsl:template> diff --git a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl index 4e61f1f476..2e3b22acf4 100644 --- a/lib/erl_docgen/priv/xsl/db_pdf_params.xsl +++ b/lib/erl_docgen/priv/xsl/db_pdf_params.xsl @@ -3,7 +3,7 @@ # # %CopyrightBegin% # - # Copyright Ericsson AB 2009-2011. All Rights Reserved. + # Copyright Ericsson AB 2009-2012. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in @@ -52,7 +52,7 @@ <!-- XSL-FO properties --> <xsl:attribute-set name="caption"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.8em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="keep-with-previous.within-page">always</xsl:attribute> @@ -61,7 +61,7 @@ </xsl:attribute-set> <xsl:attribute-set name="pre"> - <xsl:attribute name="font-family">monospace</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="linefeed-treatment">preserve</xsl:attribute> @@ -162,7 +162,7 @@ <xsl:attribute name="border-after-width">1pt</xsl:attribute> <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> <xsl:attribute name="break-before">page</xsl:attribute> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.83em</xsl:attribute> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="space-after">1em</xsl:attribute> @@ -171,7 +171,7 @@ </xsl:attribute-set> <xsl:attribute-set name="h2"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.5em</xsl:attribute> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -180,7 +180,7 @@ </xsl:attribute-set> <xsl:attribute-set name="h3"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.33em</xsl:attribute> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -189,7 +189,7 @@ </xsl:attribute-set> <xsl:attribute-set name="h4"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.17em</xsl:attribute> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -198,7 +198,7 @@ </xsl:attribute-set> <xsl:attribute-set name="h5"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -207,7 +207,7 @@ </xsl:attribute-set> <xsl:attribute-set name="h6"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.83em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -227,20 +227,20 @@ <xsl:attribute name="border-after-style">solid</xsl:attribute> <xsl:attribute name="border-after-width">2pt</xsl:attribute> <xsl:attribute name="border-color"><xsl:value-of select="$pdfcolor"/></xsl:attribute> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.9em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="page-footer"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.9em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="code"> <xsl:attribute name="background-color">#e0e0ff</xsl:attribute> - <xsl:attribute name="font-family">monospace</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="linefeed-treatment">preserve</xsl:attribute> @@ -303,7 +303,7 @@ <xsl:attribute-set name="module-name"> <xsl:attribute name="border-after-style">solid</xsl:attribute> <xsl:attribute name="border-after-width">1pt</xsl:attribute> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">1.5em</xsl:attribute> <xsl:attribute name="font-weight">normal</xsl:attribute> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> @@ -313,7 +313,7 @@ <xsl:attribute-set name="function-name"> <xsl:attribute name="font-weight">bold</xsl:attribute> - <xsl:attribute name="font-family">monospace</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSansMono, monospace</xsl:attribute> <!-- xsl:attribute name="font-size">0.8em</xsl:attribute --> <xsl:attribute name="keep-with-next.within-page">always</xsl:attribute> <xsl:attribute name="space-after">0.25em</xsl:attribute> @@ -401,7 +401,7 @@ </xsl:attribute-set> <xsl:attribute-set name="caption"> - <xsl:attribute name="font-family">sans-serif</xsl:attribute> + <xsl:attribute name="font-family">DejaVuSans, sans-serif</xsl:attribute> <xsl:attribute name="font-size">0.8em</xsl:attribute> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="keep-with-previous.within-page">always</xsl:attribute> diff --git a/lib/erl_docgen/src/Makefile b/lib/erl_docgen/src/Makefile index 6c8b438b25..ef96f5dbf2 100644 --- a/lib/erl_docgen/src/Makefile +++ b/lib/erl_docgen/src/Makefile @@ -78,10 +78,10 @@ docs: # ---------------------------------------------------- $(APP_TARGET): $(APP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ $(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk - sed -e 's;%VSN%;$(VSN);' $< > $@ + $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@ # ---------------------------------------------------- # Release Target diff --git a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl index cbaa93a15d..e3cc354206 100644 --- a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl +++ b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl @@ -1,19 +1,20 @@ -%% ``The contents of this file are subject to the Erlang Public License, +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. +%% retrieved online at http://www.erlang.org/. %% %% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See -%% the Licence for the specific language governing rights and limitations +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations %% under the License. %% -%% The Initial Developer of the Original Code is Ericsson AB. -%% Portions created by Ericsson are Copyright 1999-2006, Ericsson AB. -%% All Rights Reserved.�� -%% -%% $Id$ +%% %CopyrightEnd% %% -module(docgen_edoc_xml_cb). @@ -39,12 +40,14 @@ module(Element, Opts) -> SortP = proplists:get_value(sort_functions, Opts, true), XML = layout_module(Element, SortP), - xmerl:export_simple([XML], docgen_xmerl_xml_cb, []). + RootAttributes = root_attributes(Element, Opts), + xmerl:export_simple([XML], docgen_xmerl_xml_cb, RootAttributes). %% CHAPTER -overview(Element, _Opts) -> +overview(Element, Opts) -> XML = layout_chapter(Element), - xmerl:export_simple([XML], docgen_xmerl_xml_cb, []). + RootAttributes = root_attributes(Element, Opts), + xmerl:export_simple([XML], docgen_xmerl_xml_cb, RootAttributes). %%--Internal functions-------------------------------------------------- @@ -99,6 +102,16 @@ layout_module(#xmlElement{name = module, content = Es}=E, SortP) -> ?NL,Authors] }. +root_attributes(Element, Opts) -> + Encoding = case get_attrval(encoding, Element) of + "" -> + DefaultEncoding = epp:default_encoding(), + proplists:get_value(encoding, Opts, DefaultEncoding); + Enc -> + Enc + end, + [#xmlAttribute{name=encoding, value=Encoding}]. + layout_chapter(#xmlElement{name=overview, content=Es}) -> Title = get_text(title, Es), Header = {header, [ diff --git a/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl b/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl index 884932ed12..d713b61c0a 100644 --- a/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl +++ b/lib/erl_docgen/src/docgen_xmerl_xml_cb.erl @@ -1,19 +1,20 @@ -%% ``The contents of this file are subject to the Erlang Public License, +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2001-2012. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be -%% retrieved via the world wide web at http://www.erlang.org/. +%% retrieved online at http://www.erlang.org/. %% %% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See -%% the Licence for the specific language governing rights and limitations +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations %% under the License. %% -%% The Initial Developer of the Original Code is Ericsson AB. -%% Portions created by Ericsson are Copyright 1999-2006, Ericsson AB. -%% All Rights Reserved.�� -%% -%% $Id$ +%% %CopyrightEnd% %% -module(docgen_xmerl_xml_cb). @@ -35,9 +36,14 @@ '#xml-inheritance#'() -> [xmerl_xml]. -'#root#'(Data, _Attrs, [], _E) -> +'#root#'(Data, Attrs, [], _E) -> + Encoding = + case [E || #xmlAttribute{name = encoding, value = E} <- Attrs] of + [E] -> E; + _ -> atom_to_list(epp:default_encoding()) + end, ["<",DTD,">"] = hd(hd(Data)), - ["<?xml version=\"1.0\" encoding=\"latin1\" ?>\n", + ["<?xml version=\"1.0\" encoding=\"",Encoding,"\" ?>\n", "<!DOCTYPE "++DTD++" SYSTEM \""++DTD++".dtd\">\n", Data]. diff --git a/lib/erl_docgen/vsn.mk b/lib/erl_docgen/vsn.mk index 2599dc0ff7..a2262198dc 100644 --- a/lib/erl_docgen/vsn.mk +++ b/lib/erl_docgen/vsn.mk @@ -1,2 +1 @@ -ERL_DOCGEN_VSN = 0.3.3 - +ERL_DOCGEN_VSN = 0.3.4 |