Skip to content

Commit

Permalink
Fixed nsbp bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleepwalker committed Apr 17, 2015
1 parent 60932b7 commit f68b60f
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ List should be comma separated, somethink like `action1,action2,action3`.
The response comes in the JSON format.

```
{"version":"1.2.1","result":"Your text."}
{"version":"1.2.2","result":"Your text."}
```

#### Error codes
Expand Down
2 changes: 1 addition & 1 deletion lib/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$raw = 'Сервис "Typographie" - подготовка текстов к веб-публикации онлайн (с) 2014-2015';

require_once('typographie.class.php');
$engine = new Typographie('inquot,dashes,specials,paragraphs');
$engine = new Typographie('quotes,dashes,specials,paragraphs');
$result = $engine->process($raw);

echo $result;
Expand Down
6 changes: 3 additions & 3 deletions lib/typographie.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down Expand Up @@ -250,9 +250,9 @@ protected function processDashes(&$text) {
);

if (in_array('nbsp', $this->_actions)) {
$actions['/(\s)--?($|\s)/'] = chr(194).chr(160).'—$2';
$actions['/(\s)--?($|\s)/u'] = chr(194).chr(160).'—$2';
} else {
$actions['/(\s)--?($|\s)/'] = ' —$2';
$actions['/(\s)--?($|\s)/u'] = ' —$2';
}

$this->performActions($text, $actions);
Expand Down
2 changes: 1 addition & 1 deletion tests/general.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down
2 changes: 1 addition & 1 deletion www/api/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down
2 changes: 1 addition & 1 deletion www/api/rules.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.1",
"version": "1.2.2",
"actions": ["quotes", "inquot","dashes","dblspace","angles","specials","mathchars","punctuation","specialspaces","nbsp","hellip","paragraphs","safehtml","entities"],
"errors": {
"1": "BAD_REQUEST",
Expand Down
2 changes: 1 addition & 1 deletion www/engine/converter.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down
2 changes: 1 addition & 1 deletion www/engine/main.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down
6 changes: 3 additions & 3 deletions www/engine/typographie.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down Expand Up @@ -250,9 +250,9 @@ protected function processDashes(&$text) {
);

if (in_array('nbsp', $this->_actions)) {
$actions['/(\s)--?($|\s)/'] = chr(194).chr(160).'—$2';
$actions['/(\s)--?($|\s)/u'] = chr(194).chr(160).'—$2';
} else {
$actions['/(\s)--?($|\s)/'] = ' —$2';
$actions['/(\s)--?($|\s)/u'] = ' —$2';
}

$this->performActions($text, $actions);
Expand Down
2 changes: 1 addition & 1 deletion www/js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Typographie, v1.2.1
* Typographie, v1.2.2
* (c) 2014–2015 Artyom "Sleepwalker" Fedosov <mail@asleepwalker.ru>
* https://github.com/asleepwalker/typographie
*/
Expand Down
2 changes: 1 addition & 1 deletion www/pages/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<article>
<p>Сервис <b>«Typographie»</b> предназначен для тех, кому лень запоминать и постоянно вводить alt-коды для получения такой банальной штуки как специальные символы. Однако, если в личной переписке допустимо, например, вместо тире написать обитающий на клавиатуре символ «дефис», то публикуемый в Сети текст должен быть лишён подобных изъянов. А поскольку делать это вручную <a href="?contacts">вашему покорному слуге</a> было ещё более лень, чем вводить alt-коды, то возникла идея раз и навсегда автоматизировать этот процесс.</p>
<p>Идея проста: вы пишете текст в привычном для себя формате, получаете — готовый к публикации. Для вставки спецсимволов достаточно конструкции из доступных на клавиатуре знаков (например, <nobr>+- превращается в ±</nobr>). При этом можно «типографировать» как обычный текст, так и с HTML-тэгами, или даже конвертировать из одного формата в другой. При желании можно настроить список действий, которые будет совершать <b>«Typographie»</b> над вашим бедным текстом.</p>
<p>Полный список манипуляций, совершаемых скриптом, выглядит следующим образом (<a href="?history">версия 1.2.1</a>):</p>
<p>Полный список манипуляций, совершаемых скриптом, выглядит следующим образом (<a href="?history">версия 1.2.2</a>):</p>
<ul>
<li>Замена программистских кавычек <nobr>("")</nobr> на традиционные кавычки-ёлочки <nobr>(«»)</nobr></li>
<li>Замена вложенных кавычек <nobr>(««»» → «„“»)</nobr> или, в зависимости от настроек, слияние с повторяющими</li>
Expand Down
2 changes: 1 addition & 1 deletion www/pages/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<p>Список действий перечисляется через запятую, вида <i><tt>action1,action2,action3</tt></i>.</p>
<h2>Пример ответа</h2>
<p>Ответ приходит в формате JSON.</p>
<code>{"version":"1.2.1","result":"Your text."}</code>
<code>{"version":"1.2.2","result":"Your text."}</code>
<h2>Коды ошибок</h2>
<p><b><tt>BAD_REQUEST</tt></b> : Не получен обязательный параметр — текст для обработки (<b><i>raw</i></b>).<br>
<b><tt>ACTIONLIST_EMPTY</tt></b> : Не указано ни одно действие. Все действия — не передавайте <b><i>actions</i></b> вообще<br>
Expand Down
1 change: 1 addition & 0 deletions www/pages/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div id="help">
<?php include('help.php') ?>
<article>
<p><b>17.04.2015</b>: Вышла версия <b>1.2.2</b>: Исправлены баги с неразрывным пробелом</p>
<p><b>27.03.2015</b>: Вышла версия <b>1.2.1</b>: Добавлены спецсимволы умножения, деления и суммирования</p>
<p><b>24.03.2015</b>: Вышла версия <b>1.2.0</b>:
<ul>
Expand Down

0 comments on commit f68b60f

Please sign in to comment.