Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mxml
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Armando I. Rivera
mxml
Commits
f1f17030
Commit
f1f17030
authored
Apr 21, 2017
by
Michael Sweet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Markdown support.
parent
b06830dc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
17 deletions
+43
-17
doc/mxml.man
doc/mxml.man
+1
-1
mmd.c
mmd.c
+20
-4
mxmldoc.c
mxmldoc.c
+13
-12
xcode/mxml.xcodeproj/project.pbxproj
xcode/mxml.xcodeproj/project.pbxproj
+9
-0
No files found.
doc/mxml.man
View file @
f1f17030
.TH mxml 3 "Mini-XML API" "04/
1
1/17" "Mini-XML API"
.TH mxml 3 "Mini-XML API" "04/
2
1/17" "Mini-XML API"
.SH NAME
mxml \- Mini-XML API
.SH INCLUDE FILE
...
...
mmd.c
View file @
f1f17030
...
...
@@ -296,6 +296,12 @@ mmdLoad(const char *filename) /* I - File to load */
doc
=
current
=
mmd_add
(
NULL
,
MMD_TYPE_DOCUMENT
,
0
,
NULL
,
NULL
);
if
(
!
doc
)
{
fclose
(
fp
);
return
(
NULL
);
}
/*
* Read lines until end-of-file...
*/
...
...
@@ -718,7 +724,17 @@ mmd_parse_inline(mmd_t *parent, /* I - Parent node */
lineptr
=
mmd_parse_link
(
lineptr
,
&
text
,
&
url
);
if
(
text
)
if
(
text
&&
*
text
==
'`'
)
{
char
*
end
=
text
+
strlen
(
text
)
-
1
;
text
++
;
if
(
end
>
text
&&
*
end
==
'`'
)
*
end
=
'\0'
;
mmd_add
(
parent
,
MMD_TYPE_CODE_TEXT
,
whitespace
,
text
,
url
);
}
else
if
(
text
)
mmd_add
(
parent
,
MMD_TYPE_LINKED_TEXT
,
whitespace
,
text
,
url
);
if
(
!*
lineptr
)
...
...
@@ -816,9 +832,9 @@ mmd_parse_inline(mmd_t *parent, /* I - Parent node */
*/
static
char
*
/* O - End of link text */
mmd_parse_link
(
char
*
lineptr
,
/* I - Pointer into line */
char
**
text
,
/* O - Text */
char
**
url
)
/* O - URL */
mmd_parse_link
(
char
*
lineptr
,
/* I - Pointer into line */
char
**
text
,
/* O - Text */
char
**
url
)
/* O - URL */
{
lineptr
++
;
/* skip "[" */
...
...
mxmldoc.c
View file @
f1f17030
...
...
@@ -173,7 +173,7 @@ static int is_markdown(const char *filename);
static
mxml_type_t
load_cb
(
mxml_node_t
*
node
);
static
const
char
*
markdown_anchor
(
const
char
*
text
);
static
void
markdown_write_block
(
FILE
*
out
,
mmd_t
*
parent
,
int
mode
);
static
void
markdown_write_
inline
(
FILE
*
out
,
mmd_t
*
node
,
int
mode
);
static
void
markdown_write_
leaf
(
FILE
*
out
,
mmd_t
*
node
,
int
mode
);
static
mxml_node_t
*
new_documentation
(
mxml_node_t
**
mxmldoc
);
static
int
remove_directory
(
const
char
*
path
);
static
void
safe_strcpy
(
char
*
dst
,
const
char
*
src
);
...
...
@@ -915,10 +915,7 @@ build_toc(mxml_node_t *doc, /* I - Documentation */
}
add_toc
(
toc
,
type
-
MMD_TYPE_HEADING_1
+
1
,
markdown_anchor
(
title
),
title
);
next
=
NULL
;
}
else
next
=
mmdGetFirstChild
(
node
);
if
((
next
=
mmdGetNextSibling
(
node
))
==
NULL
)
{
...
...
@@ -1518,7 +1515,7 @@ markdown_write_block(FILE *out, /* I - Output file */
if
(
mmdIsBlock
(
node
))
markdown_write_block
(
out
,
node
,
mode
);
else
markdown_write_
inline
(
out
,
node
,
mode
);
markdown_write_
leaf
(
out
,
node
,
mode
);
}
fputs
(
"
\n
"
,
out
);
...
...
@@ -1611,7 +1608,7 @@ markdown_write_block(FILE *out, /* I - Output file */
if
(
mmdIsBlock
(
node
))
markdown_write_block
(
out
,
node
,
mode
);
else
markdown_write_
inline
(
out
,
node
,
mode
);
markdown_write_
leaf
(
out
,
node
,
mode
);
}
if
(
type
>=
MMD_TYPE_HEADING_1
&&
type
<=
MMD_TYPE_HEADING_6
)
...
...
@@ -1623,13 +1620,13 @@ markdown_write_block(FILE *out, /* I - Output file */
/*
* 'markdown_write_
inline()' - Write an inline
markdown node.
* 'markdown_write_
leaf()' - Write an leaf
markdown node.
*/
static
void
markdown_write_
inline
(
FILE
*
out
,
/* I - Output file */
mmd_t
*
node
,
/* I - Node to write */
int
mode
)
/* I - Output mode */
markdown_write_
leaf
(
FILE
*
out
,
/* I - Output file */
mmd_t
*
node
,
/* I - Node to write */
int
mode
)
/* I - Output mode */
{
const
char
*
text
,
/* Text to write */
*
url
;
/* URL to write */
...
...
@@ -1704,7 +1701,7 @@ markdown_write_inline(FILE *out, /* I - Output file */
break
;
case
MMD_TYPE_LINKED_TEXT
:
element
=
"a"
;
element
=
NULL
;
break
;
case
MMD_TYPE_CODE_TEXT
:
...
...
@@ -1751,7 +1748,8 @@ markdown_write_inline(FILE *out, /* I - Output file */
else
fprintf
(
out
,
"<a href=
\"
%s
\"
>"
,
url
);
}
else
if
(
element
)
if
(
element
)
fprintf
(
out
,
"<%s>"
,
element
);
if
(
!
strcmp
(
text
,
"(c)"
))
...
...
@@ -1765,6 +1763,9 @@ markdown_write_inline(FILE *out, /* I - Output file */
if
(
element
)
fprintf
(
out
,
"</%s>"
,
element
);
if
(
url
)
fputs
(
"</a>"
,
out
);
}
}
...
...
xcode/mxml.xcodeproj/project.pbxproj
View file @
f1f17030
...
...
@@ -23,6 +23,7 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
271227FF1EAADBE200167F24
/* mmd.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
271227FD1EAADBE200167F24
/* mmd.c */
;
};
272C00191E8C66C8007EBCAC
/* mxml-attr.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
272C000D1E8C66C8007EBCAC
/* mxml-attr.c */
;
};
272C001A1E8C66C8007EBCAC
/* mxml-entity.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
272C000E1E8C66C8007EBCAC
/* mxml-entity.c */
;
};
272C001B1E8C66C8007EBCAC
/* mxml-file.c in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
272C000F1E8C66C8007EBCAC
/* mxml-file.c */
;
};
...
...
@@ -104,6 +105,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
271227FD1EAADBE200167F24
/* mmd.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
name
=
mmd.c
;
path
=
../mmd.c
;
sourceTree
=
"<group>"
;
};
271227FE1EAADBE200167F24
/* mmd.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
name
=
mmd.h
;
path
=
../mmd.h
;
sourceTree
=
"<group>"
;
};
272C00051E8C6664007EBCAC
/* libmxml.a */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
archive.ar
;
includeInIndex
=
0
;
path
=
libmxml.a
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
272C000D1E8C66C8007EBCAC
/* mxml-attr.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
name
=
"mxml-attr.c"
;
path
=
"../mxml-attr.c"
;
sourceTree
=
"<group>"
;
};
272C000E1E8C66C8007EBCAC
/* mxml-entity.c */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.c
;
name
=
"mxml-entity.c"
;
path
=
"../mxml-entity.c"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -189,6 +192,8 @@
272C00321E8C6ABB007EBCAC
/* tools */
=
{
isa
=
PBXGroup
;
children
=
(
271227FD1EAADBE200167F24
/* mmd.c */
,
271227FE1EAADBE200167F24
/* mmd.h */
,
272C00331E8C6ADE007EBCAC
/* mxmldoc.c */
,
272C00401E8C6B1B007EBCAC
/* testmxml.c */
,
272C00571E943266007EBCAC
/* zipc.c */
,
...
...
@@ -358,6 +363,7 @@
isa
=
PBXSourcesBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
271227FF1EAADBE200167F24
/* mmd.c in Sources */
,
272C00431E8C6B34007EBCAC
/* mxmldoc.c in Sources */
,
272C00591E943266007EBCAC
/* zipc.c in Sources */
,
);
...
...
@@ -601,6 +607,7 @@
272C00301E8C6A94007EBCAC
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
272C003D1E8C6AEB007EBCAC
/* Build configuration list for PBXNativeTarget "testmxml" */
=
{
isa
=
XCConfigurationList
;
...
...
@@ -609,6 +616,7 @@
272C003F1E8C6AEB007EBCAC
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
272C00451E8C6B5A007EBCAC
/* Build configuration list for PBXAggregateTarget "All" */
=
{
isa
=
XCConfigurationList
;
...
...
@@ -617,6 +625,7 @@
272C00471E8C6B5A007EBCAC
/* Release */
,
);
defaultConfigurationIsVisible
=
0
;
defaultConfigurationName
=
Release
;
};
/* End XCConfigurationList section */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment