Skip to content

Commit

Permalink
asciidoc docs rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Mar 31, 2019
1 parent 25f474d commit 8a298e7
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
10 changes: 10 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,27 @@ class EnumFlagsConan(b2.B2.Mixin, ConanFile):
url = "https://github.com/grisumbras/enum-flags"
homepage = url

options = {"with_docs": [False, True]}
default_options = {"with_docs": False}

exports_sources = (
"jamroot.jam",
"*build.jam",
"exports/*.jam",
"*.hpp",
"*.cpp",
"LICENSE*",
"*.adoc",
)
no_copy_source = True
build_requires = "boost_build/[>=1.68]@bincrafters/stable"

def b2_setup_builder(self, builder):
if self.options.with_docs:
builder.options.with_docs = True
builder.using("asciidoctor")
return builder

def package_info(self):
self.info.header_only()

Expand Down
36 changes: 36 additions & 0 deletions doc/build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import asciidoctor ;
import path ;


project enum-flags-doc ;

path-constant HERE : . ;


local rule templates-dir ( path ) {
path = [ path.root $(path) $(HERE) ] ;
local files = [ glob $(path)/* ] ;
return <flags>"-T $(path)" <dependency>$(files) ;
}


alias common-attributes
: usage-requirements
<asciidoctor-attribute>nofooter
<asciidoctor-attribute>source-highlighter=pygments
<asciidoctor-attribute>pygments-linenums-mode=inline
# <asciidoctor-attribute>pygments-css

# <asciidoctor-attribute>pygments-style=monokai
<asciidoctor-attribute>pygments-style=paraiso-dark

# <asciidoctor-attribute>pygments-style=friendly

<asciidoctor-attribute>icons=font
# <asciidoctor-attribute>stylesdir=styles

[ templates-dir templates ]
;


html index : index.adoc common-attributes ;
12 changes: 12 additions & 0 deletions doc/examples/example0.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <flags/flags.hpp>

enum class MyEnum { Value1 = 1 , Value2 = 2 };
ALLOW_FLAGS_FOR_ENUM(MyEnum)

int main() {
auto mask = MyEnum::Value1 | MyEnum::Value2;
if (mask & MyEnum::Value2) {
// do something
}
return 0;
}
21 changes: 21 additions & 0 deletions doc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
= enum-flags

*enum-flags* is a C++ library that allows you to convert scoped enums into bit
flags. +
You can use it as simple as this:

[source, c++]
----
include::examples/example0.cpp[]
----

== Documentation

* *link:overview/index.html[Overview]* +
An overview of the features and the design.

* *link:tutorial/index.html[Tutorial]* +
A tutorial that shows how to use the library.

* *link:reference/index.html[Reference]* +
API reference.
3 changes: 3 additions & 0 deletions jamroot.jam
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import option ;
import package ;
import path ;

Expand All @@ -20,5 +21,7 @@ explicit headers ;

package.install-data license : enum-flags : LICENSE ;

if [ option.get with-docs : : yes ] { build-project doc ; }

alias install : headers license exports//install ;
explicit install headers license ;

0 comments on commit 8a298e7

Please sign in to comment.