asciidoc:有没有一种方法可以创建在libreoffice writer中可见的锚点? [英] asciidoc: is there a way to create an anchor that will be visible in libreoffice writer?

查看:181
本文介绍了asciidoc:有没有一种方法可以创建在libreoffice writer中可见的锚点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tl; dr;

在docbook中创建锚点的正确方法是什么?并且有没有一种方法可以使锚点在作家中可见?

What is the correct way to create an anchor in docbook? and is there a way that will make the anchor visible in writer?

我正在尝试将以前在单个open office文档中的文档拆分为较小的asciidoc文档,这些文档既包含在主要开放办公室文档中,又转换为html&中的一个或两个. pdf. 我主要是在工作.我使用asciidoctor创建html. asciidoctor-pdf创建pdf,结合使用asciidoctor和pandoc创建.odt文件.我还尝试了asciidoc的python实现,但发现该接口不太有用.

I am trying to split up documentation that was previously in single open office documents into smaller asciidoc documents which are both included in the main open office document and also converted to either or both of html & pdf. I have this mostly working. I use asciidoctor to create html. asciidoctor-pdf to create pdf and a combination of asciidoctor and pandoc to create .odt files. I also tried the python implementation of asciidoc but found the interface less useable.

在asciidoc和odt之间来回跳跳显然是不可能的.这是一种融合,其中对主文档进行了文字处理,但包含了可以独立产生的内容(请考虑手册页-实际上是几种用例之一).

Round tripping between asciidoc and odt is obviously not possible. This is sort of a fusion where the master document is word processed but pieces of content that can be produced independently (think man pages - in fact that is one of several use cases) are included.

将asciidoc转换为html:

asciidoc to html:

asciidoctor -b html5 foo.adoc -o foo.html

asciidoc到pdf:

asciidoc to pdf:

asciidoctor-pdf -b pdf foo.adoc -o foo.pdf

从asciidoc到odt

asciidoc to odt

asciidoctor -b docbook foo.adoc -o foo.docbook pandoc --base-header-level=3 -V date:"" -V title:"" -f docbook foo.docbook -o foo.odt

asciidoctor -b docbook foo.adoc -o foo.docbook pandoc --base-header-level=3 -V date:"" -V title:"" -f docbook foo.docbook -o foo.odt

使用pandoc时,我必须使日期和标题无效,并根据需要设置标题级别,以增加复杂性.

With pandoc I have to nullify the date and title and set the header-level as desired for the section to be inserted as an extra complication.

我在开放式办公室内使用insert section将生成的.odt插入主文档中. 请注意,主文档不是主文档,因为在没有自动在h1边界上分割文件的情况下,我找不到创建主文档的方法.

I insert the resulting .odt into the main document using insert section inside open office. Note that the main document is not a master document as I could not find a way of creating a master document without also automatically splitting the file on h1 boundaries.

我需要解决两个主要问题.我想在asciidoc文档中添加标题作为交叉引用,并在字母索引中为其创建条目(实际上第一个标题就足够了).有没有办法做到这一点? asciidoc中的索引标记不会导致在.odt文件中创建条目.

I have two main problems to resolve with this set-up. I would like to add headings in the asciidoc document as cross references and also create entries for them in the alphabetical index (actually the first heading would be suffcient). Is there a way to do this? Index markers in asciidoc do not result in entries in .odt file being created.

我可以使用插入引用/标题"并引用唯一命名的标题来交叉引用插入部分中的内容.但是,每当我使用全部更新"时,这些交叉引用就会失效.它们显示为错误:找不到参考源".

I am able to cross reference content in the inserted section using "insert reference/heading" and referencing the uniquely named header. However, whenever I use "update all" these cross references are invalidated. They are shown as "Error: Reference source not found".

[另外,我还想提供一种自动查找损坏的交叉引用的方法]

我当前正在使用libreoffice-版本:4.3.7.2

I am currently using libreoffice - Version: 4.3.7.2

如果一个版本的表现优于另一个版本或风味(例如apache),我也不会不利.

I am not adverse to switching version or flavours (i.e. apache) if one behaves better than the other.

我不确定答案是否在链的asciidoc或docbook部分.我会接受一个答案,该答案会在插入部分的开头(.adoc/docbook文件的顶部)自动插入一个索引条目.

I'm not sure if the answer is in the asciidoc or docbook parts of the chain. I would accept an answer which inserts a index entry at the start of the inserted section (top of the .adoc/docbook file) automatically.

我也愿意将工具链更改为可以使用的工具. 例如,我尝试了asciidoc-odt后端,并触犯了 https://github.com/dagwieers/asciidoc-odf/issues/47 并不能激发信心. 使用asciidoc-odt可以避免创建中间docbook文件的麻烦.但是,我仍然无法显示锚点.

I am also open to changing my toolchain to something that will work. For example I tried the asciidoc-odt backend and fell foul of https://github.com/dagwieers/asciidoc-odf/issues/47 which does not inspire confidence. Using asciidoc-odt I avoid the need to create an intermediate docbook file. However, I still can't get the anchor to appear.

我可以得到一个宏来创建锚点,但是目前我还没有弄清楚如何从命令行运行宏.

I can get a macro to create an anchor but at present I haven't figured out how to run the macro from the command line.

推荐答案

要在DocBook中创建锚,请在.adoc文件中创建一个内联锚.例如,将其提供给asciidoctor:

To create an anchor in DocBook, make an inline anchor in the .adoc file. For example, giving this to asciidoctor:

[[X1]]Section1
---------------

产生了这个:

<title>
    <anchor xml:id="X1" xreflabel="[X1]"/>
    Section1
</title>

相反,将其放在单独的行上并没有在我的测试中创建anchor标记:

Conversely, putting this on separate lines did not create an anchor tag in my test:

[[X1]]
Section 1

现在有一些坏消息.从《 Pandoc用户指南》 :

Now for some bad news. From the Pandoc User's Guide:

HTML格式(包括HTML幻灯片和EPUB),LaTeX和ConTeXt当前支持内部链接.

Internal links are currently supported for HTML formats (including HTML slide shows and EPUB), LaTeX, and ConTeXt.

我将其解释为当前Pandoc不在Writer中创建内部链接.当我尝试时,该链接被忽略.

I interpret this to mean that currently, Pandoc does not create internal links in Writer. When I tried it, the link was ignored.

注意:看来我没有回答您所有的问题.如果您想询问有关LibreOffice交叉引用和标题的更多信息(问题末尾的大胆段落),也许您可​​以为该部分提出一个单独的问题.

Note: It looks like I did not answer all of your questions. If you want to ask more about LibreOffice cross references and headings (the big bold paragraph towards the end of the question), maybe you could make a separate question just for that part.

这篇关于asciidoc:有没有一种方法可以创建在libreoffice writer中可见的锚点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