<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://qingliezhiquan.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0</id>
	<title>一批把法律文本的标题转换为 wikitext 层级标题的 Emacs 函数 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://qingliezhiquan.com/mediawiki/index.php?action=history&amp;feed=atom&amp;title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0"/>
	<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;action=history"/>
	<updated>2026-08-11T00:42:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8480&amp;oldid=prev</id>
		<title>Mwroot at 16:35, 30 September 2025</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8480&amp;oldid=prev"/>
		<updated>2025-09-30T16:35:35Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:35, 1 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;一批 Emacs 函数，可以很方便地处理国家法律数据库中等各处下载下来的法律文本，使其标题以 wikitext 形式呈现。具体排版效果可参见本站 [[宪法]] 分享的法条。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;一批 Emacs 函数，可以很方便地处理国家法律数据库中等各处下载下来的法律文本，使其标题以 wikitext 形式呈现。具体排版效果可参见本站 [[宪法]] 分享的法条。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__TOC__&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 从其他地方下载的法律文本通用处理 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 从其他地方下载的法律文本通用处理 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key selfmoney_wiki:diff:1.41:old-8479:rev-8480:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
	<entry>
		<id>https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8479&amp;oldid=prev</id>
		<title>Mwroot at 16:35, 30 September 2025</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8479&amp;oldid=prev"/>
		<updated>2025-09-30T16:35:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:35, 1 October 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l72&quot;&gt;Line 72:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 72:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   (goto-char (point-min))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   (goto-char (point-min))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   (insert &amp;quot;{{#css: \n.tocnumber { display: none; }\n}}\n&amp;quot;))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   (insert &amp;quot;{{#css: \n.tocnumber { display: none; }\n}}\n&amp;quot;))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== 小部头法律编号升一升 ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&quot;elisp&quot; line&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(defun my-replace-equals ()&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  &quot;把所有 === 替换为 == 。&quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  (interactive)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  (save-excursion&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    (goto-char (point-min))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;    (while (search-forward &quot;===&quot; nil t)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;      (replace-match &quot;==&quot;))))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;;; 绑定到 C-c j&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(global-set-key (kbd &quot;C-c j&quot;) &#039;my-replace-equals)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key selfmoney_wiki:diff:1.41:old-8477:rev-8479:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
	<entry>
		<id>https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8477&amp;oldid=prev</id>
		<title>Mwroot: Created page with &quot;一批 Emacs 函数，可以很方便地处理国家法律数据库中等各处下载下来的法律文本，使其标题以 wikitext 形式呈现。具体排版效果可参见本站 宪法 分享的法条。  == 从其他地方下载的法律文本通用处理 == &lt;syntaxhighlight lang=&quot;elisp&quot; line&gt; (defun convert-legal-headers-to-wikitext ()   &quot;将当前 buffer 中的法律文书标题转换为 mediawiki wikitext 层级格式。 对以“第…编”、“第…章...&quot;</title>
		<link rel="alternate" type="text/html" href="https://qingliezhiquan.com/mediawiki/index.php?title=%E4%B8%80%E6%89%B9%E6%8A%8A%E6%B3%95%E5%BE%8B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A0%87%E9%A2%98%E8%BD%AC%E6%8D%A2%E4%B8%BA_wikitext_%E5%B1%82%E7%BA%A7%E6%A0%87%E9%A2%98%E7%9A%84_Emacs_%E5%87%BD%E6%95%B0&amp;diff=8477&amp;oldid=prev"/>
		<updated>2025-09-30T16:34:10Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;一批 Emacs 函数，可以很方便地处理国家法律数据库中等各处下载下来的法律文本，使其标题以 wikitext 形式呈现。具体排版效果可参见本站 &lt;a href=&quot;/blog/%E5%AE%AA%E6%B3%95&quot; title=&quot;宪法&quot;&gt;宪法&lt;/a&gt; 分享的法条。  == 从其他地方下载的法律文本通用处理 == &amp;lt;syntaxhighlight lang=&amp;quot;elisp&amp;quot; line&amp;gt; (defun convert-legal-headers-to-wikitext ()   &amp;quot;将当前 buffer 中的法律文书标题转换为 mediawiki wikitext 层级格式。 对以“第…编”、“第…章...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;一批 Emacs 函数，可以很方便地处理国家法律数据库中等各处下载下来的法律文本，使其标题以 wikitext 形式呈现。具体排版效果可参见本站 [[宪法]] 分享的法条。&lt;br /&gt;
&lt;br /&gt;
== 从其他地方下载的法律文本通用处理 ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;elisp&amp;quot; line&amp;gt;&lt;br /&gt;
(defun convert-legal-headers-to-wikitext ()&lt;br /&gt;
  &amp;quot;将当前 buffer 中的法律文书标题转换为 mediawiki wikitext 层级格式。&lt;br /&gt;
对以“第…编”、“第…章”、“第…节”开头的行进行转换：&lt;br /&gt;
- ‘编’ -&amp;gt; 二级标题 (== 标题 ==)&lt;br /&gt;
- ‘章’ -&amp;gt; 三级标题 (=== 标题 ===)&lt;br /&gt;
- ‘节’ -&amp;gt; 四级标题 (==== 标题 ====)&lt;br /&gt;
处理过程中先统一替换各种混乱空格为单个空格，并在最后将标题中的半角空格转换为全角空格。&amp;quot;&lt;br /&gt;
  (interactive)&lt;br /&gt;
  (save-excursion&lt;br /&gt;
    (goto-char (point-min))&lt;br /&gt;
    (while (not (eobp))&lt;br /&gt;
      (let ((line (buffer-substring-no-properties&lt;br /&gt;
                   (line-beginning-position) (line-end-position))))&lt;br /&gt;
        (cond&lt;br /&gt;
         ;; 处理“编”&lt;br /&gt;
         ((string-match &amp;quot;^\\s-*\\(第[^[:space:]]*编\\)\\s-*\\(.*\\)$&amp;quot; line)&lt;br /&gt;
          (let* ((part1 (match-string 1 line))&lt;br /&gt;
                 (part2 (match-string 2 line))&lt;br /&gt;
                 (title (concat part1 &amp;quot; &amp;quot; part2)))&lt;br /&gt;
            ;; 将全角和连续空格统一替换为一个半角空格，并去除首尾空白&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot;[ 　]+&amp;quot; &amp;quot; &amp;quot; title))&lt;br /&gt;
            (setq title (string-trim title))&lt;br /&gt;
            ;; 替换半角空格为全角空格&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot; &amp;quot; &amp;quot;　&amp;quot; title))&lt;br /&gt;
            (delete-region (line-beginning-position) (line-end-position))&lt;br /&gt;
            (insert (format &amp;quot;== %s ==&amp;quot; title))))&lt;br /&gt;
         ;; 处理“章”&lt;br /&gt;
         ((string-match &amp;quot;^\\s-*\\(第[^[:space:]]*章\\)\\s-*\\(.*\\)$&amp;quot; line)&lt;br /&gt;
          (let* ((part1 (match-string 1 line))&lt;br /&gt;
                 (part2 (match-string 2 line))&lt;br /&gt;
                 (title (concat part1 &amp;quot; &amp;quot; part2)))&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot;[ 　]+&amp;quot; &amp;quot; &amp;quot; title))&lt;br /&gt;
            (setq title (string-trim title))&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot; &amp;quot; &amp;quot;　&amp;quot; title))&lt;br /&gt;
            (delete-region (line-beginning-position) (line-end-position))&lt;br /&gt;
            (insert (format &amp;quot;=== %s ===&amp;quot; title))))&lt;br /&gt;
         ;; 处理“节”&lt;br /&gt;
         ((string-match &amp;quot;^\\s-*\\(第[^[:space:]]*节\\)\\s-*\\(.*\\)$&amp;quot; line)&lt;br /&gt;
          (let* ((part1 (match-string 1 line))&lt;br /&gt;
                 (part2 (match-string 2 line))&lt;br /&gt;
                 (title (concat part1 &amp;quot; &amp;quot; part2)))&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot;[ 　]+&amp;quot; &amp;quot; &amp;quot; title))&lt;br /&gt;
            (setq title (string-trim title))&lt;br /&gt;
            (setq title (replace-regexp-in-string &amp;quot; &amp;quot; &amp;quot;　&amp;quot; title))&lt;br /&gt;
            (delete-region (line-beginning-position) (line-end-position))&lt;br /&gt;
            (insert (format &amp;quot;==== %s ====&amp;quot; title)))))&lt;br /&gt;
        (forward-line 1)))))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 从国家法律法规数据库下载的法律文本专用处理 ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;elisp&amp;quot; line&amp;gt;&lt;br /&gt;
