Skip to content

Commit 543ca91

Browse files
committed
initial version
1 parent 6f4b15d commit 543ca91

File tree

2 files changed

+251
-3
lines changed

2 files changed

+251
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
asciidoc-habrahabr-backend
2-
==========================
1+
# Habrahabr backend for AsciiDoc
32

4-
AsciiDoc backend for generating Habrahabr friendly HTML
3+
An [AsciiDoc](http://asciidoc.org/) plugin for generating
4+
[Habrahabr](http://habrahabr.ru/) friendly HTML markup from AsciiDoc
5+
source.
6+
7+
Для установки плагина скачайте
8+
[habrahabr.zip](https://github.com/downloads/powerman/asciidoc-habrahabr-backend/habrahabr.zip)
9+
и установите его через `asciidoc`:
10+
11+
asciidoc --backend install habrahabr.zip
12+
13+
HTML полученный после конвертации backend-ом 'habrahabr' можно сразу
14+
вставлять в поле для ввода текста новой статьи на сайте, но при этом
15+
необходимо включить чекбокс:
16+
17+
[X] Отключить автоматические переносы строк и создание ссылок

habrahabr.conf

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
#
2+
# habrahabr.conf, v0.1.0
3+
#
4+
# An AsciiDoc backend that renders the AsciiDoc source as HTML in the style of
5+
# Habrahabr (http://habrahabr.ru/).
6+
#
7+
# Latest version available at: https://github.com/powerman/asciidoc-habrahabr-backend
8+
#
9+
# Author: Alex Efros <powerman-asdf@ya.ru>, 2014
10+
# License: Public Domain or MIT
11+
#
12+
13+
[miscellaneous]
14+
outfilesuffix=.html
15+
newline=\n
16+
pagewidth=800
17+
pageunits=px
18+
19+
[attributes]
20+
basebackend=html
21+
basebackend-html=
22+
basebackend-habrahabr=
23+
idprefix=
24+
source-highlighter=
25+
habracut=<habracut>
26+
27+
28+
# Article structure
29+
[header]
30+
31+
# == Header
32+
[sect1]
33+
{newline}<h4>{numbered?{sectnum} }{title}</h4>
34+
<br>
35+
|
36+
# === Header
37+
[sect2]
38+
{newline}<h5>{numbered?{sectnum} }{title}</h5>
39+
<br>
40+
|
41+
# ==== Header
42+
[sect3]
43+
{newline}<h6>{numbered?{sectnum} }{title}</h6>
44+
<br>
45+
|
46+
# ===== Header
47+
[sect4]
48+
template::[sect3]
49+
50+
[footer]
51+
{newline}
52+
______________________<br>
53+
<h6>Текст конвертирован используя <a href="https://github.com/powerman/asciidoc-habrahabr-backend">habrahabr backend</a> для <a href="http://asciidoc.org/">AsciiDoc</a>.</h6>
54+
55+
56+
[macros]
57+
# abbr:CDI[Contexts & Dependency Injection]
58+
# acronym:CDI[Contexts & Dependency Injection]
59+
(?su)(?<!\w)[\\]?(?P<name>abbr|acronym):(?P<target>\S*?)\[(?P<title>.*?)\]=abbr
60+
61+
62+
# link:/index.html[]
63+
# link:/index.html[Title]
64+
[link-inlinemacro]
65+
<a href="{target}">{0={target}}</a>
66+
# http://host/[]
67+
# http://host/[Title]
68+
[http-inlinemacro]
69+
<a href="{name}:{target}">{0={name}:{target}}</a>
70+
# https://host/[]
71+
# https://host/[Title]
72+
[https-inlinemacro]
73+
<a href="{name}:{target}">{0={name}:{target}}</a>
74+
# abbr:CDI[Contexts & Dependency Injection]
75+
# acronym:CDI[Contexts & Dependency Injection]
76+
[abbr-inlinemacro]
77+
<{name} title="{title}">{target}</{name}>
78+
# image:http://host/img.png[]
79+
# image:http://host/img.png[link="http://host/"]
80+
[image-inlinemacro]
81+
<a href="{link}">
82+
<img src="{target}" />
83+
{link#}</a>
84+
# anchor:id[text]
85+
[anchor-inlinemacro]
86+
<anchor>{target}</anchor>
87+
[anchor2-inlinemacro]
88+
# xref:id[text]
89+
[xref-inlinemacro]
90+
<a href="#{target}">{0={target}}</a>
91+
# <<id,text>>
92+
[xref2-inlinemacro]
93+
<a href="#{1}">{2={1}}</a>
94+
# `mono`
95+
[literal-inlinemacro]
96+
<code>{passtext}</code>
97+
# '''
98+
[ruler-blockmacro]
99+
<hr>
100+
101+
# FIXME should be image:: but it isn't
102+
[image-blockmacro]
103+
104+
# _i_ *b* +m+ `s' ``d'' ^sup^ ~sub~
105+
[tags]
106+
emphasis=<i>|</i>
107+
strong=<b>|</b>
108+
monospaced=<code>|</code>
109+
singlequoted={lsquo}|{rsquo}
110+
doublequoted={ldquo}|{rdquo}
111+
unquoted=|
112+
superscript=<sup>|</sup>
113+
subscript=<sub>|</sub>
114+
115+
[replacements]
116+
117+
[replacements2]
118+
# Forced line +
119+
# break.
120+
(?m)^(.*)\s\+$=\1<br>
121+
\n=&nbsp;\n
122+
123+
# [[id]]
124+
[paragraph]
125+
<anchor>{id}</anchor>{newline}
126+
{newline}|<br><br>
127+
128+
# [quote]
129+
[quoteblock]
130+
<blockquote>
131+
|
132+
</blockquote>
133+
134+
# Delimited blocks.
135+
# ----
136+
[listingblock]
137+
<pre>
138+
|
139+
</pre><br>
140+
# ....
141+
[literalblock]
142+
<pre>
143+
|
144+
</pre><br>
145+
#
146+
[verseblock]
147+
<pre>
148+
|
149+
</pre><br>
150+
151+
# * item
152+
[listtags-bulleted]
153+
list=<ul>|</ul><br>
154+
item=<li>|</li>
155+
text=|
156+
# . item
157+
[listtags-numbered]
158+
list=<ol>|</ol><br>
159+
item=<li>|</li>
160+
text=|
161+
162+
# [source,perl]
163+
[source-filter-style]
164+
source-style=template="sourceblock",presubs=(),postsubs=(),posattrs=("style","language","src_numbered")
165+
166+
[sourceblock]
167+
<source lang="{language}">
168+
|
169+
</source>
170+
<br>
171+
172+
[blockdef-listing]
173+
template::[source-filter-style]
174+
175+
[paradef-default]
176+
template::[source-filter-style]
177+
178+
# [options="header"]
179+
# |=================
180+
[table]
181+
<table>
182+
{headrows}
183+
{bodyrows}
184+
{footrows}
185+
</table>
186+
<br>
187+
188+
[tabletags-default]
189+
bodyrow=<tr>|</tr>
190+
headdata=<th>|</th>
191+
bodydata=<td>|</td>
192+
paragraph=|
193+
194+
195+
# Required sections
196+
[tabletags-header]
197+
198+
[tabletags-emphasis]
199+
200+
[tabletags-strong]
201+
202+
[tabletags-monospaced]
203+
204+
[tabletags-verse]
205+
206+
[tabletags-literal]
207+
208+
[tabletags-asciidoc]
209+
210+
[admonitionparagraph]
211+
212+
[partintroblock]
213+
214+
[abstractblock]
215+
216+
[sidebarblock]
217+
218+
[openblock]
219+
220+
[exampleblock]
221+
222+
[admonitionblock]
223+
224+
[listtags-callout]
225+
226+
[listtags-qanda]
227+
228+
[listtags-glossary]
229+
230+
[listtags-bibliography]
231+
232+
[listtags-labeled]
233+
234+
[listtags-horizontal]
235+

0 commit comments

Comments
 (0)