lounge_lizard 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/Guardfile +33 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +43 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/circle.yml +14 -0
- data/ext/drafter/CHANGELOG.md +278 -0
- data/ext/drafter/Dockerfile +17 -0
- data/ext/drafter/Makefile +62 -0
- data/ext/drafter/appveyor.yml +17 -0
- data/ext/drafter/bin/drafter +0 -0
- data/ext/drafter/build/Makefile +387 -0
- data/ext/drafter/build/drafter.Makefile +6 -0
- data/ext/drafter/build/drafter.target.mk +159 -0
- data/ext/drafter/build/ext/snowcrash/libmarkdownparser.target.mk +141 -0
- data/ext/drafter/build/ext/snowcrash/libsnowcrash.target.mk +154 -0
- data/ext/drafter/build/ext/snowcrash/libsundown.target.mk +149 -0
- data/ext/drafter/build/ext/snowcrash/perf-libsnowcrash.target.mk +147 -0
- data/ext/drafter/build/ext/snowcrash/snowcrash.Makefile +6 -0
- data/ext/drafter/build/gyp-mac-tool +606 -0
- data/ext/drafter/build/libdrafter.target.mk +186 -0
- data/ext/drafter/build/libsos.target.mk +137 -0
- data/ext/drafter/build/out/Release/drafter +0 -0
- data/ext/drafter/build/out/Release/libdrafter.dylib +0 -0
- data/ext/drafter/build/out/Release/libmarkdownparser.a +0 -0
- data/ext/drafter/build/out/Release/libsnowcrash.a +0 -0
- data/ext/drafter/build/out/Release/libsos.a +0 -0
- data/ext/drafter/build/out/Release/libsundown.a +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/config.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/main.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/drafter/src/reporting.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/ConversionContext.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/NamedTypesRegistry.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractAPI.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractDataStructure.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractElementFactory.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/RefractSourceMap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Render.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/Serialize.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeAST.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeResult.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/SerializeSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/drafter_private.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ComparableVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Element.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/ExpandVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/IsExpandableVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/JSONSchemaVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/PrintVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Query.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/Registry.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/RenderJSONVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeCompactVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/SerializeVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/TypeQueryVisitor.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libdrafter/src/refract/VisitorUtils.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libmarkdownparser/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Blueprint.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/BlueprintSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HTTP.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/HeadersParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSON.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONOneOfParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONSourcemap.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONTypeSectionParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/MSONValueMemberParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Section.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/Signature.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/UriTemplateParser.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/posix/RegexMatch.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsnowcrash/ext/snowcrash/src/snowcrash.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsos/ext/sos/src/sos.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o +0 -0
- data/ext/drafter/build/out/Release/obj.target/libsundown/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o +0 -0
- data/ext/drafter/circle.yml +32 -0
- data/ext/drafter/config.gypi +10 -0
- data/ext/drafter/config.mk +5 -0
- data/ext/drafter/configure +224 -0
- data/ext/drafter/drafter.gyp +189 -0
- data/ext/drafter/drafter.xcworkspace/contents.xcworkspacedata +13 -0
- data/ext/drafter/ext/snowcrash/Makefile +58 -0
- data/ext/drafter/ext/snowcrash/appveyor.yml +7 -0
- data/ext/drafter/ext/snowcrash/common.gypi +165 -0
- data/ext/drafter/ext/snowcrash/configure +197 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/Makefile +90 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/CONTRIBUTING.md +10 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile +84 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/Makefile.win +33 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/smartypants.c +72 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/examples/sundown.c +80 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini.h +37 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.c +108 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.c +84 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.c +647 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.h +77 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.c +389 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html_block_names.txt +25 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.c +297 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.h +51 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.c +225 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.h +96 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/html_blocks.h +206 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.c +2726 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.h +147 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.c +204 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.h +58 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.c +81 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.h +29 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/sundown.def +20 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/markdown/markdown.vcproj +188 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/msvc.sln +38 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/msvc/sundown/sundown.vcproj +206 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.cc +160 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.h +90 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.cc +152 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.h +103 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.cc +388 -0
- data/ext/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.h +106 -0
- data/ext/drafter/ext/snowcrash/snowcrash.gyp +196 -0
- data/ext/drafter/ext/snowcrash/src/ActionParser.h +560 -0
- data/ext/drafter/ext/snowcrash/src/AssetParser.h +123 -0
- data/ext/drafter/ext/snowcrash/src/AttributesParser.h +123 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.cc +90 -0
- data/ext/drafter/ext/snowcrash/src/Blueprint.h +489 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintParser.h +845 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.cc +81 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintSourcemap.h +345 -0
- data/ext/drafter/ext/snowcrash/src/BlueprintUtility.h +111 -0
- data/ext/drafter/ext/snowcrash/src/CodeBlockUtility.h +276 -0
- data/ext/drafter/ext/snowcrash/src/DataStructureGroupParser.h +157 -0
- data/ext/drafter/ext/snowcrash/src/HTTP.cc +49 -0
- data/ext/drafter/ext/snowcrash/src/HTTP.h +108 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.cc +117 -0
- data/ext/drafter/ext/snowcrash/src/HeadersParser.h +377 -0
- data/ext/drafter/ext/snowcrash/src/MSON.cc +272 -0
- data/ext/drafter/ext/snowcrash/src/MSON.h +405 -0
- data/ext/drafter/ext/snowcrash/src/MSONMixinParser.h +103 -0
- data/ext/drafter/ext/snowcrash/src/MSONNamedTypeParser.h +135 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.cc +132 -0
- data/ext/drafter/ext/snowcrash/src/MSONOneOfParser.h +80 -0
- data/ext/drafter/ext/snowcrash/src/MSONParameterParser.h +166 -0
- data/ext/drafter/ext/snowcrash/src/MSONPropertyMemberParser.h +106 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.cc +141 -0
- data/ext/drafter/ext/snowcrash/src/MSONSourcemap.h +181 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.cc +209 -0
- data/ext/drafter/ext/snowcrash/src/MSONTypeSectionParser.h +213 -0
- data/ext/drafter/ext/snowcrash/src/MSONUtility.h +506 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.cc +214 -0
- data/ext/drafter/ext/snowcrash/src/MSONValueMemberParser.h +390 -0
- data/ext/drafter/ext/snowcrash/src/ModelTable.h +87 -0
- data/ext/drafter/ext/snowcrash/src/ParameterParser.h +516 -0
- data/ext/drafter/ext/snowcrash/src/ParametersParser.h +222 -0
- data/ext/drafter/ext/snowcrash/src/PayloadParser.h +733 -0
- data/ext/drafter/ext/snowcrash/src/Platform.h +33 -0
- data/ext/drafter/ext/snowcrash/src/RegexMatch.h +32 -0
- data/ext/drafter/ext/snowcrash/src/RelationParser.h +87 -0
- data/ext/drafter/ext/snowcrash/src/ResourceGroupParser.h +297 -0
- data/ext/drafter/ext/snowcrash/src/ResourceParser.h +536 -0
- data/ext/drafter/ext/snowcrash/src/Section.cc +48 -0
- data/ext/drafter/ext/snowcrash/src/Section.h +60 -0
- data/ext/drafter/ext/snowcrash/src/SectionParser.h +246 -0
- data/ext/drafter/ext/snowcrash/src/SectionParserData.h +109 -0
- data/ext/drafter/ext/snowcrash/src/SectionProcessor.h +299 -0
- data/ext/drafter/ext/snowcrash/src/Signature.cc +75 -0
- data/ext/drafter/ext/snowcrash/src/Signature.h +103 -0
- data/ext/drafter/ext/snowcrash/src/SignatureSectionProcessor.h +442 -0
- data/ext/drafter/ext/snowcrash/src/SourceAnnotation.h +166 -0
- data/ext/drafter/ext/snowcrash/src/StringUtility.h +323 -0
- data/ext/drafter/ext/snowcrash/src/UriTemplateParser.cc +195 -0
- data/ext/drafter/ext/snowcrash/src/UriTemplateParser.h +240 -0
- data/ext/drafter/ext/snowcrash/src/ValuesParser.h +111 -0
- data/ext/drafter/ext/snowcrash/src/posix/RegexMatch.cc +99 -0
- data/ext/drafter/ext/snowcrash/src/snowcrash.cc +90 -0
- data/ext/drafter/ext/snowcrash/src/snowcrash.h +44 -0
- data/ext/drafter/ext/snowcrash/src/win/RegexMatch.cc +78 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/AUTHORS +12 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/DEPS +23 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/OWNERS +1 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/PRESUBMIT.py +137 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/buildbot_run.py +136 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/OWNERS +6 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/buildbot/commit_queue/cq_config.json +15 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/codereview.settings +10 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/data/win/large-pdb-shim.cc +12 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp +8 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp.bat +5 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/gyp_main.py +16 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSNew.py +340 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSProject.py +208 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSSettings.py +1096 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSToolFile.py +58 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUserFile.py +147 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.py +270 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSUtil.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.py +445 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/MSVSVersion.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.py +548 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/__init__.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.py +608 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/common.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/easy_xml.py +157 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/flock_tool.py +54 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/__init__.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/analyzer.py +741 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/android.py +1069 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/cmake.py +1248 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/dump_dependency_json.py +99 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/eclipse.py +425 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypd.py +94 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/gypsh.py +56 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.py +2218 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/make.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/msvs.py +3467 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.py +2427 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/ninja.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.py +1300 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/generator/xcode.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.py +2899 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/input.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/mac_tool.py +605 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.py +1093 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/msvs_emulation.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.py +160 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ninja_syntax.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/ordered_dict.py +289 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.py +46 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/simple_copy.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/win_tool.py +314 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.py +1664 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_emulation.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.py +276 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcode_ninja.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.py +2927 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xcodeproj_file.pyc +0 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylib/gyp/xml_fix.py +69 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/pylintrc +307 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples +81 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/samples/samples.bat +5 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/setup.py +19 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/emacs/gyp.el +275 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/graphviz.py +100 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_gyp.py +155 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_sln.py +169 -0
- data/ext/drafter/ext/snowcrash/tools/gyp/tools/pretty_vcproj.py +329 -0
- data/ext/drafter/ext/snowcrash/vcbuild.bat +139 -0
- data/ext/drafter/ext/sos/Makefile +62 -0
- data/ext/drafter/ext/sos/src/sos.cc +235 -0
- data/ext/drafter/ext/sos/src/sos.h +188 -0
- data/ext/drafter/ext/sos/src/sosJSON.h +121 -0
- data/ext/drafter/ext/sos/src/sosYAML.h +105 -0
- data/ext/drafter/src/ConversionContext.cc +39 -0
- data/ext/drafter/src/ConversionContext.h +34 -0
- data/ext/drafter/src/NamedTypesRegistry.cc +405 -0
- data/ext/drafter/src/NamedTypesRegistry.h +28 -0
- data/ext/drafter/src/NodeInfo.h +143 -0
- data/ext/drafter/src/RefractAPI.cc +579 -0
- data/ext/drafter/src/RefractAPI.h +28 -0
- data/ext/drafter/src/RefractDataStructure.cc +1199 -0
- data/ext/drafter/src/RefractDataStructure.h +26 -0
- data/ext/drafter/src/RefractElementFactory.cc +107 -0
- data/ext/drafter/src/RefractElementFactory.h +67 -0
- data/ext/drafter/src/RefractSourceMap.cc +29 -0
- data/ext/drafter/src/RefractSourceMap.h +57 -0
- data/ext/drafter/src/Render.cc +157 -0
- data/ext/drafter/src/Render.h +40 -0
- data/ext/drafter/src/Serialize.cc +160 -0
- data/ext/drafter/src/Serialize.h +289 -0
- data/ext/drafter/src/SerializeAST.cc +507 -0
- data/ext/drafter/src/SerializeAST.h +29 -0
- data/ext/drafter/src/SerializeResult.cc +170 -0
- data/ext/drafter/src/SerializeResult.h +34 -0
- data/ext/drafter/src/SerializeSourcemap.cc +331 -0
- data/ext/drafter/src/SerializeSourcemap.h +21 -0
- data/ext/drafter/src/Version.h +40 -0
- data/ext/drafter/src/config.cc +91 -0
- data/ext/drafter/src/config.h +38 -0
- data/ext/drafter/src/drafter.cc +137 -0
- data/ext/drafter/src/drafter.h +102 -0
- data/ext/drafter/src/drafter_private.cc +85 -0
- data/ext/drafter/src/drafter_private.h +34 -0
- data/ext/drafter/src/main.cc +137 -0
- data/ext/drafter/src/refract/AppendDecorator.h +58 -0
- data/ext/drafter/src/refract/Build.h +67 -0
- data/ext/drafter/src/refract/ComparableVisitor.cc +43 -0
- data/ext/drafter/src/refract/ComparableVisitor.h +62 -0
- data/ext/drafter/src/refract/Element.cc +409 -0
- data/ext/drafter/src/refract/Element.h +656 -0
- data/ext/drafter/src/refract/ElementFwd.h +37 -0
- data/ext/drafter/src/refract/ElementInserter.h +59 -0
- data/ext/drafter/src/refract/Exception.h +31 -0
- data/ext/drafter/src/refract/ExpandVisitor.cc +359 -0
- data/ext/drafter/src/refract/ExpandVisitor.h +58 -0
- data/ext/drafter/src/refract/FilterVisitor.h +52 -0
- data/ext/drafter/src/refract/IsExpandableVisitor.cc +140 -0
- data/ext/drafter/src/refract/IsExpandableVisitor.h +31 -0
- data/ext/drafter/src/refract/Iterate.h +160 -0
- data/ext/drafter/src/refract/JSONSchemaVisitor.cc +675 -0
- data/ext/drafter/src/refract/JSONSchemaVisitor.h +73 -0
- data/ext/drafter/src/refract/PrintVisitor.cc +164 -0
- data/ext/drafter/src/refract/PrintVisitor.h +50 -0
- data/ext/drafter/src/refract/Query.cc +13 -0
- data/ext/drafter/src/refract/Query.h +38 -0
- data/ext/drafter/src/refract/Registry.cc +114 -0
- data/ext/drafter/src/refract/Registry.h +43 -0
- data/ext/drafter/src/refract/RenderJSONVisitor.cc +255 -0
- data/ext/drafter/src/refract/RenderJSONVisitor.h +51 -0
- data/ext/drafter/src/refract/SerializeCompactVisitor.cc +167 -0
- data/ext/drafter/src/refract/SerializeCompactVisitor.h +56 -0
- data/ext/drafter/src/refract/SerializeVisitor.cc +214 -0
- data/ext/drafter/src/refract/SerializeVisitor.h +55 -0
- data/ext/drafter/src/refract/TypeQueryVisitor.cc +46 -0
- data/ext/drafter/src/refract/TypeQueryVisitor.h +110 -0
- data/ext/drafter/src/refract/Visitor.h +126 -0
- data/ext/drafter/src/refract/VisitorUtils.cc +63 -0
- data/ext/drafter/src/refract/VisitorUtils.h +231 -0
- data/ext/drafter/src/reporting.cc +263 -0
- data/ext/drafter/src/reporting.h +39 -0
- data/ext/drafter/src/stream.h +148 -0
- data/ext/drafter/tools/homebrew/drafter.rb +18 -0
- data/ext/drafter/tools/make-tarball.sh +39 -0
- data/ext/drafter/tools/refract-filter.py +96 -0
- data/ext/drafter/tools/release.sh +17 -0
- data/ext/drafter/vcbuild.bat +203 -0
- data/lib/lounge_lizard/binding.rb +29 -0
- data/lib/lounge_lizard/version.rb +3 -0
- data/lib/lounge_lizard.rb +18 -0
- data/lounge_lizard.gemspec +37 -0
- metadata +547 -0
@@ -0,0 +1,647 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009, Natacha Porté
|
3
|
+
* Copyright (c) 2011, Vicent Marti
|
4
|
+
*
|
5
|
+
* Permission to use, copy, modify, and distribute this software for any
|
6
|
+
* purpose with or without fee is hereby granted, provided that the above
|
7
|
+
* copyright notice and this permission notice appear in all copies.
|
8
|
+
*
|
9
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
10
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
11
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
12
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
13
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
14
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
15
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#include "markdown.h"
|
19
|
+
#include "html.h"
|
20
|
+
|
21
|
+
#include <string.h>
|
22
|
+
#include <stdlib.h>
|
23
|
+
#include <stdio.h>
|
24
|
+
#include <ctype.h>
|
25
|
+
|
26
|
+
#include "houdini.h"
|
27
|
+
|
28
|
+
#define USE_XHTML(opt) (opt->flags & HTML_USE_XHTML)
|
29
|
+
|
30
|
+
int
|
31
|
+
sdhtml_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname)
|
32
|
+
{
|
33
|
+
size_t i;
|
34
|
+
int closed = 0;
|
35
|
+
|
36
|
+
if (tag_size < 3 || tag_data[0] != '<')
|
37
|
+
return HTML_TAG_NONE;
|
38
|
+
|
39
|
+
i = 1;
|
40
|
+
|
41
|
+
if (tag_data[i] == '/') {
|
42
|
+
closed = 1;
|
43
|
+
i++;
|
44
|
+
}
|
45
|
+
|
46
|
+
for (; i < tag_size; ++i, ++tagname) {
|
47
|
+
if (*tagname == 0)
|
48
|
+
break;
|
49
|
+
|
50
|
+
if (tag_data[i] != *tagname)
|
51
|
+
return HTML_TAG_NONE;
|
52
|
+
}
|
53
|
+
|
54
|
+
if (i == tag_size)
|
55
|
+
return HTML_TAG_NONE;
|
56
|
+
|
57
|
+
if (isspace(tag_data[i]) || tag_data[i] == '>')
|
58
|
+
return closed ? HTML_TAG_CLOSE : HTML_TAG_OPEN;
|
59
|
+
|
60
|
+
return HTML_TAG_NONE;
|
61
|
+
}
|
62
|
+
|
63
|
+
static inline void escape_html(struct buf *ob, const uint8_t *source, size_t length)
|
64
|
+
{
|
65
|
+
houdini_escape_html0(ob, source, length, 0);
|
66
|
+
}
|
67
|
+
|
68
|
+
static inline void escape_href(struct buf *ob, const uint8_t *source, size_t length)
|
69
|
+
{
|
70
|
+
houdini_escape_href(ob, source, length);
|
71
|
+
}
|
72
|
+
|
73
|
+
/********************
|
74
|
+
* GENERIC RENDERER *
|
75
|
+
********************/
|
76
|
+
static int
|
77
|
+
rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque)
|
78
|
+
{
|
79
|
+
struct html_renderopt *options = opaque;
|
80
|
+
|
81
|
+
if (!link || !link->size)
|
82
|
+
return 0;
|
83
|
+
|
84
|
+
if ((options->flags & HTML_SAFELINK) != 0 &&
|
85
|
+
!sd_autolink_issafe(link->data, link->size) &&
|
86
|
+
type != MKDA_EMAIL)
|
87
|
+
return 0;
|
88
|
+
|
89
|
+
BUFPUTSL(ob, "<a href=\"");
|
90
|
+
if (type == MKDA_EMAIL)
|
91
|
+
BUFPUTSL(ob, "mailto:");
|
92
|
+
escape_href(ob, link->data, link->size);
|
93
|
+
|
94
|
+
if (options->link_attributes) {
|
95
|
+
bufputc(ob, '\"');
|
96
|
+
options->link_attributes(ob, link, opaque);
|
97
|
+
bufputc(ob, '>');
|
98
|
+
} else {
|
99
|
+
BUFPUTSL(ob, "\">");
|
100
|
+
}
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Pretty printing: if we get an email address as
|
104
|
+
* an actual URI, e.g. `mailto:foo@bar.com`, we don't
|
105
|
+
* want to print the `mailto:` prefix
|
106
|
+
*/
|
107
|
+
if (bufprefix(link, "mailto:") == 0) {
|
108
|
+
escape_html(ob, link->data + 7, link->size - 7);
|
109
|
+
} else {
|
110
|
+
escape_html(ob, link->data, link->size);
|
111
|
+
}
|
112
|
+
|
113
|
+
BUFPUTSL(ob, "</a>");
|
114
|
+
|
115
|
+
return 1;
|
116
|
+
}
|
117
|
+
|
118
|
+
static void
|
119
|
+
rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, void *opaque)
|
120
|
+
{
|
121
|
+
if (ob->size) bufputc(ob, '\n');
|
122
|
+
|
123
|
+
if (lang && lang->size) {
|
124
|
+
size_t i, cls;
|
125
|
+
BUFPUTSL(ob, "<pre><code class=\"");
|
126
|
+
|
127
|
+
for (i = 0, cls = 0; i < lang->size; ++i, ++cls) {
|
128
|
+
while (i < lang->size && isspace(lang->data[i]))
|
129
|
+
i++;
|
130
|
+
|
131
|
+
if (i < lang->size) {
|
132
|
+
size_t org = i;
|
133
|
+
while (i < lang->size && !isspace(lang->data[i]))
|
134
|
+
i++;
|
135
|
+
|
136
|
+
if (lang->data[org] == '.')
|
137
|
+
org++;
|
138
|
+
|
139
|
+
if (cls) bufputc(ob, ' ');
|
140
|
+
escape_html(ob, lang->data + org, i - org);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
BUFPUTSL(ob, "\">");
|
145
|
+
} else
|
146
|
+
BUFPUTSL(ob, "<pre><code>");
|
147
|
+
|
148
|
+
if (text)
|
149
|
+
escape_html(ob, text->data, text->size);
|
150
|
+
|
151
|
+
BUFPUTSL(ob, "</code></pre>\n");
|
152
|
+
}
|
153
|
+
|
154
|
+
static void
|
155
|
+
rndr_blockquote(struct buf *ob, const struct buf *text, void *opaque)
|
156
|
+
{
|
157
|
+
if (ob->size) bufputc(ob, '\n');
|
158
|
+
BUFPUTSL(ob, "<blockquote>\n");
|
159
|
+
if (text) bufput(ob, text->data, text->size);
|
160
|
+
BUFPUTSL(ob, "</blockquote>\n");
|
161
|
+
}
|
162
|
+
|
163
|
+
static int
|
164
|
+
rndr_codespan(struct buf *ob, const struct buf *text, void *opaque)
|
165
|
+
{
|
166
|
+
BUFPUTSL(ob, "<code>");
|
167
|
+
if (text) escape_html(ob, text->data, text->size);
|
168
|
+
BUFPUTSL(ob, "</code>");
|
169
|
+
return 1;
|
170
|
+
}
|
171
|
+
|
172
|
+
static int
|
173
|
+
rndr_strikethrough(struct buf *ob, const struct buf *text, void *opaque)
|
174
|
+
{
|
175
|
+
if (!text || !text->size)
|
176
|
+
return 0;
|
177
|
+
|
178
|
+
BUFPUTSL(ob, "<del>");
|
179
|
+
bufput(ob, text->data, text->size);
|
180
|
+
BUFPUTSL(ob, "</del>");
|
181
|
+
return 1;
|
182
|
+
}
|
183
|
+
|
184
|
+
static int
|
185
|
+
rndr_double_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
186
|
+
{
|
187
|
+
if (!text || !text->size)
|
188
|
+
return 0;
|
189
|
+
|
190
|
+
BUFPUTSL(ob, "<strong>");
|
191
|
+
bufput(ob, text->data, text->size);
|
192
|
+
BUFPUTSL(ob, "</strong>");
|
193
|
+
|
194
|
+
return 1;
|
195
|
+
}
|
196
|
+
|
197
|
+
static int
|
198
|
+
rndr_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
199
|
+
{
|
200
|
+
if (!text || !text->size) return 0;
|
201
|
+
BUFPUTSL(ob, "<em>");
|
202
|
+
if (text) bufput(ob, text->data, text->size);
|
203
|
+
BUFPUTSL(ob, "</em>");
|
204
|
+
return 1;
|
205
|
+
}
|
206
|
+
|
207
|
+
static int
|
208
|
+
rndr_linebreak(struct buf *ob, void *opaque)
|
209
|
+
{
|
210
|
+
struct html_renderopt *options = opaque;
|
211
|
+
bufputs(ob, USE_XHTML(options) ? "<br/>\n" : "<br>\n");
|
212
|
+
return 1;
|
213
|
+
}
|
214
|
+
|
215
|
+
static void
|
216
|
+
rndr_header(struct buf *ob, const struct buf *text, int level, void *opaque)
|
217
|
+
{
|
218
|
+
struct html_renderopt *options = opaque;
|
219
|
+
|
220
|
+
if (ob->size)
|
221
|
+
bufputc(ob, '\n');
|
222
|
+
|
223
|
+
if (options->flags & HTML_TOC)
|
224
|
+
bufprintf(ob, "<h%d id=\"toc_%d\">", level, options->toc_data.header_count++);
|
225
|
+
else
|
226
|
+
bufprintf(ob, "<h%d>", level);
|
227
|
+
|
228
|
+
if (text) bufput(ob, text->data, text->size);
|
229
|
+
bufprintf(ob, "</h%d>\n", level);
|
230
|
+
}
|
231
|
+
|
232
|
+
static int
|
233
|
+
rndr_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque)
|
234
|
+
{
|
235
|
+
struct html_renderopt *options = opaque;
|
236
|
+
|
237
|
+
if (link != NULL && (options->flags & HTML_SAFELINK) != 0 && !sd_autolink_issafe(link->data, link->size))
|
238
|
+
return 0;
|
239
|
+
|
240
|
+
BUFPUTSL(ob, "<a href=\"");
|
241
|
+
|
242
|
+
if (link && link->size)
|
243
|
+
escape_href(ob, link->data, link->size);
|
244
|
+
|
245
|
+
if (title && title->size) {
|
246
|
+
BUFPUTSL(ob, "\" title=\"");
|
247
|
+
escape_html(ob, title->data, title->size);
|
248
|
+
}
|
249
|
+
|
250
|
+
if (options->link_attributes) {
|
251
|
+
bufputc(ob, '\"');
|
252
|
+
options->link_attributes(ob, link, opaque);
|
253
|
+
bufputc(ob, '>');
|
254
|
+
} else {
|
255
|
+
BUFPUTSL(ob, "\">");
|
256
|
+
}
|
257
|
+
|
258
|
+
if (content && content->size) bufput(ob, content->data, content->size);
|
259
|
+
BUFPUTSL(ob, "</a>");
|
260
|
+
return 1;
|
261
|
+
}
|
262
|
+
|
263
|
+
static void
|
264
|
+
rndr_list(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
265
|
+
{
|
266
|
+
if (ob->size) bufputc(ob, '\n');
|
267
|
+
bufput(ob, flags & MKD_LIST_ORDERED ? "<ol>\n" : "<ul>\n", 5);
|
268
|
+
if (text) bufput(ob, text->data, text->size);
|
269
|
+
bufput(ob, flags & MKD_LIST_ORDERED ? "</ol>\n" : "</ul>\n", 6);
|
270
|
+
}
|
271
|
+
|
272
|
+
static void
|
273
|
+
rndr_listitem(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
274
|
+
{
|
275
|
+
BUFPUTSL(ob, "<li>");
|
276
|
+
if (text) {
|
277
|
+
size_t size = text->size;
|
278
|
+
while (size && text->data[size - 1] == '\n')
|
279
|
+
size--;
|
280
|
+
|
281
|
+
bufput(ob, text->data, size);
|
282
|
+
}
|
283
|
+
BUFPUTSL(ob, "</li>\n");
|
284
|
+
}
|
285
|
+
|
286
|
+
static void
|
287
|
+
rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque)
|
288
|
+
{
|
289
|
+
struct html_renderopt *options = opaque;
|
290
|
+
size_t i = 0;
|
291
|
+
|
292
|
+
if (ob->size) bufputc(ob, '\n');
|
293
|
+
|
294
|
+
if (!text || !text->size)
|
295
|
+
return;
|
296
|
+
|
297
|
+
while (i < text->size && isspace(text->data[i])) i++;
|
298
|
+
|
299
|
+
if (i == text->size)
|
300
|
+
return;
|
301
|
+
|
302
|
+
BUFPUTSL(ob, "<p>");
|
303
|
+
if (options->flags & HTML_HARD_WRAP) {
|
304
|
+
size_t org;
|
305
|
+
while (i < text->size) {
|
306
|
+
org = i;
|
307
|
+
while (i < text->size && text->data[i] != '\n')
|
308
|
+
i++;
|
309
|
+
|
310
|
+
if (i > org)
|
311
|
+
bufput(ob, text->data + org, i - org);
|
312
|
+
|
313
|
+
/*
|
314
|
+
* do not insert a line break if this newline
|
315
|
+
* is the last character on the paragraph
|
316
|
+
*/
|
317
|
+
if (i >= text->size - 1)
|
318
|
+
break;
|
319
|
+
|
320
|
+
rndr_linebreak(ob, opaque);
|
321
|
+
i++;
|
322
|
+
}
|
323
|
+
} else {
|
324
|
+
bufput(ob, &text->data[i], text->size - i);
|
325
|
+
}
|
326
|
+
BUFPUTSL(ob, "</p>\n");
|
327
|
+
}
|
328
|
+
|
329
|
+
static void
|
330
|
+
rndr_raw_block(struct buf *ob, const struct buf *text, void *opaque)
|
331
|
+
{
|
332
|
+
size_t org, sz;
|
333
|
+
if (!text) return;
|
334
|
+
sz = text->size;
|
335
|
+
while (sz > 0 && text->data[sz - 1] == '\n') sz--;
|
336
|
+
org = 0;
|
337
|
+
while (org < sz && text->data[org] == '\n') org++;
|
338
|
+
if (org >= sz) return;
|
339
|
+
if (ob->size) bufputc(ob, '\n');
|
340
|
+
bufput(ob, text->data + org, sz - org);
|
341
|
+
bufputc(ob, '\n');
|
342
|
+
}
|
343
|
+
|
344
|
+
static int
|
345
|
+
rndr_triple_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
346
|
+
{
|
347
|
+
if (!text || !text->size) return 0;
|
348
|
+
BUFPUTSL(ob, "<strong><em>");
|
349
|
+
bufput(ob, text->data, text->size);
|
350
|
+
BUFPUTSL(ob, "</em></strong>");
|
351
|
+
return 1;
|
352
|
+
}
|
353
|
+
|
354
|
+
static void
|
355
|
+
rndr_hrule(struct buf *ob, void *opaque)
|
356
|
+
{
|
357
|
+
struct html_renderopt *options = opaque;
|
358
|
+
if (ob->size) bufputc(ob, '\n');
|
359
|
+
bufputs(ob, USE_XHTML(options) ? "<hr/>\n" : "<hr>\n");
|
360
|
+
}
|
361
|
+
|
362
|
+
static int
|
363
|
+
rndr_image(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *alt, void *opaque)
|
364
|
+
{
|
365
|
+
struct html_renderopt *options = opaque;
|
366
|
+
if (!link || !link->size) return 0;
|
367
|
+
|
368
|
+
BUFPUTSL(ob, "<img src=\"");
|
369
|
+
escape_href(ob, link->data, link->size);
|
370
|
+
BUFPUTSL(ob, "\" alt=\"");
|
371
|
+
|
372
|
+
if (alt && alt->size)
|
373
|
+
escape_html(ob, alt->data, alt->size);
|
374
|
+
|
375
|
+
if (title && title->size) {
|
376
|
+
BUFPUTSL(ob, "\" title=\"");
|
377
|
+
escape_html(ob, title->data, title->size); }
|
378
|
+
|
379
|
+
bufputs(ob, USE_XHTML(options) ? "\"/>" : "\">");
|
380
|
+
return 1;
|
381
|
+
}
|
382
|
+
|
383
|
+
static int
|
384
|
+
rndr_raw_html(struct buf *ob, const struct buf *text, void *opaque)
|
385
|
+
{
|
386
|
+
struct html_renderopt *options = opaque;
|
387
|
+
|
388
|
+
/* HTML_ESCAPE overrides SKIP_HTML, SKIP_STYLE, SKIP_LINKS and SKIP_IMAGES
|
389
|
+
* It doens't see if there are any valid tags, just escape all of them. */
|
390
|
+
if((options->flags & HTML_ESCAPE) != 0) {
|
391
|
+
escape_html(ob, text->data, text->size);
|
392
|
+
return 1;
|
393
|
+
}
|
394
|
+
|
395
|
+
if ((options->flags & HTML_SKIP_HTML) != 0)
|
396
|
+
return 1;
|
397
|
+
|
398
|
+
if ((options->flags & HTML_SKIP_STYLE) != 0 &&
|
399
|
+
sdhtml_is_tag(text->data, text->size, "style"))
|
400
|
+
return 1;
|
401
|
+
|
402
|
+
if ((options->flags & HTML_SKIP_LINKS) != 0 &&
|
403
|
+
sdhtml_is_tag(text->data, text->size, "a"))
|
404
|
+
return 1;
|
405
|
+
|
406
|
+
if ((options->flags & HTML_SKIP_IMAGES) != 0 &&
|
407
|
+
sdhtml_is_tag(text->data, text->size, "img"))
|
408
|
+
return 1;
|
409
|
+
|
410
|
+
bufput(ob, text->data, text->size);
|
411
|
+
return 1;
|
412
|
+
}
|
413
|
+
|
414
|
+
static void
|
415
|
+
rndr_table(struct buf *ob, const struct buf *header, const struct buf *body, void *opaque)
|
416
|
+
{
|
417
|
+
if (ob->size) bufputc(ob, '\n');
|
418
|
+
BUFPUTSL(ob, "<table><thead>\n");
|
419
|
+
if (header)
|
420
|
+
bufput(ob, header->data, header->size);
|
421
|
+
BUFPUTSL(ob, "</thead><tbody>\n");
|
422
|
+
if (body)
|
423
|
+
bufput(ob, body->data, body->size);
|
424
|
+
BUFPUTSL(ob, "</tbody></table>\n");
|
425
|
+
}
|
426
|
+
|
427
|
+
static void
|
428
|
+
rndr_tablerow(struct buf *ob, const struct buf *text, void *opaque)
|
429
|
+
{
|
430
|
+
BUFPUTSL(ob, "<tr>\n");
|
431
|
+
if (text)
|
432
|
+
bufput(ob, text->data, text->size);
|
433
|
+
BUFPUTSL(ob, "</tr>\n");
|
434
|
+
}
|
435
|
+
|
436
|
+
static void
|
437
|
+
rndr_tablecell(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
438
|
+
{
|
439
|
+
if (flags & MKD_TABLE_HEADER) {
|
440
|
+
BUFPUTSL(ob, "<th");
|
441
|
+
} else {
|
442
|
+
BUFPUTSL(ob, "<td");
|
443
|
+
}
|
444
|
+
|
445
|
+
switch (flags & MKD_TABLE_ALIGNMASK) {
|
446
|
+
case MKD_TABLE_ALIGN_CENTER:
|
447
|
+
BUFPUTSL(ob, " align=\"center\">");
|
448
|
+
break;
|
449
|
+
|
450
|
+
case MKD_TABLE_ALIGN_L:
|
451
|
+
BUFPUTSL(ob, " align=\"left\">");
|
452
|
+
break;
|
453
|
+
|
454
|
+
case MKD_TABLE_ALIGN_R:
|
455
|
+
BUFPUTSL(ob, " align=\"right\">");
|
456
|
+
break;
|
457
|
+
|
458
|
+
default:
|
459
|
+
BUFPUTSL(ob, ">");
|
460
|
+
}
|
461
|
+
|
462
|
+
if (text)
|
463
|
+
bufput(ob, text->data, text->size);
|
464
|
+
|
465
|
+
if (flags & MKD_TABLE_HEADER) {
|
466
|
+
BUFPUTSL(ob, "</th>\n");
|
467
|
+
} else {
|
468
|
+
BUFPUTSL(ob, "</td>\n");
|
469
|
+
}
|
470
|
+
}
|
471
|
+
|
472
|
+
static int
|
473
|
+
rndr_superscript(struct buf *ob, const struct buf *text, void *opaque)
|
474
|
+
{
|
475
|
+
if (!text || !text->size) return 0;
|
476
|
+
BUFPUTSL(ob, "<sup>");
|
477
|
+
bufput(ob, text->data, text->size);
|
478
|
+
BUFPUTSL(ob, "</sup>");
|
479
|
+
return 1;
|
480
|
+
}
|
481
|
+
|
482
|
+
static void
|
483
|
+
rndr_normal_text(struct buf *ob, const struct buf *text, void *opaque)
|
484
|
+
{
|
485
|
+
if (text)
|
486
|
+
escape_html(ob, text->data, text->size);
|
487
|
+
}
|
488
|
+
|
489
|
+
static void
|
490
|
+
toc_header(struct buf *ob, const struct buf *text, int level, void *opaque)
|
491
|
+
{
|
492
|
+
struct html_renderopt *options = opaque;
|
493
|
+
|
494
|
+
/* set the level offset if this is the first header
|
495
|
+
* we're parsing for the document */
|
496
|
+
if (options->toc_data.current_level == 0) {
|
497
|
+
options->toc_data.level_offset = level - 1;
|
498
|
+
}
|
499
|
+
level -= options->toc_data.level_offset;
|
500
|
+
|
501
|
+
if (level > options->toc_data.current_level) {
|
502
|
+
while (level > options->toc_data.current_level) {
|
503
|
+
BUFPUTSL(ob, "<ul>\n<li>\n");
|
504
|
+
options->toc_data.current_level++;
|
505
|
+
}
|
506
|
+
} else if (level < options->toc_data.current_level) {
|
507
|
+
BUFPUTSL(ob, "</li>\n");
|
508
|
+
while (level < options->toc_data.current_level) {
|
509
|
+
BUFPUTSL(ob, "</ul>\n</li>\n");
|
510
|
+
options->toc_data.current_level--;
|
511
|
+
}
|
512
|
+
BUFPUTSL(ob,"<li>\n");
|
513
|
+
} else {
|
514
|
+
BUFPUTSL(ob,"</li>\n<li>\n");
|
515
|
+
}
|
516
|
+
|
517
|
+
bufprintf(ob, "<a href=\"#toc_%d\">", options->toc_data.header_count++);
|
518
|
+
if (text)
|
519
|
+
escape_html(ob, text->data, text->size);
|
520
|
+
BUFPUTSL(ob, "</a>\n");
|
521
|
+
}
|
522
|
+
|
523
|
+
static int
|
524
|
+
toc_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque)
|
525
|
+
{
|
526
|
+
if (content && content->size)
|
527
|
+
bufput(ob, content->data, content->size);
|
528
|
+
return 1;
|
529
|
+
}
|
530
|
+
|
531
|
+
static void
|
532
|
+
toc_finalize(struct buf *ob, void *opaque)
|
533
|
+
{
|
534
|
+
struct html_renderopt *options = opaque;
|
535
|
+
|
536
|
+
while (options->toc_data.current_level > 0) {
|
537
|
+
BUFPUTSL(ob, "</li>\n</ul>\n");
|
538
|
+
options->toc_data.current_level--;
|
539
|
+
}
|
540
|
+
}
|
541
|
+
|
542
|
+
void
|
543
|
+
sdhtml_toc_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options)
|
544
|
+
{
|
545
|
+
static const struct sd_callbacks cb_default = {
|
546
|
+
NULL,
|
547
|
+
NULL,
|
548
|
+
NULL,
|
549
|
+
toc_header,
|
550
|
+
NULL,
|
551
|
+
NULL,
|
552
|
+
NULL,
|
553
|
+
NULL,
|
554
|
+
NULL,
|
555
|
+
NULL,
|
556
|
+
NULL,
|
557
|
+
|
558
|
+
NULL,
|
559
|
+
rndr_codespan,
|
560
|
+
rndr_double_emphasis,
|
561
|
+
rndr_emphasis,
|
562
|
+
NULL,
|
563
|
+
NULL,
|
564
|
+
toc_link,
|
565
|
+
NULL,
|
566
|
+
rndr_triple_emphasis,
|
567
|
+
rndr_strikethrough,
|
568
|
+
rndr_superscript,
|
569
|
+
|
570
|
+
NULL,
|
571
|
+
NULL,
|
572
|
+
|
573
|
+
NULL,
|
574
|
+
toc_finalize,
|
575
|
+
|
576
|
+
NULL,
|
577
|
+
NULL,
|
578
|
+
NULL,
|
579
|
+
|
580
|
+
NULL
|
581
|
+
};
|
582
|
+
|
583
|
+
memset(options, 0x0, sizeof(struct html_renderopt));
|
584
|
+
options->flags = HTML_TOC;
|
585
|
+
|
586
|
+
memcpy(callbacks, &cb_default, sizeof(struct sd_callbacks));
|
587
|
+
}
|
588
|
+
|
589
|
+
void
|
590
|
+
sdhtml_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options, unsigned int render_flags)
|
591
|
+
{
|
592
|
+
static const struct sd_callbacks cb_default = {
|
593
|
+
rndr_blockcode,
|
594
|
+
rndr_blockquote,
|
595
|
+
rndr_raw_block,
|
596
|
+
rndr_header,
|
597
|
+
rndr_hrule,
|
598
|
+
rndr_list,
|
599
|
+
rndr_listitem,
|
600
|
+
rndr_paragraph,
|
601
|
+
rndr_table,
|
602
|
+
rndr_tablerow,
|
603
|
+
rndr_tablecell,
|
604
|
+
|
605
|
+
rndr_autolink,
|
606
|
+
rndr_codespan,
|
607
|
+
rndr_double_emphasis,
|
608
|
+
rndr_emphasis,
|
609
|
+
rndr_image,
|
610
|
+
rndr_linebreak,
|
611
|
+
rndr_link,
|
612
|
+
rndr_raw_html,
|
613
|
+
rndr_triple_emphasis,
|
614
|
+
rndr_strikethrough,
|
615
|
+
rndr_superscript,
|
616
|
+
|
617
|
+
NULL,
|
618
|
+
rndr_normal_text,
|
619
|
+
|
620
|
+
NULL,
|
621
|
+
NULL,
|
622
|
+
|
623
|
+
NULL,
|
624
|
+
NULL,
|
625
|
+
NULL,
|
626
|
+
|
627
|
+
NULL
|
628
|
+
};
|
629
|
+
|
630
|
+
/* Prepare the options pointer */
|
631
|
+
memset(options, 0x0, sizeof(struct html_renderopt));
|
632
|
+
options->flags = render_flags;
|
633
|
+
|
634
|
+
/* Prepare the callbacks */
|
635
|
+
memcpy(callbacks, &cb_default, sizeof(struct sd_callbacks));
|
636
|
+
|
637
|
+
if (render_flags & HTML_SKIP_IMAGES)
|
638
|
+
callbacks->image = NULL;
|
639
|
+
|
640
|
+
if (render_flags & HTML_SKIP_LINKS) {
|
641
|
+
callbacks->link = NULL;
|
642
|
+
callbacks->autolink = NULL;
|
643
|
+
}
|
644
|
+
|
645
|
+
if (render_flags & HTML_SKIP_HTML || render_flags & HTML_ESCAPE)
|
646
|
+
callbacks->blockhtml = NULL;
|
647
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2011, Vicent Marti
|
3
|
+
*
|
4
|
+
* Permission to use, copy, modify, and distribute this software for any
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
7
|
+
*
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#ifndef UPSKIRT_HTML_H
|
18
|
+
#define UPSKIRT_HTML_H
|
19
|
+
|
20
|
+
#include "markdown.h"
|
21
|
+
#include "buffer.h"
|
22
|
+
#include <stdlib.h>
|
23
|
+
|
24
|
+
#ifdef __cplusplus
|
25
|
+
extern "C" {
|
26
|
+
#endif
|
27
|
+
|
28
|
+
struct html_renderopt {
|
29
|
+
struct {
|
30
|
+
int header_count;
|
31
|
+
int current_level;
|
32
|
+
int level_offset;
|
33
|
+
} toc_data;
|
34
|
+
|
35
|
+
unsigned int flags;
|
36
|
+
|
37
|
+
/* extra callbacks */
|
38
|
+
void (*link_attributes)(struct buf *ob, const struct buf *url, void *self);
|
39
|
+
};
|
40
|
+
|
41
|
+
typedef enum {
|
42
|
+
HTML_SKIP_HTML = (1 << 0),
|
43
|
+
HTML_SKIP_STYLE = (1 << 1),
|
44
|
+
HTML_SKIP_IMAGES = (1 << 2),
|
45
|
+
HTML_SKIP_LINKS = (1 << 3),
|
46
|
+
HTML_EXPAND_TABS = (1 << 4),
|
47
|
+
HTML_SAFELINK = (1 << 5),
|
48
|
+
HTML_TOC = (1 << 6),
|
49
|
+
HTML_HARD_WRAP = (1 << 7),
|
50
|
+
HTML_USE_XHTML = (1 << 8),
|
51
|
+
HTML_ESCAPE = (1 << 9),
|
52
|
+
} html_render_mode;
|
53
|
+
|
54
|
+
typedef enum {
|
55
|
+
HTML_TAG_NONE = 0,
|
56
|
+
HTML_TAG_OPEN,
|
57
|
+
HTML_TAG_CLOSE,
|
58
|
+
} html_tag;
|
59
|
+
|
60
|
+
int
|
61
|
+
sdhtml_is_tag(const uint8_t *tag_data, size_t tag_size, const char *tagname);
|
62
|
+
|
63
|
+
extern void
|
64
|
+
sdhtml_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options_ptr, unsigned int render_flags);
|
65
|
+
|
66
|
+
extern void
|
67
|
+
sdhtml_toc_renderer(struct sd_callbacks *callbacks, struct html_renderopt *options_ptr);
|
68
|
+
|
69
|
+
extern void
|
70
|
+
sdhtml_smartypants(struct buf *ob, const uint8_t *text, size_t size);
|
71
|
+
|
72
|
+
#ifdef __cplusplus
|
73
|
+
}
|
74
|
+
#endif
|
75
|
+
|
76
|
+
#endif
|
77
|
+
|