Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Texinfo support #1408

Merged
merged 3 commits into from
Aug 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<property name="db.style.fopdf" value="fopdf.xsl"/>
<property name="db.style.html" value="html_chunk.xsl"/>
<property name="db.style.htmlsingle" value="html.xsl"/>
<property name="db.style.info" value="texinfo.xsl"/>

<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
Expand All @@ -57,6 +58,11 @@
<property name="ceylon.module-resolver.jar" value="${ceylon.module-resolver.dir}/com.redhat.ceylon.module-resolver-${module.com.redhat.ceylon.module-resolver.version}.jar"/>
<property name="ceylon.module-resolver.lib" location="${ceylon.repo.dir}/${ceylon.module-resolver.jar}"/>


<condition property="hasInfo">
<os family="unix"/>
</condition>


<!-- Classpath for the build tools. -->
<path id="lib.classpath">
Expand Down Expand Up @@ -104,6 +110,17 @@

</target>

<target name="info"
depends="clean.doc"
description="Compile Texinfo documentation for all languages.">

<!-- TRANSLATOR: Duplicate this line for your language -->
<antcall target="lang.docinfo">
<param name="lang" value="en"/>
</antcall>

</target>

<target name="revdiff"
description="Generates a diff report for all translated versions.">

Expand Down Expand Up @@ -135,6 +152,7 @@
<antcall target="lang.dochtml"/>
<antcall target="lang.dochtmlsingle"/>
<antcall target="lang.htmlmisc"/>
<antcall target="lang.docinfo"/>
</target>


Expand Down Expand Up @@ -295,6 +313,44 @@

</target>

<target name="lang.docinfo.texi">

<mkdir dir="${build.dir}/${lang}/info/"/>

<java classname="com.icl.saxon.StyleSheet" fork="true" dir="${basedir}" maxmemory="192m">
<classpath refid="lib.classpath"/>
<arg value="-o"/>
<arg value="${build.dir}/${lang}/info/ceylon-spec.texi"/>
<arg value="${basedir}/${lang}/master.xml"/>
<arg value="${basedir}/${lang}/styles/${db.style.info}"/>
</java>

</target>

<target name="lang.docinfo.make" if="hasInfo">

<exec executable="makeinfo" dir="${build.dir}/${lang}/info/">
<arg value="ceylon-spec.texi"/>
</exec>

</target>

<target name="lang.docinfo"
depends="lang.docinfo.texi,lang.docinfo.make"
description="Generates the Texinfo documentation only for a language (set lang)"/>

<target name="lang.docinfo.install"
depends="lang.docinfo"
if="hasInfo">

<exec executable="sudo" dir="${build.dir}/${lang}/info/">
Copy link
Member

Choose a reason for hiding this comment

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

You guys are not seriously considering running sudo in a build file, are you? That's a big veto from me.

Copy link
Member Author

Choose a reason for hiding this comment

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

You need root permissions to install the info file. Same as the ancient

./configure
make
sudo make install

Copy link
Member

Choose a reason for hiding this comment

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

Is there a MANPATH analog, like INFOPATH, that can be used instead? Seems like this should go in the dist folder, along side bin.

Copy link
Member

Choose a reason for hiding this comment

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

Well, do you notice how it should be the user who explicitly runs sudo and not make?

Not only that, but I'd want to install to my user info path, not the system, like we do for the rest of the publish commands.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jvasileff yes, it’s actually called INFOPATH :) however, if it’s unset, info falls back to a compile-time default (usually /usr/share/info), which I don’t think we can determine.

@FroMage Is there a user info path? I can’t find it. Of course, you can make it yourself with INFOPATH, but it doesn’t seem to be intended in info’s design.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. For now I removed the use of sudo and added a check for root rights to the install task

Copy link
Member

Choose a reason for hiding this comment

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

@lucaswerkmeister best open an issue in ceylon-dist so we don't forget to add this to the debian/redhat packages

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

In the end I decided to remove the install task entirely, it just has no business being there ^^

<arg value="sh"/>
<arg value="-c"/>
<arg value="install --owner=root --group=root --mode=0644 ceylon-spec.info* /usr/share/info &amp;&amp; install-info --info-dir=/usr/share/info /usr/share/info/ceylon-spec.info"/>
</exec>

</target>

<target name="lang.revdiff"
description="Reports difference between English and translation (set lang)">

Expand Down
2 changes: 1 addition & 1 deletion en/modules/declarations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ TypeConstraints?

</section>

<section>
<section id="dynamicinterfaces">
<title>Dynamic interfaces</title>

