-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
251 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
asciidoc-habrahabr-backend | ||
========================== | ||
# Habrahabr backend for AsciiDoc | ||
|
||
AsciiDoc backend for generating Habrahabr friendly HTML | ||
An [AsciiDoc](http://asciidoc.org/) plugin for generating | ||
[Habrahabr](http://habrahabr.ru/) friendly HTML markup from AsciiDoc | ||
source. | ||
|
||
Для установки плагина скачайте | ||
[habrahabr.zip](https://github.com/downloads/powerman/asciidoc-habrahabr-backend/habrahabr.zip) | ||
и установите его через `asciidoc`: | ||
|
||
asciidoc --backend install habrahabr.zip | ||
|
||
HTML полученный после конвертации backend-ом 'habrahabr' можно сразу | ||
вставлять в поле для ввода текста новой статьи на сайте, но при этом | ||
необходимо включить чекбокс: | ||
|
||
[X] Отключить автоматические переносы строк и создание ссылок |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
# | ||
# habrahabr.conf, v0.1.0 | ||
# | ||
# An AsciiDoc backend that renders the AsciiDoc source as HTML in the style of | ||
# Habrahabr (http://habrahabr.ru/). | ||
# | ||
# Latest version available at: https://github.com/powerman/asciidoc-habrahabr-backend | ||
# | ||
# Author: Alex Efros <powerman-asdf@ya.ru>, 2014 | ||
# License: Public Domain or MIT | ||
# | ||
|
||
[miscellaneous] | ||
outfilesuffix=.html | ||
newline=\n | ||
pagewidth=800 | ||
pageunits=px | ||
|
||
[attributes] | ||
basebackend=html | ||
basebackend-html= | ||
basebackend-habrahabr= | ||
idprefix= | ||
source-highlighter= | ||
habracut=<habracut> | ||
|
||
|
||
# Article structure | ||
[header] | ||
|
||
# == Header | ||
[sect1] | ||
{newline}<h4>{numbered?{sectnum} }{title}</h4> | ||
<br> | ||
| | ||
# === Header | ||
[sect2] | ||
{newline}<h5>{numbered?{sectnum} }{title}</h5> | ||
<br> | ||
| | ||
# ==== Header | ||
[sect3] | ||
{newline}<h6>{numbered?{sectnum} }{title}</h6> | ||
<br> | ||
| | ||
# ===== Header | ||
[sect4] | ||
template::[sect3] | ||
|
||
[footer] | ||
{newline} | ||
______________________<br> | ||
<h6>Текст конвертирован используя <a href="https://github.com/powerman/asciidoc-habrahabr-backend">habrahabr backend</a> для <a href="http://asciidoc.org/">AsciiDoc</a>.</h6> | ||
|
||
|
||
[macros] | ||
# abbr:CDI[Contexts & Dependency Injection] | ||
# acronym:CDI[Contexts & Dependency Injection] | ||
(?su)(?<!\w)[\\]?(?P<name>abbr|acronym):(?P<target>\S*?)\[(?P<title>.*?)\]=abbr | ||
|
||
|
||
# link:/index.html[] | ||
# link:/index.html[Title] | ||
[link-inlinemacro] | ||
<a href="{target}">{0={target}}</a> | ||
# http://host/[] | ||
# http://host/[Title] | ||
[http-inlinemacro] | ||
<a href="{name}:{target}">{0={name}:{target}}</a> | ||
# https://host/[] | ||
# https://host/[Title] | ||
[https-inlinemacro] | ||
<a href="{name}:{target}">{0={name}:{target}}</a> | ||
# abbr:CDI[Contexts & Dependency Injection] | ||
# acronym:CDI[Contexts & Dependency Injection] | ||
[abbr-inlinemacro] | ||
<{name} title="{title}">{target}</{name}> | ||
# image:http://host/img.png[] | ||
# image:http://host/img.png[link="http://host/"] | ||
[image-inlinemacro] | ||
<a href="{link}"> | ||
<img src="{target}" /> | ||
{link#}</a> | ||
# anchor:id[text] | ||
[anchor-inlinemacro] | ||
<anchor>{target}</anchor> | ||
[anchor2-inlinemacro] | ||
# xref:id[text] | ||
[xref-inlinemacro] | ||
<a href="#{target}">{0={target}}</a> | ||
# <<id,text>> | ||
[xref2-inlinemacro] | ||
<a href="#{1}">{2={1}}</a> | ||
# `mono` | ||
[literal-inlinemacro] | ||
<code>{passtext}</code> | ||
# ''' | ||
[ruler-blockmacro] | ||
<hr> | ||
|
||
# FIXME should be image:: but it isn't | ||
[image-blockmacro] | ||
|
||
# _i_ *b* +m+ `s' ``d'' ^sup^ ~sub~ | ||
[tags] | ||
emphasis=<i>|</i> | ||
strong=<b>|</b> | ||
monospaced=<code>|</code> | ||
singlequoted={lsquo}|{rsquo} | ||
doublequoted={ldquo}|{rdquo} | ||
unquoted=| | ||
superscript=<sup>|</sup> | ||
subscript=<sub>|</sub> | ||
|
||
[replacements] | ||
|
||
[replacements2] | ||
# Forced line + | ||
# break. | ||
(?m)^(.*)\s\+$=\1<br> | ||
\n= \n | ||
|
||
# [[id]] | ||
[paragraph] | ||
<anchor>{id}</anchor>{newline} | ||
{newline}|<br><br> | ||
|
||
# [quote] | ||
[quoteblock] | ||
<blockquote> | ||
| | ||
</blockquote> | ||
|
||
# Delimited blocks. | ||
# ---- | ||
[listingblock] | ||
<pre> | ||
| | ||
</pre><br> | ||
# .... | ||
[literalblock] | ||
<pre> | ||
| | ||
</pre><br> | ||
# | ||
[verseblock] | ||
<pre> | ||
| | ||
</pre><br> | ||
|
||
# * item | ||
[listtags-bulleted] | ||
list=<ul>|</ul><br> | ||
item=<li>|</li> | ||
text=| | ||
# . item | ||
[listtags-numbered] | ||
list=<ol>|</ol><br> | ||
item=<li>|</li> | ||
text=| | ||
|
||
# [source,perl] | ||
[source-filter-style] | ||
source-style=template="sourceblock",presubs=(),postsubs=(),posattrs=("style","language","src_numbered") | ||
|
||
[sourceblock] | ||
<source lang="{language}"> | ||
| | ||
</source> | ||
<br> | ||
|
||
[blockdef-listing] | ||
template::[source-filter-style] | ||
|
||
[paradef-default] | ||
template::[source-filter-style] | ||
|
||
# [options="header"] | ||
# |================= | ||
[table] | ||
<table> | ||
{headrows} | ||
{bodyrows} | ||
{footrows} | ||
</table> | ||
<br> | ||
|
||
[tabletags-default] | ||
bodyrow=<tr>|</tr> | ||
headdata=<th>|</th> | ||
bodydata=<td>|</td> | ||
paragraph=| | ||
|
||
|
||
# Required sections | ||
[tabletags-header] | ||
|
||
[tabletags-emphasis] | ||
|
||
[tabletags-strong] | ||
|
||
[tabletags-monospaced] | ||
|
||
[tabletags-verse] | ||
|
||
[tabletags-literal] | ||
|
||
[tabletags-asciidoc] | ||
|
||
[admonitionparagraph] | ||
|
||
[partintroblock] | ||
|
||
[abstractblock] | ||
|
||
[sidebarblock] | ||
|
||
[openblock] | ||
|
||
[exampleblock] | ||
|
||
[admonitionblock] | ||
|
||
[listtags-callout] | ||
|
||
[listtags-qanda] | ||
|
||
[listtags-glossary] | ||
|
||
[listtags-bibliography] | ||
|
||
[listtags-labeled] | ||
|
||
[listtags-horizontal] | ||
|