我有一个Joomla网站,我正在为大学设计。用户应该能够发布与Android编程相关的教程。
http://www.jciadt.com/cms/ca
目前,我正在尝试让用户发布的文章成功地显示代码片段。
我研究过使用这个扩展:
http://alexgorbatchev.com/SyntaxHighlighter/
这看起来是一个可行的选择,但当我包含代码片段时,我在文章中得到了不希望的结果:
见下文:
http://www.jciadt.com/cms/ca/index.php/tutorials/beginner/9-layout-ui-options-part-i
滚动到页面底部的嵌套列表部分,看看我的意思。
有人知道可能出了什么问题吗?
我会采取以下方法来确定发生了什么:
#1比较内容,即原始源代码,以确保其格式正确。如果您将<Button
元素和各种android:
属性的缩进视为问题所在,那么我注意到的一件事是,与前几行相比,在链接的页面中,它们前面的空格数量错误。前面的所有行似乎都使用标准的4 spaces
每个tab
停止,最后一组使用6个空格。
当我把你的代码复制到这个答案中时,我看到了同样的问题,所以我猜它在你的原始代码中。
<LinearLayout ... >
<TextView ... />
<EditText ... />
<LinearLayout
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:padding="5dp"
android:gravity="center"
android:text="@string/setName" />
<Button
android:layout_width="150dp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5dp"
android:gravity="center"
android:text="@string/clearName" />
</LinearLayout>
</LinearLayout>
#2如果内容正确,那么考虑到Joomla扩展目录(JED)上有多少不同的代码高亮扩展,我会尝试几种不同的扩展。如果它们都有相同的问题,那么您可能在代码示例中遗漏了一些内容。