Skip to content
Web service for preparation of Russian texts for the web publication
PHP CSS JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
api
www
.gitignore
LICENSE
README.md
composer.json
package.json
webpack.config.js

README.md

#Typographie

Easy-to-use service for basic typographical preparation of russian texts before web publication.
Also available as an extension for Google Chrome.

Web service

Available as online service at typographie.ru

typographie

Library

You can use Typographie as a standalone library in your PHP project.

Installation

Add package to the composer.json:

composer require asleepwalker/typographie "~1.3.0"

Run Composer:

php composer.phar install

Example

<?php

	use asleepwalker\typographie\Typographie;

	$raw = 'Сервис "Typographie" - подготовка текстов к веб-публикации онлайн (с) 2014-2017';
	$engine = new Typographie('inquot,dashes,specials,paragraphs');
	$result = $engine->process($raw);

	echo $result;
	// > Сервис «Typographie» — подготовка текстов к веб-публикации онлайн © 2014–2017

API

Web service also has API.

For processing text, you need to create HTTP request and send params using POST method to https://api.typographie.ru/

Parameters

raw (required) : The text to be processed.
actions : List of actions, separated by a comma (default — all).
in : Mode of the input, plain (by default) or html.
out : Mode of the output, plain (by default) or html.

Encoding — UTF-8.

Available actions

quotes : Correction of quotes: "" becomes «».
inquot (needs quotes) : Nested quotes: «„“» (otherwise — duplicate quotes stashing).
dashes : If necessary replace hyphens with dashes and minus signs.
angles : Replace asterisks and quotes with degrees, feet, inches.
dblspace : Fix duplicate spaces in the text.
specials : Insert special characters (from the symbol table).
mathchars : Insert mathematical symbols (from the same table).
punctuation : Fix punctuation, such as spaces before commas.
specialspaces : Fix the wrong skip special characters with spaces.
nbsp : Attach short words to following words in the text.
hellip : Replace repeating dot symbols with ellipsis.
paragraphs : Puts paragraphs (<p>) when converting to HTML (with empty string as a delimeter).
safehtml : Do not process the text inside the HTML-tags <code> and <pre>.

List should be comma separated, somethink like action1,action2,action3.

Response example

The response comes in the JSON format.

{"version":"1.3.0","result":"Your text."}

Error codes

BAD_REQUEST : Not received a required parameter — the text for processing (raw).
ACTIONLIST_EMPTY : Not specified actions. To perform all available actions just skip the action parameter.
ACTIONLIST_INVALID : Non-existent actions found in the list.
INPUT_MODE_INVALID : Invalid input text mode.
OUTPUT_MODE_INVALID : Invalid output text mode.

License

The MIT License.

You can’t perform that action at this time.