在asciidoc到html转换行的开头的字面星号

时间:2016-12-05 10:29:58

标签: html escaping literals asciidoc

a * a这样的AsciiDoc源被转换为HTML作为普通文本“a * a”。如果星号是该行中的第一个非空格字符,则它会启动一个列表(这是正常的)。但是,我需要用文字星号开始一个段落。我尝试了以下方法来逃脱它:

  • `*`
    • *(在<code>内呈现)
  • \*
    • \ *(呈现为普通文本,但存在反斜杠)
  • +*+
    • *(在<code>内呈现)
  • pass::[*]
    • 错误:block macro cannot occur here: pass::[*]
  • '*'
    • * (在<em>内呈现 - 最接近我目前所需的内容)

如何在AsciiDoc源代码行的开头指定一个星号,以便它在HTML输出中显示为普通文本?

2 个答案:

答案 0 :(得分:4)

事实证明,对于inline passthroughs,需要使用不同形式的/** Method 1 : to get as an array **/ console.log( // get all span elements have id and within section $('section span[id]') // iterate to generate the array of id .map(function() { // return the id value return this.id; }) // get array from jQuery object .get() ) /** Method 2 : for just iterating **/ $('section span[id]').each(function() { console.log(this.id); })。我还检查了@Mario Lopez建议的解决方案。我总结了以下选项:

  • 直通:
    • <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section class="blog-summary-read col-md-6 col-md-offset-1"> <span id="spnid2">2</span> <span id="spnid3">3</span> <span id="spnid4">4</span> <span id="spnid5">5</span> <span id="spnid6">6</span> </section>
    • pass
    • pass:[*]
  • 打扰列表模式
    • +++*+++(来自FAQ的“官方解决方案”)
    • $$*$$
    • {empty}*
  • HTML转义
    • *text
    • *{sp}

答案 1 :(得分:3)

我知道有两种选择。将其转换为列表的模式特别是星号后跟空格。

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-14-164126d430da> in <module>()
      1 # Plot
----> 2 plt.pcolormesh(X, Y, C)

/home/unix/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in pcolormesh(*args, **kwargs)
   3091         ax.hold(hold)
   3092     try:
-> 3093         ret = ax.pcolormesh(*args, **kwargs)
   3094     finally:
   3095         ax.hold(washold)

/home/unix/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1810                     warnings.warn(msg % (label_namer, func.__name__),
   1811                                   RuntimeWarning, stacklevel=2)
-> 1812             return func(ax, *args, **kwargs)
   1813         pre_doc = inner.__doc__
   1814         if pre_doc is None:

/home/unix/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in pcolormesh(self, *args, **kwargs)
   5393         allmatch = (shading == 'gouraud')
   5394 
-> 5395         X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)
   5396         Ny, Nx = X.shape
   5397 

/home/unix/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in _pcolorargs(funcname, *args, **kw)
   4993         if len(args) == 3:
   4994             X, Y, C = [np.asanyarray(a) for a in args]
-> 4995             numRows, numCols = C.shape
   4996         else:
   4997             raise TypeError(

ValueError: need more than 1 value to unpack

将会像这样呈现:

  • 项目

您可以省略空格或使用空格属性。

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/content_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="tr.k12.evrim.evrimnews.MainActivity"
    tools:showIn="@layout/activity_main">




    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/frameLayout"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Giriş Yap"
                android:onClick="SignIn"
                android:textStyle="bold"
                style="@style/Widget.AppCompat.Button.Colored"/>




            </LinearLayout>


    </FrameLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:layout_below="@id/frameLayout"
        android:orientation="vertical">



    <Button
        android:text="Duyurular"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_below="@+id/frameLayout"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="13dp"
        android:id="@+id/button2"
        android:drawableLeft="@drawable/megaphone" />

    <Button
        android:text="Kadromuz"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_below="@+id/button2"
        android:layout_alignEnd="@+id/button2"
        android:layout_marginTop="13dp"
        android:id="@+id/button3"
        android:drawableLeft="@drawable/puzzle"/>

        <Button
            android:text="Başarılarımız"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:layout_marginTop="12dp"
            android:id="@+id/button5"
            android:drawableLeft="@drawable/trophy"/>


    <Button
        android:text="Ortaklarımız"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_marginTop="12dp"
        android:id="@+id/button4"
        android:drawableLeft="@drawable/deal"/>




    </LinearLayout>

</RelativeLayout>

将分别呈现(分别):

*项
*项目

有关属性和替换的更多信息,请访问: http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#attributes-and-substitutions