<para>A <emphasis>dynamic interface</emphasis> is an interface declared with the
Expand Down
6 changes: 3 additions & 3 deletions en/modules/execution.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void run() {
or when an exception is thrown by an evaluation, assignment, invocation, or
instantiation.</para>

<section>
<section id="frames">
<title>Frames</title>

<para>When execution of a body begins, a <emphasis>frame</emphasis> is created.
Expand Down Expand Up @@ -294,7 +294,7 @@ void run() {

</section>

<section>
<section id="currentinstancesandcurrentframes">
<title>Current instances and current frames</title>

<para>A frame may be the <emphasis>current frame</emphasis> for a body. When the
Expand Down Expand Up @@ -586,7 +586,7 @@ String result = middleObject.string;</programlisting>

</section>

<section if="lateinitialization">
<section id="lateinitialization">
<title>Initialization of late references</title>

<para>A reference annotated <literal>late</literal> may be uninitialized in a
Expand Down
48 changes: 48 additions & 0 deletions support/docbook-xsl/texinfo/block.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version='1.0'>

<xsl:template match="para">
<xsl:apply-templates/>
<xsl:text> <!-- explicit blank line -->

</xsl:text>
</xsl:template>

<xsl:template match="itemizedlist">
@itemize @bullet
<xsl:apply-templates/>
@end itemize
</xsl:template>

<xsl:template match="listitem">
@item <xsl:apply-templates/>
</xsl:template>

<xsl:template match="comment">
@smallindentedblock
<xsl:apply-templates/>
@end smallindentedblock
</xsl:template>

<xsl:template match="programlisting">
@example
<xsl:apply-templates/>
@end example
</xsl:template>

<xsl:template match="screen">
@quotation
<xsl:apply-templates/>
@end quotation
</xsl:template>

<xsl:template match="synopsis">
@verbatim
<xsl:value-of select="."/>
@end verbatim
</xsl:template>

</xsl:stylesheet>
30 changes: 30 additions & 0 deletions support/docbook-xsl/texinfo/docbook.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version='1.0'?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version='1.0'>

<xsl:output method="text"
encoding="ISO-8859-1"
indent="no"/>

<xsl:include href="../VERSION"/>
<xsl:include href="param.xsl"/>
<xsl:include href="empty.xsl"/>
<xsl:include href="text.xsl"/>
<xsl:include href="inline.xsl"/>
<xsl:include href="block.xsl"/>
<xsl:include href="structure.xsl"/>
<xsl:include href="../lib/lib.xsl"/>
<xsl:include href="../common/l10n.xsl"/>
<xsl:include href="../common/common.xsl"/>
<xsl:include href="../common/titles.xsl"/>

<xsl:param name="stylesheet.result.type" select="'texinfo'"/>

<xsl:key name="id" match="*" use="@id"/>

<xsl:template match="/"><xsl:apply-templates/></xsl:template>

</xsl:stylesheet>
11 changes: 11 additions & 0 deletions support/docbook-xsl/texinfo/empty.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version='1.0'>

<xsl:template match="bookinfo"/>
<xsl:template match="title"/>
<xsl:template match="toc"/>

</xsl:stylesheet>
12 changes: 12 additions & 0 deletions support/docbook-xsl/texinfo/inline.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version='1.0'>

<xsl:template match="literal">@code{<xsl:apply-templates/>}</xsl:template>
<xsl:template match="emphasis">@emph{<xsl:value-of select="."/>}</xsl:template>
<xsl:template match="xref">@ref{<xsl:value-of select="@linkend"/>, ,<xsl:value-of select="key('id',@linkend)[1]/title"/>}</xsl:template>
<xsl:template match="filename">@file{<xsl:value-of select="."/>}</xsl:template>

</xsl:stylesheet>
40 changes: 40 additions & 0 deletions support/docbook-xsl/texinfo/param.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file contains a bunch of params and templates that we don't care about, but the runtime needs. -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:src="http://nwalsh.com/xmlns/litprog/fragment" exclude-result-prefixes="src" version="1.0">

<xsl:template name="is.graphic.format"><xsl:param name="format"/>0</xsl:template>
<xsl:template name="is.graphic.extension"><xsl:param name="format"/>0</xsl:template>
<xsl:template name="write.chunk"/>
<xsl:template name="href.target"/>
<xsl:template name="xref.xreflabel"/>

<xsl:param name="appendix.autolabel" select="1"/>
<xsl:param name="author.othername.in.middle" select="1"/>
<xsl:param name="chapter.autolabel" select="1"/>
<xsl:param name="collect.xref.targets" select="'no'"/>
<xsl:param name="formal.procedures" select="1"/>
<xsl:param name="graphic.default.extension"/>
<xsl:param name="l10n.gentext.default.language" select="'en'"/>
<xsl:param name="l10n.gentext.language" select="''"/>
<xsl:param name="l10n.gentext.use.xref.language" select="0"/>
<xsl:param name="olink.base.uri" select="''"/>
<xsl:param name="part.autolabel" select="1"/>
<xsl:param name="preface.autolabel" select="0"/>
<xsl:param name="preferred.mediaobject.role"/>
<xsl:param name="punct.honorific" select="'.'"/>
<xsl:param name="qanda.defaultlabel">number</xsl:param>
<xsl:param name="qanda.inherit.numeration" select="1"/>
<xsl:param name="qandadiv.autolabel" select="1"/>
<xsl:param name="section.autolabel" select="0"/>
<xsl:param name="section.label.includes.component.label" select="0"/>
<xsl:param name="targets.filename" select="'target.db'"/>
<xsl:param name="tex.math.in.alt" select="''"/>
<xsl:param name="use.role.for.mediaobject" select="1"/>
<xsl:param name="use.svg" select="1"/>
<xsl:param name="xref.with.number.and.title" select="1"/>
<xsl:param name="xref.label-title.separator">: </xsl:param>
<xsl:param name="xref.label-page.separator"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="xref.title-page.separator"><xsl:text> </xsl:text></xsl:param>
<xsl:param name="insert.xref.page.number">no</xsl:param>
</xsl:stylesheet>
Loading