<s> '''<STR_LIT>''' <EOL> '''<STR_LIT>''' <EOL> DISQUS_SCRIPT = "<STR_LIT>" <EOL> def create_thread ( disqus_shortname , identifier ) : <EOL> '''<STR_LIT>''' <EOL> return str ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( disqus_shortname , identifier ) ) <EOL> def enable_count ( disqus_shortname ) : <EOL> '''<STR_LIT>''' <EOL> return str ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> % disqus_shortname ) <EOL> def get_count ( link , identifier ) : <EOL> '''<STR_LIT>''' <EOL> return str ( '<STR_LIT>' % <EOL> ( link , identifier , "<STR_LIT>" ) ) <EOL> def add_disqus_block ( app , pagename , templatename , context , doctree ) : <EOL> '''<STR_LIT>''' <EOL> if not app . config . disqus_shortname : <EOL> return <EOL> env = app . builder . env <EOL> if DISQUS_SCRIPT not in context [ "<STR_LIT>" ] : <EOL> context [ "<STR_LIT>" ] . append ( DISQUS_SCRIPT ) <EOL> if pagename in env . blog_metadata and env . blog_metadata [ pagename ] . comments : <EOL> context [ "<STR_LIT>" ] = create_thread ( app . config . disqus_shortname , pagename ) <EOL> env . blog_metadata [ pagename ] . comment_count = get_count ( <EOL> "<STR_LIT>" % ( app . config . website , <EOL> env . blog_metadata [ pagename ] . link ) , <EOL> pagename ) <EOL> else : <EOL> context [ "<STR_LIT>" ] = enable_count ( app . config . disqus_shortname ) <EOL> def setup ( app ) : <EOL> '''<STR_LIT>''' <EOL> app . add_config_value ( "<STR_LIT>" , None , True ) <EOL> app . connect ( "<STR_LIT>" , add_disqus_block ) </s>
