我有一段我想在我的网站上发布的 Stata 代码。
代码如下所示:
/* creating temporary files*/
forval i = 1964/2012 {
use mar`i', clear
unab allvars: _all
local masterlist "income race age grdatn edlev grdhi hisp spneth recnum state cntyfp cbsa hhtype hhid numper"
local keeplist: list allvars & masterlist
keep `keeplist'
save temporaryMar`i'
}
capture erase stateLevel`yearStart'-`yearEnd'.dta
/* end of temporary files establishment */
/* *** INCOME ADJUSTMENTS ***
** variable name "incomeStandard". making sure that
** income does not contain any coded values. ................ etc
为了将其转换为好看的 HTML 并将其发布在我的网站上,我需要编写以下内容:
<div class="geshifilter">
<pre class="java geshifilter-java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Integers <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">(</span><span style="color: #003399;">String</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> arguments<span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//declaring a variable</span>
<span style="color: #666666; font-style: italic;">/* Using for loop to repeat instruction execution */</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">(</span>c <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> c <span style="color: #339933;"><=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> c<span style="color: #339933;">++</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">(</span>c<span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span>
<span style="color: #009900;">}</span>
<span style="color: #009900;">}</span></pre></div>
这样做太麻烦了。有没有更简单的方法?像语法荧光笔一样?