mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 01:54:43 +03:00
removes commonmark and the markdown jet
This commit is contained in:
parent
a8500ce23d
commit
6266388109
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,9 +1,6 @@
|
||||
[submodule "subprojects/softfloat3"]
|
||||
path = subprojects/softfloat3
|
||||
url = https://github.com/urbit/berkeley-softfloat-3.git
|
||||
[submodule "subprojects/commonmark-legacy"]
|
||||
path = subprojects/commonmark-legacy
|
||||
url = https://github.com/urbit/commonmark-legacy.git
|
||||
[submodule "subprojects/ed25519"]
|
||||
path = subprojects/ed25519
|
||||
url = https://github.com/urbit/ed25519.git
|
||||
|
@ -289,7 +289,3 @@
|
||||
u3_noun u3wfu_snub(u3_noun);
|
||||
u3_noun u3wfu_toss(u3_noun);
|
||||
u3_noun u3wfu_wrap(u3_noun);
|
||||
|
||||
/** Tier 7.
|
||||
**/
|
||||
u3_noun u3wg_down(u3_noun);
|
||||
|
@ -327,7 +327,3 @@
|
||||
u3_noun u3wzu_snub(u3_noun);
|
||||
u3_noun u3wzu_toss(u3_noun);
|
||||
u3_noun u3wzu_wrap(u3_noun);
|
||||
|
||||
/** Tier 7.
|
||||
**/
|
||||
u3_noun u3yg_down(u3_noun);
|
||||
|
220
jets/g/down.c
220
jets/g/down.c
@ -1,220 +0,0 @@
|
||||
/* j/g/down.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
#include <cmark.h>
|
||||
#include <node.h>
|
||||
#include <buffer.h>
|
||||
|
||||
static u3_noun node_to_noun(cmark_node * nod);
|
||||
|
||||
static u3_noun list_elems_to_noun(cmark_node * nod)
|
||||
{
|
||||
u3_noun elems = u3_nul;
|
||||
|
||||
cmark_node * child;
|
||||
for ( child = nod->last_child; child; child = child->prev ) {
|
||||
elems = u3nc(node_to_noun(child),elems);
|
||||
}
|
||||
|
||||
return elems;
|
||||
}
|
||||
|
||||
static u3_noun document_to_noun(cmark_node * nod)
|
||||
{
|
||||
return list_elems_to_noun(nod);
|
||||
}
|
||||
|
||||
static u3_noun block_quote_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nc(c3__bloq,u3_nul),list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun list_to_noun(cmark_node * nod)
|
||||
{
|
||||
return
|
||||
u3nc(
|
||||
u3nt(
|
||||
c3__list,
|
||||
__(nod->as.list.tight),
|
||||
(nod->as.list.list_type == CMARK_BULLET_LIST)
|
||||
? nod->as.list.bullet_char /* XX convert? */
|
||||
: u3nc(nod->as.list.start,
|
||||
(nod->as.list.delimiter == CMARK_PERIOD_DELIM)
|
||||
? '.'
|
||||
: ')')),
|
||||
list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun list_item_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nc(c3__item,u3_nul),list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun code_block_to_noun(cmark_node * nod)
|
||||
{
|
||||
u3_atom str = u3i_string((c3_c *) nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_noun res =
|
||||
u3nt(
|
||||
c3__code,
|
||||
nod->as.code.fenced
|
||||
? u3nq(
|
||||
u3_nul,
|
||||
nod->as.code.fence_char,
|
||||
nod->as.code.fence_length,
|
||||
u3i_tape((c3_c *) nod->as.code.info.ptr)
|
||||
)
|
||||
: u3_nul,
|
||||
u3qe_lore(str));
|
||||
u3z(str);
|
||||
return res;
|
||||
}
|
||||
|
||||
static u3_noun html_to_noun(cmark_node * nod)
|
||||
{
|
||||
u3_atom str = u3i_string((c3_c *) nod->string_content.ptr); /* XX u3i_bytes */
|
||||
u3_noun res = u3nc(c3__html, u3qe_lore(str));
|
||||
u3z(str);
|
||||
return res;
|
||||
}
|
||||
|
||||
static u3_noun paragraph_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__para, list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun header_to_noun(cmark_node * nod)
|
||||
{
|
||||
/* see also nod->as.header.setext */
|
||||
return u3nt(c3__head, nod->as.header.level, list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun hrule_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__hrul, u3_nul);
|
||||
}
|
||||
|
||||
static u3_noun reference_def_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__defn, u3_nul);
|
||||
}
|
||||
|
||||
static u3_noun text_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3_blip, u3i_tape((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
static u3_noun softbreak_to_noun(cmark_node * nod) // XXX
|
||||
{
|
||||
return u3nt(0, 10, 0);
|
||||
}
|
||||
|
||||
static u3_noun linebreak_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__line, u3_nul);
|
||||
}
|
||||
|
||||
static u3_noun inline_code_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(c3__code, u3i_tape((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
static u3_noun inline_html_to_noun(cmark_node * nod) // XXX
|
||||
{
|
||||
return u3nc(c3__htmt, u3i_string((c3_c *) cmark_chunk_to_cstr(&nod->as.literal)));
|
||||
}
|
||||
|
||||
static u3_noun emph_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nc(c3__emph, c3n), list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun strong_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nc(c3__emph, c3y), list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun link_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nt(c3__link,
|
||||
nod->as.link.url
|
||||
? u3i_tape((c3_c *) nod->as.link.url)
|
||||
: u3_nul,
|
||||
nod->as.link.title
|
||||
? u3nc(u3_nul, u3i_tape((c3_c *) nod->as.link.title))
|
||||
: u3_nul),
|
||||
list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun image_to_noun(cmark_node * nod)
|
||||
{
|
||||
return u3nc(u3nt(c3__blot,
|
||||
u3i_tape((c3_c *) nod->as.link.url),
|
||||
nod->as.link.title
|
||||
? u3nc(u3_nul, u3i_tape((c3_c *) nod->as.link.title))
|
||||
: u3_nul),
|
||||
list_elems_to_noun(nod));
|
||||
}
|
||||
|
||||
static u3_noun node_to_noun(cmark_node * nod)
|
||||
{
|
||||
if (!nod) {
|
||||
fprintf(stderr, "markdown null node");
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
switch ( nod->type ) {
|
||||
/* Block */
|
||||
case CMARK_NODE_DOCUMENT: return document_to_noun(nod);
|
||||
case CMARK_NODE_BLOCK_QUOTE: return block_quote_to_noun(nod);
|
||||
case CMARK_NODE_LIST: return list_to_noun(nod);
|
||||
case CMARK_NODE_LIST_ITEM: return list_item_to_noun(nod);
|
||||
case CMARK_NODE_CODE_BLOCK: return code_block_to_noun(nod);
|
||||
case CMARK_NODE_HTML: return html_to_noun(nod);
|
||||
case CMARK_NODE_PARAGRAPH: return paragraph_to_noun(nod);
|
||||
case CMARK_NODE_HEADER: return header_to_noun(nod);
|
||||
case CMARK_NODE_HRULE: return hrule_to_noun(nod);
|
||||
case CMARK_NODE_REFERENCE_DEF: return reference_def_to_noun(nod);
|
||||
/* Inline */
|
||||
case CMARK_NODE_TEXT: return text_to_noun(nod);
|
||||
case CMARK_NODE_SOFTBREAK: return softbreak_to_noun(nod);
|
||||
case CMARK_NODE_LINEBREAK: return linebreak_to_noun(nod);
|
||||
case CMARK_NODE_INLINE_CODE: return inline_code_to_noun(nod);
|
||||
case CMARK_NODE_INLINE_HTML: return inline_html_to_noun(nod);
|
||||
case CMARK_NODE_EMPH: return emph_to_noun(nod);
|
||||
case CMARK_NODE_STRONG: return strong_to_noun(nod);
|
||||
case CMARK_NODE_LINK: return link_to_noun(nod);
|
||||
case CMARK_NODE_IMAGE: return image_to_noun(nod);
|
||||
default: fprintf(stderr, "bad markdown parsing");
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
}
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qg_down(u3_atom a)
|
||||
{
|
||||
c3_c *tex = u3r_string(a);
|
||||
|
||||
/* XX better strlen */
|
||||
cmark_node * doc = cmark_parse_document(tex, strlen(tex));
|
||||
|
||||
u3_noun res = document_to_noun(doc);
|
||||
|
||||
cmark_node_free(doc);
|
||||
// free out, tex?
|
||||
return res;
|
||||
}
|
||||
u3_noun
|
||||
u3wg_down(u3_noun cor)
|
||||
{
|
||||
u3_noun a;
|
||||
|
||||
if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
|
||||
(c3n == u3ud(a)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
return u3qg_down(a);
|
||||
}
|
||||
}
|
13
jets/tree.c
13
jets/tree.c
@ -81,15 +81,6 @@ static u3j_core _141_hex_aes_d[] =
|
||||
};
|
||||
static c3_c* _141_hex_aes_ha[] = {0};
|
||||
|
||||
static u3j_harm _141_hex_down_mark_a[] = {{".2", u3wg_down, c3y}, {}};
|
||||
static c3_c* _141_hex_down_mark_ha[] = {0};
|
||||
|
||||
static u3j_core _141_hex_down_d[] =
|
||||
{ { "mark", 7, _141_hex_down_mark_a, 0, _141_hex_down_mark_ha },
|
||||
{}
|
||||
};
|
||||
static c3_c* _141_hex_down_ha[] = {0};
|
||||
|
||||
static u3j_harm _141_hex_lore_a[] = {{".2", u3we_lore}, {}};
|
||||
static c3_c* _141_hex_lore_ha[] = {0};
|
||||
static u3j_harm _141_hex_loss_a[] = {{".2", u3we_loss}, {}};
|
||||
@ -181,9 +172,7 @@ static c3_c* _141_hex_ripe_ha[] = {0};
|
||||
|
||||
|
||||
static u3j_core _141_hex_d[] =
|
||||
{ { "down", 8063, 0, _141_hex_down_d, _141_hex_down_ha },
|
||||
|
||||
{ "lore", 63, _141_hex_lore_a, 0, _141_hex_lore_ha },
|
||||
{ { "lore", 63, _141_hex_lore_a, 0, _141_hex_lore_ha },
|
||||
{ "loss", 63, _141_hex_loss_a, 0, _141_hex_loss_ha },
|
||||
{ "lune", 127, _141_hex_lune_a, 0, _141_hex_lune_ha },
|
||||
|
||||
|
@ -179,10 +179,6 @@ jets_f_ut_src = [
|
||||
'jets/f/ut_wrap.c'
|
||||
]
|
||||
|
||||
jets_g_src = [
|
||||
'jets/g/down.c'
|
||||
]
|
||||
|
||||
jets_src = [
|
||||
'jets/tree.c'
|
||||
]
|
||||
@ -192,7 +188,8 @@ jets_all_src = [
|
||||
jets_c_src, jets_d_src,
|
||||
jets_e_src, jets_e_ed_src,
|
||||
jets_f_src, jets_f_ut_src,
|
||||
jets_g_src, jets_src]
|
||||
jets_src
|
||||
]
|
||||
|
||||
noun_src = [
|
||||
'noun/allocate.c',
|
||||
@ -315,7 +312,6 @@ else
|
||||
endif
|
||||
|
||||
# For these libs we provide fallback bundle
|
||||
cmark_dep = dependency('libcmark', version: '0.12.0', fallback: ['commonmark-legacy', 'cmark_dep'])
|
||||
urbitscrypt_dep = dependency('libscrypt', version: '>=0.1.21', fallback: ['libscrypt', 'libscrypt_dep'])
|
||||
|
||||
ed25519_dep = dependency('ed25519', version: '>=0.1.0', fallback: ['ed25519', 'ed25519_dep'])
|
||||
@ -332,7 +328,6 @@ deps = [openssl_dep,
|
||||
curl_dep,
|
||||
libuv_dep,
|
||||
libh2o_dep,
|
||||
cmark_dep,
|
||||
secp256k1_dep,
|
||||
gmp_dep,
|
||||
sigsegv_dep,
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 8555ef14c4a503f57a0d192bb120159239f4322c
|
Loading…
Reference in New Issue
Block a user