(defun bzk-wikitext-format ()&lt;br /&gt;
  &amp;quot;转换 buffer 为 wikitext 格式，依次执行：&lt;br /&gt;
1. 调用 `convert-legal-headers-to-wikitext` 函数转换标题格式；&lt;br /&gt;
2. 用 `flush-lines` 删除所有完全为空的行（匹配正则 `^$`）；&lt;br /&gt;
3. 用正则将每行行尾替换为额外的换行符，实现段落间增加一个空行；&lt;br /&gt;
4. 在 buffer 顶端插入指定的 CSS 设置，隐藏 .tocnumber。&lt;br /&gt;
&lt;br /&gt;
注意：此函数依赖于已定义的 `convert-legal-headers-to-wikitext` 函数。&amp;quot;&lt;br /&gt;
  (interactive)&lt;br /&gt;
  ;; 1. 调用转换标题的函数&lt;br /&gt;
  (convert-legal-headers-to-wikitext)&lt;br /&gt;
  ;; 2. 删除空白行（使用正则匹配完全为空的行）&lt;br /&gt;
  (flush-lines &amp;quot;^$&amp;quot;)&lt;br /&gt;
  ;; 3. 用正则将行尾替换为换行符（即在每行后再插入一个换行符）&lt;br /&gt;
  (replace-regexp &amp;quot;$&amp;quot; &amp;quot;\n&amp;quot; nil (point-min) (point-max))&lt;br /&gt;
  ;; 4. 在 buffer 顶部插入 CSS 配置内容&lt;br /&gt;
  (goto-char (point-min))&lt;br /&gt;
  (insert &amp;quot;{{#css: \n.tocnumber { display: none; }\n}}\n&amp;quot;))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mwroot</name></author>
	</entry>
</feed>