Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@friends-library/adoc-utils

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@friends-library/adoc-utils - npm Package Compare versions

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

13

dist/fragment.d.ts

@@ -1,4 +0,9 @@

import { Asciidoc, Html } from '@friends-library/types';
export declare function adocFragmentToHtml(adoc: Asciidoc): Html;
export declare function backtickQuotesToEntities(asciidoc: Asciidoc): Asciidoc;
export declare function htmlEntitiesToDecimal(adoc: Asciidoc): Asciidoc;
export declare function adocFragmentToHtml(adoc: string): string;
export declare function backtickQuotesToEntities(asciidoc: string): string;
export declare function htmlEntitiesToDecimal(adoc: string): string;
export declare const ADOC_SYNTAX: {
LEFT_DOUBLE_QUOTE: string;
RIGHT_DOUBLE_QUOTE: string;
LEFT_SINGLE_QUOTE: string;
RIGHT_SINGLE_QUOTE: string;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.htmlEntitiesToDecimal = exports.backtickQuotesToEntities = exports.adocFragmentToHtml = void 0;
exports.ADOC_SYNTAX = exports.htmlEntitiesToDecimal = exports.backtickQuotesToEntities = exports.adocFragmentToHtml = void 0;
const types_1 = require("@friends-library/types");

@@ -13,9 +13,10 @@ function adocFragmentToHtml(adoc) {

function backtickQuotesToEntities(asciidoc) {
const adoc = exports.ADOC_SYNTAX;
return asciidoc
.replace(new RegExp(`${types_1.ADOC_SYNTAX.RIGHT_DOUBLE_QUOTE}${types_1.ADOC_SYNTAX.RIGHT_SINGLE_QUOTE}`, `gim`), `${types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE}${types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE}`)
.replace(new RegExp(`${types_1.ADOC_SYNTAX.RIGHT_SINGLE_QUOTE}${types_1.ADOC_SYNTAX.RIGHT_DOUBLE_QUOTE}`, `gim`), `${types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE}${types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE}`)
.replace(new RegExp(types_1.ADOC_SYNTAX.LEFT_DOUBLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.LEFT_DOUBLE_QUOTE)
.replace(new RegExp(types_1.ADOC_SYNTAX.RIGHT_DOUBLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE)
.replace(new RegExp(types_1.ADOC_SYNTAX.LEFT_SINGLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.LEFT_SINGLE_QUOTE)
.replace(new RegExp(types_1.ADOC_SYNTAX.RIGHT_SINGLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE);
.replace(new RegExp(`${adoc.RIGHT_DOUBLE_QUOTE}${adoc.RIGHT_SINGLE_QUOTE}`, `gim`), `${types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE}${types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE}`)
.replace(new RegExp(`${adoc.RIGHT_SINGLE_QUOTE}${adoc.RIGHT_DOUBLE_QUOTE}`, `gim`), `${types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE}${types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE}`)
.replace(new RegExp(adoc.LEFT_DOUBLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.LEFT_DOUBLE_QUOTE)
.replace(new RegExp(adoc.RIGHT_DOUBLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.RIGHT_DOUBLE_QUOTE)
.replace(new RegExp(adoc.LEFT_SINGLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.LEFT_SINGLE_QUOTE)
.replace(new RegExp(adoc.RIGHT_SINGLE_QUOTE, `gim`), types_1.HTML_DEC_ENTITIES.RIGHT_SINGLE_QUOTE);
}

@@ -27,1 +28,7 @@ exports.backtickQuotesToEntities = backtickQuotesToEntities;

exports.htmlEntitiesToDecimal = htmlEntitiesToDecimal;
exports.ADOC_SYNTAX = {
LEFT_DOUBLE_QUOTE: `"\``,
RIGHT_DOUBLE_QUOTE: `\`"`,
LEFT_SINGLE_QUOTE: `'\``,
RIGHT_SINGLE_QUOTE: `\`'`,
};

@@ -1,3 +0,2 @@

import { Asciidoc } from '@friends-library/types';
export declare function quotify(adoc: Asciidoc): Asciidoc;
export declare function quotifyLine(line: Asciidoc): Asciidoc;
export declare function quotify(adoc: string): string;
export declare function quotifyLine(line: string): string;

@@ -1,4 +0,3 @@

import { Asciidoc, Html } from '@friends-library/types';
export declare function htmlShortTitle(title: Asciidoc): Html;
export declare function htmlTitle(title: Asciidoc): Html;
export declare function utf8ShortTitle(title: Asciidoc): string;
export declare function htmlShortTitle(title: string): string;
export declare function htmlTitle(title: string): string;
export declare function utf8ShortTitle(title: string): string;
{
"name": "@friends-library/adoc-utils",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"author": "Jared Henderson <jared@netrivet.com>",

@@ -24,3 +24,3 @@ "description": "asciidoc utils",

"@friends-library/hilkiah": "^1.3.2",
"@friends-library/types": "^7.0.0-beta.2",
"@friends-library/types": "^7.0.0-beta.3",
"lodash.memoize": "^4.1.2",

@@ -30,3 +30,3 @@ "roman-numerals": "^0.3.2"

"devDependencies": {
"@friends-library/dev": "^4.5.0",
"@friends-library/dev": "^4.5.1",
"@types/lodash.memoize": "^4.1.6",

@@ -33,0 +33,0 @@ "@types/roman-numerals": "^0.3.0",

@@ -1,9 +0,4 @@

import {
ADOC_SYNTAX as adoc,
HTML_DEC_ENTITIES as html,
Asciidoc,
Html,
} from '@friends-library/types';
import { HTML_DEC_ENTITIES as html } from '@friends-library/types';
export function adocFragmentToHtml(adoc: Asciidoc): Html {
export function adocFragmentToHtml(adoc: string): string {
return backtickQuotesToEntities(adoc)

@@ -15,3 +10,4 @@ .replace(/--/g, html.MDASH)

export function backtickQuotesToEntities(asciidoc: Asciidoc): Asciidoc {
export function backtickQuotesToEntities(asciidoc: string): string {
const adoc = ADOC_SYNTAX;
return asciidoc

@@ -32,4 +28,11 @@ .replace(

export function htmlEntitiesToDecimal(adoc: Asciidoc): Asciidoc {
export function htmlEntitiesToDecimal(adoc: string): string {
return adoc.replace(/&hellip;/g, html.ELLIPSES);
}
export const ADOC_SYNTAX = {
LEFT_DOUBLE_QUOTE: `"\``,
RIGHT_DOUBLE_QUOTE: `\`"`,
LEFT_SINGLE_QUOTE: `'\``,
RIGHT_SINGLE_QUOTE: `\`'`,
};

@@ -1,8 +0,6 @@

import { Asciidoc } from '@friends-library/types';
export function quotify(adoc: Asciidoc): Asciidoc {
export function quotify(adoc: string): string {
return adoc.split(`\n`).map(quotifyLine).join(`\n`);
}
export function quotifyLine(line: Asciidoc): Asciidoc {
export function quotifyLine(line: string): string {
if (line === `'''`) {

@@ -9,0 +7,0 @@ return line;

import { toRoman } from 'roman-numerals';
import { Asciidoc, Html, HTML_DEC_ENTITIES as HEX } from '@friends-library/types';
import { HTML_DEC_ENTITIES as HEX } from '@friends-library/types';
export function htmlShortTitle(title: Asciidoc): Html {
export function htmlShortTitle(title: string): string {
return htmlTitle(title.replace(/\bvolumen? \b/i, `Vol.${HEX.NON_BREAKING_SPACE}`));
}
export function htmlTitle(title: Asciidoc): Html {
export function htmlTitle(title: string): string {
return title

@@ -20,3 +20,3 @@ .replace(/\b(\d+)\b(.)?/g, (_, digits, next) => {

export function utf8ShortTitle(title: Asciidoc): string {
export function utf8ShortTitle(title: string): string {
return htmlShortTitle(title)

@@ -23,0 +23,0 @@ .replace(new RegExp(HEX.MDASH, `g`), `–`)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc