<div dir="ltr">I have been in the process of rewriting bidi package in dtx (usind ltxdoc with hypdoc package) source and it appears that fontspec has a bug. As soon as I add the fontspec package and run xelatex twice on bidi.dtx, I get this error:<br>
<br>
<style type="text/css">p, li { white-space: pre-wrap; }</style>
<p style="margin: 0px; text-indent: 0px;">! LaTeX Error: Text for \verb command ended by end of line.</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">See the LaTeX manual or LaTeX Companion for explanation.</p>
<p style="margin: 0px; text-indent: 0px;">Type  H &lt;return&gt;  for immediate help.</p>
<p style="margin: 0px; text-indent: 0px;"> ...                                              </p>
<p style="margin: 0px; text-indent: 0px;">                                                  </p>
<p style="margin: 0px; text-indent: 0px;">l.6 ...clindex{5279}{}{58}, \hdclindex{5293}{}{72}</p>
<p style="margin: 0px; text-indent: 0px;">                                                  </p>
<p style="margin: 0px; text-indent: 0px;">? </p><br>bidi.dtx can be found at <a href="https://bitbucket.org/vafa/bidi/downloads">https://bitbucket.org/vafa/bidi/downloads</a><br><br>Has anyone else experienced this?<br clear="all">
<br>-- <br><div dir="ltr"><div dir="rtl">به نام خداوند جان و خرد          کزین برتر اندیشه برنگذرد</div></div><br>
</div>